The Venus Transit: history and stories

Mark Anderson, author of the book The Day The World Discovered the Sun on the Science Talk podcast last week talked about the transit of Venus that’s happening today. Also make sure you listen to part 2 of the podcast!

It’s an amazing story about the efforts in 1760 to measure the distance to Venus. They had to travel far north and also south to the tropics to measure the angle of view from two known locations. Astonishing that they did this so long ago, even using the moon as a GPS, a technique that had only just been figured out.

The global positioning satellite in this case was the moon. In the 1760s science was for the first time able to predict with uncanny accuracy the moon’s exact motion in the sky years ahead of time. So some of these Venus transit pioneers, especially England’s Astronomer Royal Nevil Maskelyne, had mastered a method by which a ship’s navigator anywhere on the Earth could observe the moon with a £8 sextant and a reference manual (costing a few shillings) — and in short order discover their exact location on the planet. The long-sought solution to the longitude problem was now easy, inexpensive and at hand. (source)

Edit: Some amazing photos of the Venus transit, as taken from the Nasa website: 1, 2, 3

This is how you pop the question

On Wednesday, May 23rd, 2012, I told my girlfriend to meet me at my parent’s house for dinner. When she arrived I had stationed my brother to sit her in the back of an open Honda CRV and give her some headphones. He “wanted to play her a song”…

What she got instead was the world’s first Live Lip-Dub Proposal.

Damn onions.

Mount box.net drives in Linux

I was one of the lucky few to receive a 50GB upgrade from box.net, (or box.com where they now live, marketing fail?) when I installed their Android app. I don’t have a use for that much storage on my phone but on my desktop machines? Oh yes!

This forum post describes in detail how to mount a Box drive on a Debian/Ubuntu machine although the instructions will mostly apply to other systems too as long as they have the davfs2 package.

There is a gotcha. Instead of using http://www.box.net/ you can use https://www.box.com/ which is a good gotcha. Also, I’m not the only person to notice that the mount point has a lot less storage than I thought it would have. It should be 50GB total but this is what I see from df -h:

https://www.box.com/dav 26G 13G 13G 50% /mnt/box.net

It’s enough for my needs. I’m going to copy snapshots of my local email there every night.

PS. Are you a Windows user? Sync any folder with Google Drive using the instructions here (but it uses “hardlinks” which have limitations, read the comments for more).
Actually, forget what it says in that post. Copy your files to your Google Drive and then place a symlink on your local drive to the copied files or folders using mklink. Make sure you run cmd.exe as an Administrator. I found this worked perfectly to sync the Pictures folder after I had copied it to my Google Drive:

cd c:\Users\USERNAME\
mklink /d Pictures “c:\Users\USERNAME\Google Drive\Pictures”

Any files copied into the Pictures folder are copied to the Google Drive now!

WP Super cache 1.1

This is a bugfix release of the full page caching plugin WP Super Cache for WordPress.

Not much has changed in the week or so since I asked for testers but in case you missed that post here are the changes since 1.0:

  • Use $_SERVER[ ‘SERVER_NAME’ ] to create cache directories. No more non existant blogs appearing in your cache supercache and blogs folders.
  • Only create blogs cached directories if valid requests and blogs exist.
  • Only clear current blog’s cache files if navigation menu is modified
  • Added clean_post_cache action to clear cache on post actions
  • Removed garbage collection details on Contents tab
  • Added wp_cache_check_mobile cacheaction filter to shortcircuit mobile device check.
  • Don’t delete cache files for draft posts
  • Added action on wp_trash_post to clear the cache when trashed posts are deleted
  • Show a warning when 304 browser caching is disabled (because mod_rewrite caching is on)
  • New check for safe mode if using less that PHP 5.3.0
  • Added wp_supercache_remove_cookies filter to disable anonymous browsing mode.
  • Fixed garbage collection schedule dropdown
  • Fixed preload problem clearing site’s cache on “page on front” sites.
  • Fix for PHP variable not defined warnings
  • Fixed problem refreshing cache when comments made as siteurl() sometimes didn’t work
  • Preloading of taxonomies is now optional
  • Domain mapping fixes.
  • Better support for https sites. Remove https:// to get cache paths.
  • Added AddDefaultCharset .htaccess rule back in and added an option to remove it if required.
  • Added multisite plugin that adds a “Cached” column to Network->Sites to disable caching on a per site basis.
  • Added WPTouch plugin to modify browser and prefix list in mobile detection code. Added support for that plugin’s exclude list.
  • Fixed cache tester
  • Filter the tags that are used to detect end-of-page using the wp_cache_eof_tags filter.
  • Removed debug level from logging as it wasn’t helpful.
  • Removed mention of wp-minify.

As ever, the support forum is the best place to go for help as I monitor it all the time. Before you post there use Google to search for any error strings and use the debug system in the plugin as it will probably tell you what’s going on.

