Archive for the ‘Uncategorized’ Category

A CouchDB primer for an ActiveRecord mindset

Thursday, September 25th, 2008 by Alexander Lang
picture from http://uk.gizmodo.com/2006/07/27/kick_back_on_the_cabernet_couc.html

That couch was our intro picture at the workshop.
(picture from gizmodo.com)

Monday was the first event at our new upstream office, starring @janl and me presenting an introduction to CouchDB - including a new hands on examples part - and afterwards an overview of what can be done with CouchDB in Ruby so far. The talks were followed by a discussion that gave (hopefully not only) me a couple of new insights I want to share here - after summarizing the evening for the people who couldn’t make it. There will also be a video recording with synchronized slides of both talks be available in the next days (thanks @klimpong).

What is CouchDB

CouchDB ist the new cool kid on the block. It’s a document oriented database that has replication built in, can scale massively and uses an HTTP REST interface to query it. Documents are stored as JSON constructs and can be queried with views that are built using Map-Reduce (a smaller company called google has had a bit of success with that recently). Oh and it’s written in Erlang. Jan has given a number of talks on numerous events already, so there are already a couple of videos and slides available - not from the hands on part though :) For that you should watch his blog I guess.
(more…)

Let the text fields grow

Thursday, September 18th, 2008 by Thilo Utke

I find it rather hard to choose the right size for text boxes. They are either to small so that you feel like caged in while writing into them or they are so big that you feel lost in that great white emptiness. These times are past since someone came up with auto expanding text areas (e.g. facebook uses them).

For one of our rails apps we use John R. Wulff’s ‘text_area_with_auto_resize‘ plugin. The plugin will give you auto growing text boxes for all text_area calls. I wrote a little extension for prototype’s (1.6.x) in-place editing text area that makes these text areas auto growing as well. So we can have auto growing text areas all over the place. ;)

CouchDB-Workshop

Wednesday, September 17th, 2008 by Alexander Lang

Am 22.9. 2008 gibt es einen Workshop zu CouchDB mit Jan Lehnardt (CouchDB maintainer) und mir. Nach einer kurzen Einführung wird der Fokus vor allem auf hands on experience liegen, d.h. es wird Beispiele und Code geben. Nach Jans CouchDB-Teil werde ich einen Überblick über die derzeitigen Ruby-Bibliotheken geben und wie damit der schnelle Einstieg zu schaffen ist.

“Leider” sind bereits alle Plätze ausgebucht, da wir nur begrenzt Stühle zur Verfügung haben. Wer trotzdem kommen will trägt sich am besten in die Warteliste ein und begnügt sich dann eventuell mit einem Platz auf dem Boden. Sicherlich wird das nicht der letzte Workshop bei uns sein. Mal sehen was uns demnächst noch so alles einfällt…

Rails Camp Denmark - Back to nature the ruby way.

Sunday, September 7th, 2008 by Thilo Utke

If you ever meet a bunch of people sitting with their laptops in front of a tent in the middle of nowhere you might have stumbled across a rails camp. The rails camp is a new unconference where ruby hackers meet to exchange ideas and have fun in an open and inspiring environment. And what could be more open and inspiring when being torn out of your everyday internet/office/city routine by camping. Being cut off from the internet will bring up new approaches and insights to overcome programming challenges as well as bring the members of the ruby community more in touch with each other. Of course it’s also a hell of fun when you’re off from your daily routine with a lot to laugh, drink and play.

That’s why we will attend the rails camp in Denmark to meet our fellow rubyists (eg. from Oslo or the last Euruko) and might code some crazy ideas. The Rails Camp Denmark will likely take place at the end of October - the final date isn’t set yet - 24th October just outside Svendborg on the Danish island of Funen. If you want to join the rails camp you should invest 75 Euro and be prepared for camping over a weekend. More details and discussions can be found in the google group.

Hold your thumbs that the temperatures at the End of October don’t drop below zero so we won’t have to keep our mac books running to heat our tent. ;)

cucumber - next generation rspec story runner (updated)

Tuesday, August 26th, 2008 by Alexander Lang

yesterday while skimming through my Twitter timeline I stumbled across aslak hellesoy’s cucumber. cucumber is a rewrite of the rspec story runner, allowing you to write user stories in plain text and make them executable by adding a bunch of ruby magic.

the features of both - story runner and cucumber - are basically the same. cucumber just gets rid of all these little glitches that disturb your work flow when working with story runner and adds that little bit of polish that makes the difference. but see for yourself:
(more…)

Functional Testing awesomeness with Webrat

Saturday, August 9th, 2008 by Alexander Lang

I recently started using Webrat in one of our project’s test suites and fell in love with it immediately. Webrat is a functional testing library for Ruby on Rails which you can use in your rails integration tests (or better: the RSpec Story Runner) to let your tests walk through your application. The big difference between Webrat and a “standard” Rails Integration Test is that with Webrat you click on actual links and submit actual forms, instead of just sending requests to you application.

This closes an important gap to testing in a real browser (like with Selenium) and now gives us much more confidence in our tests - we now not only know that our models and controllers integrate, but we also know that they work with our views. That had been an unpleasant problem for a while. All our tests were passing but we still had way too many problems with invalid links and forms submiting to the wrong action. No more.

