Conway’s Game of Life

So, thanks to xkcd I learnt about something cool today that’s been around for ages (wish I’d studied more maths….).

All the sites I found for playing with the simulation had Java applets on them, so I wanted to make a javascript one, I know it’s not a true implementation, because it goes a bit mental at the edges… but it was interesting anyway…

It’s here anyway if anyone wants to play… The timings might be a bit of a problem if you create a huge grid with small squares… so be prepared for Internet Exploder to give you some memory leak issues…

http://dom.hastin.gs/files/gameOfLife/gameOfLife.html

Edit: Updated links.

mod-framework: PHP, light and easy

I know there’s already infinite PHP framework out there, trying to be rails; and most of them are doing it really well, I just feel that none of them completely embrace the simplicity of convention over configuration, so I’m trying to build one that ticks all the boxes.

It’s pretty simple so far, and is only a few hundred KB, but I think it’s got some cool features, and maybe even potential.

Like the other stuff it’s under a Creative-Commons SA license and can be found at:

http://mod-framework.googlecode.com/.

Any opinions, suggestions, contributions would be gratefully received.

Current functionality:

Model-View-Controller system
MySQL support (using a modified version of the DB class from earlier)
script/server implementation in PHP
Helper association, so if you create a PageHelper class for your Pages controller all the functions will automatically be made ‘global’ (accessible view functionname() instead of Helper::functionname())
Includes mootools in the htdocs folder

The DB doesn’t work quite how I would have imagined it to (well, with PHP 5.3 it might… but I haven’t got it yet…) so currently any models are added to $GLOBALS[] so that for a Page model, $GLOBALS[‘Page’]->find_by_name(‘dom’), etc would work.

There’s probably some other stuff in there too…

Advent QC430 (QRC430) Windows XP Drivers

Just spent hours trying to set up Windows XP on an Advent QC430 (QRC430) which had Vista on. There doesn’t seem to be a pack of drivers already for it so I thought that I’d combine all the drivers I found into one zip file for anyone else suffering the same misfortune, to save time hunting through forums and experimenting with trial and error.

Contains all the files you should need (display, wireless, touchpad, audio, etc).

Please let me know if there are any missing files, but I’ve just used all these to set up this laptop so they should all be there.

My first starting point was:

http://www.uktsupport.co.uk/advent/laptop/qc430.htm

which contained most of the files that were needed, although the display and wireless drivers failed.

File:

Dropbox
Local

Edit: As per a couple of comments, it seems the audio drivers don’t work with SP3, unfortunately I don’t have the laptop to test this with any more, but another commenter helpfully provided a link to an updated set on Intel’s site.

MySQL backup script

I’ve recently been learning more and more about bash scripting and the cool functions and features that are included, that i’ll probably never use…

I recently had to set up a cron to backup all MySQL databases but I didn’t want them in one huge file.

So I’ve written a little script, that is probably not entirely efficient, but serves it’s purpose for us:

This was tested on a SuSE 11 server, might need some tweaking on other dists.

Ruby on Rails: image_submit_tag and :confirm

I was told about an issue today with the image_submit_tag not supporting the :confirm method on the element:

so I thought I’d share a quick fix which would be the actual javascript returned by the function:

Hope this can save some people time…

submitEvents – Javascript form submission handler

Something that I seem to be doing a lot lately, is writing a handler for processing the submission of a form, and since mootools is the JS framework of choice, I’ve written this little class that handles the onsubmit of a form and adds some useful features.

  • Confirmation – Provides an Ok, Cancel input box before proceeding further
  • Submit Button – Disable and change the text on a submit button
  • Information Div – Display a div that lets the user know something is happening
  • Undo – Undo the changes (re-enable a previously disabled submit button, change the information div) that have been carried out by the class
  • AJAX – Submit the form using AJAX instead of the ‘old fashioned’ way

All these should be easily implemented using the class.

Examples are provided in examples.html.

As previously, this work is released under the creative commons share alike license.

Download submitEvents 0.1 (31.9k) (Includes mootools 1.2)

Edit: I really do dislike internet exploder… The above version failed in IE6 (mootools’ form.toQueryString() function). I’ve updated the code to 0.11 which can be found here:

submitEvents 0.11 (32.8k) (Includes mootools 1.2)

Edit 2: Ok, so my hatred for IE, although deserved, was unnecessary in this situation…

I’ve updated the code to use mootools .bind(this) on the ajax onComplete function, this fixed the main problem with IE6 and makes the code look much cleaner. Also the examples file is now PHP instead of static HTML and returns a var_dump of $_POST when the form is submitted.

PS. This will be the final update to this post!

submitEvents 0.2 (32.3k) (Includes mootools 1.2)

DB

Here’s a little script I’ve wanted to make for a while, but have only just finally got the motivation to work on.

It’s a lightweight Database wrapper with functions similar to Ruby on Rails’ ActiveRecord.

When I discovered the __call() method I wanted to make my own version in PHP, so here it is!

It supports most basic functions, all based on the MySQL set of PHP functions, no other wrapper is required (PEAR etc.). There is not (yet?) any automatic mysql_real_escape_string or anything, although that could easily be added if required, my assumption is you’ve done that kind of thing already before passing anything to it.

It’s only a first draft, so any comments, questions or pointing out any typo’s in the code, (yeah, there are likely to be a few…) would be muchly appreciated.

This work is free under the Creative Commons Share Alike 2.0 license.

Download:

DB_0.1.tar.gz (4.84Kb)

Edit: Think next on my list is TextMate syntax highlighting and maybe the non-default template…

First!

Will I really ever use this?

Who knows… But maybe I’ll keep a log of all the cool stuff I find…