Ph values

Stephan on testing, software (good and bad), Ruby and the world at large

Removing Stored Passwords on Windows

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 »

Upgrading a Ruby Version Using ‘rvm’

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 »

NoMethodError in Rails Tests — Fun With Fixtures

Posted by stephan on 18. November 2010

In case there’s this weird error message when running unit tests for a Rails app, chances are that your fixtures need some attention. Especially if the schema changed…

NoMethodError: undefined method ‘name’ for #

method method_missing in test_process.rb at line 511
method method_missing in test_case.rb at line 158
method rescue in run in setup_and_teardown.rb at line 26
method run in setup_and_teardown.rb at line 33
method block (2 levels) in run_test_suites in unit.rb at line 641
method each in unit.rb at line 635
method block in run_test_suites in unit.rb at line 635
method each in unit.rb at line 634
method run_test_suites in unit.rb at line 634
method run in unit.rb at line 594
method block in autorun in unit.rb at line 492

There’s no test method given, because, well the tests don’t even get that far: It’s likely that there’s a key (column name) given in the fixture, which is not in the DB schema (anymore).

Posted in Programming, Ruby, Ruby on Rails | Tagged: , | Leave a Comment »

TextMate 1.5.10 … and Ruby 1.9.2

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 Uncategorized, Programming | Tagged: , | Leave a Comment »

Save to ‘invisible’ folders on Mac OS X

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 »

More RVM, TextMate, Ruby and (!) Rails godness

Posted by stephan on 9. November 2010

Here’s another article on the topic of rvm, Textmate, Ruby & Rails: Blended Musings (http://blendedmusings.blogspot.com/2010/10/getting-rvm-textmate-ruby-187-and-192.html)

Posted in Programming, Ruby, Uncategorized | Tagged: , , , | Leave a Comment »

Another note to self: RVM, TextMate and Ruby 1.9.2

Posted by stephan on 8. November 2010

Getting rvm and Ruby 1.9.2 and TextMate can be a bit of work, especially if you’re using rake as well inside TextMate.

Good Thing there’s a solution already: Jim blogged about it at “RVM, ruby 1.9 and TextMate“. Thanks Jim!

 

Posted in Ruby, Programming | Tagged: , , , | Leave a Comment »

Ruby, Sequel and Trees

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: , , | Leave a Comment »

About 40 Years Ago And Metrics

Posted by stephan on 18. July 2009

The term “Software Engineering” is coming to age: It was coined slightly more than 40 years ago in Garmisch-Partenkirchen, Germany. Tom DeMarco wrote a very interesting article about his opinion about the topic, which is available online at the IEEE Software magazine: “Software Engineering: An Idea Whose Time Has Come and Gone?” Let me cite just this part:

This leads us to the odd conclusion that strict control is something that matters a lot on relatively useless projects and much less on useful projects. It suggests that the more you focus on control, the more likely you’re working on a project that’s striving to deliver something of relatively minor value.

I strongly recommend to read the whole article.

Posted in Programming, Software | Tagged: , , | Leave a Comment »

Show the full path in Finder

Posted by stephan on 12. June 2009

As described over at “Mac OS X (Tiger and Leopard) Configuration Tips” you can configure Finder to display the full path to the currently displayed folder by using this (in a terminal of your choice):

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

Change back to the default (of the default) using ‘NO’ instead of ‘YES’. Apparently this works in Leopard (or later) only.

Posted in Mac | Tagged: , | Leave a Comment »

Remove files or directories from a git repository

Posted by stephan on 26. May 2009

Ever needed to remove a file or directory from a git repository? I had to: After pushing a change that included a rather large file to a remote repository, the repository couldn’t be cloned anymore (due to a memory limitation). The support is working on the issue, but being able to clone the repository seems more important to me than having the slides for a presentation (of the past) in this particular repository.

So here’s how: David Underhill has already done – and described – it: “Git: Forever Remove Files Or Folders From History”

Worked for me as well.

Posted in Programming, Software | 1 Comment »

Sinatra and reloading

Posted by stephan on 25. May 2009

Since its 0.9.2 release on 18th of May 2009, Sinatra doesn’t automatically reload files anymore – not even in development mode.

To achieve this use ‘shotgun’

sudo gem install shotgun

and then start the server using:

shotgun <your_applicationname>.rb

The effect is essentially the same (apart from avoiding the issues the ‘traditional’ way of reloading apparently had – which is why it was removed). 

Thanks for pointing this out in this thread @ rubyforen.de.

Posted in Programming, Ruby | 3 Comments »

A Pure Ruby Readline

Posted by stephan on 18. May 2009

 

As found on Github via RubyCorner on DEV_MEM.dump_to(:blog) – Multimedia systems blog.

For all of those who a running Ruby on a Windows machine (known not to be the ideal place to use the readline library) or on some flavour of Unix (where the library might not be available, at least not from scratch), there is now a pure Ruby implementation available: The pure Ruby readline on Github.

Posted in Ruby | Tagged: , , | Leave a Comment »

Euruko 2009 – back from Barcelona

Posted by stephan on 12. May 2009

These two days with Ruby enthusiasts form all over the world not just Europe was great. Nicely located at citilab, with very good public transportation to the city centre of Barcelona, there was enough space inside as well as out side the building to talk to the other attendees, just relax in the sun or work with the notebook. Two wi-fi networks inside and outside the building could deal well with all the notebooks and mobile phones connected to it. This worked very good indeed.

The presentations I liked most where the ones introducing really exciting and new stuff. First and foremost there’s Rhodes, which enables the creation of native mobile applications with Ruby and HTML. And of course Matz’ keynote was very entertaining as well. More really new stuff was about Adhearsion a way to build voice enabled application with Ruby (and Rails). Then some of the presentations were a really good show. Most notably Javier’s talk about gosu, a framework for games and Pablo’s presentation about Archaeopteryx which was probably the loudest presentation I’ve ever heard. :-)

