Restore frozen iPhone 3G after erasing all data
Yesterday, I reset and erased all data on my jailbroken iPhone 3G, and ended up with a phone that will not startup. After a little searching around I came across the following steps to restore the iPhone:
- Shutdown the phone by holding down the Power+Home button for 10 seconds. Let go of the buttons when the screen flashes and goes blank
- Connect the USB cable to the computer, but NOT to the phone.
- Connect the other end of the USB cable to the iPhone while holding down the Home button (5 to 10 seconds), till the iTunes connection screen is displayed on the phone.
- iTunes will now detect the iPhone, and you will be able to restore the phone.
Note: This seems to happen only with Jailbroken iPhone 3Gs which are reset and erased.
PHP Command Line Progress Bar
A simple progress bar function for php command line (CLI) scripts:
function progressBar($current, $total, $label="Progress: ", $interval=5) {
if ($current == 0) {
echo $label;
// start the bar
echo "| 0%";
} else {
$pos = ($current / $total * 100);
if( fmod($pos, $interval) == 0 ) {
if( $pos >= 10 ) echo "\010";
if( $pos == 100 ) echo "\010";
echo "\010\010\010";
echo "| $pos%";
}
}
// end progress with a new line
if ($current == $total) echo "\n";
}
Reference code: PHP CLI Progress Indicator
WordPress Comment Stats Query
Here is a query you can run against your WordPress comments table to view total comments by year and month. If you use a different table name prefix, then substitute ‘wp’ with your table name prefix.
SELECT year(comment_date) as y, month(comment_date) as m, concat(substr(monthname(comment_date),1,3), " ", year(comment_date)) as month, count(*) as total FROM wp_comments GROUP BY y, m ORDER BY m, y ASC



