I made this

I can’t believe it, but I actually took the time out yesterday to make this. Here’s what it’s meant to look like:

Paper Wallet - Original
..and here’s my effort:

Paper Wallet - My Effort

It is safe to say I drank too much coffee yesterday ;)

The pot crack’d

It was Sunday morning and I went through my usual routine: I got up, flicked on the coffee machine which I had filled with water and ground coffee the night before and went to the bathroom. I decided to get back into my bed for a bit and whilst I was lying there I heard a cracking sound. I feared the worst, thinking: “please not my precious caffeine preparation paraphernalia” and sure enough the black goodness was weeping from the pot and sizzling on the hotplate. Poor photography aside, here’s the fallen soldier:

Cracked - old coffee pot

My brother and his fiancee presented me with the machine Christmas before last, my love of the stuff being what it is, so it had seen well over a year of practically daily use. Not wanting to disrupt my morning routine for the next day I decided to head down to Argos after a swim to pick up a replacement. Here’s the new machine on its maiden run:

Cracked - the replacement coffee machine

For a good while I’ve been thinking about getting a more “professional” filter machine so I decided not to spend big and the model I choose was inexpensive yet fits my needs precisely, fitting in well with the remainder of my coffee equipment. It truly is an obsession :)

Ninan 1.1.0

The latest stable of Ninan was released a few days ago and I’ve just gotten around to upgrading my installation of it.

There wasn’t much to the upgrade process: I downloaded and untared the archive and I thought I’d play it smart and copy over my old ninanconfig.xml and it appeared to work, but gave up the ghost when it came to actually downloading something. I renamed the file, restarted Ninan, reentered all my details and preferences and I’m now happily downloading at 1.2 MB/s :)

I love this program although I still haven’t put the effort into getting the restart feature to work and I’m not too keen on having to use the memory-hog that is Java to run it, but Ninan does the job at hand and does it well.

May the leeching resume!

PHP predefined variables on BSD

I’ve been getting ready for the deployment of wow4kids.com and one of the final features to be into place was restricting access to the administrative back-end.

I enabled admin routing in CakePHP and put all the back-end code into admin_* functions in my controller which are accessible via /admin/controller/action. I wanted to enable some form of access control but without utilising a full user management system which would have been overkill.

The /admin/ directory only exists through some mod_rewrite magic so I couldn’t just use a simple .htaccess file. After much head-scratching and reading of documentation I arrived at a simple solution:

  1. I created a .htaccess protected directory, /adminauth/
  2. in this directory I created an index.php file which redirected to a URL passed to it via HTTP GET
  3. in /app/app_controller.php I defined a beforeFilter() function which uses a regular expression to determine if the called action contained “admin_” in its name
  4. if so, check if the $_SERVER['AUTH_TYPE'] variable is set
  5. redirect to /adminauth/, passing the current URL, if it isn’t set
  6. let mod_auth take care of the rest

This worked a charm on my home Linux box, but when it came to testing the code on the iMac the site is being developed on, the script couldn’t detect the server variable and was thrown into an infinite loop of redirects, doh!

The same result was had when I uploaded the code to the FreeBSD web-host the site will be deployed to, so I had no choice but to rethink my solution.

It was either going to be sessions or cookies and in the moment cookies seemed appealing. I changed the controller to check $_COOKIE[] instead of $_SERVER[] and /adminauth/index.php to call setcookie() . It seems to be working so far, fingers crossed it’ll be suitable for production purposes!