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).

E.g;
users_id = Array.new
#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
users_id.join(",")
# "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')
.options[document.getElementById('book').selectedIndex].innerHTML;


details,
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

Get Free video lectures

Free video lecture dot com is a site you find a lot online free material available for your field of interest so as I got very useful and helping resources for my studies, so just click >> free video lectures and enjoy free learning.