New blogging site

Sat Sep 05 11:06 GMT 2015

This blog contains only historical posts (until I get around to recoding the Ocaml that generated it). At the moment any new content will be found on my twitter stream below or at my GitHub pages site.

#include <twitterfeed>

Sat Feb 02 17:04:04 GMT 2013

Disturbing popularity

Wed May 23 20:04:04 BST 2007

My drawings seem to be getting popular - a Google image search for "smiley" returns a link to my smile face artwork on the first page now (up from third about a month ago). "Smiley face" is still on the second page. May be worth looking at an image hosting service such as [Imageshack] or adding Adsense links to pay for the increased bandwidth. Or printing T-shirts, but I think the drawings are too detailed for screen printing, from what I read of the [Spreadshirt FAQs anyway.



Setting the timezone in FreeBSD

Wed May 23 19:59:49 BST 2007

Since moving back to the UK I wanted to set my system clock to the correct timezone (ie not Brisbane time). As the last time I had done this was eight months ago, I had forgotten how to do it. A Google search revealed a method that I had not used before but seems to have worked:

cd /etc/
sudo cp /usr/share/zoneinfo/Europe/London localtime
sudo adjkerntz -a



Ocaml for CGI. URL encoding and decoding

Sat May 5 19:59:03 EST 2007

I want to try to use Ocaml for Common Gateway Interface (CGI). There are a number of libraries out there to do this, but as an exercise I want to have a shot myself first. The first task is to write functions that escape or unescape characters in a URI. Checking [RFC 2396] shows that aside from a limited set of unreserved characters everything else needs to be encoded into the form %20 = space, %25 = % etc if it is to be passed as a query string parameter to the URI, or as POST data.

let inrange x low high = (x >= low) && (x <= high)
let isupper c = inrange c 'A' 'Z'
let islower c = inrange c 'a' 'z'
let isnum c = inrange c '0' '9'
let isalphanum c = (isupper c) || (islower c) || (isnum c)
let ismarker c = match c with
  |'-' | '_' | '.' | '!' 
  | '~' | '*' | '\'' | '(' | ')' -> true
  | _ -> false
let unreserved c = (isalphanum c) || (ismarker c)

let char_to_str = String. (...)



Vim tricks

Sat May 5 13:48:21 EST 2007

[Some tips on using vim]. One thing that I've noticed on several hosts is that files open to the last position edited. To set this us use

set viminfo='20,\"50
autocmd BufReadPost * if line("'\"") | exe "'\"" | endif

or in general use '" to move to the mark of last position edited in the file. If you actually want to start at the front of the file then a quick 1G or gg will take you there.

Also found another [article on moving around in Vim].



Installing Apache (again)

Fri May 4 17:32:03 EST 2007

The Facebook API looks pretty interesting, and has prompted me to have a look at CGI programming again. The first step in this process is to install Apache on my laptop, as editing code on my webserver in the UK from Australia rapidly becomes tedious due to the lag.

My webserver account uses suexec, so I want to install Apache with that in use. This requires setting the WITHAPACHESUEXEC=yes environment variable before installing the port. Don't install Apache yet though!

I also want to have php4 installed, with the mod_php Apache module. This is done by sudo make config in the lang/php4 directory and choosing the "Install Apache Module" option. Then sudo make install clean installs both php4 with apache13 being installed as a dependency.

Tested the webserver by going to localhost - that worked fine. Tested http://localhost/cgi-bin/test-cgi (one of the default examples installed along with Apache). (...)



New drawings

Sun Feb 11 11:39:23 EST 2007

I just realised that it has been ages since I updated my website. I got a chance to scan in some more of my drawings, they're in the art section. The first looks something like an "Angry Chicken", see the gritted teeth, squint and coxcomb. The second is a blob with a cheesy grin.

Looking at my referer logs I seem to be getting a fair few hits from people who like my drawings - this is good! Slightly less good is the fact that a few of them hotlink the large versions of the pictures and use them as backgrounds for their MySpace pages. My bandwidth on this host is pretty limited (1GB/month), so if you're one of these people could you please make a local copy instead.

The most popular images seem to be my smiley logo and the hands picture. I also get the first hit on google images for "red dragon symbol" and on the first page for "dark hands".



The newsworthiness of current events

Sun Dec 10 18:56:56 EST 2006

Possibly interesting data mining project: Lexis search of column inches vs number of deaths vs distance from newspaper source geographically. Three dimensional data problem, but I hypothesise that there will be a power law relationship between column inches and some geometric combination (eg distance*body count) of the other parameters. How does this vary with year of publication? An event is newsworthy if it affects you. An event affects you directly if someone you know is affected. Telecommunications and long-distance travel have increased exponentially over the last few decades, has this changed the scaling law? What about further classification by type of event eg accident versus intentional action (eg warfare, terrorism)? Another hypothesis: outside a certain geographical radius accidental and intentional events will be fairly similar in terms of total coverage unless a fair proportion of the readership have ties to the location.

[ideas] [politics]


Outside Context Problem

Sun Dec 10 18:23:42 EST 2006

Rereading "Excession" by Ian M. Banks at the moment:

An Outside Context Problem was the sort of thing most civilisations encountered just once, and which they tended to encounter rather in the same way a sentence encountered a full stop. The usual example given to illustrate an Outside Context Problem was imagining you were a tribe on a largish, fertile island; you'd tamed the land, invented the wheel or writing or whatever, the neighbours were cooperative or enslaved but at any rate peaceful and you were busy raising temples to yourself with all the excess productive capacity you had, you were in a position of near-absolute power and control which your hallowed ancestors could hardly have dreamed of and the whole situation was just running along nicely like a canoe on wet grass ... (...)

[notes] [politics]


Everything is Lisp if you use Emacs

Sun Dec 10 08:42:07 EST 2006

A simple editor or word processor lets you type in characters on the keyboard and save them to a file so that you can access the file later. A more advanced editor allows formatting markup of the text, eg headings, lists, paragraphs, justification of text. An extremely advanced editor has an embedded scripting language to allow the user to automate common tasks. The type of tasks that can be automated depends on how powerful the scripting language is, and what interfaces there are between the editor and the outside world.

Emacs is an extremely advanced editor. The scripting language is a dialect of common Lisp, so lack of power is not a concern. The editor can be tied into external programs such as news readers, mail agents, web browsers, compilers, contract checker, ... with the scripting language. Programmers love this because it allows automation of common compilation tasks. (...)

[code] [ideas]



Sat Dec 9 14:31:58 EST 2006

Writing a computer program at the most basic level simply involves taking a thought, translating that thought into a programming language and then running the final program on some machine. However, the downside to programming is that it requires a rigid structure in order to allow the computer to interpret the programming language correctly. This is not completely a downside as it encourages logical thought about a problem, but there are many elements of a program that consist of "boilerplate" code that is reused from problem to problem with no thought involved - a boring problem rather than an intersting one.

Programmers like interesting problems. Turning a boring problem into an interesting problem means finding a general solution to the boring problem so the programmer does not have to think about the boring problem ever again. This means building tools.

The Ocaml distribution has a good selection of tools, which are similar to those available to other developed languages. (...)

[code] [ideas]


Showing last 10 of 128 entries

code (31)

erlang (6)
ideas (24)
lisp (1)
me (16)
notes (6)
ocaml (5)
physics (46)
qo (7)
unix (8)
vim (4)