Archive for March, 2008

Google finance’s new stockscreener has sparklines

Friday, March 14th, 2008

I noticed this morning that google finance has a new stock screener feature that lets you choose stocks with features in a certain range by way of an interactive sparkline. These are miniature graphs that go inline with text. In this case the graph is a histogram that indicates how much of the stock market falls into each part of the range - this will give one a quick preview how inclusive their search parameters are.

googlefinance.png

Hacked!

Friday, March 14th, 2008

I’m really lax about updating my wordpress install. Turns out I got burned this time, and inadvertently hosted a bunch of links to various flavors of porn site.

I was on an ancient (and security hole ridden) version of Wordpress, and I wouldn’t even have noticed if the hack didn’t also break posting new entries. I was attempting to post my previous entry on Ruby programming, and the post wasn’t working. So I figured it wasn’t working because of the programming language syntax being rejected somehow, so I would update to a more modern version. Which I did, and that still didn’t work so I started poking around the log files. Lo and behold, my access log is full of requests for html files in a subdirectory of the site. They shouldn’t be there I thought!

So I’d been hacked- someone got remote access to my account using this hack in a file “ro8kfbsmag.txt” (more info). All cleaned up now (I think) but not how I’d meant to spend my afternoon.

Ruby operator precedence (the ors and ands of it)

Friday, March 14th, 2008

I found out (by introducing a bug into the application I’ve been working on) that “or” and “||” do not have equal precedence in Ruby.

More importantly, the assignment operator “=” has higher precedence than “or” so that means that while the expression


>> foo = nil || 2
=> 2
>> foo
=> 2

results in foo being assigned the value 2 as you might expect, the following expression leaves foo assigned the value nil.


>> foo = nil or 2
=> 2
>> foo
=> nil

This is well covered ground online (see this post) but I was surprised that this oddity didn’t warrant an explicit mention in the operator precedence section of the Pickaxe book.