Skip to main content


Showing posts from January, 2008

Rosewill IDE USB 2.0 external enclosure

Got this from newegg. It is the Rosewill RX35MV-U-BU SLV 3.5" IDE to USB 2.0 External Enclosure (Silver Aluminum & plastic). If you have an old hard disk drive (HDD) hanging about and it works and you want to convert it into external storage - give this a try.

Be aware that the design is iffy and the IDE connector pins that stick out from underneath the PCB may touch the aluminium case - I put two layers of duct tape strips to ensure isolation between the data pins/power and the case body per chance pressure on the case caused the aluminum body to short the power or data pins.

The standoffs between the drive and the enclosure are plastic, which doesn't make for such efficient heat conduction even though the body is aluminum.

The drive was easy and intuitive to assemble - took about 10 minutes. Vista has no problem recognizing and treating the enclosure as an external drive.

This is an IDE USB 2.0 device, IDE drives are going out of fashion now, being replaced by SATA

As a sam…

Rails project quick start quick list

Build database using sql
In command line do rails expt where expt is the name of the projectunder config/database.yml change sql adapter and database nameruby script/generate scaffold (model name) (repeat for each model)ruby script/server -edevelopment -p3000, replace development with test or production, replace 3000 with the port number you wantnow start messing with the internals

Image vectorization

Inkscape is awesome.I just discovered image vectorization on inkscape. You just import a bitmap image and then go to path->trace bitmap [inkscape wiki]. The effects are amazing AND fast. I'm impressed.

update_attributes and associations - customizing rails magic

For sources in Rriki the user types in a list of authors for that publication and RRiki takes care of looking up the database of known authors, creating new entries if need be and then linking the relevant authors to the publication. This is all good and dandy for the user, but editing poses a problem: update_attributes takes its information from the form, which does not have the association information.

From we have :

def update_attributes(attributes)
self.attributes = attributes

All that was needed was to not use the bundled update_attributes and instead manually do

@source.attributes = params[:source]

Another instance where it is necessary to break into the comfy 'it just works' world of rails and customize some of the magic.

Rails : Where to put what

I'm trying to clean up Rriki. Yes, this is procrastination and I should do my research, but clean code looks soooo nice !

Any way, I'm trying to program the rails way (some mumbo jumbo about MVC and DRY). For Rriki's 'sources' (storage for research articles, books etc.) I have a certain amount of processing that I have to do - I export the table data to BibTeX so I can use it with LaTeX, I import publication data from pubmed, and I write to auxiliary databases such as for bibus.

Currently code for this is placed in the model, in the controller and in sources_helper. But I have learned that this is not the true way. The proper coding etiquette is as follows
Thin controllers : put as much of your logic in the model as possible and keep the controller slim and trim. Ideally, you should be able to glance at a controller method and figure out what information it grabs. [Jamis Buck]Fat models : Most of the logic will be about fetching, manipulating and parsing model data. S…

Vacuum pumps

Are available from
The science company. (search for vacuum pumps) The ones they have are plastic body, and they get a decent vacuum but for small volumes (each stroke moves about 15ml). They come with a guageThe tool source. Which seems to be geared toward automotive (car) repair. They have a bunch of handheld vacs just like the science company. Their Mityvac range has some aluminum/zinc bodied pumps that get to 25inHg vacuum.
Mityvac has a list of distributors on their page.Ralston instruments has nice looking vacuum pumps and gauges.

A mouse in the house : Webcam motion detection

We have a mouse in the house. I wanted to have the little intruder on camera. I dug out the old webcam and started to google for webcam motion detection software. Unfortunately a free but closed source program (Yawcam) won over a open source one (Dorgem). You can see the results in the video above.

The mouse makes its appearances at 3:00am, 3:50am and 5:26am. I forgot to add in time stamps to the images, but Yawcam can do that.

Dorgem was not satisfactory because I couldn't get motion detection to work. There was no way to adjust the threshold. I set it to take shots every 1s and it saved images with time stamped filenames (and a time stamp on the image itself) but the motion detection did not work. Perhaps the CCD noise kept triggering the software, I just got image dumps regularly at the 1s rate. [Help page on how to use Dorgem for motion detection]

Yawcam is more professionally designed. It has a motion detection preview pane where you can adjust thresholds or have the software ad…

Modifying Thunderbird tags

There is no good way to modify or delete tag definitions from the Thunderbird UI. The tag definitions are stored in prefs.js [mozillazine] in lines such as

user_pref("mailnews.tags.receipt.color", "#C0C0C0");
user_pref("mailnews.tags.receipt.tag", "Receipt");

