Bill Farmer

Random thoughts on random subjects

Haskell

by Bill Farmer. Categories: Hacking .

I read an article recently about how amazingly efficient functional programming, and Haskell in particular is. So I thought I’s give it a go and see how I got on.

You can try it out in your browser: http://tryhaskell.org

    λ let factorial n = product [1..n] in factorial 99
    9332621544394415268169923885626670049071596826438162146859
    2963895217599993229915608941463976156518286253697920827223
    7582511852109168640000000000000000000000
    :: (Enum a, Num a) => a
    λ  

Pretty impressive! So I thought I’d try a simple web application.

    import Network.CGI
    cgiMain :: CGI CGIResult
    cgiMain = do
        setHeader "Content-Type" "text/html; charset=UTF-8"
        output "Hello World!\n"
    main :: IO ()
    main = runCGI (handleErrors cgiMain)

This seemed to work, so I tried a graphical GTK app.

Read more →

SlimStat

by Bill Farmer. Categories: Hacking .

When I first set up this web site, I looked for a simple web analytics program so that I could see if anyone actually looked at it. After faffing about with a couple of well known open source packages, I decided that they were way over the top by several orders of magnitude. Then I found SlimStat. However it appears to be no longer actively maintained, which it why the previous link is via the Way Back Machine. But it works just fine. It’s also on Github and Google Code.

Read more →

Raspberry Pi Wifi

by Bill Farmer. Categories: Hacking .

When I got my Pi some months ago I bought a wifi adapter for it, as you do. But I couldn’t get it to work reliably in Raspbian, and I didn’t even try in Arch Linux. So I tested the adapter on my windoze box, and it worked just fine, and I tried it with Linux and it worked just fine, so I put it in the ‘too hard’ box.

Read more →

Python

by Bill Farmer. Categories: Hacking .

I’ve studiously avoided Python up till now, even though it appears to be fairly popular, because it violates the first law of compiler design: ‘Blank space shalt not be significant except to separate tokens where necessary.’. That’s why you can minimise a lengthy JavaScript script like jQuery to one enormously long line and it still works just fine.

But, she-who-shall-be-ignored (self categorisation) decided she wanted to enter an advent calender competition which involved checking a web page to see if your name has come up and sending an email if it does. So I thought that’s an ideal little job to run on my Raspberry Pi. So I installed the ssmtp package and attempted to test sending an email. After several days of faffing about with no joy I gave up.

Read more →

Whatever-o-meter

by Bill Farmer. Categories: Hacking .

Whatever

Introduction

Whatever-o-meter is a WordPress and Hugo plugin that shows a tachometer-like dial with a pointer, asks a series of predefined questions which are answered by moving a slider, shows one of several predefined results, and moves the tacho pointer to a position determined by the value of the result. The project is on Github.

Documentation

Whatever-o-meter uses the shortcode [whatever-o-meter] or {{<whatever-o-meter>}} to insert the whatever-o-meter display into the page. Other page content above and below the shortcode will appear on the page as normal. Do not use more than one whatever-o-meter shortcode on the page, only the first one is likely to work. If the shortcode is used on a page with no questions defined, the code will be replaced with the message:

Read more →
Previous page Next page