Adventures in programming and data.

  • Organise photos by date

    I organise my photos by grouping them in a directory, where the directory takes on the name “created_date title” (e.g. 2016-05-16 Birthday Party). As it became tedious to create a directory and manually group photo sets, I wrote a Ruby script to assist with the heavy lifting. After that, it’s just a matter of providing […]

  • SecurePay SecureFrame example

    I recently had to debug an application that uses SecurePay as an online payment system. Rather than using API integration, the application used SecureFrame, where SecurePay provides the payment page (e.g. via an iframe). I couldn’t find an example in the SecureFrame documentation, so here’s a minimal working example:

  • Resetting password of Devise user from the database

    I recently encountered a situation where I was trying to access a Rails application but: I didn’t know the password for the admin user The reset password functionality was not working I had no access to a Rails console Knowing the User model was using Devise, I set a password for a user on a […]

  • Spatial Analysis with Python

    I’ve recently had to undertake spatial data analysis and one of the more challenging tasks was to identify repeat vs unique vehicle journeys. While QGIS is fantastic for visualising routes through heatmaps and density plots, one of my requirements was to provide quantitative metrics around the proportion of repeat vs unique journeys. To achieve this, […]

  • Data Category Spheres of Influence

    I recently read the article “What is Master Data Management?” by Guy Holmes in the recent (Q2, 2015) PPDM Foundations Journal. There was one statement he made that thought-provokingly captured the definition of master data: “The key difference [from transactional data] is that master data elements tend to repeat in other data sets, and therefore […]

  • SOAP and REST

    I recently published an article on the MIMOSA website that discusses the virtues of SOAP and REST in the context of the information and interoperability standards that we support. Read the article

  • Creating new objects with Ember

    I’ve been using Ember on my new projects and while it has a steep learning curve, isn’t as featured as a server-based web framework and documentation is scattered, it allows you to create a clean and maintainable frontend. The applications I’ve been creating are largely CRUD and I couldn’t find any good guidance on how […]

  • Get database version in Rails

    For one of my applications, I recently created a status report page which shows crucial information for debugging, including software versions, service connectivity and filesystem path writability. One of the items was a database version string, and the standard ActiveRecord interface does not support this concept. While version methods usually exist in the connection adapters, […]

  • Combining DataTable’s Ajax and Javascript sources

    I often use DataTables as it provides a lot of out-of-the-box functionality for searching, ordering, paginating and use of Ajax data sources. However, using the server-side processing example means the HTML page will load, and then there is a short wait until DataTables fetches the data from the server using Ajax. This can make an […]

  • Optimising index view performance

    I recently came across a scenario where my index views in Rails were taking a long time to render when there were large data sets. The problem stemmed having a lot of data presented that were from models/tables other than the primary model/table of interest. For example, an “asset” index view may have the following […]