Archive for the ‘Uncategorized’ Category
Posted by Stephan on 14. June 2011
Another note to self: To remove passwords on a Windows machine (done on a Win 7, should work on XP & Vista at least, too)
Hit [Windows-Key]-R (or start a command line) then
control keymgr.dll
There you are, delete passwords in the open window as necessary.
Posted in Uncategorized | Leave a Comment »
Posted by Stephan on 21. February 2011
Another note to self (mostly): If you’re using rvm (and you should), to upgrade an existing Ruby version old to a new version new you can do this (on a command line):
rvm upgrade new old
At the time of this writing, that would be:
rvm upgrade 1.9.2-p180 1.9.2-p136
Thanks to Wayne Seguin for tweeting the hint.
Posted in Uncategorized | Leave a Comment »
Posted by Stephan on 13. November 2010
There’s a new version of Textmate available. Cool, thanks! However after installing … I couldn’t run Rake tasks anymore (the keyboard short cut to remember: Shift-Ctrl-R).
In ‘rake_mate.rb’ (line 49, /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RakeMate/rake_mate.rb). I inserted “.lines” to make it look like this:
tasks = [DEFAULT_TASK] + tasks.lines.grep(/^rake\s+(\S+)/) { |t| t.split[1] }
Additionally I had to ‘re-copy’ the plist.bundle as described on the rvm site.
Now everything works fine again.
Addendum: As mentioned in the rvm guide to using TextMate, I had to (re) move TextMate’s own Builder.rb out of the way:
cd /Applications/TextMate.app/Contents/SharedSupport/Support/lib/ ; mv Builder.rb Builder.rb.backup
Posted in Programming, Uncategorized | Tagged: Ruby, TextMate | Leave a Comment »
Posted by Stephan on 10. November 2010
And another reminder to self:
Saving to invisible files in save file dialogs on the Mac is described at macs.about.com.
Hint to remember: Hidden files are also called dot files and the keybord combination is ⌘⇧. (Command-Shift .)
Posted in Uncategorized | Leave a Comment »
Posted by Stephan on 28. July 2009
While working on some tree structure a couple of unit tests failed, when creating some form of summary of said tree structure. First of all here’s a condensed form of the code:
require 'sequel'
DB = Sequel.sqlite
DB.create_table :items do
primary_key :id
String :name
String :foo, :default => 'NOT SET'
Integer :item_id
end
class Item < Sequel::Model
one_to_many :items
def summary
if items.empty?
return [ { self.name => self.foo } ]
else
items.inject( [] ){ | r, sub_res | r << sub_res.summary }
end
end
end
r1 = Item.create :name => 'R1'
r2 = Item.create :name => 'R2'
r1.add_item r2
r2.foo = 'Ding'
#r2.save
[ r1, r2 ].each{ |i|
puts "Item : #{ i.id }"
puts "Direct Foo: #{ i.foo.inspect }"
puts "Summary : #{ i.summary.inspect }"
puts
}
Notice, that I’ve commented out saving r2. The output is:
Item : 1
Direct Foo: "NOT SET"
Summary : [[{"R2"=>"NOT SET"}]]
Item : 2
Direct Foo: "Ding"
Summary : [{"R2"=>"Ding"}]
What I didn’t expect – and why the unit tests failed – is the ‘NOT SET’ in the r1 summary.
One way to end up with what I originally expected is to save r2. Another way is to set r2.foo before adding r1 to r1:
r2.foo = 'Ding'
r1.add_item r2
How ever I’m still not sure whether this is intended behaviour and why it should behave like this. (If it is, I’d like to know why.)
What do you think?
Posted in Ruby, testing, Uncategorized | Tagged: Ruby, Sequel, tree | Leave a Comment »
Posted by Stephan on 10. October 2008
While reading about the DRY principle (for “Don’t repeat yourself”) and the evil of copy-and-paste coding (again), I started thinking what to do instead. Actually, what to do is more or less obvious: Put the code into a place where its accessible to be reused — a method, may be in a new or existing module or class.
So, whenever I feel the ‘need’ to copy code, I now think about cutting it, creating a new method and calling that. Apart form avoiding duplication, the code is now testable immediately by calling the method (instead of getting the surrounding code exercised). And the methods using the code gets shorter.
In the end, it boils down to pasting code being perfectly OK, it’s the copying that causes the trouble.
Posted in method call, Programming, testing, Uncategorized | Tagged: Coding, Testability | Leave a Comment »
Posted by Stephan on 30. March 2008
My favourite quotes of the conference: “…the nasty snake language…” (Matz about Python) and “I don’t know how to use Ruby” (Koichi on Ruby).
Posted in Uncategorized | Tagged: EURUKO, Matz, Ruby | 1 Comment »
Posted by Stephan on 20. November 2007
There’s a “Ruby and Rails” meeting in Munich on Monday 26th November, starting at 19:30. The location is the “Augustiner am Dom”.
In case you’re coming for a beer or two, some Bavarian food etc. please drop me an e-mail at phvalue ät mac point com, so we can arrange a reservation.
Posted in Uncategorized | Tagged: Beer, Munich, Rails, Ruby | Leave a Comment »
Posted by Stephan on 13. November 2007
So the European Ruby Conference is over for 2007 — a big “Thank you!” to everyone involved: Organisers, the Universitiy of Vienna for the great lecture hall and network we were allowed to use, the Viennese who did a great job getting it done, the speakers — keynote or not — and of course all the attendees.
I was not very surprised to see that Testing, Quality and Beauty of code was a topic again, as was meta programming and really interesting new applications. For more on that including links to the available slides please see the Euruko 2007 Wiki.
If you like to stay connected and watch the photos we shot in Vienna sign up at Facebook and join the “Eurukobackweb” group. There we’ll also try to get “Euruko 2008″ organised. Up to know it’s all open: If you’d like to see it happen in your city or country: Join the group. If you prefer a more sunny season: Join the group. Should you think it should be more organised: Join the group. Or is you “only” like to get in touch with Ruby programmers: Join the group.
Hope to see as many of you as possible again next year. And a few more new Eurukoristas. It’s fun, interesting and the coffee was excellent (remember? We were in Vienna).
Posted in Uncategorized | Tagged: EURUKO, Ruby, Vienna | Leave a Comment »
Posted by Stephan on 7. November 2007
While preparing some code example for the Euruko 2007 I noticed a somewhat strange behaviour of TextMate while editing Ruby code. With the Ruby bundle being active, I expect CMD-R (“Apple-R”) to execute the Ruby code a hand. Which it does, unless the text cursor is inside a string interpolation expression.
An example: The first screen shot shows the example code, the cursor being positioned outside the #{ … }.

After CMD-R is hit, the output is the expected Ruby output as shown below.

However, if the cursor is inside the string interpolation expression as below

the result of hitting CMD-R doesn’t meet my expectation:
I wonder why this happens. Apparently the behaviour has to do the the scope the cursor is in. A hint about how to avoid this is greatly appreciated.
Posted in Uncategorized | Tagged: Mac OS X, Ruby, TextMate | 3 Comments »
Posted by Stephan on 4. November 2007
The pre conference dinner for the European Ruby Conference 2007 will be on Friday the 9th November 2007 at 20:00.
The location is called Das Lederer.
The address is: A-1080 Wien, Skodagasse 28 / Ecke Lederergasse
Posted in Uncategorized | Tagged: EURUKO, Vienna | Leave a Comment »
Posted by Stephan on 26. February 2007
So Ruby is the #1 in the UK
The Official UK Singles Chart : 25.02.2007:
BBC Radio 1 UK charts
Also available for iPod, BTW.
Posted in Uncategorized | Leave a Comment »
Posted by Stephan on 23. July 2006
Well, I took it and scored embarrassingly high. :–)

Anyway it is fun.
Posted in Uncategorized | Leave a Comment »