How to improve your sleep in seconds….

In this post Richard Wiseman recommends reducing the use of screens late at night because of the blue light emitted by them as that can keep you awake for longer.

I read books on my phone but I use Screen Filter To bring the brightness way down. Once I start reading a book I generally get sleepy within a dozen words or so! Anyway, I just installed the Twilight app that changes the temperature of the screen at different times of the day. At night it will make the screen go slightly red. I’ll give it a go tonight. Maybe I’ll look at the screen and fall into a deep sleep..

The irony is, I’m typing this at my PC where I should really have something like f.lux installed if I’m that worried about it.

PHP Notice: Undefined variable: _SERVER in ..

I upgraded Linux on this server a while back and in the course of that upgrade PHP was upgraded too, to version 5.5.9.

Since I had a modified php.ini it asked me to check over any new options. There were a few but I fixed anything that looked like it might break things. I saved the php.ini and let the upgrade go on.

Clearing up bugs

Some time later I saw odd notices in the PHP error log. Usually it referred to wp-comments-post.php but files outside of WordPress raised the warning too:

PHP Notice: Undefined variable: _SERVER in ..

It turns out the fix is rather easy. Jacques Marneweck on his blog posted a solution. Simply switch off “auto_globals_jit” in your php.ini and restart Apache (if required).

From the PHP manual entry for auto_globals_jit:

When enabled, the SERVER and ENV variables are created when they’re first used (Just In Time) instead of when the script starts. If these variables are not used within a script, having this directive on will result in a performance gain.

The PHP directives register_globals, register_long_arrays, and register_argc_argv must be disabled for this directive to have any affect. Since PHP 5.1.3 it is not necessary to have register_argc_argv disabled.

A bug

It looks like the bug is ancient although I’m not using APC, and the JIT compiler can be fooled if you access the super globals like _SERVER through variable variables. Sneaky!

The default for auto_globals_jit is “On” so next time you upgrade PHP keep an eye on the error log.

B/W HDR Look in Lightroom

Anthony Morganti uses an interesting technique to create photos with a black and white HDR look in Lightroom. It can transform a photo so it looks something like this. (I added a vignette as well.)

B/W HDR Look 1

B/W HDR Look 2

It doesn’t suit all photos of course, it’s also only a starting point as you should develop your photos in whatever way you desire. To avoid repeating all those steps every time I created a Lightroom preset.
Grab that file and install it in the same way you’d install any Lightroom preset. What d’you think?

What’s Bill Gates up to now?

It’s still weird to me that Bill Gates is one of the good guys now. As head of Microsoft he was a ruthless business man who ran a monopoly that every Linux user despised. Since then Microsoft has faltered, or at least the computing arena has changed since the nineties and they’re still catching up.

Anyway, he and his wife now head the Bill & Melinda Gates Foundation that do amazing work combating disease and helping projects all over the world. For a taste of what they do here are two podcasts worth listening to:

nerdistgates

  • Bill Gates on the Nerdist Podcast. I loved hearing his anecdotes from the early days of computing but what was more interesting was hearing about the fight against polio.
  • Scientific American have a two part show here and here that I’m listening to now.

The Great War Diaries

This is an amazing podcast by the BBC about how ordinary men and women experienced World War One. Stories are brought to life by dramatizing what happened using sound effects and actors.

If you’re a fan of Dan Carlin’s Hardcore History podcast you may remember in Blueprint for Armageddon IV Captain Charles May’s story was told. He wrote a touching letter to his wife before he was due to “go over the top”. You can find it and other stories in this Independent post.

Captain Charles “Charlie” May, 27, thinking of his wife, Bessie, and baby daughter, showed none of his comrades’ enthusiasm to go into battle.

A member of the 22nd Battalion, The Manchester Regiment, 7th Division, he wrote to his wife on 17 June, a fortnight before the bloody first day of battle of the Somme: “I do not want to die. Not that I mind for myself. If it be that I am to go, I am ready. But the thought that I may never see you or our darling baby again turns my bowels to water. I cannot think of it with even the semblance of equanimity.”

Over the months his attitude changed to resigned fatalism. May’s final diary entry at 5.45am on 1 July, reproduced from Malcolm Brown’s history of the Somme, was among the last testaments to be written by the 19,240 Britons who would die on the Somme that day. “No Man’s land is a tangled desert,” he wrote. “We do not yet seem to have stopped his machine guns. These are popping off all along our parapet as I write. I trust they will not claim too many of our lads before the day is over.”

Suspecting he might not return, he asked his friend, Captain FJ Earles, if he would look after his wife and daughter. May led his men over the top at 7.30am that day. The 22nd Manchesters made progress across No Man’s Land, but the machine guns he wrote of cut down many of the battalion – and May was among the dead. Earles kept his promise, and later married May’s widow.