discovered another mysql trick
if you are experiencing underflow with mysql fixed point arithmetic, you may need to force a floating point evaluation. cast() does not support cast to floating point so multiply by 1e0 instead
e.g.
select 1000000000000000000000000000000 * ( 1 / ( 1000000000000000000000000000000 ));
returns the wrong answer, whereas :
select 1000000000000000000000000000000 * ( 1 / ( 1e0 [...]
mysql cast to floating point
By craig mcmillan on January 14th, 2009Flow of control in Debian maintainer scripts
By Jan Berkel on January 7th, 2009The Debian package installation process (as described in the Debian policy) is fairly complicated, at least internally. During the process of building a Debian package for our software I often had to check the policy manual for the order the various maintainer scripts (e.g. postinst, prerm etc.) are called. To complicate things further, both the [...]
fixtures are evil, but so is mysql
By Jan Berkel on December 9th, 2008MySQL is not getting much love at the office, today was another of those days.
A little bit of background: we were in the process of replacing our fixture-based rails specs with “rspec scenarios”, a small extension we wrote for rails/rspec (to be released soon). The idea is that you create a scenario programatically rather than [...]
Pearsons in the database, part 2
By David MacIver on December 9th, 2008Before I explain what this is about, the following tweets provide useful context for how I feel about this:
http://twitter.com/DRMacIver/status/1047320819
http://twitter.com/DRMacIver/status/1047321174
We’ve been discovering that the SQL query I wrote for calculating pearsons, while it works fine for small datasets (say a few hundred thousand ratings), once you get to around the million rating mark starts being unusably [...]
rails 2.2 + jruby + jetty = win
By Jan Berkel on November 27th, 2008In case you missed it, rails 2.2 recently got released, finally promising thread safety among some other things. Thread safety has always been neglected by the rails core team, the standard way to scale up in rails (pre 2.2) is to run multiple processes, which makes deployment a lot harder (I think there’re at least [...]
Calculating Pearson’s correlation coefficient in SQL
By David MacIver on November 23rd, 2008Apparently I’m crazy.
Well, it’s not the first time this accusation has been levelled. But it’s one of the more amusing ones.
My colleague Jan Berkel was at Ruby Manor, where one of the talks was on acts_as_recommendable. Here’s what he had to say on the subject:
a plugin for rails to generate recommendations. lets you do things [...]
Computing connected graph components via SQL
By David MacIver on November 19th, 2008Hi, I don’t post to here much. I’m one of the devs working on SONAR, focusing on mostly theme extraction.
As with many applications, SONAR’s data crunching is basically relational database driven. We keep thinking about experimenting with graph DB based approaches, but never manage to find quite a compelling enough reason - there’s no way [...]
Produce a members report for all your Mailman lists
By Jon Cowie on October 14th, 2008I recently had cause to produce a report on the membership of all our Mailman mailing lists, so rather than doing it manually I knocked together the following handy bash script…change mailman location and output file as desired :)
OUTPUTFILE=”/tmp/mailman_report”
CURRMONTH=`date +%m-%Y`
LISTS=`/usr/local/mailman/bin/list_lists | awk ‘{print $1}’ | grep -v [!0-9]`
rm ${OUTPUTFILE}
echo “Mailman Report for ${CURRMONTH}” > ${OUTPUTFILE}
echo [...]
removing global fixtures for ruby tests
By craig mcmillan on July 2nd, 2008global fixtures are evil, but we’ve got a bunch of unit tests depending on them, so we still need them around
here’s a neat [and generally fast, though a degenerate O(#tables^2) case is possible] way of deleting all fixtures without invoking db dependent ways of ignoring foreign-key constraints, and without loading all the objects into memory [...]
Open Visualisation Workshop at the Trampery
By Jan Berkel on May 21st, 2008Trampoline Systems is hosting a visualisation workshop this coming Saturday, 24th May, organised by the Open Knowledge Foundation. Come along if you’re interested in open source visualisation technologies (Prefuse, Flare etc.). The goal is to have a very informal setting to talk about various aspects of visualising data. Find out more in the official announcement.
Hope [...]
