Posts

Add a text to text box, hide when it is clicked, show when clicked out

My Friend Ukesh gave me this code, thanks to him for saving my time. <input name="q" id="search_text" type="text" value="- Search -" onfocus="clearDefaultText(this)" onblur="clearDefaultText(this)" style="background:none"/> <script> function clearDefaultText(field){ if (field.defaultValue == field.value) field.value = ''; else if (field.value == '') field.value = field.defaultValue; } </script>

Embed Flash - swf file in website

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100" height="90"> <param name="movie" value="/videos/TGP.swf" /> <param name="quality" value="high" /> <embed src="/videos/TGP1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="293" height="275"></embed> </object>

ruby conference - India, Bangalore 2010

Image
Me @ Ruby conf, Bangalore. - 20-3-2010 Seasons Hall, Royal orchid. The great man sitting is ola bini priya, me, veera, shiv, uthiravel 21-3-2010 updating blog & twitting my Boss Senthil, Uthiravel, me Very Excited meeting Obie Fernandez. wht a man!!! wht a programmer!!

File Extension

Hi, Wanna get file extension filename.scan(/\.\w+$/)

Rails - select class not applied

Hi, previously my code was like this, I tried much using, html_options, options, but class is not applied for select. <%= f.select 'difficulty', options_for_select({ "Easy" => "1", "Medium" => "3", "Hard" => "5"}, get_difficulty(@tour).to_s), :class =>'input_text' %> Right way to do: <%= select :tour, :difficulty, { "Easy" => "1", "Medium" => "3", "Hard" => "5"}, {:selected=>get_difficulty(@tour).to_s}, :class=>"input_text" %> Now class is applied!!! Any other better way pls tel me,,.</span>

Getting a MySQL DB dump in local machine from server

Getting a DB dump in local machine from server.. Step1: Login into the server where mysql is hosted - ssh username@server Step 2: Take MySQL Dump mysqldump dbname -u dbusername -p > filename.sql Step 3: Logout Logout of server Step 4: from Local machine scp username@server:server_path/filename.sql dumpfile.sql The above steps can be done in 1 step. mysqldump -h hostname -u dbusername -p dbname > filename.sql

You’re in the middle of a conflicted merge (git)

Problem Trying to update (pull) in git causes the error ‘you’re in the middle of a conflicted merge’. How to resolve a Git Conflict?  Solution NOTE: Take a backup of your code before you do this. This will remove all your changes and revert to master branch!! To be able to get out of this error try the followng: git reset --hard HEAD git fetch origin git reset --hard origin to reset the state, and then you should be able to use git pull as normal. This site helped me when i faced this problem - http://www.42.mach7x.com/2009/11/24/youre-in-the-middle-of-a-conflicted-merge-git/