Webrat provides a sort of DSL (everything is a DSL nowaday isn’t it? :) ) for interacting with all the HTML elements you would find in a HTML document like links, checkboxes, radio buttons, text fields, selects and submit buttons. A test case might look like this:

Webrat now fetches the start page of the application, parses it and follows the first link labelled with “Sign Up”, gets the corresponding page, parses the form, fills in the values and submits it. Whenever a response comes back with anything else than a 200 (or 302, in which case that redirection is followed automatically) or an element on the page can’t be found, Webrat complains with an error and you know there’s probably something wrong in your view.

In Order to get this working with Story Runner I have wrapped most calls into When calls, for example:

And now my Story looks like this:

I’m not sure yet if it makes sense to release those wrappers as a plugin, we’ll see. After all it’s just a few lines of trivial code.

By the way, Webrat is hosted on awesome github, so after using it for 30 minutes (seriously) I forked my own version and added support for the Rails date helpers (selects_date Date.today, :from => 'signup_date' instead of selects 'December', :from => 'signup_date_2i'; selects '2008', :from => 'signup_date_1i'; selects '01', :from => 'signup_date_3i') and Emails (e.g. clicking the activation link in a signup email). (Bryan Helmkamp, if you read this: Why haven’t you pulled this (and in fact any other fork) into the main line yet?)

All in all the experience has been fantastic. Webrat is on all my Rails projects now. The only - conceptual - problem so far is that I can’t use it to test AJAX. But that’s the topic of another post. And there’s a fork on github that experiments with celerity, which can do AJAX and everything.

Warum ich selbständig geworden bin?

Wednesday, July 23rd, 2008 by Alexander Lang

Ich kann arbeiten wann ich will.

Ich kann arbeiten wo wo ich will.

Ich kann arbeiten mit wem ich will.

Ich kann arbeiten woran ich will.

Ich kann mir meine Kunden aussuchen.

Ich kann arbeiten womit ich will.

Ich kann arbeiten wie ich will.

Ich kann mir mein Büro aussuchen und einrichten wie ich will.

Ich kann mir aussuchen, wieviel Geld ich verdienen will.

Ich lerne jeden Tag mehr dazu, weil ich nicht nur Programmierer, sondern gleichzeitig noch Projektmanager, Geschäftsführer, Administrator, Sales-Fuzzi und sonstwas bin.

Um das mal zusammenzufassen: ich habe die freiheit zu tun was ich will. Und wenn ich irgendwann mal keine Lust mehr habe kann ich mich immer noch anstellen lassen. Oder nach Hawaii gehen. Darum.

(Hab ich noch was vergessen? Kommentare…)

Oslo we’re coming

Friday, July 18th, 2008 by Thilo Utke

So, finally everything is prep’ed: flights booked, accommodation confirmed, host office organized and cat fed. Tomorrow, very early in the morning, off we go to Oslo to live and work there for one week ;)

It’s just a short period of time but we’ll try to get the most out off it. We got in contact with the local ruby user group, starting off with a couple of beers on sunday and hopefully exchanging some great wisdom. Maybe we can also initiate a speaker exchange with the berlin ruby user group.

Thanks to shortcut who have been kind enough to let us stay at their office for the week, we are mighty excited to get a glimpse on their work culture. And in the evenings and weekends we will surely check out the vicinity of Oslo.

I’m sure this will be cool work holidays ;) If anyone in Oslo wants to meet us just send an email. We’ll also be posting some photos once we’re there.

RSpec Story Runner auf deutsch

Monday, July 14th, 2008 by Alexander Lang

Wir sind gerade mit einem neuen Projekt gestartet - alles richtig “nach Lehrbuch”: kurze Iterationen, Iteration Planning zusammen mit dem Kunden, Behavior Driven Design, User Stories, automatisierte acceptance Tests - all die schönen Dinge die man in so einem modernen agilen Softwareprojekt haben will.

Während der Planung der ersten Iteration haben wir zusammen mit dem Kunden User Stories geschrieben, um sie anschließend direkt in den RSpec Story Runner zu werfen, also As a User I want to upload my photo So that everyone can see my smiley face. Da unsere Kunden deutsch sprechen war das Meeting und dementsprechend auch die Stories auf deutsch, also Als Benutzer will ich mein Foto hochladen können damit alle mein tolles Grinsegesicht sehen können. Damit der Story Runner damit umgehen konnte mussten wir ihm eine neue Sprache beibringen. So geht’s:

(more…)

Moving from Rails 2.0.x to Rails 2.1 [Updated]

Wednesday, June 4th, 2008 by Thilo Utke

We are in the process of moving our production code from autoki to the shiny new rails 2.1 and thanks to our unit tests/(r)specs we encountered some gotchas and wows we’d like to share.

Here are some things that change in rails you shold be aware of.
If you are using custom callbacks for you rails observer you now have to tell rails about these callbacks first. Simply add a define_callbacks :your_callback, :your_other_callback in models with custom callbacks.

(more…)