Skip to main content

Posts

Showing posts from February, 2008

Passing parameters to render_component

render_component is used to call an action in a controller while rendering a view.

Note the difference in how to pass parameters to the controller between link_to and render_component

link_to 'Edit', {:controller => 'notes', :action => 'edit', :p1 => @note, :p2 => @zippo }


render_component :controller => 'notes', :action => 'edit', :params => {:p1 => @note, :p2 => @zippo}

Lunar eclipse

The moon turned a lovely shade yesterday. Pics with a 3.2 MPx Cannon Powershot on a tripod. They are poor quality - mostly over exposed.



Eclipse half way done


The streak is probably a satellite, with the bright dots being when it spins and reflects the sunlight my way.

Making up numbers

SETI, anthropogenic C02 driven global warming (oh, sorry, climate change - now that its becoming more and more clear that climatologists are like economists: both dealing with complex dynamical systems and not knowing whats going on, but pretending to anyway), casualty demographics in the Vietnam war, trickle down economies, DDT, population bomb, population implosions and other policy driving scientific results are based on numbers. Science gives us grounding in that it strives to be quantitative. When we have numbers at hand we feel we can argue with authority and moral superiority.


But what's the use if the numbers are MADE UP?

xkcd has once again said what I'm sure many people want to say but are afraid of saying.

C64 Nostalgia

The emulator is winvice, and the game archive is at arnold. I had a c128 and the emulator brought back memories of trying out the monitor command [instruction set here] and the sprite editor [here]. I remember going through the ROM using the monitor's memory inspect ability and coming across names of some people, followed by the string 'HACKERS!'. winvice does not have this (I searched) and perhaps my computer was a small batch that had been harmlessly hacked at the factory.

Using rails frame work from outside rails

It is possible to use and test bits and pieces of your rails application from outside rails e.g. from a ruby script.

You need to add

require 'd:/research/rriki/config/environment'

at the start of the script to access all your models and be able to manipulate database info.

This starts you up in development mode, if you want to force a particular mode you can do

ENV['RAILS_ENV'] ||= 'production'
require 'd:/research/rriki/config/environment'

The ENV statement needs to come first.

Assigning permanent drive letters to USB drives on Vista

For various reasons you might want external storage to come up with consistent drive letters. For instance I use Unison to backup my data to two external HDD, both of which connect with the letter f: when plugged in separately. This confuses Unison's state and it ends up taking a long time to synchronize the roots. It would be better if they came up as, say, f: and g:, so I could write two separate profiles for them.

Dave from the unsion users list pointed [thread] me to USBDLM. This runs as a service and enables one to do a host of things with removable storage drives, including assign persistent drive letters. But, it is not opensource and it is a service.

Reluctant to add more services to my list I found out that Vista's Disk management system, which allows you to rename drive letters, is persistent. Which solves the problem elegantly. I think. So far.

Loose Manhole Cover VI : Resolved (?)

(Read episodes I, II, III, IV , V first)

A phone back to PG County was fielded by a courteous lady who had our initial complaint and the workers followup report on file. (One point to PG County for efficiency). She gave a phone number to call which was for an 'engineering' department. It wasn't clear what this department was, but a phone call was made and a message left.

Now, for the past couple of days there has been no clanking! One thought was that rising temperatures might have caused the cover to expand and fit more snugly in the socket, but we've had another cold spell and no sound from the cover, so may be its been fixed!

Image sequence to movie : Mencoder

UPDATE: I have switched over to ffmpeg.

Mencoder works on both Linux and windows and is a great option for the simple, repetitive task of taking an image sequence dumped from a data analysis program and converting it into a movie (to animate the data) [Mencoder help page: movie from image frames].

What I end up using is the following command

mencoder -audiofile sound.wav -oac copy mf://*.jpg -mf fps=25 -ovc lavc -lavcopts vcodec=wmv2 -of avi -o output.avi -vf scale=800:600

-audiofile sound.wav -oac copy tells mencoder that the audio file to attach to the animation is called sound.wav and I want it copied as is (no change in encoding) [more here, and here]. You can omit this if there is no audio file

mf://*.jpg -mf fps=25 -ovc lavc -lavcopts vcodec=wmv2 tells it to take all the .jpg files in the directory and make a movie at 25fps using the microsoft wmv codec

-of avi -o output.avi -vf scale=800:600 The output file is called output.avi and has a size of 800 x 600 pixels in avi format. Omi…