Ph values

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

Archive for the ‘Programming’ Category

osx-gcc-installer or XCode

Posted by Stephan on 12. February 2012

  1. How to remove Xcode completely from your system:
    sudo /Developer/Library/uninstall-devtools --mode=all

    Use at your own risk!

  2. Where to get Xcode: The App store: https://developer.apple.com/xcode/
  3. OSX-gcc-intstaller: https://github.com/kennethreitz/osx-gcc-installer
Addtional info: Another way is to get the “Command Line Tools for Xcode” at https://developer.apple.com/downloads/ (which requires an Apple developer account).
Happy hacking!

Posted in Mac, Programming, Software, Work Environment | Tagged: , | 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 Programming, Uncategorized | Tagged: , | 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 Programming, Ruby | 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 »

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 »

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 »

Ruby 1.9.1 & Installing It Parallel To 1.8

Posted by Stephan on 31. January 2009

Ruby 1.9.1 has just been released.

And just as a reminder: Dave Thomas describes how to install and run Ruby 1.9 in parallel to 1.8 – as well has giving some information about what has changed.

Posted in Programming, Ruby | 1 Comment »

Pasting Code Is OK

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

Things We Do, But Shouldn’t

Posted by Stephan on 21. September 2008

I regularly fire up the same applications: TextMate, a browser or two, mail programs, iTunes, a shell, irb and others. Now, while Quicksilver is excellent for firing up applications (and a lot of other things), I’d still be busy typing and/or mouse-pointing and clicking. And doing that is boring, cumbersome and not what I like to do anyway. I shouldn’t (have to) do it. And, in fact, I don’t. A little bit of Ruby code will do it:

#!/usr/bin/ruby
%w( <full_application_paths_go_here> ).each{ | app | system "open #{app} &" }

Replace <full_application_paths_go_here> with a list of space-delimited full application paths, save it into a file (in ~/bin presumably), make it executable and there you go. Actually, the language doesn’t matter at all here. The only thing that does matter is to fire up the applications.

Starting all most used applications is now just a few key strokes away. There’s certainly a very similar way to do this on other *nix OSes and Windows.

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

Berlin – Day 3 / RailsConf Europe part 1 – Tutorials

Posted by Stephan on 17. September 2007

The morning started with me finding out that breakfast at my hotel is served from 8 to 11 — while I had to leave before 8. Anyway there’s so many places in Berlin to get a great breakfast. So I had it on the way to the conference.

The 1st tutorial I atended was Trotter Cashion’s “Refactoring”. that was a good introduction as well as a few great tips for tools to help refactoring:

  • heckle: ‘Bebugs’ your code automatically and will tell you what you didn’t cover in you test cases in quite a few cases. It dynamically changes you code by turning ifs to unlesses, ‘==’ to ‘!=’ etc. You get the idea. It then checks whether you unit/tests are failing, i.e. wether they would allow you to find this particular fault. Which they likely won’t in so many cases.
  • grep: Well, it’s grep.
  • rcov: Another tool to tell you about test coverage. This one generates HMTL reports which show which code is and isn’t executed when running your test cases. Very useful a lot faster than heckle, at the price of being less rigousus.
  • glark: A new way for grepping.

After than lunch time revealed that this time lunch is a lot better than at last year’s RailsConf in London. In fact is was excellent. Fresh fish, salads, lettuce, desserts. Options – more than one indeed – for vegetarians.
A minor issue is, just like in London last year, the wireless network: With about 300 attendees around, the network is really really slow.

Now, I’m attending the GIS tutorial (while typing this post). Anyway the accompanying script seems to be a good starting point.

And my RejectConf talk still isn’t done…

Posted in Programming, RailsConfEurope, RailsConfEurope07, testing | Leave a Comment »

RailsConf Europe 2007 in Berlin

Posted by Stephan on 15. June 2007

A short message: The Registration for RailsConf Europe 2007 is now open.

I just received my order confirmation — looking forward to all the tutorials, talks and the “Bratwurst on Rails”.

Posted in Programming, Ruby, Ruby on Rails | 1 Comment »

Learning Ruby on Windows

Posted by Stephan on 1. May 2007

Well, I did it myself: Learning Ruby on a Windows machine. However not with such a huge number of books, on-line tutorials and what-not. In fact I learned most of it with The Pickaxe Book (1st edition, though).

However I just now ran into something new: Hackety Hack. Created by the creator of Why’s poignant Guide To Rubywhytheluckystiff.

I even installed it on my Mac, well the thing is running in Parallels. Because Hackety Hack comes as a Windows installer. Which is why I called this ‘Learning Ruby on Windows’.

Posted in Programming, Ruby | 1 Comment »

Rails Cookbook for Rails 1.2

Posted by Stephan on 19. January 2007

I really value good documentation for current versions of software, so I am pleased to see that Rob Orsini’s Rails Cookbook is published quite in time with the release of Rails 1.2 which has been released in the past few days.

This completes the documentation of both Ruby itself and Ruby on Rails even further.

Posted in Programming, Rails Cookbook, Ruby, Ruby on Rails, Technical book | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.