This is my 400th post, and I waste it talking about delay in getting to work.
In any case, the other day I was delayed in getting to work by a traffic jam on the river. I thought taking the water taxi was to help me avoid this stuff.
This is my 400th post, and I waste it talking about delay in getting to work.
In any case, the other day I was delayed in getting to work by a traffic jam on the river. I thought taking the water taxi was to help me avoid this stuff.
I had the idea that I might photo blog more if there was an easy way to get photos off my iPhone and into a blog post. The easiest way would be to e-mail the photo someplace for WordPress to get it. Unfortunately, most of the e-mail to blog post plugins (and the built-in stuff) just sucks for my need.
I decided to look at the XML-RPC API to see if I could get it done that way, and then write a script to be called out of procmail to create the mail. There is a function there that will do what I want, wp.uploadFile aka metaWeblog.newMediaObject. The specification for that call says that the file being uploaded must be Base64 encoded. No problem, a few line of ruby later and I have everything ready to test an upload. The file goes up, but its unviewable in a browser. A quick check of the file on the server and its revealed to be a text file filled with Baes64 looking data. Somewhere along the line it wasn’t being decoded.
After about an hour of screwing around, I determined it wasn’t anything obvious in my code, so I thought I’d look at the code for WordPress 2.5.1 to see if I missed anything obvious. In reading their code, I found that the WordPress folks forgot something obvious, their code never Base64 decodes it before it writes it to a file. A quick one-line change later, and *boom* I’m off.
Here’s the patch in case its useful to anyone else. I’ll have the script up when I’m done with it.
(Also, in a small bit of embarrassment, I must admit fixing this took me 10 minutes longer than it should because I forgot ; is end of statement in PHP.)
Index: xmlrpc.php
===================================================================
--- xmlrpc.php (revision 7840)
+++ xmlrpc.php (working copy)
@@ -1880,6 +1880,10 @@
$name = "wpid{$old_file->ID}-{$filename}";
}
+ # The specification says that this is base64 encoded,
+ # we should really decode it.
+ $bits = base64_decode($bits);
+
$upload = wp_upload_bits($name, $type, $bits);
if ( ! empty($upload['error']) ) {
$errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
We got a couple Flip Video cameras in at work. We plan to use them to get some stuff for the web and various other things. One thing we’ll do sometime this week is write a review. That being said, Chris took one home to play with to get a feel for them, and caught this moment of awesomeness.
There is an awesome bar in in Washington, D.C. called the Brickskeller. Its my kinda place. Hell, even their domain name is lovethebeer.com. They claim to have the world’s largest beer selection and it certainly looked like they did. Unfortunately, due to season rotation and popularity, some of what we tried to order wasn’t available.
Inspired by the Wingin’ It beer photo stream and my visit to the Brickskeller last night, I’ve decided to start doing a similar thing here. I forgot to get a picture of the Orval Trappist Ale I had last night, but luckily, I can snag one off their web site.
I also had an Oskar Blues Ten Fidy again, mostly because I thought I’d never get that awesomeness again. The guys at the table next to us suggested a Maredsous Dubbel or Triple. I went with the Dubbel. It was awesome.
On a geek note, right now I’m just uploading this into wordpress. I’m not sold on using flickr, but I’m not sure why.
For the first time in about 11 years, I’m seriously considering using another nickname on IRC. I think we can actually blame twitter for this.
When you’re listening to Nine Inch Nails and your speakers get GSM interference from your phone…Â It just fits in as part of the music.
Dinah is 4 years old today. She’s lived her toughest year to date having to adjust to a younger sibling who’s become mobile and takes her stuff now. Here’s a picture from her princess makeover and photo shoot at Disney World.
Yes, hopefully its a lot more than 4 more years, but the title brings the funny to me.
I read this in the dead tree edition of the Tribune yesterday and forgot to make a post bitching about it. Luckily, Chicagoist was there: Congressman Says Second Life Could Expose Kids To Porn, Predators.
Basically, Mark Kirk got his panties all up in a bunch because Second Life have some adult stuff going on and in his opionin its too easy for minors to get into that area. While I understand his concern, I disagree that the government should be stepping in here, even with something as minor as an FTP consumer alert. Parents should be monitoring what their children are doing on-line. If you can’t take the time and/or education commitment to do that as a parent, disable your internet access.
The part that really chaps my hide is the following (quoted from the Tribune):
Kirk said he knew of no cases in which children were targeted by sexual predators on Second Life, but he said he considers the virtual world an emerging danger.
So…there’s been no reported problems, or at least none visible to him, but OH MY GOD! RAISE THE ALARM BELLS! THE CHILDRENS! WON’T SOMEONE THINKS OF THEM??!?!?!!! I hate election year fear-based attention-getting pandering.
For the record, I have no particular love for Second Live either. I’ve played with it a bit but I don’t get all the hype around it. I must just be getting old.
At times, I think I spend more time writing about using wordpress than actually using it sometimes. I’ll need to fix that. Today, thanks to WordPress’s dashboard, I came across the WP-Codebox plugin. THanks to GeSHI, it can color up a lot of languages and fixes some problems I’ve had with other plugins. Honestly, I’ve never been satisfied with any of them. I think this could change that.
Just to show it off, I present to you some random ruby I wrote the other day when I was working on something. I’ll leave it to you to guess what I’m doing and why with this code. (And I also think I could do it better than using a while loop, but I was able to bang it out quickly for what I needed.)
#!/usr/bin/env ruby
require 'fileutils'
srand(Time.now.to_i)
offset = 214
files = Dir['*']
count = 1
while !files.empty?
file = files.delete_at(rand(files.size))
extention = File.extname(file).downcase
name = sprintf('%d%s', count + offset, extention)
puts "#{file} -> #{name}"
FileUtils.move(file, name)
count += 1
end