Archive for August, 2008

ruby not using daylight saving (dst) ?

August 31, 2008

irb(main):023:0> t=Time.parse(“12:20 EST”)
=> Sun Aug 31 22:50:00 +0530 2008

Since it is daylight saving in New York, I should be getting 21:50 not 22:50. The dst? method gives false, since it is not daylight saving in my timezone.
The Mac widget as well as http://www.timezoneconverter.com/cgi-bin/tzc.tzc give me the correct result.
(In order to run Time.parse on irb you [...]

Vim and Textile

August 31, 2008

Tim the Enchanter, has some great things to say about the vim editor, my childhood friend. He talks of Textile for Vim. Sounds great. However, I wanted to leave a note telling him about HTML.vim but Tim doesn’t take comments.
I used to like Textile but much prefer Maruku now.

Neverblock: asynch IO for ruby.
Neverblock mysql.

OS X Leopard: So it is /etc/paths.d or /etc/paths ?

August 31, 2008

So, as always, my shell script runs fine on the terminal, but bombs as a cron-job! The PATH variable for the system is different.
Leopard now requires us the create a file in /etc/paths.d (see this). Did not work for me! In any case, that does not let me specify the order of inclusion.
There’s also a [...]

Extracting data with Hpricot – Night 2

August 30, 2008

To the newbie following examples, who has not poured through the docs, and is not a ruby expert (me), Hpricot does give some surprises.
I spent a lot of time figuring this out.
check= trrow.search(“//td[@width='30']//img[@alt='Winner']“)
I need to see if the html row contains this image or not.
On some rows check is blank, on some it has the [...]

Extracting data with Hpricot – Night 1

August 30, 2008

I saw the tutorial on scraping gmail with Hpricot and Mechanize, and thought I’d try it. Strangely, it works from irb, but gives errors when run as a ruby program. Mainly, page does not have a method names uri. And page.class gives String.
Also, the url of the actual email has two “?” in it. Had [...]

Javascript: the good and bad

August 26, 2008

Just wrote my first program in javascript (see previous post). Things I liked about javascript:
1. C-like syntax – thankfully!
2. Good regexp classes.
3. Decent handling of arrays, strings, etc. (Although, NO PRINTF !!!)
Problems I faced:
1. While executing, Firefox does NOTHING if there is an error in the file. No error message! It takes me ages to [...]

Runner’s Time calculator

August 26, 2008

Some days back (while watching the Olympics), I wrote (in ruby) a command line program that given a distance and time, would calculate how much time it would take to complete some other distance.
So if Haile runs 1000 meters in 2:32.1 (2 minutes, 32.1 seconds), how much time will he take for the 10000 meters, [...]

Comparing some static HTML generators

August 24, 2008

I have started looking at some static html website generators. Will be writing more about them in separate posts. I am not looking to have to know or do too much with CSS or too much customization. I would like it to use sensible defaults, conventions and leave me to just fill data. I like [...]

What is wrong with man pages and –help

August 24, 2008

Today most programs have at least 20 command line options, usually much more. A newcomer wishes to run the basic or minimal functionality of a tool/utility without as yet getting into complex usage. However, the “–help” and man pages of ALL programs do not give basic usage.
All options, frequently used ones, as well as rarely [...]

Mac OS X OpenPGP with Alpine

August 24, 2008

As usual, poured through many many difficult how-to’s for getting PGP on my system. Then gave up and just did the usual “sudo port -v install gnupgp“. A few minutes later, I was creating my keys.
Now that makes me really wonder about some program called Mac GPG Guard which showed a lot of programs I [...]