Author Archives for Ian Dunlop
Ruby on Rails and IIS on Windows 7
Here are the steps I needed to install ruby 1.8, rails 2.3, sqlserver to run our https://github.com/myGrid/methodbox codebase on a Windows 7 platform and run it all under IIS. It should also work for any rails 2 or 3 project. If you use rmagick or libxml-ruby then pay attention to the installing gems part […]
Ruby, Windows and RMagick
Been doing a lot of rails work on windows recently and ran into some issues that needed solved. Just like on Unix, to get the RMagick gem working on a windows platform you need to install ImageMagick. Go to http://www.imagemagick.org/script/binary-releases.php?ImageMagick=uteqfietdab37ghqrvfuvoul55#windows and download http://www.imagemagick.org/download/binaries/ImageMagick-6.7.3-7-Q16-windows-dll.exe
Double click and go through the installer, selecting to install C and C++ […]
Sun/Oracle Java on Ubuntu
Ubuntu Lucid Lynx (10.04) does not have the sun java repositories available by default. You need to add them like this:
sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
Then update the packages available:
sudo apt-get update
Then you can install Sun’s (Oracles?) Java
sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin
Bundler, OSX and the MysqlCompat::MysqlRes error
If you get the uninitialized constant MysqlCompat::MysqlRes error when trying to run your Rails app all the evidence points to it being a 32 v 64 bit issue. However, I had built mysql for the x86_64 architecture and the mysql gem installed was also for 64 bits. So why was I still getting this error. […]
Tab navigation and tooltips
We use the tabifier javascript from barelyFitz in a few places in MethodBox. However, I wanted it to have a different, more descriptive tooltip than the tab title. The default code doesn’t seem to do this so I added a couple of little changes to make this happen.
You can see the complete file here but […]
Looping over javascript arrays with Prototype framework
Had an array in javascript and tried to loop over it using
for (x in array){
…some code
}
I was confused why it seemed to have lots more members than I had put in with contents that seemed to be functions. So I used console.log and firebug to print out the array members and saw that they were […]
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


