Thursday, March 18, 2010

Combining (concatenating) pdfs on mac

A free automator work flow called combinepdfs is available. It works fine for combining a bunch of pdf files into one.

Wednesday, March 17, 2010


Easy as pie to install, and runs fine. See the tutorial here.

Simple and quick interactivity in pylab plots

Refer to the api:

import pylab
fig = pylab.figure()
pylab.plot(pylab.rand(10), pylab.rand(10))
def onclick(event):
print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
event.button, event.x, event.y, event.xdata, event.ydata)

cid = fig.canvas.mpl_connect('button_press_event', onclick)

Saturday, March 13, 2010

rake tasks example

An example of a rake task is given under /lib/tasks/migratedata.rake

Rails drag and drop with scriptaculous

From here:

<% element_to_drag_id = "item_#{}" %>
<div id=<%= element_to_drag_id %> class='mydrop'>
<%= draggable_element(element_to_drag_id, :revert=>true) %>
<% element_to_drop_id = "receiver" %>
<div id=<%= element_to_drop_id %> >
Whatever else
<%= 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

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 divs that have overflow:auto on

This can be fixed by setting :ghosting=>true in the draggable.

Friday, March 12, 2010

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


You should be all set

Thursday, March 4, 2010

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.