Schrödinger’s Cat causing problems

The linux distribution Fedora have announced their new version release name, Schrödinger’s Cat, inspired by the famous thought-experiment trying to conceptualise quantum mechanics. But this has brought about some perhaps unforeseen issues regarding the handling of text. The name isn’t simple and contains non-ASCII characters. This is where a slight digression on what a string is would be advisable if you aren’t already comfortable. May I recommend Spolky’s excellent What Every Programmer Should Know About Unicode. If software hasn’t taken this into account then things can go wrong. Things went wrong. The folks over at LWN have detailed the events.

What interests me is the behaviour of Chrome on Mac; given the suggestion of naming the release “Schrödinger’s ?”. That final symbol is the Unicode character for a cat. Specifically a smiling cat face with heart-shaped eyes. Which leads to certain problems. Specifically for me that character will render correctly in title tabs in Chrome, but not in the document body. This isn’t a problem with Firefox however, which handles the symbol without issue. Further Chrome on either Linux or iOS seem to behave properly as well. This appears to have been a known problem for some time.

It’s 2013 and Unicode is still a problem, sigh.

Git workflows with Laravel

I have my local dev box and my VPS which this site resides on. I don't want to make changes directly to the PHP code on the server, mistakes happen and that would be bad. So I write code on my dev box, and when I'm happy everything works, put the code on to the VPS. Git is a godsend for tasks like this. It also helps that Laravel is developed with Git.

First we set up a git repo on the dev box tracking the develop branch of the Laravel git repo. Then we change the origin to our own github repo, we shall call Laravel's repo upstream. Obviously we need to first go to github.com and set up a new empty repo. This means any changes we make to the code will get pushed to our repo, not Laravel's (not that we could push changes directly to them, that requires a pull request).

$ git clone -b develop git://github.com/laravel/laravel.git my-laravel
$ cd my-laravel
$ git remote rename origin upstream
$ git remote add origin git@github.com:username/my-laravel-on-github
$ git push -u origin develop

When the guys at Laravel update their code we need to incorporate those into our codebase, which is easily done.

$ git fetch upstream
$ git merge upstream/develop

Once we have made any changes we want to it is a simple case of committing and pushing those changes

$ git add <file>
$ git commit -a
$ git push -u origin develop

We also need to run the last command once we've pulled any changes from upstream. We can then pull the changes from our github repo onto the VPS. This way we can make sure nothing is going to break before we put any code in production. *[VPS]: Virtual Private Server

Using Laravel 4

I've updated the blog to use Laravel 4. Laravel 4 is currently in beta development, a complete rewrite of the PHP framework to use Composer to be more modular and interoperable.

Currently I'm not doing things the best way as my Git knowledge isn't up to scratch. I followed the instructions on the Laravel beta docs page. I also installed Composer system-wide by putting the phar file in /usr/local/bin. Thus all I need to do is go into my Laravel directory and run composer update and all the components are updated to the latest version; including any extra packages I've added to the composer.json file myself.

I find this incredibly exciting. It's simply a case of going to http://packagist.com/ and going I like the sound of that, all I have to do is add one line to one file and I can use it. For example, I'm using Markdown in my posts, so I use this package by dflydev. Admittedly it's not as simple as just adding a line to the composer.json file. Due to how packages are loaded, anywhere I want to use the file I need to add the line

use dflydev\\markdown\\MarkdownExtraParser

Though I am sure there are better ways of doing this. I believe this can be done by editing the providers and aliases arrays in app/config/app.php, but I'm yet to look into this properly.

I'm also doing a basic redesign of the site, focusing slightly on the layout, but mainly the colour-scheme, incorporating the Solarized colour palette. Maybe even a little SASS/LESS magic to switch between dark/light schemes.

Getting SPDY support

I now have SPDY support on my website. Though I don't know if I've done it the right way. My site is on a VPS running Debian 6. This means the version of OpenSSL in the repositories is version 0.9.8, SPDY requires at least version 1.0.1.

So, time to get the latest OpenSSL. I have left the repo version installed and then compiled the latest from source letting it install in the default /usr/local/ssl:

