Category Archives: Development
SHA1 in PHP and MySQL
Wrote a brief note on the speed of digests in PHP vs. the speed of the same digest in MySql.
Read it at http://fwebde.com/php/encryption-php-vs-mysql/
An Up/Down control in jQuery
Recently, I needed to write an up/down selector – you know the sort, it’s where you select a number by clicking on an up or down arrow. Since they can be useful for other things besides numbers, I gave it the plugin treatment.
Most of the information about the plugin can be found in its documentation page.
Also available is a slightly beefier styled and animated demo of the plugin.
If you’re just interested in the plugin itself, you can find it here.
Attaching data to elements in jQuery
This morning, I found out about a very useful jQuery function going by the unassuming name of data. This fantastic little beast creates a data store for an element, and lets you store just about anything in there.
One of the ways in which this can be used is to attach functions to an element, and using them when required. To demonstrate the usefulness of this feature, I wrote two versions of a simple validation system. In one, we use the data function to assign one or more validators to an input box [Example 1: using $(x).data()]. In the other, we iterate over the inputs and check them against validators as needed [Example 2: not using $(x).data()]. Continue reading
Generics in Java and C#
Today I was writing some interceptors in Java, and I wanted to be able to filter the input based on whether it implemented a given interface or otherwise. Class<?> exposes a very handy isAssignableFrom method for this, but it doesn’t look very nice, so I tried to go for something a bit neater, like:
1: Feature.<TargetFeature>isImplementedBy(interceptedInstance);
Neat, and much more readable. I didn’t quite make it there, but got close enough for my purposes, and had some (very little) deeper knowledge of generics inflicted upon me for my sins.
Code reviews with NDepend
Using NDepend to identify areas of interest in a code base.
Continue reading