Author Archives for Ian Dunlop

RServe on OSX Snow Leopard


I always seem to have some difficulty getting the Rserve component of the R stats library up and running on OSX.  Installing it via install.packages(”rserve”) from within R  appears to work but when running R CMD Rserve I usually get some sort of error like:
/Library/Frameworks/R.framework/Resources/bin/Rcmd: line 62: exec: Rserve: not found
Compiling from source using the […]

Obscure mysql bug number 1153 (08S01) (my packet’s too big)


Ok, here’s one you don’t see every day.
Importing a mysql dumpfile results in “ERROR 1153 (08S01) at line 265: Got a packet bigger than ‘max_allowed_packet’ bytes”
Errm.
Log in to a mysql console,
enter the magic commands:
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
Modify your import to include the command:
–max_allowed_packet=100M
so you have something like
mysql –max_allowed_packet=100M -u user -p db_name < dump.sql
Try […]

Taming the Savage Beast (Forums)


We needed a forum for one of our web projects written in rails and a quick google revealed Savage Beast.  It seemed to fit the bill although needed some css tweeks to co-exist with what we currently have.  However, when clicking on its RSS feed icon it threw an ActionController::Request.relative_url_root method missing error which was […]

‘Nicer’ URLs for Rails


URLs pointing to resources in a Rails app tend to look like www.somesite.com/people/1
Add this to your model:

def to_param
“#{id}-#{title.downcase.gsub(/[^[:alnum:]]/,’-')}”.gsub(/-{2,}/,’-')
end
Where title is whatever you want to appear after the id and you will get URLs like
www.somesite.com/people/1-Ian
More info from here

Sending lots of data using Post and Rails (ie. avoid URI too long error)


I was having problems with a link to remote that I had encoded as follows:
link_to_remote ‘Variable’, :url=> sort_variables_surveys_url(:sorted_variables=>sorted_variables, :search_query=>query, :survey_list => years, :sort => key)
The sorted_variables param was far too big in some cases and returning a ‘uri too long’ error.  So I scratched my head for a while and then looking at the link_to_remote […]

Getting data out of MySQL (and then back in)


There seems to be lots of ways to get your databases out of a MySQL database and an even more bewildering array of ways to get it back in.  I have found that the following commands seem to be the best way to do it (for me):
Out
mysqldump –databases database_name -u username -p > dumpfile.sql
In
mysql -u […]

Zipfiles, CSV and UUIDs


MethodBox currently uses a java servlet to create Comma Separated Value (CSV) files inside a zip file.  These are then sent back to the rails application on demand over http.  What we needed was a metadata file to go into the zip file explaining what the CSV files had in them.  It was easiest to […]

More bits == better? AKA Snow Leopard broke my Gems


Snow Leopard install went fine.  Running methodbox after this didn’t.  ImageMagick, libxml and mysql gems were all broken.  Followed this advice to get it all working.  Boils down to re-install MacPorts, install ImageMagick and libxml2 from ports, re-install the RMagick and libxml-ruby gems, install mysql-64bit, re-install mysql gem (in 64 bit mode).
Easy!!  Only took 2 […]

There’s something good around the corner


Up until now we have been using images to fake rounded edges on divs etc.  This is fine until you want to change the styling and resize anything.  So, I had a look at doing it in pure CSS.  Luckily, so have lots of other people eg. Nifty Corners and Spiffy Corners.  I used the […]

Sorry for the delay - we’ve been on the rails


So it’s been a few months since the last post about adventures in flex.  The final verdict, quite nice but without more developer support the obesity-elab project was too big for one person.  So, we decided to go with the flow and follow the rails path like myExperiment and Sysmo.  This gave us a big […]

Ian Dunlop