Adventures in programming and data.
-
Install Oracle XE 11g R2 on Ubuntu 12.04
I’ve recently had a task of enabling Oracle database support for a JRuby on Rails application. To set up an Oracle database for use on a development environment, there were two preferred options – using Oracle DB on a virtual machine or installing Oracle XE locally. 1. Oracle DB on a virtual machine Oracle kindly…
-
History of the Bible
I ran a different type of study with our church youth group today where we investigated the history of the Bible. It was a combination of a trivia-style and lecture-style presentation and I’ve uploaded the notes I used. It took a little while to put it together – most of the time was spent reading…
-
Adding CSRF token to jQuery AJAX requests
When using a jQuery-supported framework such as Backbone, underlying jQuery AJAX requests are typically abstracted at the model layer. To insert Cross-Site Request Forgery (CSRF) tokens or other session data into the request, one method is to proxy a method in the call stack and add the token via an option (example). This does have…
-
GUS Gives
I was approached two years ago by a colleague from the Queensland Department of Education and Training (DET) to help set up a web application for GUS Gives – a charity portal that collects payments from members and provides detailed analytics for charity organisations. My role was to provide data management support and the first…
-
Parallel Bible
My 85 year old grandma has been getting into reading various bible translations from her iPad. In order to improve her Hindi reading skills, she was looking for a side-by-side translation of a Malayalam bible and Hindi bible. While we could find Malayalam-English and Hindi-English versions, we couldn’t find a Malayalam-Hindi one that she could…
-
Reducing Rails asset precompile times on JRuby
Rails asset precompile times on JRuby are considerably slower compared to MRI. I came across this post which provided suggestions on speeding up the asset precompile task. Using the following options – using Node.js instead of therubyrhino for JS compilation, forcing the JVM to 32 bit (although this can be omitted on a 32 bit…
-
Silencing noise in the Rails development log
The standard Rails development log contains a lot of noise that is rarely meaningful for debugging. The Quiet Assets gem is a mandatory part of my Rails development process as it removes the logging noise of the asset pipeline. Also, if WEBrick is used as a development server, the following entry is logged for each…
-
Mocking instances created via ActiveRecord’s find
Most Ruby mocking frameworks have the ability to mock a new object created via a constructor. However, when an object is created via ActiveRecord’s find or find_by_* methods, the .new method isn’t invoked. Instead, the .instantiate method is called. For example, to specify :instantiate as the object creation method using FlexMock:
-
Persisting IRB & Rails Console History
Continuing the theme on customising IRB and Rails Console, add these lines to ~/.irbrc to persist the command history across console sessions: