Git show files for a commit

Posted on June 16, 2010, under Git.

A trip to Secunderabad in June

Posted on June 12, 2010, under Miscellaneous.

I’m taking a trip to Secunderabad between June 17th and June 20th.

Going to Madhu’s House Warming Function in Secunderabad

A trip to Bangalore in June

Posted on June 2, 2010, under Miscellaneous.

I’m taking a trip to Bangalore between June 4th and June 8th.

I am going to be in Bangalore with my son Santosh and we are having a small function for him to have first food. Really excited!

Add multiple virtual host along with Passenger

Posted on January 5, 2010, under Shell Scripts.

I was having few projects on my MAC and was really bugged up with maintaining the port numbers and other stuffs, a real cumbersome.

After, Jacek’s thought on this, I had set up the following:

Install the gem:

sudo gem install ghost

after that add a virtual host

sudo ghost add paddy.local (a choice of your virtual host)

Install the Passenger gem:

sudo gem install passenger
sudo passenger-install-apache2-module

After installing the apache module for passenger, you may have add the following lines (after installation it will tell based on your own enviroment)

(in your httpd.conf)

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.8/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.8
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Also you may have to enable your virtual host too …by default, it may be disabled(commented) and you have to enable(uncomment) it

# Virtual hosts

Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

Next, you have to add the vitual host for your rails app.

(httpd-vhosts.conf)


ServerName www.yourhost.com
DocumentRoot /somewhere/public

BSNL 3G Speed

Posted on November 23, 2009, under Miscellaneous.

After a long awaiting for the actual launch of 3G service in Chennai, its available now. I rushed up to the customer service center and got myself the 3G Sim Card and just tried the net speed which BSNL claims

Search comma separated values db column in Rails

Posted on November 22, 2009, under MySQL, Rails.

I wanted to search for a value in DB and the column data is comma separated values say …

foo,bar,hey,hay

Now I wanted to find a record based on the value …say …hay

MySQL’s FIND_IN_SET comes into play and it works as follows

Model.find(:first, :conditions => ["FIND_IN_SET(?,search_column)", search_string])

Hope this helps!

Making will_paginate to work with acts_as_taggable_on_steriods

Posted on September 1, 2009, under Rails.

After going through, few post on pagination for the tags, this worked for me.

<%
 size = Upload.find_tagged_with(params[:id]).length
 @uploads = Upload.paginate_tagged_with(params[:id], :total_entries => size, :page => params[:page], :per_page => 1)
%>

Installing MySQL Gem on Mac OSX with XAMPP

Posted on July 26, 2009, under Mac OSX, MySQL.

I was having lot of trouble on installing the MySQL Gem for Mac OSX Leopard 10.5.9 via XAMPP. I have the XAMPP running and also mySQL. Here are the steps.

1. Install XAMPP for MAC

2. Install XAMPP Dev Package

3. From your terminal type the following command and you’ll see the following

sudo gem install mysql -- --with-mysql-dir=/Applications/XAMPP/xamppfiles/ -- with-mysql-lib=/Applications/XAMPP/xamppfiles/lib -- with-mysql-include=/Applications/XAMPP/xamppfiles/include/ -- with-mysql-config=/Applications/XAMPP/xamppfiles/bin/mysql_config

Git Stash

Posted on May 10, 2009, under Git.

Currently, I am working on few files and when you do a git pull, you may sometimes get a message as follows:

error: Entry 'app/views/alerts/index.rhtml' not uptodate. Cannot merge.

So you know, somebody has updated the code and you do need to commit the file so that the file can be merged and for some reason I don’t want to commit till i finish the work. This is where git stash comes into play. from your root of the app, do the following command

git stash
git pull
git stash apply #Apply your changes

for more info http://www.kernel.org/pub/software/scm/git/docs/git-stash.html

Is Active

Posted on April 13, 2009, under Rails.

  def is_active?
    (start_date .. expiry_date) === DateTime.now
  end