Friday, September 28, 2012

Review: The Clean Coder: A Code of Conduct for Professional Programmers

This book has wow effect for me. The author is famous @unclebobmartin. I called books of such type as "craftsmanship" books (term borrowed from @unclebobmartin). This book is like a companion book for The Pragmatic Programmer, but it has a little bit another "inflection":
  1. Book has close relation to software engineering as a profession and style is narrative. It very easy to read and follow the general idea.
  2. Uncle Bob did very important thing (as for me), he told us about his own failures and their consequences. It is looks very honest which brings together author and reader.
  3. He isn't cardinal in his statements. Be pragmatic, borrow his experience and just don't do the same mistakes.
  4. You won't find any technological advices in this book. There is ONLY life concepts :)
  5. It's like a craftsmanship Zen for software engineers.
  6. Uncle Bob gives us bootstrap cookbook for non-technological skills.
 Read it. Re-think the ideas. And improve your skills.

Sunday, September 23, 2012

PACEMAKER LAMP Conference Report

I had a chance to be a speaker on PACEMAKER LAMP Conference. It was amazing experience.
The organizer did the job pretty well. The atmosphere was fun. I've got so many positive emotions.
I must admit that two topics were very interesting for me:
  1. Using and scaling Rack and Rack-based middle ware, by Alona Mekhovova
  2. The presenter has shared her experience in Rack and shown the most popular use cases where we can use this lib.
  3. Building rich web application with Flask and Chaplin.js, by Yehor Nazarkin
  4. This presenter has shown the another way of implementing web application without the Django framework. It's cool to see developers' efforts outside the "standard" web-stack.
And, here is the slides from my speech:

Thursday, September 13, 2012

Outlook: Two time zones in calendar

Today, during internal training I've noticed very neat feature in Outlook 2010 Calendar, see screenshot below:
It's very useful feature if you're working with geographically distributed teams and like to align "your" and "their" time on your Outlook Calendar. It's really helpful during the meeting's planing and similar issues.

How to switch on this feature? See below:
  1. Right click on "Time Zone", left line
  2. Select "Change Time Zone"
  3. Add second time zone
That's it. Have fun!

Wednesday, September 12, 2012

Install Rails on Ubuntu 12.04 with RVM support

Nowadays, RVM is very popular in Ruby/Rails community on Linux/OS X. Even more, it's best practice to use RVM for Ruby environment management. Ubuntu is my major Linux distribution. Here I've collected steps for installing Ruby, Rails via RVM on Ubuntu 12.04. I must admit that in many cases it's the re-post from different sources.

So, let's start.

Install Ruby, Rails (see the source):
sudo apt-get update
sudo apt-get install curl
curl -L | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvmsudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
rvm install 1.9.3
rvm use 1.9.3 --default
rvm rubygems current
gem install rails
Please check the original in case you have some issues during this process.

Fix Bundler issues:
If you create Rails project or any other Ruby project which supports Bundler and run install command, you will get the next error:
$ bundle install
ERRRO: Gem bundler is not installed, run `gem install bundler` first.

But gem list clearly shows us that bundler has been properly installed. To fix this problem We have to tweak .bashrc file a little (see the original idea):
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
source ~/.bashrc

Fix rails server throw could not find JavaScript runtime
Now you will get the next interesting error when you tried to run rails server:
username@ubuntu:~/_Projects/Rails/blog$ rails server
/home/username/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See for a list of available runtimes. (ExecJS::RuntimeUnavailable)
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs.rb:5:in `'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs.rb:4:in `'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
 from /home/username/_Projects/Rails/blog/config/application.rb:7:in `'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in '
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
 from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:50:in `'
 from script/rails:6:in `require'
 from script/rails:6:in `
Install Node.js to fix this error:
$ sudo apt-get install nodejs
Check this wiki "Installing Node.js via package manager" If you have some troubles with installing node.js


Saturday, September 08, 2012

Install Rubymine 4.5.x on Ubuntu 12.04

As you probable know NetBeans has dropped Ruby support. And now, RubyMine is one of the best Ruby IDE. Here I'd like to describe the steps for installing RubyMine on Ubuntu 12.04.

Official requirement is "Sun JDK 1.6. (OpenJDK is not supported)". I've decided to install Oracle JDK v.1.7.

I've used the next advices from "Ubuntu 12.04 – install sun jdk 6-7" (see re-post below):

Install Sun JDK 7 on Ubuntu 12.04:
Download the sun jdk 7 tar file from here
Extract the tar file:
tar -xvzf jdk-7u4-linux-x64.tar.gz
Move extracted folder to this location:
sudo mv jdk1.7.0_04 /usr/lib/jvm/
Install Update Java package (see here)
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install update-java
sudo update-java

Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1
Choose default java:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
java version test:
java -version
javac -version
Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
JAVA_HOME configuration
You can set JAVA_HOME in Ubuntu so simple: Edit the file .bashrc under your home directory and add the following lines: (if .bashrc is hidden click in Nautilus Menu View > Show Hidden Files)
export JAVA_HOME=/path/your/jdk
export PATH=$JAVA_HOME/bin:$PATH
Install RubyMine (see official)
Unpack the rubymine-4.5.3.tar.gz file using the following command:
tar xfz rubymine-4.5.3.tar.gz

Run from the bin sub-directory


Tuesday, September 04, 2012