Hello, BPW? 1995 called. It wants its web site back.
Craigslist suggestion: pause and resume listings
Here’s a feature suggestion: I’d like the ability to pause and resume a post on Craigslist.
Here’s the scenario:
- I post an ad in free stuff
- I get 10 responses immediately
- I want to stop getting responses until I can deal with the ones I’ve already received
- If I delete the ad, I can’t repost it for two days (it gets flagged as spamming)
It would be nice if I could pause the ad, either until I resumed it, or for a fixed period of time (1, 12 or 24 hours).
I emailed Craig a few months ago. Perhaps if he gets more requests, they’ll implement this.
MySQL database backup script
I wrote one of these for Mailman last fall, and finally got around to putting together a quick script to back up your MySQL databases. It optimizes and repairs all of your tables, then creates a directory for today, dumps each database into a SQL file and zips it up, leaving you with a directory of .tgz files.
The script requires the Python MySQL module. If you’re using DarwinPorts, port install py-mysql
; on Debian, apt-get install python-mysqldb
. With fink, install mysql-python-py24 (or mysql-python-py23, or mysql-python-py25, etc.).
The script is called mysqlBackup.py, and its syntax is pretty straightforward:
Usage: mysqlBackup.py <backuppath> <password> [<user>] [<hostname>]
If the username isn’t specified, it defaults to root. Likewise, the host defaults to localhost.
Typical use would be to place a helper script like this /etc/cron.weekly
:
#!/bin/sh
/usr/local/bin/mysqlBackup.py /home/backups/mysql/ mypassword
mysqlBackup.py is available under a CreativeCommons-Attribution license.
JavaScript date validation
I was searching the web for JavaScript date validation code. All I found were lots of really bad ideas. Some were quite complicated. John Gang was on the right track. I didn’t see Chris Hogben’s article initially, but he used the right algorithm.
Still, nobody offered the complete solution. Given a date string YYYY-MM-DD, is the date valid?
The smart way to do this is to (a) parse the date string with a regular expression, (b) construct a date object and (c) compare what you got out of the date object to what you put in. To make this really convenient, we’ll use JavaScript’s proptotype functionality to extend the String class, making this available to any string:
var IsoDateRe = new RegExp("^([0-9]{4})-([0-9]{2})-([0-9]{2})$");
var matches = IsoDateRe.exec(this);
if (!matches) return false;
var composedDate = new Date(matches[1], (matches[2] – 1), matches[3]);
return ((composedDate.getMonth() == (matches[2] – 1)) &&
(composedDate.getDate() == matches[3]) &&
(composedDate.getFullYear() == matches[1]));
}
Here’s the method in action:
alert(a + (a.isValidDate() ? " is a valid date" : " is not a valid date"));
Come to my SXSW panel on user interface consistency
At this year‘s SXSW Interactive festival, I’ll be moderating the panel Getting to Consistency: Don’t Make Your Users Think. The blurb:
Predictable and consistent software is much easier to use. This session explores interface consistency, examples of consistency failures and their consequences.
This is going to be a really interesting discussion. I have three fantastic panelists:
- Steve Johnson, Senior Manager, User Experience, Adobe
- Jennifer Fraser, Lead User Experience Designer, Corel
- Alex Graveley, User Interface Engineer, VMware
We’re going to explain what consistency really means to you and your users and show what it can do for you. What happens when you’re not consistent? We’ll demonstrate examples of failures from the silly to the catastrophic and list the obvious (and hidden) costs of inconsistency.
Sometimes, however, you don’t want to be consistent. We’ll explain why.
Come to this session and be the new best friend of your performance, security, accessibility, tech support and product documentation teams. (Then, go to the session on managing social networks and information overload.)
thoughts on code
“The best code you have is the code you didn’t write.”
“Legacy code is any code without tests.” (likely paraphrasing Michael Feathers)
Address Book AppleScript example
Here’s a simple AppleScript that exports all of the email addresses in your Mac OS X address book as a comma-separated list:
tell application “Address Book”
set emailList to {}
set peopleCount to (count every person)
repeat with i from 1 to peopleCount
set emailList to emailList & (get value of every email of person i)
end repeat
set outputFileName to choose file name with prompt “Save address book as text:” default name “addressbook.txt”
set outputFile to open for access outputFileName with write permission
repeat with e in emailList
write e & “, ” to outputFile
end repeat
close access outputFile
end tell
Hilarious Ellen DeGeneres excerpt
Ellen picks up the phone and calls 88-year-old Gladys Hardy of Austin, Texas, who proceeds to steal the show.
Then, she calls her again:
Anya Marina house concert photos
Eric Carter and Enric Teller posted some photos of last month’s fantastic Anya Marina house concert.