echo "hey, it works" > /dev/null

just enough to be dangerous

Finding files in collection of zip files


My aim was to find a bunch of zip files, unzip with the -t flag to get their contents, and look for a specific file in the archive. The output I wanted was the name of the zip, followed by the path to the file. Like this:

ZIP: archive.zip
   testing: path/to/the/filename  OK

find . -name *.zip -exec unzip -t {} \; grep filename gives me the path to the file in the archive, but not the name of the file (aside: I always forget that you need space, backslash, semicolon at the end of the find exec flag). I ended up writing a script that prints the zip name first, then unzips the archive and greps the output.

</p>
 
<h1>!/bin/bash</h1>
 
<p>echo "ZIP: $1"
unzip -t <code>echo $1</code> | grep filename

Trouble is, the zip files have spaces and brackets in their names (eww!), so unzip can't find them. For example, if the archive is called my zip.zip, unzip tries to unzip my.zip. Now, the solution at this point should have been obvious, but as usual my brain went on holiday for an hour or two and I went down a wacky sed path. The solution is much simpler; use quotes.

</p>
 
<h1>!/bin/bash</h1>
 
<p>echo "ZIP: $1"
unzip -t "<code>echo $1</code>" | grep filename

Is there a way to do away with the script and make it a one liner?

WordPress links fixed


So, now links work. I had decided to change the permalink mode from the "ugly" default to "almost pretty", which makes permalinks look like http://www.twofishcreative.com/michael/blog/2007/02/27/wordpress-woes/. What I didn't do was create an .htaccess file so that WordPress could use apache's mod_rewrite to make sure that those almost pretty links actually work. All I needed to do was ssh to my host, change to my blog directory and

% touch .htaccess
% chmod 666 .htaccess

Then when I chose the almost pretty permalink option WordPress updated the .htaccess file to include the necessary rewrite rules. More information can be found under the Wordpress permalinks documentation.

WordPress woes


Okay, this isn't going so well. I've edited the About page, and now I get a 404 on it. I'm sure it worked before, and all I did was edit content. And none of the category links are working either. I started mucking with the theme code, I'm pretty knackered at the moment, and that's not the best time to start hacking with themes, but I can't see that I would have done anything bad. I'm not sure what I broke.

[Update: hmm, not even the links to posts work]

Importing my blogroll


I subscribe to a whole lot of feeds (well, a whole lot for me is about 30, I don't know how people pretend to keep up with thousands). There's this blogroll feature on WordPress, so I think, wouldn't it be great if I could just import my feeds to the blogroll. Turns out you can. In theory.

I log in as admin and click "Blogroll", and I see an "Import Links" tab, where I can import links as OPML. All good, I've heard of OPML. I successfully export all my feeds from NetNewsWire, and try to upload them to WordPress.

Unable to create directory /home/xnwq/public_html/twofish/michael/blog/wp-content/uploads/2007/02. Is its parent directory writable by the server?

Well, no, uploads doesn't exist. The default installation doesn't have anywhere to upload to. And if I create an uploads directory I have to give it at least 707 permissions so that the server can upload to it. I'm no expert, but that's bad, right? As an experiment, I change the permissions of the wp-content directory to 707, and sure enough, the server creates the uploads directory - with 707 permissions owned by the server. I'm not comfortable with that, so I delete the directory and change the permissions back.

However, just because WordPress created the directory doesn't mean everything was okay except the permissions.

XML error: Invalid document end at line 1

Not a particularly good error message, and actually incorrect. The file is indeed valid XML. Okay, let me be more precise; the file is well-formed XML, I haven't validated it against an OPML schema or DTD.

Hmm, more investigation required on both counts.

OpenID


After reading Simon Willison's post about setting an OpenID, and watching his screencast, I went ahead and set one up. The most attractive thing to me is a unique URI that I can use to log in to a variety of different sites (okay, there isn't much variety yet), without setting up different accounts on all of them. Tim Bray has written a post on his concerns about OpenID, in which he looks at it from the other side, what does an OpenID mean to a site where someone is logging in (among other things). The comments are illuminating. OpenID is not about proving who you are, though that may be built on top at some stage. I'd be very happy to leave comments on Tim's site after logging in with my OpenID, and I don't really care what the OpenID says about me to Tim.