Skip to main content


Showing posts from March, 2010

Rails drag and drop with scriptaculous

From here:

<% element_to_drag_id = "item_#{}" %> <div id=<%= element_to_drag_id %> class='mydrop'>Whatever </div> <%= draggable_element(element_to_drag_id, :revert=>true) %><% element_to_drop_id = "receiver" %> <div id=<%= element_to_drop_id %> > Whatever else </div> <%= drop_receiving_element(element_to_drop_id, # The id of the receiving element :accept => "mydrop", # The CSS class of the dropped element :with => "'dropid=' + ('_').last())", # The query string parameters :url => {:action=> 'dropped'} # The action to call )%>Controller:
Do whatever you need. The id is passed in params[:dropid]. See views/keywords/_show_key.html.erb and controllers/keyword_controller.rb for illustration of how to use it.

There is an issue with dragging and dropping across di…

Resilient electronics

Someone spilled water on my cellphone (a prepaid T-mobile phone) at night, and in the morning, I picked it up and the display was blank- just lit with the backlight but no display. The phone would switch on and off by holding down the power button (the vibrate would go off indicating on/off). The person said to let it dry and it should be OK.

I was skeptical, since it was an electronic item that had soaked in (a little) water overnight with the power on, but I took out the battery, the SIM card, shook the water out and left it on the table. After an hour or two I came back, replaced the battery and found that the display was back. Pleasantly surprised I put the SIM card in and found that everything was intact, except that a few of the buttons were not working.

Emboldened by this, I turned on the heater and placed the cellphone without battery or SIM card on the radiator and left it for about 4 hours. After this, all cellphone functions had returned.