Improve Mozilla Firefox 3 memory usage

an extended period of time, even though the latest major version (3) has made massive memory usage improvements over previous versions. This tweak will make sure Firefox behaves more like standard Windows applications when it comes to being minimized, as in freeing up the memory it’s using for Windows. The down-side to this is that when restored or maximized again, there will be a delay as the application shifts chunks from slow virtual memory to system memory.

  • Go to about:config
  • Right click anywhere in the list and choose New > Boolean
  • Call the entry config.trim_on_minimize and set it to true
  • Restart Firefox
  • You might want to go to about:config to confirm the change took effect
]]>

Finding duplicated data across one or more columns in a database table

< ![CDATA[A few months ago I posted a little query about finding duplicate rows in a database table. I’m revisiting this because I helped out Doogie with a similar query last night but with some complications.

Let’s start with the original simple scenario of checking duplicates in a single column.

Some example data, a Users table:

+----+----------------+
| Id | Email          |
+----+----------------+
|  1 | joe@bloggs.com |
|  2 | joe@bloggs.com |
|  3 | joe@bloggs.com |
|  4 | jane@doe.com   |
|  5 | jane@doe.com   |
|  6 | john@doe.com   |
+----+----------------+

You can see that joe@bloggs.com and jane@doe.com have been duplicated. This could have been prevented by putting a unique index on the Email column.

So to find what emails have duplicates in our table:

Continue reading Finding duplicated data across one or more columns in a database table

Creating thumbnail images with automatic cropping and maintaining aspect ratio

< ![CDATA[Most thumbnail-generation solutions will shrink the original down while maintaining aspect ratio. Usually you specify the maximum height and width of the thumbnail, e.g. 150 x 200. However, if your original image's aspect ratio is different to the maximum thumbnail dimensions, you will end up with dead space vertically or horizontally (shown in green in the illustration). This can be quite an eyesore when displaying thumbnails in a grid. Normal Thumbnail Resizing Diagram

I’ve got an algorithm that will automatically crop the image either horizontally or vertically to then match the thumbnail aspect ratio, so you end up with the thumbnails all being the same size even though they may be coming from originals of wildly different aspect ratio.

In the illustration, you can see that the image is scaled down and fills all the available thumbnail space, showing the parts in grey from the original that were cropped out.

Image resizing with automatic cropping

The algorithm does the cropping before the resizing. It takes the width and height of the original image, and the width and height of the desired thumbnail. It will return the width and height that the original must be cropped to, to match the aspect ratio of the thumbnail. Continue reading Creating thumbnail images with automatic cropping and maintaining aspect ratio