Monthly Archives: March 2007

pywikipedia Bot Multiple Image Upload

March 31, 2007 » Geek

So I got another email from Dr. Workman about and needing a bulk image uploader script for the pywikipedia bot framework. I decided to not go all out and write my own, like last time and just utilize the script that comes with the default package.

The information was in Excel, and could be exported to a delimited text file, so I chose to open the file, read a line, split it on a tab (tab-delimited file you see) and then have python do a system call to the script with all the necessary arguments.

Pretty rockin, didn’t do much validation or anything, but it seems to work. :) Check it out: jh_multiUploadFromFile.pys

Debugging, BASE, Opera and XHR

March 26, 2007 » Geek

I’ve been going crazy trying to make my new ajaxy review creation tool cross-browser. It isn’t working out at all. IE gets stuck and gives terrible, totally non-helpfull debug information. A line number, but it won’t even specify the script it happened in, or what kind of error it was. Terrible, and I can’t find anything on debugging in IE, a plug-in like firebug would be nice.

I also found out, that as of Opera 9.10, it does not apply the BASE tag to script requests. I don’t know if that’s spec or not, but I had to apply absolute paths to a bunch of XHR’s to get them working in Opera. That one took a while to find, but I found the debugging stuff for Opera, and it’s not terrible.

I haven’t even thought about Safari, I’m kind of scared of it actually. Right now I’m going with a second set of scripts that don’t use all the fancy stuff in them, and I’m using %{HTTP_USER_AGENT} and mod_rewrite to push browsers to the right place.

Good times.

XML, XSL Are Stinkin Powerfull

March 21, 2007 » Geek

I had never really tried to do anything with XML. Looking at an XML file with no help is an intimidating prospect. I figured it was too complicated to bother with, and it’s just for storing things right?

In my file structures class we’ve gotten to XML recently, and today I did my homework for that section. Holy cow is XML cool when you combine it with XSL. The ability to translate a plain XML doc into some nice, clean, formatted XHTML, or really pretty much anything you want is pretty cool. Now I understand.

Tags: ,

C++ Print Binary Function

March 19, 2007 » Geek

A while back I used a function I found on the web to print off a binary representation of a number while I was working on a blowfish implementation in C++. I haven’t finished the blowfish, but I made some changes to the binary function, and thought I’d post it since it is a handy thing to have.

Essentially all I did was set it so it grouped the digits by 4 and padded out the MSB set with 0’s so they all line up.

Here’s an example program, and the results.

Fun with mootools

March 18, 2007 » Geek

I was playing with mootools today, and whilst trying to create a swapping pair of content divs, I put together a neat algorithm for handling the callbacks and getting it to do what I want.

I only wanted one div showing at a time, and I wanted them to swap with a function. So I set up the following guardian variable and functions. Check it out.

It might be a little verbose, but it works like a charm.