Chris Worfolk's Blog


Formatter Library

May 3rd, 2012 | Tech

If you’re like me, which seems unlikely as statistically you’re probably far more sensible, you’ll get really annoyed when the white spacing or indentation isn’t consistent within a file.

Because of this, I recently wrote a little Ruby script which would automatically clean up my CSS files and make them all nice and pretty. It’s now publicly available on Github if you want a copy.

At some point in the future I’m intending to do similar scripts for other file types – the SocietasPro codebase already has a similar system for PHP, though that only flags inconsistencies, it doesn’t correct them.

Changing your SSH port

May 3rd, 2012 | Life, Tech

If you want to change your SSH port to something a little less obvious, it’s easy to do. It’s debatable how much security it actually gives you, but it will certainly make you feel safer, and that is probably the most important thing.

pico /etc/ssh/sshd_config

I’m using pico in this example, but vim will work just as well. You should find a line which is commented out, specifying that the port is 22. This doesn’t need to be uncommented normally, as it defaults to port 22.

#Port 22

Just uncomment this and put a new port number in.

Port 8473

Now save the file and exit. Finally, restart SSH for it to take affect.

/etc/rc.d/init.d/sshd restart

Don’t forget, next time you SSH in you will need to use the new port number!

ssh -p 8473 hostname

Mind. Blown.

May 2nd, 2012 | Life

Mind fuck diagram

After I had finished explaining all this, he looked at me and said “that may be the case sir. But that’s still no excuse for doing 37 in a 30 zone.”

Worth a try, anyway.

EMDR

May 1st, 2012 | Thoughts

Recently, I undertook my first session of EMDR.

It’s a relatively new form of therapy (albeit, older than Elina), which in it’s full title is named “Eye movement desensitization and reprocessing” originally developed to help trauma victims and has since expanded into other areas.

So far, I’m quite torn about it. On one hand, EMDR is now approved and recommended by The National Institute for Health and Clinical Excellence (NICE) and has shown to be affective in dozens of randomised controlled trials.

On the other hand, it really, really sounds like Dianetics.

For those not familiar with it, Dianetics is a concept developed by Scientology founder L. Ron Hubbard which divided the mind into two parts – one of which is the reactive mind that stores traumatic memories, and anything associated with those memories, related or not.

This is why Scientologists are very quite around people who have been knocked out – because anything they say will be linked to the memory of being knocked out in the reactive mind. These are stored as negative engrams and the only way to get rid of them is to pay for Audit Counseling.

I’m not a subscriber to Dianetics, and even though EMDR has a lot of key differences (for example, the traumatic memories don’t just pop out of existence in a second), it’s similarities have thrown me somewhat, despite all the evidence to show EMDR genuinely does work. It’s like some kind of reverse-placebo affect, is there a term for that?

Karting

April 30th, 2012 | Distractions

Recently, I went indoor karting with work.

I was rubbish at it, almost everyone was faster than me, but it was never the less a lot of fun. It’s definitely the kind of thing I could get into with a bit more practice. I don’t quite have the money to buy my Formula One team yet, but a kart, well that’s a whole different matter…

The Little Paris Kitchen

April 29th, 2012 | Distractions, Thoughts

Rachel Khoo is a business genius. If you’ve seen her BBC Two show, The Little Paris Kitchen, you may have heard her claim she opened her own restaurant. You’ll then no doubt notice that what is has actually done is put a table in front of her sofa and put a few chairs round the other side of it, in her living room.

So, she is basically just having people over for dinner. And charging for it!

In a recent episode, she made Beef Wellington, explaining that both the English and the French have their own version of the dish. This strikes me as odd.

The English dish Beef Wellington is named after the Duke of Wellington, the man who led us to victory against Napoleon at the Battle of Waterloo. We celebrate him for that, hence why we created a dish full of steak in his name.

But the French were on the losing side of the battle. Why have a dish named as such?

Tackling the Immigration Issue

April 28th, 2012 | Religion & Politics

Immigration has been a hot topic over the past decade. Many people are concerned about the level of immigrants coming into the UK, while other groups argue that we need immigrants to continue flooding to the UK in order to promote growth and ensure there is still a bit of money left in the pension pot.

Realistically though, there is really just one group of immigrants causing more problems in our society than any other. Addressing this one specific area would bring far more equality and fairness to our society.

That’s why I’m launching my new campaign Deport the Sax-Cobergs.

Royal Family

They come over here, they take our jobs…

They take our women…

And they live in massive council houses funded by the tax payer…

So, I’ll be handing round a petition…

Migrating away from register globals

April 27th, 2012 | Programming, Tech

If you are luckily enough to work in a Web 2.0 start up, you probably won’t have to deal with too much legacy code. But for the rest of us, we can often find ourselves working with code which can be even decades out of date.

One of the big issues in PHP has been the deprecation of register globals. Of course, this happened quite a long time ago, because the idea of register globals was just plain stupid, but recent versions of PHP (5.3 onwards), will now throw a deprecation error.

So, we need to find a way to turn register globals off.

The end solution is of course to refactor the code so it doesn’t use register globals at all. Anything short of this is going to be a security nightmare, it’s like a ticking time bomb sitting on your server. But until then, there is a way you can emulate it in your PHP code while you work to get rid of it, allowing you to turn the register global settings off.

All you need is something like this in your code.

foreach ($_REQUEST as $key => $val) {
	$$key = $val;
}

Bad Science in the Developing World

April 27th, 2012 | Humanism

As part of the Atheist Society‘s Reason Week, I recently attended a talk by Martin Robbins, author of The Guardian’s Lay Science blog, on Bad Science in the Developing World.

In the talk, Martin described an expedition to Africa that he undertook last year to investigate the quackery that the Western World is bringing to the continent. As you can imagine – it’s a lot. With limited education, how are people supposed to know that homoeopathy is nonsense? Of course, they can’t be expected to, so it’s an easy sell.

The real question though, is probably “what is the solution?” As Martin points out, when the competition is local herbalists and shamans, finding an answer is going to be tough.

Chinese Grand Prix

April 26th, 2012 | Distractions

It has been a fantastic start to the Formula One season.

With Perez coming in second in his Sauber at Malaysia, Rosberg and his Mercedes qualified on pole and converted it to a win in China. That means that the top two steps of the podium for the first three races – a total of six positions – has been shared by five teams! McLaren, Red Bull, Mercedes, Sauber and Ferrari are all looking in great shape this year and the other teams aren’t far behind.

Last year was an enjoyable season but it did often feel like 23 cars following Vettel round a track. This year has already seen some amazingly competitive racing and long may it continue. Ideally, primarily on the races, the BBC are showing in full.