Chris Worfolk's Blog


Fast math

January 25th, 2012 | Success & Productivity

What is nine times seven? Did you know it was sixty three before reading this far? You probably did, but don’t pat yourself on the back too hard yet, as it could well have been that your brain was already reading ahead and the buffered information hadn’t reached your consciousness yet (if that is a thing, I think it is but I’m not a psychologist). Although, being a reader of my blog, you probably could do the math that fast anyway.

But not everybody can. Not because maths might not be their strong point but because they don’t use the same technique we do.

I mean, working out nine times seven isn’t nine times seven really is it? It’s ten times seven, minus seven. Because that is way faster. Because you can almost instantly tell that ten times seven is seventy, then all you do is subtract seven and you have your answer.

This was always obvious to me. But then, maths was always a far stronger side for me than English was. Hence why I can easily do such maths, but why there will almost certainly be parts of this blog post which make no grammatical sense at all. But it was brought to my attention when someone told me they had been learning about little techniques like that, that for some people it isn’t obviously, but you can teach them it and their maths skills get a lot faster.

In fact, it’s almost always faster to do it that way. Take six times seven for example. If I didn’t know that off by heart I would do seven times ten, seventy, divided by two, because again that is easy maths, thirty five, plus seven, gives you forty two. That would be way faster than counting up seven, fourteen, twenty one, etc, etc, even though it’s actually three different multiplications.

It’s like the i++ of the human brain.

Remembering a word

January 24th, 2012 | Thoughts

Is there anything worse than when you just can’t remember a word no matter how hard you try?

Yes. Yes there is. Cancer. Smallpox. TB. Disease in general. War. Crime. Guns. X Factor. Poverty. Death, taxes, earthquakes, hard to open packaging, etc, etc.. Ok, so there are many things worse than not being able to remember a specific word, but it’s still quite annoying.

So I thought I would share my experiences, to see if others (ie, you, the reader) had similar processes or maybe even some better suggestions.

The biggest problem I find is that I will get a specific sound stuck in my head. I have the sound “an” stuck in my head, but the word I’m trying to think of begins with a “sh” sound – and no matter how hard I try, all the word I can think of keep beginning with an “an” sound, and even when I deliberately think of another word, I just find myself drifting back to the same sound, even though I’ve tried all the possibilities and it clearly doesn’t start with that (I’m 95% sure…).

The problem (I imagine) is that my brain is stuck in a particular pattern, and I need to get out of that pattern.

The way I get round that it to just start thinking of other random sounds, and indeed making that sound in my head. Not actual words, just the sounds. “be…”, “du…”, “re…”, over and over. That is all I usually need my conscious mind to do, and the rest of my mind will then suddenly make the connection, and I think of the word when I hit the right sound.

Anyway, the moral of the story is, the brain is pretty cool.

i386 or x86_64 architecture?

January 24th, 2012 | Life, Tech

Wondering if you’re running i386 or x84_64? No problem, there is quick command which will return this information to you.

uname -i

ZonePlay on PlanetWin365

January 23rd, 2012 | Life

PlanetWin365

I’m pleased to say that after much blood, sweat and toil, we have finally launched ZonePlay live with one of our internet partners, PlanetWin365. It’s been a tough couple of months with plenty of late nights, early mornings, but it’s very gratifying to see the product go live in a brand new outlet. Full credit to Russ and Andy who have worked their metaphorical socks off to get it there.

Chocolate

January 22nd, 2012 | Family & Parenting, Photos

She left me roses by the stairs. Surprises let me know she cares.

Which reminds me, I’ve now been waiting almost a year to see Blink-182 and the gig is still months anyway…

Parking

January 21st, 2012 | Photos

Audi drivers are definitely the new BMW drivers. There is a parking space literally less than a metre to the right of this shot.

Flying Without Fear

January 20th, 2012 | Life

Earlier this month, I attended a Flying Without Fear course.

It consists of a morning session which looks at both the theory behind flying and why it is safe, and the psychology of anxiety and how to control your mind. After lunch you head over to the airport and actually take a flight.

The theory part was brilliant. Captain Dom explained the basic physics which keep you in the air, the various sections of the flight, what he does on take off, the backup systems they have in place – this was absolutely fascinating. Unfortunately it didn’t calm my nerves as I know a lot of the science behind it and I’ve never been worried about whether the plane is going to fall out of the sky or anything like that.

