Skip to main content

Posts

Showing posts from March, 2010

Rails drag and drop with scriptaculous

From here : View: <% element_to_drag_id = "item_#{item.id}" %> <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=' + (element.id.split('_').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. Note: There is an issue with dragging a...

rails 2.3.2 to 2.3.5

sudo gem update rails sudo gem install rack --version '1.0.1' ( rails won't play with the latest version of rack 1.1.0 ) sudo gem update bluecloth make sure you haven't set a particular rails gem version in environment.rb script/about You should be all set

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.