in this case "receipt" is the name of the tag (the string that gets put into the mail header) and "Receipt" is what you see in thunderbird, and the highlight color is #C0C0C0, which is a light shade of gray.

Thunderbird local folder tags redux : It can be done!

Compacting a folder adds the X-Mozilla-Keys: header if it does not exist [mozillazine],[googlegroups thread],[bugzilla].
You can force a folder compact by deleting an (unimportant) email and then compacting the folder. (Just clicking compact will do nothing to a folder if there is nothing to be deleted).
Thunderbird, once it sees the X-Mozilla-Keys: header, will actually use it to store tags.You can verify this by deleting the .msf file and seeing if the tagging persistsYou can now move this email around (from inside Thunderbird) and the tags move with the email, even to a folder that, in general, does not have the X-Mozilla-Keys: header! True metadata.You can tag a folder that doesn't have the X-Mozilla-Keys: header and afterwards compact it and Thunderbird will move the tags into the header. Just make sure you really compact the folder (pt 2. above)Thunderbird stores tag definitions (highlight color etc.) in prefs.js
Good, now I can continue with my tagging of archived mail...

Archiving email : Thunderbird tags not ready for primetime yet

Thunderbird stores email in plain text files (mbox format) that have names like INBOX and mysweetiesemails (files with no extensions). Riding with these mbox files are other plaintext files with corresponding names INBOX.msf and mysweetiesemails.msf . These .msf files are mail summary files used by thunderbird to speed up certain actions that would otherwise require repeated trawls through a large text file. The .msf files are autogenerated as required and can be deleted.

The good thing about mbox, I think, is that in the end it is not proprietary and it is plain text. Thunderbird has enough of a user base that whatever comes after Thunderbird will have a way to import mbox mail (if not use mbox directly).

I wanted to archive my email off my university's server onto local folders on my compuer. Thunderbird's "Local Folders" can be reconfigured to any folder on your computer, by going to tools->account settings.

I had organized my mail into different folders on my pop…

Turning interactivity off when drawing in matplotlib

Running in interactive mode is great and all, but I just learned that in interactive mode EVERY plotting command causes a COMPLETE redraw. That would explain all the flickering and delay in a script I put together that changes the plot each time a mouse action is executed on the axes.

However, ioff() comes to the rescue. This nifty function temporarily turns off interactivity, so that all those plotting commands go in a pipeline and you can show it all in the end when you want to.

Loose Manhole Cover V : The buck passes (almost) full circle

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

The buck has almost come full circle, I think I'm at 290 degrees. I phoned CableCom again today (naturally they didn't call me back as promised) and they took my complaint and said they would pass it on to Verizon but the lady was sure that it was the county's responsibility.

I'm now expecting Verizon (if they do anything at all) to say its the County's problem.

Heh, heh. Now, I need to start getting things in writing so I can have, on paper confirmation of the nexus of the universe, this loose man hole cover that everyone thinks is the other guy's responsibility.

Heh, actually wouldn't that mean I could just take the lid and sell it on ebay? I mean if PG. County says its Verizon's responsibility and if Verizon/CableCom says its PG County's that means ... its no ones ... so its abandoned ... so ... finders keepers

Converting raster images to SVG

I needed to merge photos I took of a setup with some figures of data. I was thinking to convert my photo (.jpg) into svg format (my idea was that it would be zoomable, and perhaps smaller in size). However, a look at scale-a-vector suggested to me that the conversion is not worth it. So I'm merely going to paste in my bitmap photos of the setup onto my vector figures of the data.

Drawing database diagrams

I wanted to do some documentation for Rriki which involved drawing database tables and how table rows are related to each other. I looked around and tried dia and MySQL workbench. Dia is able to export to SVG and it can draw connectors between blocks so that when you move the blocks the connectors move. However the SVG export is not correctly interpreted by Inkscape. The blocks are drawn correctly, the labels on the blocks are offset from their desired positions, and the label of the last drawn block is missing.

MySQL workbench can grab table definitions from a sql dump, and you can draw relations between tables, but the drawing is very clumsy, and the display flickers continuously.

I went back to good old Inkscape for my diagram.

Education by Slashdot

There was some story on slashdot and was tagged myhovercraftisfullofeels. Naturally I started a search on this and this page told me that it was some monty python thing. And I realized how much of my education about the fake modern world has come from slashdot.

For instance I have learned acronyms and phrases

IANAL - I am not a lawyer
IANAP - I am not a physicist
YMMV - Your mileage may vary
YRO - your rights online
ISP - internet service provider (In the real world this is Indian Sari Palace)
OMG ponies!!!!
in this house we obey the laws of thermodynamics
my hovercraft is full of eels
vapor ware
In Soviet Russia YOU educate slashdot