My early memories of programming

My earliest memories of programming are directly related to the pain of not being able to save my work.

The first proper computer my family owned was a Commodore Vic-20. I guess my parents bought it in 1984 or 1985 but it might have been earlier. The Vic-20 came out years before but this was recession hit 80’s Ireland. I’m pretty sure the computer was bought in O’Callaghan’s shop, where the betting shop is now on Pembroke Street.

I remember copying a flying bird BASIC listing from the Vic-20 manual one school morning, and I think I made it fly left and right too. What made it stick in my mind was the anguish I felt because I couldn’t save it. We had a Vic-20 you see but we didn’t have a datasette that could record or play back data on cassette tapes. I left the machine on while I went to school which was risky because they had huge heavy power supplies that had a tendency to overheat (not that I knew that then!) Thankfully we did get a datasette later because I remember playing Wacky Waiters on it. Or it might have been some sort of interface that let me plug a regular cassette player into the Vic-20. Chip Electronics sold them in clear plastic bags I think. All a little hazy now unfortunately!

So, thanks to this site I was able to track down a scanned copy of the Vic-20 manual and immediately jumped to the Flying Birds bit. A little bit of rose tint nostalgia on a murky Friday evening almost 30 years later.

What got you into programming?

Fatal error: Allowed memory size of 67108864 bytes exhausted

WordPress uses memory. Plugins and themes use memory. New versions of software may use more memory than before. When that happens and PHP on your server doesn’t have enough memory then PHP will stop with a fatal error like this:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1203208 bytes) in /home/*****/public_html/wp-admin/includes/class-pclzip.php on line 4215

This happens quite a bit but it’s not a bug in WordPress or your new plugin or theme, you simply need to let PHP use more memory on your server. Thankfully WordPress makes it easy to do this. You must define a constant, WP_MEMORY_LIMIT in your server’s wp-config.php like this:

define(‘WP_MEMORY_LIMIT’, ‘128M’);

The error message will give you an idea of how much memory is required. The error message says it tried to allocate 1203208 bytes or just over 1MB of memory. The limit here is 67108864 bytes, or 65536KB which is 64MB so here I’d need a WP_MEMORY_LIMIT of more than 66M. The error message will go away once PHP has enough memory but be sure to test it.

If you allocate too much memory your server could start eating into disk swap space. Also be aware that each Apache child process is allowed to use that much memory so if you had ten processes it could use ten times the memory limit in a worst case scenario. If that happens you’ll need more RAM or you’ll have to figure out what’s using so much memory.

There’s also a WP_MAX_MEMORY_LIMIT constant. By default it’s 256M and it’s currently only used when uploading images.

On the off chance that you don’t have WordPress installed and you came here from a search engine, then you’ll want to use ini_set() somewhere early in the PHP process to increase the memory limit:

ini_set(‘memory_limit’, ‘128M’);

Finally, I love that the wp-config.php codex page is the first result of a search for WP_MEMORY_LIMIT.

Super Cache for the Weekend

WP Super Cache 1.0 came out several months ago and while it worked fine for most people there’s always room for improvement and bug fixes. Here are some of the bug fixes and improvements coming in the next version which I plan on releasing next week.

There are a lot of changes there so if you have a self hosted blog I would really appreciate if you download the development version, wp-super-cache.zip and install it in your plugins folder.

  • Use $_SERVER[ ‘SERVER_NAME’ ] to create cache directories.
  • Only create blogs cached directories if valid requests and blogs exist.
  • Only clear current blog’s cache files if navigation menu is modified
  • Added clean_post_cache action to clear cache on post actions
  • Removed garbage collection details on Contents tab
  • Added wp_cache_check_mobile cacheaction filter to shortcircuit mobile device check.
  • Don’t delete cache files for draft posts
  • Added action on wp_trash_post to clear the cache when trashed posts are deleted
  • Show a warning when 304 browser caching is disabled (because mod_rewrite caching is on)
  • New check for safe mode if using less that PHP 5.3.0
  • Added wp_supercache_remove_cookies filter to disable anonymous browsing mode.
  • Fixed garbage collection schedule dropdown
  • Fixed preload problem clearing site’s cache on “page on front” sites.
  • Fix for PHP variable not defined warnings
  • Fixed problem refreshing cache when comments made as siteurl() sometimes didn’t work
  • Preloading of taxonomies is now optional
  • Domain mapping fixes.
  • Better support for https sites. Remove https:// to get cache paths.
  • Added AddDefaultCharset .htaccess rule back in and added an option to remove it if required.
  • Added multisite plugin that adds a “Cached” column to Network->Sites to disable caching on a per site basis.
  • Added WPTouch plugin to modify browser and prefix list in mobile detection code. Added support for that plugin’s exclude list.
  • Fixed cache tester
  • Filter the tags that are used to detect end-of-page using the wp_cache_eof_tags filter.