Posted by matijs
11/12/2011 at 18h08
Something weird just happened. While refactoring GirFFI, I had managed to remove all use of a particular module. So, I removed the corresponding file, ran the tests using
rake test
And the tests passed. Committed, done.
Then, I took a walk down to the library. By the time I got back, as soon as I looked at my code again, there it was: A giant require statement requiring the file I had just removed. Huh, why do my tests pass?
Well, duh, I have GirFFI installed as a gem, and my code is just picking up the missing file from there. So, I run
bundle exec rake test
The tests fail, showing me exactly the line I need to remove. Commit amended, done.
So, the moral of the story: If you’re developing a gem, use your isolation tool of choice, be it Bundler, Isolate, or something else, to shield your gem development environment from older installed versions.
Posted in software | no comments | no trackbacks
Posted by matijs
31/07/2011 at 17h31
Recently, there was a change in where Debian’s rubygems packages store each gem’s files. Instead of having a separate bin directory for each version of ruby, now both the 1.8 and the 1.9 version store scripts in /usr/local/bin. In fact, they will happily overwrite each other’s scripts. This can be very confusing when you think you’re running a script with Ruby 1.8, but in fact it’s running with 1.9, and hence, 1.9’s set of installed gems.
All this made me seriously consider using RVM. Which was quite shocking, as I consider it to be an ugly hack, both in concept and in execution. So, rather than admitting defeat, I decided to create my own hack.
Posted in software | no comments | no trackbacks
Posted by matijs
30/06/2011 at 18h15
It’s happening, like it happens to all of us: My hard disk is getting full,
and although the free space would have seemed like an ocean just a decade
ago, now it’s a worryingly small pool of tiny little gigabytes. I could
try freeing up some by tediously going through all the photos I never
bothered to cull before, but with Gb-sized videos being added on a regular
basis, that isn’t a long term solution. Where long term is anything that
will tide me over to my next laptop.
But, what if I could offload some of those files to some other storage
medium? I’m not really that fond of external hard disks, but perhaps a file
server? Great! You mount some remote directory, and it’s like it’s right
there on your machine.
2 comments | no trackbacks
Posted by matijs
10/05/2011 at 07h09
Over two years ago, I had the idea, that it should be possible to combine two great technologies, ruby-ffi, and GObject Introspection, to dynamically create bindings for GLib-based libraries.
This idea, like many, was born from frustration: The development of
Ruby-GNOME2 is labour-intensive, and therefore, it lags behind the
development of Gnome libraries. In particular, I wanted to use the Gio
library, which had no bindings at the time, to fetch generated icons for
images.
Posted in software | no comments | no trackbacks
Posted by matijs
22/04/2011 at 09h30
Let’s look at dynamic method generation. I need it for GirFFI, and if you
do any kind of metaprogramming, you probably need it too. It was
already shown a long time ago that using string evaluation is preferable to using
define_method with a block.
That is, if you care at all about speed.
Posted in software | no comments | no trackbacks
Posted by matijs
13/12/2010 at 23h14
On twitter, @clemensk asks:
Hey SQL experts, is it somehow possible in pure (My)SQL to extract a
nested set from a table full of paths (think: Category 1 > Category 2)?
To do this, you need to do two things: Extract the names of the nodes, and
calculate values for lft and rgt. Here’s my take on the latter part:
Posted in software | 1 comment | no trackbacks
Posted by matijs
10/12/2010 at 09h29
If you’re going to do this:
def foo= f
@foo = f + " bar"
end
Then don’t first do this:
But instead do this:
That way, there won’t be “method redefined” warnings all over the place.
Let’s make this more general: Before you release your gem, make sure it
runs without warnings. They should stick out like a sore thumb when you run
your tests, anyway.
Thanks.
Posted in software | no comments | no trackbacks
Posted by matijs
16/09/2010 at 17h22
If you still have commits with messages like ‘Oops, I forgot this file’, you’re doing something wrong. Just use git commit --amend.
Posted in software | no comments | no trackbacks
Posted by matijs
08/09/2010 at 05h22
Sometimes we say something that sounds right but is in fact the exact opposite of what we mean.
So it’s entirely possible that a talk you started presenting a year and a
half ago is so different now as to be almost indistinguishable from the original.
Andy Budd – 7 Ways to improve your public speaking
Posted in linguistics | no comments | no trackbacks
Posted by matijs
27/06/2010 at 21h10
In some of my Rails projects, I have been a contented user of the memory_test_fix plugin. However, I rather dislike the use of Rails plugins, because I find updating them later on rather difficult, and I don’t like including external libraries in my own source tree (hence, I don’t like the practice of vendoring gems much either). When the concept of ‘gem plugins’ was introduced, I created a fork on github and created the necessary files to build the plugin as a gem, and have Rails properly load it.
Posted in software | no comments | no trackbacks