Tag: project

August 22nd 2011

bit-ratchet, easier binary parsing in PHP

Tags: php project code

Recently I needed to write some code to parse a binary protocol in PHP. Given a ASCII hex string representation of the message I needed to pull off bits and bytes, using them in lots of different ways.

Problem was that you have to read a byte at a time from the hex string, then manually shift bits each time to get what you want. This gets old and confusing very quickly! To solve this I’ve written bit-ratchet, a small class that lets you read bits and bytes from a hex string very simply.

Read more...

0 Comments

December 18th 2008

Website change alerts using Lisp

Tags: lisp code project

A while ago I posted about my horrible scraper code and about how I was too embarrassed to share it…

Well it actually worked really well, it emailed me nice “HTML diff’s” of how the page was changing every now and then and it did it’s little job quite well.

I have decided to post it so that if someone wants to write a scraper / emailer in Lisp at least they have an example. (I couldn’t find many examples of how to use a lot of these libraries to start with which made it quite hard.)

Read more...

0 Comments

November 26th 2008

Month learning game

Tags: lisp project code

After the horrible mess that was the scraper script I decided to make something a bit cleaner.

It’s a nice little game that teaches you about the different months.

It works pretty well but I think the code needs some work:

Read more...

0 Comments

September 27th 2008

MU puzzle 'solver'

Tags: lisp code project

I was reading Godel, Escher, Bach: An Eternal Golden Braid on the train and when reading about the MU puzzle I decided to give it a go. I wrote most of it there on my ‘lil eeepc but I did get a bit stuck with the recursion, it was hard to get the apply-rules function to stop once a path to the answer “MU” had been found and return it.

In the end with some help from the good folks in #emacs and #lisp I had it working here’s the code:

Read more...

0 Comments

September 21st 2008

Parsing date strings in Lisp

Tags: lisp project code

Although quite pleased with my last experiment getting a web interface working I wanted to make it more powerful.

I decided the best way to go to avoid complexity was to parse input from the user so you could enter a date or a date range in any format you wanted and the program would hopefully understand what you meant. To do this I started to learn how to basic language parsers work and it seemed quite simple so I gave it a go.

It turned out to be a good challenge, I think I now finally ‘get’ Lisp macros now as well thanks to the guys in #lisp. It’s working pretty well, you can give it stuff like “next week” or “last month” or “16th September 2008 to today” or “12 03 2009” etc etc.

Read more...

0 Comments

August 25th 2008

Visualising Working days with Vecto

Tags: lisp project

When making the last lisp program I found it hard to visualise the working days between two dates. I ended up drawing these little sketches on a bit of paper to figure out if my program was doing the right thing or not!

Anyway I decided for my next project I would make a tool to display the dates for me. I am using Vecto library and so far I have found it to be awesome, really easy to use but powerful at the same time.

Read more...

0 Comments