I guess I must have let the battery on the iPhone completely discharge, as I found it motionless and unresponsive last night on my desk. Plugged it in, still nothing — won’t start up. Left it charging overnight, still no luck. Followed the reset procedure:

  • Hold down power and home buttons together until the Apple logo appears

And it came back to life. The battery was empty, plugged in, now it’s charging. It’s a relief, weird behavior, though, I think. I’ve let the battery on the other phones I’ve had over the years (Nokia, BlackBerry, Sony, Siemens, etc, etc) drain completely lots of times. Plugging in the charger always just let me start them up again with no issues.

Cooked up a little shell script to produce monthly email statistics such as amount of email received, how much of it was spam, percentage of spam correctly identified, etc. Previously, I had manually ran the numbers and input into OpenOffice Calc to get the stats — boring!

Example output:

root@dpork:~# spam-stats-month Aug 2009
 
------------------------------------
Stats for Aug 2009
------------------------------------
Ham	SpamC	SpamR	SpamM	HamC
151	122	3444	7	0
--------------------------------------------------------------
3724		Total messages
3573		Total Spam (Caught + Missed + Rejected)
95.94%		Spam as % of all mail
96.38%		% of Spam rejected by Postfix at SMTP time
0%		False positive rate (Ham misclassified as Spam)
.18%		False negative rate (Spam misclassified as Ham)
99.80%		Spam catch rate (Spam filter accuracy)
--------------------------------------------------------------

Read the rest of this entry…

I had gotten the optimal 1366×768 resolution working on the Dell Mini 10 with the optional HD display (Poulsbo chipset / Intel GMA500 video) by using the drivers provided by the Ubuntu Mobile Team.1

It’s been working great for over a month until this morning, when instead of a login screen, I was greeted with an error: “Ubuntu running in low graphics mode”.

What’s up with that? The APT log contained the explanation:

1
2
 * Running DKMS auto installation service for kernel 2.6.28-16-generic        
 *  psb-kernel-source (4.41.1)...        psb-kernel-source (4.41.1): AUTOINSTALL not set in its dkms.conf.

I guess I could set AUTOINSTALL for the psb-kernel-source module to “Yes”. I’ll think about it, meanwhile, a manual fix is easy enough:

1
2
sudo dpkg-reconfigure psb-kernel-source
sudo shutdown -r now

Read the rest of this entry…

A project I’m working required a comma delimited file containing date ranges, in one week increments, from July 1987 to the present. That’s 1166 week ranges. What sounds like a potentially time consuming ordeal, takes about 10 sec to produce with the following shell one liner:

for n in $(seq 0 1166); \
do echo -e \
$(date +%m/%d/%Y --date="1987-07-01 +$n week")","\
$(date +%m/%d/%Y --date="1987-07-01 +$n week +6 day") \
>> date.ranges; done

Read the rest of this entry…

If you’re looking for a program and need to find a package that provides it, AND your package manager is APT (e.g. you’re running Debian or one of its many derivatives, like Ubuntu), you, Sir, got a couple of options.

One way is to search package contents online at debian.org, or you could use apt-file.

Read the rest of this entry…

WordPress helpfully creates revisions of blog posts. If you’re concerned about a number of rows in the wp_posts table, you could delete old revisions. Let’s say we want to delete revisions older than 7 days:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision';
+----------+
| COUNT(*) |
+----------+
|      110 | 
+----------+
SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision' AND post_date < DATE_ADD(NOW(), INTERVAL -7 DAY);
+----------+
| COUNT(*) |
+----------+
|       84 | 
+----------+
DELETE FROM wp_posts WHERE post_type = 'revision' AND post_date < DATE_ADD(NOW(), INTERVAL -7 DAY);
SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision';
+----------+
| COUNT(*) |
+----------+
|       26 | 
+----------+

If you’re running WordPress MU, the process is the same, just need to specify the right table as each WPMU blog has its own. See this post for how to identify WPMU blog numbers and corresponding URLs.