Monthly Archives: April 2011

Jailbreak 2nd Gen iPod Touch with GreenPois0n

Spent a couple of hours today trying to jailbreak my iPod. After numerous attempts, I was on the point of giving up when I found this forum post with a solution: Run greenpois0n from the command line, rather than from the GUI.

While the forum post refers to RC5_2, I can confirm that it works with RC6 also. Here’s my method.

  1. Make sure that your iPod is connected to your computer.
  2. Shut down iTunes if it’s open.
  3. Turn off your iPod.
  4. Hold the power button and home button for 10 seconds.
  5. Release the power button, keep holding the home button for a further 10 seconds.
  6. Open Terminal.
  7. Change directory to the location of the greenpois0n app.
  8. Type open ./greenpois0n.app/Contents/MacOS/greenpois0n
  9. A new Terminal window will open and greenpois0n should now be able to jailbreak your iPod.
  10. Wait for your iPod to restart.
  11. Find the green Loader icon on your iPod and use it to install Cydia.

And that’s it – you’re good to go!

WordPress and the”filesize() [function.filesize]: stat failed”Error

I’ve been working on a website that includes a download button. When clicked the button would prompt to open or save the file. The prompt appeared on cue and the file downloaded, but for some reason the file was empty.

Checking the php_error.log, showed that this error was being generated:

PHP Warning: filesize() [function.filesize]: stat failed for http://localhost:8888/ringstone/wp-content/uploads/docs/brochure.pdf in /Applications/MAMP/htdocs/ringstone/wp-content/themes/ringstone/frontpage.php on line 26

Normally if the filesize function fails it’s because the directory where the file is stored is not writeable or the file is larger than 2GB.

In this case, the directory was writeable and the file was a lot less than 2GB in size. So I was stumped.

Going over my code, the only thing that I could see that might be causing the problem was the link to the file.

I was using the following code to get the WordPress uploads directory:

$uploads = wp_upload_dir();$url = $uploads['baseurl'];$filename = $url . ‘/docs/brochure.pdf’;

This generated the url for the document as: http://localhost:8888/ringstone/wp-content/uploads/docs/brochure.pdf

According to the PHP manual for filesize, as of PHP 5.0.0 the filesize function supports using some URL wrappers, including HTTP. The version of MAMP that I’m using includes PHP 5.3.2, so this shouldn’t have been a problem. It turns out that I was wrong.

I updated my code to:

$uploads = wp_upload_dir();$path = $uploads['basedir'];$filename = $path . ‘/docs/brochure.pdf’;

And it worked.

The lesson is that if you’re seeing filestat error in your PHP error log, then go through the following checklist:

  1. Pass filestat the directory path to the file, not the URL. (Even though the manual says that it should work.)
  2. Check that the directory is writeable.
  3. Check that the file is smaller than 2GB in size.