$ cd ssl-source
$ curl -O http://www.openssl.org/source/openssl-1.0.1e.tar.gz
$ tar -xzf openssl-1.0.1e.tar.gz
$ cd openssl-1.0.1e
$ ./config
$ make
$ make test
$ sudo make install

We now have the default OpenSSL 0.9.8 installed by Debian and our own version installed to /usr/local/ssl/bin. If we type openssl to the prompt Debian looks for a binary of the same name in the $PATH variable. We have to add /usr/local/ssl/bin to this variable so we can actually use our new version. To do this system wide on Debian we can add an openssl.sh file to directory /etc/profile.d/ containing the lines

PATH='/usr/local/ssl/bin:$PATH'
export PATH

This is the only way I could get to work. If you are running a different distro of Linux then you'll need to refer to the appropriate documentation of editing the $PATH variable. Thus, now when we type openssl, it'll look in /usr/local/ssl/bin first. Now it's time to compile nginx against the newer OpenSSL. We also need to apply the SPDY patch. Further we need to edit the source files to work with a custom OpenSSL location:

$ cd nginx-source
$ curl -O http://nginx.org/download/nginx-1.3.14.tar.gz
$ tar -xzf nginx-1.3.14.tar.gz
$ cd nginx-1.3.14
$ curl -O http://nginx.org/patches/spdy/patch.spdy.txt
$ patch -p1 < patch.spdy.txt
$ sed -i -e 's|\\.openssl/||' auto/lib/openssl/conf
$ ./configure --sbin-path=/usr/local/sbin --with-openssl=/usr/local/ssl --with-http_ssl_module --with-http_spdy_module
$ make
$ sudo make install

Obviously you may want to install the nginx binary to a different sbin path. I don't know why the openssl conf has .openssl directories that work with the default openssl installation but not our self-compiled installation. But that's it, now you should be able to add the spdy directive to the relevant config files and your sites should be SPDY enabled.

Edit: nginx have now released a new development version, 1.3.15, which includes the relevant SPDY patches. So we do not need to apply these patches, but we still need to run the sed command on the nginx source to compile against our self-installed version of OpenSSL.

What's really in our meat?

As the article puts:

The fact that it’s horsemeat that’s turning up in burgers and lasagnes is not the problem. The problem is that until specific testing was performed, we didn’t have the faintest idea what it was.

If you accept the validity of eating meat like that of a cow or a pig or a chicken, then horse really is no different. What's wrong is the way we source our meat and the economics of how that meat ends up on our plate are frankly ridiculous.

What if it wasn't relatively harmless meat but some outbreak of a disease harmful to humans. We'd be screwed.

Christmas soon

It's Christmas soon. I'm spending it with both my girlfriend's family and mine, which will mean a nice long drive for me.

In the mean time I'm really enjoying the content on 24ways and webadvent.org. Anyone know anymore such directories?

Israelis talk about fear, we Palestinians talk about death

From the article:

\“\We Palestinians don't talk about fear, we talk about death. Our rockets scare them; their rockets kill us. We have no bomb shelters, we have no sirens, we have nowhere we can take our children and keep them safe. They are scared. We are dying.\”\

Powerful stuff.

Oh dear Phillip Schofield

Why did you hand David Cameron a list of supposed sexual deviants? That was a bit of a dick move wasn't it.

Whilst primarily agreeing with Cameron on this that people should go to the police, I don't know why he brought up people being gay with the issue of witch-hunts. I know there's a current debate about whether homosexuals should be allowed to marry. That doesn't translate to gays being persecuted does it? Or do people actually believe that beig gay makes you more likely to be a paedophile, a statement my gay friends might find quite distressing.

My name is Jonny Barnes, and jonnybarnes.uk is my site. I’m from Manchester, UK .

I am active to varying degrees on several silos:

My usual online nickname is normally jonnybarnes for other services. I also syndicate my content to the IndieWeb friendly site micro.blog. Here’s a profile pic. I also have a PGP key, with fingerprint. You can email me at jonny at my domain, or message me on XMPP.