Who Needs Actions

Ruby on Rails, Javascript and Friends.

Easy HTML Table Pagination and Sorting With DataTables

DataTables is a powerful jQuery plugin that easily turns a standard HTML table into one that is sortable, paginatable, searchable and highly customisable. Having used the plugin on multiple occasions over the past few months, I deem it a huge time saver and if it’s interactive tables you’re after – I wouldn’t look elsewhere. The basic example usage makes its immediate power clear and there’s a wealth of options, an API and plenty of examples to satisfy most cases. Here’s a few tips on how to handle a few of the requirements I commonly had. I love and use CoffeeScript but for your convenience, the examples below make use of the compiled Javascript, simplified in places.

Solution for Osx Lions Wi-fi Problems

My story is like many others out there: Having purchased a new Mac in the last few weeks, arriving pre-installed with Lion, I had a few days of bliss before the problems began. Failing to connect to my wireless router, incredibly slow speeds when it did and unresponsive the majority of the time. Steve Jobs had ripped my heart out using nothing but a spoon.

I tried clearing various ram caches, recreating the wireless connection in network preferences, setting custom DNS, manual IP address, rebooting the router, performing dance rituals to the wireless dities etc and I was beginning to lose hope. Mention of an upcoming 10.7.1 update had me hopeful, but upon installation I had a few minutes of joy before the problems returned with all it’s troublesome tendencies. So what did work for me? Changing my wireless routers channel, specifically to channel 4 (avoid anything over 11 for the BT HomeHub router).

Nginx Error: No Such File to Load – Rack/commonlogger

Despite a lack of experience with server administration, I jumped in the deep end this week by grabbing a VPS from slicehost. With it, you start from scratch, with not even the firewall iptables setup to allow port 80. You’re given root access to ssh and sent on your way, which is one level above being given a screw driver and then directed to a pile of hardware components. But with frustration and confusion comes learning and knowledge… got me feeling pretty powerful over here.

The aim was to set up a Sinatra app, running with Nginx and Passenger. The installation of all was easy enough, up till the final step of pointing Nginx to my Sinatra app and seeing the following error: Exception LoadError in application (no such file to load -- rack/commonlogger)

Mac Hanging at Grey Screen After Deleting Lib Files

Is your Mac failing to boot past the grey screen, thanks to deleting some important system files? The example below is specific, but the general method to resolve should be the same in many cases: boot into single user mode and re-install the missing program.

Having switched to a Mac after years of being solely a Windows user (and you think you had a tough time growing up?!), every day is very much a learning curve. Today was no different, while trying to get libxml2 working nicely with the Nokogiri rubygem, I installed a newer version of the toolkit to a different location. My Mac stubbornly insisted on using the current 2.6.16 version so I bravely strolled into terminal and ran: sudo rm /usr/lib/libxml*.

Capistrano Ignoring Ssh Public Key

An issue that had me stumbled a while back and one of which I was reminded of this morning: the initially frustrating issue of capistrano repeatedly asking for my server ssh password. Now connecting to the deployment server via keyless ssh works without fail, the deploy config file seems fine and you can connect to your source code server via keyless ssh – so what gives?

A key aspect to remember is that the purpose of capistrano is to run commands on your remote deployment server as if you were running them locally on the server itself. So when we reach the task of grabbing the code from your chosen code repository (cloning from git for example), the command is being called from the deployment server and so it’s this connection that requires the ssh connection set up is order to avoid passwords.

The solution here is to set up the ssh key between your deployment server and your source code repository server to authorise the connection, and this is done in the usual way: running ssh-keygen on the deployment server, then copying the generated .ssh/id_rsa.pub into a new line of your source code servers .ssh/authorized_keys2 file. The details here may vary depending on your setup.

Done, no more pestering – capistrano is supposed to improve productivity after all right?

Thinking Sphinx on Rails Setup Issues

Sphinx is a full-text search server, able to index data from sources such as a database and make up for what traditional databases like MySQL lack. With use of the Thinking Sphinx gem, setup and usage with Ruby on Rails is real easy – yet there is a hurdle or two I stumbled upon:

jQuery Ajax With Rails Respond_to format.js

This year has been quite a shift for me in every aspect of my life – especially with regard to web development and this blog will now reflect that. For most part, my full time job and side projects use Ruby on Rails and related technologies such as jQuery, mysql, memcache, redis and other web development aspects such as xhtml, css, usability and design. Future posts will announce projects of my own, document my discovers and occasionally broadcast my opinions on all that is Web Development. Follow me. Let’s jump straight in: