Showing posts from 2011

VMware+ubuntu with Ruby on Rails

Lately I have started using VMware with ubuntu on my Windows machine for faster and hassle free Ruby on Rails development. But nothing comes easy, there are pretty many things you need to take care of for this setup. You can follow the steps here, preferably sequentially for the installation. To install rvm, best option is to follow the latest instructions in the rvm site.
And I would love to add the things which I have faced while installation, setup and while running my RoR app here :)
wired connection error, unable to connect to INTERNET from the Virtual Machine. Mainly this is caused not only due to your internet connection/ speed but by a corrupted Virtual machine. refer here for detail. ERROR: Error running '/usr/bin/make install', please read /usr/share/ruby-rvm/log/zlib/make.install.log. This is mainly caused as you are not executing the commands from the administrator mode. In order to do that, instead of doing $ rvm pkg install zlib do $sudo rvm package install zlib.

wired connection error in Vmware

I am recently using VMware with ubuntu for my Ruby on Rails developmental purposes for it's faster. But lately I have faced a weird error after all the initial installations went fine. Whenever I was trying to connect to internet it was failing.
I tries to trouble shoot a lot, ping-ing my host server, fixing the ip related files, reloading the VM updates, running the vm-config-ip tools and many other things from the online forums.
Alas!! nothing worked.

Then I re-installed the Vm-ware and created a new virtual machine and realised re-installation was not required.

Whenever you face such an issue, try creating a new virtual machine.

You can delete the older one, as it takes a lot of space is you are using the softwares related to ruby0rvm, git, packages, gems and IDE, etc. All the virtual machines sre stored under the /Documents/ folder by default. You can just go ther and simple shift+delete the folder from there, which you are not using.

Check the new virtual machine IP connectio…

rbx-require-relative (0.0.5) failure issue

Installing rbx-require-relative (0.0.5) Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at bundler/issues so that we can fix it. Thanks!/Users/sjain/.rvm/rubies/ruby-1.9.2-p290/ lib/ruby/site_ruby/1.9.1/rubygems/ installer.rb:364:in `ensure_required_ruby_version_met': rbx-require-relative requires Ruby version ~> 1.8.7. (Gem::InstallError) This happens because when we are adding  a dependency on ruby-debug gem in your Gemfile. gem 'ruby-debug' With ruby 1.9, you need to update this with new gem name ruby-debug19. gem 'ruby-debug19' This will eliminate the dependency on rbx-require-relative and fix the issue.

Happy Haml :)

Haml is a much cleaner way to write ruby executable with html. Unlike erb or rhtml, you need not have to give tags for every if/for loops, no need of <> tags, only remember haml works in indentations.
 You need to give 2 spaces of indentations under the main loop.

Like for example, you are looping through each element in an array, then for the code which goes inside the loop will look like this
-['a', 'b'].each do |letter|
  = letter

gem install hamlor in bundler, add gem 'haml'make a file inside the view/ directory with extension as .haml.html
remember haml works with indentation. 2 spaces 
- has to be added for ruby code which has not to be evaluated <% %>, like for, if, else= for ruby code which has to be evaluated, similar to <%= %>% for html tags, like th, td, h1 tags are required in haml

The above two lines will create a html page, with headers as doel.

for label tag in html, in haml label will come under p tag
- form_…

can 't find executable rake for rake-0.8.7 (Gem::Exception)

I faced the weird error coming up suddenly for my rails 3 app using ruby 1.9.2 using pik
the rake.gemspec file under the ruby gems folder getting some issues.

remove the rake.gemspec file
do a fresh bundle install for your application.
need not have to specify the rake version in your gemfile, as ruby 1.9.2 takes care of it.

mysql error, in rails3

This is one of most common error, you will find when you start working with rails3. But the solution is really simple. Just change the gemname to mysql2 instead mysql in the Gemfile. By now we know, that Gemfile is like a repository of the gems we need for the application, somewhat like unpacking a gem, so that we do not need to install manually the huge list of gems in each environment and bite our nails if we miss something.

The entry in Gemfile is something like this,
gem 'mysql2'

from the command propmt, go to the directory where your app is, and execute the following command to install all the gems in gemfile
bundle install

That;s it your gem mysql2 has been installed.

Now you need to change the database.yml adapter from mysql to mysql2.

run rake db:create
and see your app up and running in http://localhost:3000 (ofcourse you need to start the server , if not started yet ;)
rails server
Happy Rails-ing :)

git and svn

Lately I am trying to get hold of version control tool git. I have worked with svn but git has whole of other options and believe me it is not so bad as your first impression if you are an svn user. First Impression is not the last impression, always. Actually this is not the first, as we need to unlearn  certain things which sometimes makes it tough. Got hold of the below link in case you use both, like me and often get confuse with the syntax.
Download git on windows from gitSsh-keygen –t rsa –C hello@gmail.comgit config --global  hello@gmail.comgit config --global “Hi Hello“git config --global github.user hi-hellogit config --global github.token 0987654321yourf0123456789For some advanced concepts in git
Migrate from svn to git
 Do a SVN Export of the repository you want to migrate to GIT. • Goto the Directory • git init • git add . • git commit –m ‘Migration from SVN to GIT’ • git rem…

ORA-12514: TNS:listener does not currently know of service requested

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

I encountered this problem in my local machine while I an trying to start a Ruby on Rails application using oracleXE as a database. Check first whether the oracle XE service was running. If not do the following.

In order to start the service
--> goto Contol Panel
--> Administrative Tools
--> start OracleSevice XE

That's it...type local:3000/ to see your app up and running !!

20 sec reading

I am following Paulo Coelho's blog these days.
It has a refreshing section named 20 sec reading...was lured by the name itself, it can be possible by an author of his stature only to write such an interesting and intriguing post which can be read in time as short as 20 secs. Like to recommend to read his blog and refresh the mind.

Goal...go go, Santiago

Watched the awesome movie 'Goal' (English). The protagonist Santiago Munez inspires all to chase a dream and I am no exception. The young boy suffered from asthma and tried of hiding  that, fearing he may loose the chance to play in one of the premium football teams. When the selector came to know of this fact, quite contrary to my expectation of a person in such a situation he told, "Asthma is not a problem, but lying is!". What a thought, and what a way of expressing that. Many a times I keep on thinking the different physical criteria which are necessary for applying for  job of our dream, such as in army, air force, ballet dancer or a soccer player.But rare do we listen such a noble thought of handling our physical problems and to deal with it medically rather hiding it.
    Similar to working in a team, be it in our school project to make a poster or to finish up the lab assignments in the college days to our present official deadlines, we need to "Pass the…