25 Nov 2017

Newbies Introduction to Ruby on Rails

Note: This tutorial is intended to newbies only who want to kick-start web development with Ruby on Rails. I will just share links to different resources and give tips based on my experience which may help you starting development with Ruby on Rails.

Installation and Prerequisites

Just like any other framework ruby on rails framework has its own development environment, before diving into installations of environment I would recommend if you have  planned to use Window operating system for ruby on rails development please read Rails Development on Windows. Seriously and switch to linux/unix based operating system. If you still insist to carry on with Windows go ahead with my Best wishes.

You can find complete installation guide of Ruby on Rails on GoRails website (there are other websites too). I will recommend installing RVM instead of rbenv and installing it from source.  GoRails guides also include installing Git, MySQL/Postgres complete the installation process. You might get errors while installation please do check your OS and version before starting installation process.

Ruby Language

Once you have set up your installations and environment start with ruby language basics I would recommend The Little Book of Ruby by Huw Collingbourne. Don’t memorise anything just practice basic syntax, data structures, condition statements, loops modules and Classes. Since we have already installed ruby as well as created a project of rails (in above GoRails guide) your can either go to project root and open a console or write your program in a .rb file and run it with ruby keyword as mentioned in book.

Ruby on Rails Framework

You are familiar with Ruby language basics now it is time to start getting your hands on Ruby on Rails. You will find numerous tutorial on getting started with Rails, but RUBY ON RAILS TUTORIAL by Michael Hartl is the most comprehensive guide for newbies. It covers details at granular level starting from Zero to Deployment it includes everything. There are other good resources as well like RailsCastsDriftingRuby, RailsTutorial, but if you are newbie I would highly recommend finishing Ruby on Rails Tutorial book by Micheal Hartl thoroughly first and then look elsewhere like RailsCasts (very good for topic specific tutorials) as it will make your Rails framework understanding in-depth.

Development Environment

Development environment contains your machine, tools, settings, configurations etc. Make your development environment as smooth as possible use .bashrc, tumx, terminal settings aliases to amplify your concentration. Have strong grip over terminal commands. Choose any suitable text editor I personally use Sublime Text in development and vim or emacs in production mode. Look at StackOverFlow’s survey for Most Popular Developer Environments by Occupation.

Be Open Source 

Ruby on Rails is an open source framework and it has very large open source community, as a beginner you will get lots of help from open source community in term of different gems, git, gist, stack overflow etc. Don’t forget to contribute back once you have a good grip.

Follow Tech Talks

Ruby and Ruby on Rails framework has large community of developers across the world. There are many conferences being held across the world on Ruby language and Ruby on Rails framework both. RubyConf and RailsConf are two of the most popular conferences in Ruby on Rails world. Do follow tech talks in these conferences particularly from speakers David Heinemeier, Sean Griffin, Mike Perham, Aaron Patterson and people who are at the forefront of Ruby language and Ruby on Rails framework development. Look at 11 TOP INTERNATIONAL RUBY ON RAILS CONFERENCES AND EVENTS 2017. Also one particularly article I really like every Rails developer to read is The Rails Doctrine by DHH.

Never Stop Learning

Once you have develop basics of ruby on rails I would recommend having some DevOps and Front end frameworks like ReactJS, VueJS  skills as well. Do explore topics like High Availability, Consistency, Scaling RDBS, NoSQL etc and  regularly read engineering blogs of tech giants like Google, Twitter, Microsoft and Amazon etc.

If you are newbie to Ruby on Rails development and want any suggestions or help do ping me on twitter @alihaider907.

Happy Learning 😛

12 Nov 2015

Everyday terminal commands for Backend Developers

Today I am going to share most commonly used terminal commands for Backend Developers. I am a Backend developer and has been using these commands on a daily basis during development. I hope you will find some of them handy

grep

grep is one of the most commonly used terminal command, grep can be used in multiple ways to filter live logs, to filter text with in file or files, to filter process followings are mine daily uses of grep command

filter words from log

tail -f /path/to/log/file | grep 'word1 word2 word3'

filter process

ps aux | grep process_name

filter previous commands

history | grep command

grep can also be used to find a string within files in a folder. Although today you can search string within a folder with your favorite text editor as well. But you should also know this power of grep

grep -rnw 'path_to_file' -e "string_to_search"

For detail understanding of grep string search with in a folder please read this answer

Kill process

kill a process safely

kill -9 PID

Ctrl + R

Ctrl + R is not a command, but a very handy reverse search keyboard shortcut to filter commands you have previously typed in the terminal. keep this shortcut in your bag it might save your precious time while you work on production mode

chmod

while permissions is very broad topic in linux and unix operating system. You must have adequate know how of chmod to set permissions of files and folders
basic syntax of chmod is

chmod permissions file_or_folder_path

permissions in the chmod command requires special attention. Permission parameter is three digit integer first digit represents user, second digit represents group and third digit represents other. Each digit of three digits is further sum of read+write+executable where

4 stands for read
2 stands for write
1 stands for execute
0 stands for no permission

so permission 655 means user can read and write and can not execute ( 4+2+0), group can read but can not write and can execute ( 4+0+1) and others can read but can not write and can execute (4+0+1)

ssh-copy-id

If you consistently need to switch from local to server and vice versa, set up ssh-copy-id once to ssh to remote server again and again without password ( you can do same with by adding you ssh keys to your remote server )

ssh-copy-id username@remote_ip

apt-cache search

You may have used apt-get install a lot but apt-cache search let you search for apt packages

apt-cache search pacakage_to_search