Hello and welcome to the restorm technical blog. It is here that we post about what is happening in our labs, what keeps us busy and why X doesn't work. Read more about us on the about page.

Practical Jokes for Speccers

Mar 29, 2008 | 0 comments

Say your colleague started running rake spec and goes to the toilet with a triumphant smile on his face, expecting all .........................................., sprinkled with a few Ps here and there, be sure to press Shift-F and or -E on his keyboard with deliberation. Try not to giggle too loud when he returns ;) Ok – greetings from euruko, non-silly stuff forthcoming…

yours truly, floere

ARMIT - Jumping the git train

Mar 13, 2008 | 0 comments

I want to be on it. So I release armit to the world – even before its all mature (the way we like our beer). What’s armit, you say? Well, Armit is ‘ActiveRecord Multiple InheriTance’. Ok, that’s contrived you say, right. But it rings well.

With armit you can finally do all that crazy table stuff you’ve always wanted to. I promise to write more about it here – and to make a formal release once it is ready. Birdie, fly:

http://github.com/kschiess/armit/tree/master
git://github.com/kschiess/armit.git

Meanwhile, back at the ranch … that new kid git really rocks me off of my feet. And github looks really promising – so promising in fact that we might host more projects there in the future (not affiliated). Do give it a whirl!

Edit: Now that I read through it, that post reads like the spam I am getting. The same giddy excitement over not much. That’s a mood I am in often, I call it taking pleasure in living.

yours truly, kaspar

eliminate, stamp out and abolish redundancy - to hell with spec/mocks

Feb 12, 2008 | 0 comments

We firmly believe a testing framework should not also bring a mocking framework along. And we choose flexmock over the alternatives. Also – that choice was made before switching to rspec, so we weren’t at all happy with spec/mocks and flexmock battling themselves in our code.

The battle was inevitable, since both offer you convenience methods like

object.should_receive(:message)

Are you sure which framework you use in your rails specs? Really? Read on.

Ripping out spec/mocks

So you rip it out, right? No. Even though rspec allows you to configure mocking, rspec_on_rails will load and use the spec/mocks framework.

We selfishly rewrote rspec_on_rails into rspec_flexmock_on_rails. Branching is not always a good idea, but this time – it might just solve things for some people, that’s why we put our code in public under the same license that rspec is. Here goes:

http://swissrb.rubyforge.org/svn/rspec_flexmock_on_rails/

Please leave us a comment – if enough people start using this, we might be tempted to patch…

yours truly, kaspar

Job Offering

Feb 12, 2008 | 0 comments

Are you an experienced Programmer that lives in the region of Zurich, Switzerland? Then please send your full resume to kaspar at restorm dot com. We’re hiring!

yours truly, kaspar

ScopedProxy 1.0

Dec 21, 2007 | 0 comments

We’re proud to announce our first software release: Scoped Proxy. Here’s what it does:

require 'scoped_proxy'
class User < ActiveRecord::Base
  scoped_proxy :role do |role|
    {
      :find => { :conditions => ['role = ?', role] }
    }
  end
  scoped_proxy :deleted, :find => {
    :conditions => 'deleted_at is not null'
  }
end
admins = User.role('admin')
admins.count              # => 12
admins.find(:all)         # => [ ... ]
User.deleted.count        # => a number

Those of you who’ve read our old blog (neotrivium.com) will know the scoped proxy as a single file drop in plugin. On public demand I’ve gem-ified it. To install, simply type:

sudo gem install ScopedProxy

Easy as that. Please let me know what you think!

(Update: Here’s the link to our rubyforge project: swissrb)

yours truly, kaspar

Zen of Test Driven Development

Nov 15, 2007 | 2 comments

Run your tests. Profit of that moment of silence to find blank mind below busy thoughts. Breathe deeply.

...

3 tests, 27 assertions, 1 failures, 0 errors

Continue refreshed. That way, you can easily squeeze hours of meditation in an otherwise busy day. Think about it.

yours truly, kaspar

Tending to the blog and other crazy stuff

Nov 11, 2007 | 0 comments

Let’s assume you want to call #capture(&block) somewhere out of view context. Like so (caution, haml ahead):

= form.radio_button_group_with_label 'How\'s the surf?' do |button|
  = button.create 'IE 6'
  = button.create 'IE 7'
  = button.create 'A real Browser'

Let’s look at how we might do this:

def radio_button_group(label, field, &block)
  builder = RadioButtonGroup.new(self, field)
  label_tag = content_tag('label', label)
  content_tag = ''
  proc {
    content_tag = capture(builder, &block)
  }.bind(eval('self', block.binding)).call
  return label_format(
    label_tag, 
    content_tag
  )
end

If you look beside the boilerplate that is for formatting and other irrelevant stuff (coder attitude forever!), you see a central snippet that has a bizarre beauty about its airs:

proc {
  content_tag = capture(builder, &block)
}.bind(eval('self', block.binding)).call

We create a block using #proc, #bind something to it (as a new execution context) and then #call it. So far.. so good. This executes the block in the content of the view, which is needed for easy #capture access. Now what is the #eval(...) about? Well, turns out that Proc#bind() will only accept an object instance as an argument, no binding. Even though that would be logical, would it not?

So admire the thing in all its hideousness – and see the equivalence to

eval('self', block.binding).instance_eval do 
  # ...
end

Or, using facets

block.binding.self.instance_eval do 
  # ... 
end

Let’s assume for a second that Proc#bind would take a binding as argument. How would that transform the piece?

proc do 
  # ...
end.bind(block.binding).call

A lot cleaner already. Here’s the piece of magic that allows you to do that:

class Proc
  def bind_correct(self_or_binding)
    if self_or_binding.kind_of? Binding
      bind_incorrect eval('self', self_or_binding)
    else
      bind_incorrect self_or_binding
    end
  end
  alias :bind_incorrect :bind
  alias :bind :bind_correct
end

As always, have fun. The interested reader should take a look at the implementation of Proc#bind in active_support. Clever, that.

yours truly, kaspar

Going live

Oct 21, 2007 | 0 comments

Just a quick note to let you all know that we’ve put a load of new features online. Try to find them all !

Seriously, we’ll be posting a list of them tomorrow, with screenshots and goodies.

hugs, kaspar

yours truly, kaspar

Our Firefox Trouble

Oct 16, 2007 | 1 comment

We’re currently having trouble with Firefox. The Quicktime Plugin for Firefox doesn’t play our stream anymore. To all our cherished and frustrated users: Here’s what currently does work:

  • Safari on Mac OS
  • IE 6 and 7 on Windows

And to all those users that also love Firefox like we do: We’re working on it. Please accord us just a tiny bit more patience. And of course – if you happen to know exactly what the problem is – please tell us. We’ll reserve a special place in our hearts for you.

Streaming Quality

Most of our users will notice that the streaming quality has changed. Most of you should now be able to watch the stream, since bandwidth requirements have been halved.

Does it work for you? You liked it better before? Please let us know what you think.

yours truly, kaspar

Welcome

Oct 11, 2007 | 1 comment

This is the technical blog of restorm.com. This will be the place where you can get to know the people behind restorm.com. We’ll post:

  • Notices of service with all the gory details
  • What we’re working on and why
  • Libs and stuff that falls out of our work that we’d like to share

And so on. Watch this space for lots of interesting stuff about restorm.com and the tech we’re working with.

Welcome!

yours truly, admin