Archive for the ‘Personal’ Category
Cat Superstar
Saturday, July 22nd, 2006Onlooking Bird
Saturday, June 24th, 2006Far From The Eye
Monday, June 12th, 2006Aligator Texture
Sunday, June 11th, 2006Migrating MovableType to WordPress 2.0.2 (or The Good, The Bad and The Ugly)
Thursday, June 1st, 2006Over the last weekend and the week before that I spent a lot of time trying to migrate the blog at Pyre to use WordPress instead of the ancient MovableType installation it was using before. Unfortunately it wasn’t a very smooth ride, so I’ll write my conclusions here so that they could be useful for others.
Exporting from MovableType
The first step in the process was to export the post information from MovableType. This wasn’t really a hard step and the WordPress Importing from MovableType tutorial does a very good job of explaining this step. Unfortunately this didn’t quite work for me because MovableType doesn’t export post id #’s into this file. Why would you want that you ask?
Well…
Apparently MovableType hosts multiple blogs in the same database and uses the same tables for all the blogs. It actually goes even further and has global post id numbers so that the sequence of id’s for any one blog is not consecutive, you’ll have breaks in the numbering wherever someone posted to one of the other blogs. Huh! So maybe I should export all of the blogs at once? Well it turns out that you can’t. No single user, including the administrator can export all the blogs, they can only export the ones they “own”, which I guess means they started.
*sigh*
Importing into WordPress
This means that when I import entries into WordPress the post id #s will be completely different and maintaining links will be close to impossible.
At this point I went through the exercise of inserting my foot into my mouth from 10 different angles, after having said that the importing step “should be a breeze”. I tried writing a program to fetch all post numbers and titles from the old blog, trying to compare to how they import into WordPress and then making a file with all the correspoinding ids. In the end it was decided that maybe if we only preserve internal linking it would be OK. At that point I went and wrote a program that would go through the exported MT entries and substitute the correct addresses from my previously created massive file. This had it’s own problems.
In the end everything ended up working out quite nicely. Here’s how.
The Final Solution
First I found a very useful hint on how to export post ids from MT, which worked like a charm.
I then proceeded to to hack up WordPress to import the entries correctly. The hints at the website above gave me a good idea of what needs to be done but it was a bit old, using WordPress 1.0 instead of 2.0. Here is a patch for my WordPress hack. This also inserts print statements that show you that everything is indeed going according to plan. I’m going to explain the main points of the patch below, but these are copy/pasted parts of the patch that won’t apply if you use them by themselves, please use the full patch.
The first part of the patch is for the wp-includes/functions-post.php file, which defines functions for inserting a post into the database. The first chunk of the patch makes WordPress think that it’s creating a new post, instead of updating, by commenting out the update code.
@@ -16,11 +16,13 @@
// Are we updating or creating?
$update = false;
- if ( !empty($ID) ) {
- $update = true;
- $post = & get_post($ID);
- $previous_status = $post->post_status;
- }
+ // igorfoox
+ printf(__('In wp_insert_post, ID is %d'), $ID);
+// if ( !empty($ID) ) {
+// $update = true;
+// $post = & get_post($ID);
+// $previous_status = $post->post_status;
+// }
The second chunk makes WordPress always set the post id to the id we extracted from the comment.
@@ -45,8 +47,8 @@ $post_status = 'draft'; // Get the post ID. - if ( $update ) - $post_ID = $ID; + //if ( $update ) + $post_ID = $ID;
The third chunk is just a strategically placed print statement. The fourth chunk adds the post id to the fields that are inserted into the database.
@@ -142,12 +145,14 @@
menu_order = '$menu_order'
WHERE ID = $post_ID");
} else {
+ printf(__(' Running insert query'));
$wpdb->query(
"INSERT IGNORE INTO $wpdb->posts
- (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
+ (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, ID)
VALUES
- ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");
+ ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$post_ID')");
$post_ID = $wpdb->insert_id;
+ printf(__('||| end of insertionn with id %d'), $post_id);
}
The second part of the patch makes WordPress extract the post ids from the exported MovableType data. The first chunk ads the ‘ID’ field as a parseable token
@@ -222,6 +222,9 @@ case 'AUTHOR' : $post_author = $value; break; + case 'ID': + $ID = $value; + break; case 'TITLE' : $post_title = $wpdb->escape($value); break;
Then we also send this information to the wp_insert_post function in the second chunk
@@ -281,8 +284,9 @@
$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
- $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
+ $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'ID');
$post_id = wp_insert_post($postdata);
+ printf(__('Id was %d, wanted %d'), $post_id, $ID);
// Add categories.
if (0 != count($post_categories)) {
wp_create_categories($post_categories, $post_id);
These things will probably slightly change with new versions of WordPress, but hopefully it stays similar enough so that people can figure out how to apply it.
Finally I also had to make sure that the old blog feed remained available, because WordPress uses a different address for its feed. I accomplished this with the following .htaccess rule
RewriteRule ^index.rdf$ /blog/rdf [R,L]
I know, it’s not so subtle, doing a full redirect to get the feed right, but I couldn’t figure out how to do it in any other way. What seems to be happening is that WordPress’ internal redirect system interferes with this rule unless I do a full redirect. If anybody has a more elegant solution, I’ll be glad to hear about it.
I think this needs to be put up on the WordPress wiki, because the information there is sooo out of date. Unfortunately I spent way too much time working on this, and so I don’t have that much time to do it, but hopefully after writing it all down, I’ll be able to find the time to stick it there as well in the near future.
Airports suck
Saturday, April 8th, 2006Airports suck. Big time. I’ve been sitting at the airport for about 4 hours now. First it seems like every flight is delayed. OK, that happens, bad day. Fine. So I waited the extra 30 minutes before boarding. Then the extra 30 minutes when it took them that long to bring a wheelchair for a disabled passenger. Guess where the wheelchair was? About 3 minutes away, slow walking. Then we boarded the plain and commenced to wait another 30 minutes after being told we will depart shortly. After waiting the pilot announced that apparently there was a problem with the oxygen system on the plane and it’ll take another 2 hours to diagnose it. Diagnose it?! And then what? Another 48 hours to fix it?
Over all of that the wifi connection in the airport isn’t free. OK, it’s $8, I’d pay that to be able to spend these 4 hours productively. Guess what? With 3 tries to pay the goddamn provider, I still could do it. Every time I submit my credit card details the connection times out after 5 minutes of waiting. I just hope to god that they didn’t triple charge me for half an hour of frustration and nothing more. How do these guys still stay in business?
I need a way to sue them or something.
</rant>
Fedora on the Mac Book Pro
Wednesday, April 5th, 2006Having had a Mac Book Pro for about 2 weeks, I’ve been trying to get Fedora on it. Initially the reasoning was to get a live cd working (using Kadischi) and then hack anaconda to be able to install on to the Intel Macs. The biggest problem we had was to compile the Fedora kernel with the patches from the mactel-linux project.
Now that’s no longer needed. Today Apple released a firmware update that emulates BIOS in order to support their Windows install helper, Boot Camp. My first reaction was: OMG!
Right after that I tried to stick the Fedora Core 5 i386 install DVD and rebooted. The DVD got recognized as ‘Windows’ in the graphical boot menu, it then proceeded to boot the kernel, and start up anaconda. I had to quit it when it wanted to erase my hard drive because it was partitioned with GPT (GUID Partition Table). But now we have something much easier to work with.
Hurray!
Phishing sucker
Tuesday, April 4th, 2006Today for the first time I fell for a phishing attack. I now realize how vulnerable everybody actually is to phishing. I always considered that only suckers and very naive people fall for these things, I mean they are pretty obvious, aren’t they?
Yes and no. Although I’m semi-paranoid about my personal details and the security of my information, I managed to fall for one of these things. And it wasn’t even that amazingly done. So what happened? I’ve had a very stressful few days. Between work, getting ready for FUDCon on friday, an exam, and an assignment for the course I’m taking I haven’t gotten that much sleep. I’m pretty much going on automatic for a day or two. Something needs to be done, I do it. Things get thrown on the stack and I take them one by one and try to do them as quickly as possible. Great. How is this related?
This evening I got home from work and was planning on working on my presentation for FUDCon. I’ve already got some preliminary templates and some stuff planned out. I’ve also been planning to buy a computer-USB-cellphone cable to synch my phone contacts with my computer/email contacts. I’ve been looking on ebay and sending a whole bunch of messages to seller asking for answers. This evening I decided to look in my Junk folder to see if any of the replies went there because I didn’t get any. To my surprise some did. Great I read them and moved on. Then I briefly flipped through my other junk mail. I saw another email from an ebay member. Huh? The email was claiming that the member sent me the product and was waiting for my money.
Full stop.
What?
Since the past few days were really hectic I thought to myself did I accidentaly click Buy It Now somewhere? Quickly I clicked on the ebay link and typed in my password. Weird, why didn’t camino remember my password today? Bang, error page. Weird. Why didn’t ebay accept my password? I open up another browser window and go to www.ebay.com, type in the password. Smooth sailing.
Suddenly reality sets in. Crap. I went back to the first window and saw that they didn’t even mask the address bar with some JavaScript trick. That’s right. The address bar had a clearly non-ebay address. I’m glad that 2 or 3 weird events in a row made me realize my mistake and that I was able to login and change my password within 5 seconds of realizing it. Phew. Most people wont.
Screencasts of DrProject
Wednesday, March 8th, 2006Yesterday Pat and I made screencasts for DrProject, these are available here. We used Wink for the screencasts. Unfortunately version 1.0 of Wink doesn’t support sound throughout the cast, and you can clearly hear my lovely voice in those screencasts
. That’s because we used the 2.0 beta of Wink, which is currently only available for Windows. I have to say that from doing a few of these I get the impression that Wink really rocks! The cruft of doing a screencast took only a tiny proportion of the time that we spent on the whole deal. 90% was spent on figuring out what to say, and trying to do it without hysterical laughter. Right on Wink. I’ll be waiting patiently for this tool to come out of beta so I can use it on Linux.
Photo – inner wall of biomolecular research building
Tuesday, February 14th, 2006A photo taken in the funky building I mentioned in a previous post.






