Everynow and again I wind up rewriting a ruby performance hotspot in C. It happens infrequently enough that I always forget the C api for passing a block implemented in C to some ruby code. Hopefully writing this down will help me remember this in the future. Today, I wanted to call find_each
on a class, using a C function as the block. Pre ruby 1.9 you need to call rb_iterate
which always did my head in, but in 1.9 you use rb_block_call
which is way more straightforward (rb_iterate
is still there but deprecated)
Dressipi Is Hiring
Dressipi is looking for a mid to senior level developer to join their development team. If you love solving problems, teasing meaning out of large volumes of data and have a passion for writing well designed and tested code we’d love to hear from you. We develop recommendation systems that make shopping simpler and looking good effortless, using a combination of knowledgeable stylists and clever technology.
We’re looking for:
- a seasoned software engineer, with at least a year’s experience of Ruby on Rails
- good knowledge of MySQL (exposure to other databases/datastores a plus)
- able to hit the ground running with a large and growing Rails 3 application.
- TDD/BDD experience
Some experience of recommendation systems or machine learning techniques would be useful but by no means required. Frontend skills (HTML, CSS, jQuery) appreciated but not required.
You’ll join a small, dynamic team to work on all the technology that powers Dressipi, from consumer facing web applications to heavy backend calculations and mobile apps. No knowledge (or interest in) fashion or clothes required - our delightful stylists have all the clothing expertise we need.
As well as working with the rest of the development team you will be working closely with the stylists, encoding their unique knowledge and understanding of clothing into Dressipi’s algorithms.
You will take part in the full lifecycle of the product from understanding the business needs, to deploying the solution and analysing the resulting data.
Dressipi tackles problems in a wide range of areas, including recommendation systems, text extraction, visual recognition, crowd sourcing and more.
Request Specs and Authlogic
I was writing some rspec request specs the other day and was curious to notice that
1 2 3 4 |
|
wasn’t working: the code under test didn’t think the user was logged in at all. The same code works fine for controller specs and the authlogic documentation asserts that functional and integration tests should behave identically in this respect. Everything should just work.
Dressipi Is Hiring
Dressipi (where I work) is looking to hire a junior-ish software engineer to work on the guts of our various web applications, recommendation systems and mobile applications. We’re a rails shop but we are above all looking for bright minds that can pick up new technologies with ease, so prior knowledge of rails is not required.
If you’re interested drop us a line at jobs ]at[ dressipi.com with a covering letter & CV or any questions you might have.
NSData and RubyCocoa on 10.7
For some reason code like
1
|
|
segfaults on lion. Others have noted that this only occurs when the data contains bytes with the high bit set. This smells like something trying to interpret the string in some encoding when the string is in fact arbitrary binary data.
I’d love to use MacRuby instead of RubyCocoa, but unfortunately MacRuby doesn’t seem to be able to handle Active Record at the moment, so I can’t use it (yet). I haven’t had time to delve properly into how RubyCocoa converts between ruby and Objective-C objects but I was able to hack around by using ruby inline
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Then you can use CFDataGenerator.from_string
to convert ruby strings into nsdata instances. Remember to release the instance when you’re done!