The psychology section was rather disappointing though, which was rather a let down as I was hoping this section would actually be useful to me. Unfortunately, the course uses Neuro-linguistic programming which has now been almost entirely discredited. Why? Because it’s all nonsense.

That isn’t to say their hearts weren’t in the right place. All of the course leaders (most if not all were volunteers who had given up their time to help out!) were incredibly supportive and that is the real benefit of the course. I’m incredibly grateful for the support I received from Sarah, Jill, my dad and everyone else on the course (if you’re reading this, thank you SO much!). They got me here:

Smiling and everything. Because the irony is that I love the idea of flying. I mean, it’s really awesome right, being so far up in the air, watching everything down below like you’re living all those hours spent on Google Earth. If only I didn’t feel ill every time I got near a plane, it would be a magical experience.

Still, I’m now one step forward in the battle for Los Angeles.

Social Media: For Good or Ill

January 19th, 2012 | Events, Humanism, Tech, Thoughts

This month at the Humanist Society of West Yorkshire, Simon Duncan presented a talk on social media – what it is and whether it is a good thing or not. Of course, the answer is yes.

Social media brings us huge benefits, at relatively little cost – and indeed almost no monetary cost, as sites like Facebook are all free. Unfortunately, it tends to take a bad wrap because of people not really thinking their arguments through. You can blame the media a little for this, but I don’t think they shoulder that much responsibility.

Take cyber bullying for example. It’s ace. Kids are going to bully other kids anyway, that is just part of society, at least at the moment. But with cyber bullying – you have a full paper trail of everything that has gone on! If social media has made the bullying situation worse for anyone, it’s the bullies! You can now just take your text messages straight to the school, or even the police. None of this complicated business of having to prove what they said with witnesses.

According to Simon, studies have also shown that using social media actually increases real world interaction. That’s certainly true of me – the main reason I use Facebook is to organise real world events with my friends. As well as plenty of other uses of course, such as keeping in touch with friends I otherwise couldn’t keep in touch with affectively because they’re in a different timezone in a different part of the world.

Other fears include issues like privacy and targetted advertising. Perhaps this has been a problem in the past, but with increased awareness of the situation, companies are now putting in place the tools to effectively manage your privacy and you can quickly and instantly lock down your profile, most of which is restricted to approved friends only anyway. This is arguably far more secure than the records the government has for example, which will probably end up on a USB stick left on a public train.

Targeting advertising is actually a massive benefit to us – because more effective advertising means less advertising. If companies can reach their target audience more effectively, they need to reach less people, so they spend less on blanket advertising. This is evident from the reduction of advertising – remember all the big flashing banners and pop-ups that plagued the internet – most of those have now given way to these small text links on Google and Facebook, and the web is much the better for it.

PDO database layer

January 18th, 2012 | Tech

If you’re not using PDO in your PHP projects yet, you should be.

I finally got round to taking a proper look at it recently, and I’m really impressed. I managed to convert an entire open source project to it in under two hours! Granted, I was helped a lot by the fact that the PDO naming conventions luckily match up with the naming conventions I used in my original data access layer, but still, it was smoother than I expected.

PDO has some great advantages too:

1. It’s cross platform, so you can use it on a number of different database platforms including MySQL, MSSQL, Oracle, Postgres, SQLite and many others! All you do is enter the protocol and login details to the connection and it handles everything else.

2. It has prepared queries so you never need to escape anything again! You simple pass it some SQL with a series of question marks in, and an array of values those question marks represent and all the SQL injection negation is taken care for you.

3. If something goes wrong, it throws an exception rather than producing an error message.

4. It’s easy to extend, to add your own functionality. Just use Class MyPDO extends PDO and you can add extra functionality on top of it.

All in all, it’s a great addition to PHP and one I now wish I had gotten to sooner.

Profiling SQL queries with EXPLAIN

January 18th, 2012 | Life, Tech

If you have a complex SQL query, you might find that performance isn’t exactly ideal. Worse still, you don’t actually know which part of the query it is that is actually taking so long.

Luckily, MySQL comes to the rescue with the ability to explain.

All you have to do is start your query with the keyword EXPLAIN and MySQL will, rather than returning you a recordset of results, will instead provide a break down of everything it has done, including how it made the table joins and what order it did everything in.

EXPLAIN SELECT a INNER JOIN b ON a.col1 = b.col2 WHERE a.col1 > 1 AND b.col2 > 2;