Implementation of FNV hash in PHP

FNV is a simple algorithm and produces good results.

I needed this functionality as part of another project that required automated generation of relatively large number of unique usernames based on information provided by the user.

Some challenges:  Apparently PHP does not work well with numbers, especially large ones. I spent few hours trying to find out why my implementation was not producing correct results, … realized in the end that arithmetic with big numbers is something you should not do with PHP. To resolve these issues I had to use bitwise shift and add operations instead of multiply.

I put the code here: http://code.google.com/p/boyanov/source/browse/?repo=prototypes#hg/fnvhash.

… and a simple wiki page here: http://code.google.com/p/boyanov/wiki/FNVHash.

More information about the Fowler-Noll-Vo hash function could be found here:

Advertisements

Calendar Generator – something very simple

This is something very simple.

It happens that I often need to print various calendars, like weekly or monthly, to keep track of my task and later to use for reports.

I wrote this very simple PHP script that will output a week calendar on the screen that printed will spread on the entire page.

The information is published at GoogleCode:  http://code.google.com/p/boyanov/wiki/CalendarGenerator.

The code is available though Hg (Mercurial) at https://prototypes.boyanov.googlecode.com/hg/ or for direct browsing at http://code.google.com/p/boyanov/source/browse?repo=prototypes#hg/calgen.

Opened GoogleCode account for prototypes

I decided to share my prototypes at GoogleCode. The page is located at http://code.google.com/p/boyanov/.

I was looking for a place to store some of the code that I write from time to time. I needed something reliable that is free and that will last for longer. There are may hosting services offering storage for open source projects, like SourceForge, and they all have their pro’s and cons’. The features I was looking for were: source code repository; download facility; content management. I found GoogleCode quite convenient and convincing, so I decided to create a page there.

Another reason to make that choice was that there is offered Mercurial version control, I thought that it is time to start using on of the distributed version control system.