I have learned about cool websites

xkcd - a cool geek comic
dark roasted blend

And tens of other tid-bits of modern geek speak than enable me to maintain my alter ego at work and blend in.

Ahh, slashdot, where the comments are so much more interesting than the articles.

Matlab, nested functions, and variables

I rejoiced that MATLAB lets you have locally declared functions. Ahh, where are Python's namespaces? All hail Python. Fie promiscuous MATLAB! poor shadow, false pretender.. ahem..

Ok, so I go and nest a function and load some data from a file and Boom! MATLAB cries Uncle, with some wimpy excuse that it can't load variables into a static workspace. I ask you, is that grown up behavior?

So I have to do this round about thing: Suppose I have a mat file segmenting.mat with 6 variables called segment, dive_trials, dive_segment, trials, interaction, and capture. I have to load them into an explicit variable (thisisbogus) and then I have them as structure fields. Ewww.

thisisbogus = load('segmenting')

thisisbogus =

segment: [43x2 double]
dive_trials: [2 3 4 5 7 8 9 10 12 16 19 20 26 29 32 38 39 41 43]
dive_segment: [19x2 double]
trials: [1x38 double]
interaction: [43x1 double]
capture: [43x1 double]

I didn't want to type the bazillion lines of code to assign each field back t…

Loose Manhole Cover IV

(Read episodes I, II and III first).

I called up CableCom at 1-800-322-6852 and they took my complaint and home number and home address and said someone would call be back in the morning. Lets see how private contractors compare to government workers.