The only thing that was a tad bit disturbing for me was that I didn’t have one of the mobile microphones available and was kind of stuck behind the table as well as the phones themselves, as they seemed to go silent now and then. Aslak dealt with this best I think, repeatedly saying “Hello?” directly into the microphone whenever it went silent.

I think this year was the first time Twitter was heavily used during Euruko, reusing a bot made for Scotland on Rails. and this helped enhancing the communication and connecting people even more than in previous years. A special “Thank you” to all for the other attendees who gave me direct feedback about the presentation as well as the corresponding discussion about it, including but not limited to: Andrew Miller, Tim Becker, Mike Just, Dave Frey. Thanks a lot, indeed.

More summaries are available from Javier and Tomasz

Next year Euruko will take place in Krakow, Poland and I’m already looking forward to going there.

Posted in EURUKO, Programming, Ruby | Tagged: , , , , , | Leave a Comment »

Get Going with Git

Posted by stephan on 28. March 2009

While still in the process switch ing from Subversion to Git, here are a few helpful links I found:

Once up and running there’s of course githubgitcentral and gitorious. For hosting open source projects currently github seems to be the choice, but in case you prefer not to share stuff (just yet) gitcentral offers free (as in no money) hosting of private projects using free (as in open source) software.

Posted in Mac, Software, Work Environment | Tagged: , | Leave a Comment »

Syntax Highlight Code with TextMate in HTML

Posted by stephan on 10. March 2009

Andi Schnacke describes how to to generate HMTL to display syntax highlighted code from within TextMate. The short version:

Bundles → TextMate → Create HTML from Document

Strange I didn’t notice before.

Posted in Mac, syntax, Work Environment | 2 Comments »

Euruko 2009

Posted by stephan on 9. March 2009

Over at euruko.org the registration is now open. The conference is on the 9. & 10. of May 2009 in Barcelona, Spain. It seems they collected quite a few exciting talks – and mine. ;-)

Really looking forward to going there.

Posted in EURUKO, Ruby | Tagged: , , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.