HAML bug with :javascript filter and undefined local variable or method
http://github.com/nex3/haml/issues#issue/2
on haml 2.0.9
require 'haml/engine'
template_broken = '
:javascript
- [1, 2, 3, 4].each do |item|
= "Hey #{item}"
'
puts Haml::Engine.new(template_broken).to_html
causes
(haml):3:in `to_html': undefined local variable or method `item' for #<Object:0x2bedf64> (NameError)
from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/engine.rb:149:in `to_html'
from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/engine.rb:149:in `instance_eval'
from c:/ruby/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/haml/engine.rb:149:in `to_html'
from haml.rb:9
Replacing :javascript filter with regular %script tag fixed the issue. It’s a workaround.
require 'haml/engine'
template_broken = '
%script
- [1, 2, 3, 4].each do |item|
= "Hey #{item}"
'
puts Haml::Engine.new(template_broken).to_html
False positives in rcov

I noticed that depending on the syntax used, rcov (0.8.1.2.0 win32) can give false positives. For example, when putting blocks on the same line as methods that execute them, if the method was called and block wasn’t, the line would still be colored as “covered”.
In the image above you can see that line #23 isn’t covered, where as #28 is. Problem is, I don’t have any tests yet hitting XML portion.
What’s even more interesting is that using { } syntax on multiple lines gives false positives just the same - you have to use do/end syntax specifically. Only, and only then rcov will process the block correctly.
Something to keep in mind.
Update: I have tested this on OSX and the issue is exactly the same.
Missing ‘a’ character on Windows with rspec and cucumber

Trying to get a windows rails environment going this morning I stumbled upon something interesting - all ‘a’ characters were missing from cucumber and rspec output.
This has something to do with UTF-8 encoding and there’s a ticket and wiki post on cucumber about it, but no solution that I found acceptable.
Everything comes down to having change encoding in the current cmd window. This is achieved via a simple call to chcp 1252, but nobody want’s to do this every time, right?
To get this executed automaticaly and without resorting to serious registry editing, simply add this line to your cucmber.bat and any other batch files that are exhibiting this problem. You can find cucumber.bat in your /ruby/bin folder.
Here’s what it looks like:
chcp 1252 @ECHO OFF IF NOT "%~f0" == "~f0" GOTO :WinNT @"ruby.exe" "c:/ruby/bin/cucumber" %1 %2 %3 %4 %5 %6 %7 %8 %9 GOTO :EOF :WinNT @"ruby.exe" "%~dpn0" %*
SyntaxHighlighter 2.0.296 (maintenance release)

Changes in 2.0.296
- Added “current” to published folder which always points to latest version.
- Added rollover to the copy to clipboard button.
- Fixed OSX specific line wrapping image issue.
- Switched to LGPL v3.
It was brought to my attention that donation clause isn’t compatible with LGPL, therefore I elected to sacrifice potential free beer to stay proper open source, which. This of course means that donations are no longer required, but desired just the same (or even more so now because even fewer people will donate).
- [0000005] Locked down all CSS with
!importantproperty. If you need to override values, please use!importantas well. - [0000008] Added Scala and Perl brushes.
- [0000009] Fixed style in about page.
- [0000011] Fixed duplicate “empty” function in PHP.
As always, you can grab the latest version here.
Perfect little server - Introduction (part 1)

Over the last 3 or so years I’ve been running a Windows Home Server and everything was well. Then, a few months ago, a very high pitch noise started coming out from one of the 7 hard drives in it. The problem was, there wasn’t an easy way of telling which one was making the sound.
To stay on the safe side I decided to run to a store and grabbed me the cheapest 2 bay encolosure that was in stock. Turns out I got very lucky.
I ended up with Dlink DNS 323 which after a brief search online yielded complete how-to hack wiki. In just 10 minutes following instructions I converted a pretty dumb enclosure to a full linux box.
Once you SSH into 323, a world of possibilities opens up. First order of business was to install optware and from there, most of the common software is available in precompiled, ready to go form. I’m not a *nix expert by any means, but with help of the wiki and occasional googling 323 presented almost no trouble what so ever.
Here’s what I really like about 323:
- Efficient - 15-25 watt power consumption (reference) makes running 24/7 essentially guilt free.
- Very quite - can’t even hear the drives 5 feet away
- Gigabit ethernet
- Runs linux - fuck yeah!
- Super easy to hack
In the next post I’ll talk about what I have installed on 323 to transform it from an enclosure to a server.