Browse our posts

All 5 of them!

December 2011

Paul
Posted Dec 11th, 2011
Tagged dba, mysql, ruby, performance

Storing IP addresses the smarter way

If you need to store an IP address in a database, it's possibly because you're logging web requests or similar. This means the table can get very large, very quickly. If you're storing the addresses in a VARCHAR, you will use up a lot of space in your table and make indexing a nightmare. A lot of people don't know that you can represent these as an INT which is much more db-friendly.

Read more »


November 2011

Mike
Posted Nov 16th, 2011
Tagged javascript, base64

Detecting base64 support in javascript

Want to test if a browser supports base64 encoding? It's surprisingly easy :)

Read more »

Mike
Posted Nov 11th, 2011
Tagged javascript, jquery

Click hijacking in jQuery, part 2

Recently I wrote about a better method of hijacking click events in jQuery so that only unmodified left-click events will be captured. Unfortunately this method required using custom event binding functions rather than jQuery's native functions. To address this we can utilise jQuery's special events API, making our left-click plugin much more robust and easier to use.

Read more »

Mike
Posted Nov 9th, 2011
Tagged javascript, jquery

Click hijacking in jQuery

Update November 11th, 2011: see my follow-up post for part 2, using jQuery special events and support for jQuery's new on/off event binding.


A long, long time ago, we were working on a project which involved fairly heavy use of ajax and 'click' event triggers in jQuery. At the time, this raised problems because in javascript, the 'click' event isn't always triggered from a normal left-click. I'm generally against hijacking all but normal left-clicks; I shouldn't be prevented from opening a link in a new tab just because it has a click event attached.

Read more »

Mike
Posted Nov 9th, 2011
Tagged ruby, rails

Active routes in Rails

Not long ago I needed to put together a little helper to determine if a particular route (eg /content) was active, in order to identify which menu items should be in an 'active' state. It needed to be flexible enough to match a broad range of routes: some menu items remain active no matter where you are in a particular namespace, whereas others were active only on a particular action in a particular controller. Moreover, some menu items were active when you were in one of a collection of specific actions.

Read more »



© 2011 rawnet.com