Incidentally, I was curious as to who CableCom was. From google we see that CableCom could be:
A swiss based cable/internet/phone company.A Wisconsin-based company that does network cabling and fiber optic construction.A telemarketing company (bad industry, bad industry, don't call me) based who knows where.
A Chicago based contractor.A UK based cable TV company.A Norwegian company. And, yess ze doo tak lik Bork, iff you luk at zee leenks like "Kontakt oss" on that page.And that's just the first two pages. I'm going with the wisconsin one because Verizon has hired CableCom to do the fibreoptic work.

Vista hibernation and Bittorrent

Yesterday whenever I put my vista running laptop into hibernation it would resume immediately. It turned out that Bittorrent (I have v 6.0) when it sits in the system tray, causes this problem. I had to exit the client and the computer hibernated as usual. Fortunately by the time I had discovered this I had not gotten in too deep in tweaking settings that are best left alone when they work!

The Mechanical Universe

When I was in school I enjoyed immensely a program called The Mechanical Universe. It is a series of lectures on physics and each lecture starts out in a class room (The series was produced at the California Institute of Technology) with the professor introducing a concept. Then the lecture takes off and uses historical reconstruction, demonstrations and animations to explain the concept.

The humor and drama conveyed were great at holding my interest, and this multimodal method stuck in my mind much better than dry textbooks.

The Mechanical Universe remains in my memory as one of the better uses of television. It has been made with public money and I am happy to see that you can stream the video to your computer from

Vista defragmenter

Vista's defragmenter, unlike XP's and win98's displays no information about the disk's fragmentation state, or defragmentation progress.

However the help does say that using defrag.exe will yield more details. defrag.exe is a command line version that reminds me of linux system utilities. Remember to run it as admin. On a side note, who would have thought that Microsoft would implicitly say guis are evil?

One major improvement is that you can work while defragmentation is going on, and the process doesn't seem to affect things.

Loose Manhole cover III

After my initial complaint a prompt response from PG County sends me in search of Bell.
google search for "bell pg county" takes us to Bell Atlantic-Maryland v. PG search for "bell atlantic-maryland" takes us to the fcc and we learn that this is now Verizon search for "verizon maryland" leads to here.
I see they have a lot of things about corporate responsibility etc. etc. Good thing our tax-paid scientists (me) are going to scientifically test how correct those statements are...As a blogger, I understand I am now a journalist, at least in utopia (AKA Canada), so should I contact their media person? No, I think I will go with Network Transformation and Upgrade, and call cablecom who is their contractor for PG County. 1-800-322-6852Dare I phone them at 7:44am? Ok, I'll wait till regular business hours.

Loose Manhole cover II

PG County gets a silver medal for service.

I made a complaint to PG county about a loose manhole cover near our house on Jan 7th. On Jan 9th 3:13pm a gentleman called Wilkerson left a message on our phone system saying that he took a look at the manhole cover and its not part of the PG County drainage system, but belongs to Bell, so I'll have to call them. He also recalls coming over last year to take a look at the same manhole cover. I made a complaint via their web system last year! So they did come. They do exist!

So why am I being such a hard ass and giving them only a Silver medal? Well, Mr. Wilkerson was prompt, he looked into it, and he told me what he found, and how to proceed. To get the gold, PG County should have picked up the phone on my tax paying behalf and chewed out Bell (AT&T? or what ever they are calling themselves nowadays to hide from anti-trust).

Hmm, as a government employee I would have kinda enjoyed harassing a private company because they were giving bad…

Glossy Laptop display

My laptop has a glossy display (HP calls it a BrightView display). It is marginally annoying when there are bright surfaces behind you. When the screen is off, you would think, from the reflections, that its impossible to use, but the LCD displays pretty bright images, so they usually drown out the background behind.

I had never been able to use the laptop outside, because of reflections, until today. I decided to try again and this time, instead of sitting facing the sun I sat at an angle to it. It was amazing! At the proper angle, the back of the display diffusely reflects the sunlight, causing the screen to now act like an old fashioned LCD with no back-light.

It looks a little weird, because the letters clearly float above the greenish background (like the LCD on a clock or watch), but I was able to use it in bright sunlight, on battery (i.e. dimmed display). It was amazing.

So the trick to using the BrightView LCD in sunlight is to turn so that the sun is not reflecting directly of…

FarCry user map : Outpost 22

Just now I was whining about how Matto3 and Matto4 did not have enough stealth for me even though the level design/objects etc. was awesome. And then I downloaded and started to play Outpost22.

One word.


Of course, I'm biased by the fact that

I Love Stealth.

And this map is heaven for stealth tactics, diversionary tactics, hit and run and trap tactics.

This is so far my favorite FarCry map, even, perhaps, including the official FarCry ones, though I don't have them so well in memory.

Matto3 and Matto4 *almost* make it to my favourite list

What I really enjoyed about FarCry was the stealth element. My favorite weapons are the sniper rifle and the silenced machine pistol. I enjoy well made maps, good atmosphere and well, stealth.

I hate "boss" fights, be they with "Bosses" or large numbers of enemies at the same time, out in the open. I also hate Trigens, but that's a good kind of hate.

So Matto3 and Matto4 almost made it for me, with Matto3 beating Matto4 except for the incomplete nature of Matto3's story.

Matto3: The good
Silenced pistol with scope! Heaven!Lots and lots of humor scattered around.AWESOME maps. Really. Absolute top-notch crafting of textures, objects etc.
Some innovative aspects, like shooting gas cylinder valves to turn them into rocketsSome manipulation of the environmentMultiple routes, to an extentMatrix style slow mo!No trigens

Matto3: The bad
Incomplete - not really bad.Boss fight at a certain levelNo sniper rifleJack Carvers voice acting. Sorry, even if I allow him to be Briti…

Loose Manhole cover

There is a loose manhole on a street cover near our house. Cars going over it make a very loud clanking noise. This will be a test of PG County Government efficiency.

A. How hard is it to find who to contact about this?
A google search "prince george county government" takes us quickly toPG county where a top menu option takes us to
Government and a easily naviagble side menu takes us to
Department of Public Works and Transportation where though there is no option for a "loose manhole cover" there are things to do with roadways. I decided that "drainage" would be most appropriate since these dudes should have the tool set to open (and perhaps replace) manhole covers.Office of Highway Maintenance's (OHM) Customer Service Office at (301) 499-8520 seems to be the people to contact.
B. Does this work?
Yes! I get patched through to a operator who takes the details of the loose manhole lid and gives me a confirmation number.

All done over lunch, say 15min tops st…

Name (and url) change

When I first started this blog I decided that it would be about my stumbling around to learn Python. I had a page on my old website where I collected all kinds of assorted information I gathered trying to solve different problems. This blog finally got enough non-Python miscellanea that I decided to rename it and re-url it to what it should have been in the first place - "Assorted Experience".

I thought this was going to be painful or impossible. I knew you could change the name of the blog and the description, but the url too? From a hint here and some trying on of names I got it all squared away.

Dots in your gmail

Google help clears up a mystery for me. I often get emails meant for other people on my gmail account. There is always one difference between my gmail address and the mistaken one - a dot. Google has set up things so that adding or removing dots from the name part of your address still directs mail "properly". So if you register the address then mail sent to also gets to you.

This is an interesting choice on the part of google. I can't think of a good reason why you would do this.

Cleaning up RRiki

update sources set sources.`note_text` = replace(sources.`note_text`,'Research Support, Non-U.S. Gov\'t','')

delete links, keywords from links, keywords where and keywords.word='Research Support, Non-U.S. Gov\'t'

Ain't databases fun