Ruby on Rails | Setup MS-SQL server in Ubuntu 17.04

MSSQL Server Installation

Follow these instructions

Note: During installation it will ask you for password, put a strong password remember it or note it down.

Reset Server Admin(SA) password

If you, unfortunately, forgot the SA password then you can reset follow the commands

$ sudo systemctl stop mssql-server
$ sudo /opt/mssql/bin/mssql-conf setup


If you wish to test if Server is installed and ready to receive requests

sqlcmd -S localhost -U sa -P your_strong_password

Install FreeTDS binaries

$ apt-get wget
$ apt-get install build-essential
$ apt-get install libc6-dev

$ wget
$ tar -xzf freetds-1.00.21.tar.gz
$ cd freetds-1.00.21
$ ./configure --prefix=/usr/local --with-tdsver=7.3
$ make
$ make install

Install required gems

# SQL Server (2012 or higher required)
# Install the adapters and driver
#   gem install tiny_tds
#   gem install activerecord-sqlserver-adapter
# Ensure the activerecord adapter and db driver gems are defined in your Gemfile
#   gem 'tiny_tds'
#   gem 'activerecord-sqlserver-adapter'

If still, you cannot install the gem tiny_tds then try using sudo
$ sudo gem install tiny_tds -v '2.0.0'

Importing from Remote to Localhost db

Exporting from remote

bcp my_table_name out ~/my_table_name.txt -S -U yourusername -P 'YourStrongPassword123!!' -d mydbname -c -t ','


Import to Local

bcp my_table_name in ~/my_table_name.txt -S localhost -U sa -P 'PrashantBhusal1' -d my_local_db_name -c -t ',' -q

**Output When Successful**

Starting copy...

5 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 16 Average : (312.5 rows per sec.)

Useful links

Getting started with React.Js using NPM

My assumptions: You have prior experience of Web framework like 
  Ruby on Rails, Django, Phoenix, etc. 
Please refer to this React.js style guide for community comprehensible source code.

Hey, its not mandatory to use NPM to build applications with ReactJs; but, it will be alot easier to build, maintain, share codes using NPM. Firstly you should have NodeJs installed in your development machine.

Installation for Development Environment

$ sudo apt-get install nodejs
# try 
$ node -v
# v4.2.6
# if its says command not found: node then try 
$ nodejs
# If it shows up, it means due no some name conflicts 
# the name/command node is already taken by some binary. 
# So, its get it back.
$ sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

Probable Issues: NPM not found

Continue reading

Installation Guide: Ruby On Rails: Ubuntu 14.04

Installing Ruby

RVM is the best Tool to manage multiple versions in your system.

# Update your package manager first:

$ sudo apt-get update
# Install dependencies for ruby
# This installs CURL, Git and other dependencies

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
# To get the signature
gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

if it fails:

 command curl -sSL | gpg --import -
curl -L | bash -s stable
For all in one installation append --rails or --ruby or --ruby=1.9.3
Note: RVM might not be available right after installation is complete. Restart the terminal once after installation is completed.
#[ rvm install ruby ] installs latest version of ruby
rvm install 2.1.2
rvm use 2.1.2 --default

# Check the version of ruby installed
ruby -v
git config --global color.ui true
git config --global "YOUR NAME"
git config --global ""

# Create SSH Key
ssh-keygen -t rsa -C ""

# Now you need to add this public key to your github account
# You need to copy and paste the content of ~/.ssh/ file to
# after clicking Add SSH Key buttton
# Once you have done this, you have to type following command to check
# if it worked

ssh -T
# Hopefully, you will get this echoed

"Hi excid3! You've successfully authenticated, but GitHub does not provide shell access."

We need to install javascript runtime like NodeJS. This will let you use CoffeeScript and Gems you use to minify your javascripts (such as uglifier).

To install NodeJS, we need to add it using a PPA repository:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails
# Check the version of rails installed

rails -v
# Rails 4.1.6
sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.