Friday, April 10, 2009

Loading rails project using irb

You can load rails project in irb. for instance in your rail's project directory you start irb. Then you only need to require environment.rb file. Such as require 'config/environment.rb' in irb and thats it now you can access your project's model, etc.

Thursday, April 9, 2009

Bookmark in Firefox and Internet Explorer

Add this function into your head tag and call it. This works for both Firefox and Internet Explorer.

function add_to_fav(title, url){
window.external.AddFavorite(url, title);
else if(window.sidebar)
window.sidebar.addPanel(title, url, "")

and call like this; add_to_fav('My blog', '')

Duplicate content of Ajax call using facebox with jQuery in Internet Explorer

Problem: In Internet Explorer 7, populating once facebox lightbox using Ajax call works fine but if I repeat that calls it starts duplicating the content of the lightbox, gave impression that it appends new call at the end of already populated content and only doing hide and show of the lightbox content.

Solution: After debugging I noticed that in my Ajax call I am calling a whole web-page including HTML and BODY pair tags. So removing HTML tags and only fetching relevant DIV content solved my problem :)

Monday, April 6, 2009

run Multiple instances of Skype and Windows Live

running multiple instances of Skype;

Step1. Create a shortcut of Skype. Lets say on your Desktop. Mine Skype is installed on default location that is "C:\Program Files\Skype\Phone\Skype.exe".
Step2. Right click on the new shortcut and there you find a Target field with value "C:\Program Files\Skype\Phone\Skype.exe". Add /secondary switch at the end with space before and outside quotes. so it looks like. Target:
"C:\Program Files\Skype\Phone\Skype.exe" /secondary. and thats it.

Now double click on this icon and this will start a new Skype instance.

running multiple instances of Windows Live messenger;

Step1. Click on start -> run.
Step2. type "regedit"
Step3. Expand the tree, such as; HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Live\Messenger
Step4. Right -click on Messenger node and select New then DWORD (32-bit) Value.
Step5. Name that key MultipleInstances.
Step6. Right-click on that key and modify it with value 1, with Base Hexadecimal.
Step7. Execute Windows Live messenger from start->programs->windows live->windows live messenger.

Thats it now you can run multiple Live messenger instances.

Sunday, November 16, 2008

Use join method to merge Array into string

If you are a Ruby/Ruby on Rails developer.
Some times you need to concatenate/ merge Array elements into String, so its good to use join (Array method).

users_id =
#Add some ids into array, so it becomes,
users_id = [1001,1002,1003,1004,1005]
#Now use need all users ids in to lets say in query so just do,
#users_id.join(",") this will return String type object having users ids
# "1001,1002,1003,1004,1005"

Get selected value using JavaScript from select Tag

Getting selected value from drop-down interface or select HTML Tag using JavaScript.

use this code:


document.getElementById('book').selectedIndex, this will give you selected option index

then using that index we can get selected optoin HTML object such as, document.getElementById('book').options[index]

and finally getting its value just use innerHTML property, in my case selected book name.

Clean-Up your System, to speed it up

EasyCleaner, free to download and use, is a registry-cleaner and temporary file cleaning tool, it searches the Windows registry for entries that are pointing nowhere. EasyCleaner also lets you delete all kinds of unnecessary files such as temps and backups.

To download it : Download-EasyCleaner

URL: EasyCleaner