Older blog entries for emk (starting at number 13)

XML-RPC: Hack, hack, hack.

I've added support for HTTP Basic Authentication to xmlrpc-c. This required refactoring the client library to use server objects (instead of just URLs). This enhancement turned into a nightmare debugging job, because the following software sucks more than strictly necessary:

  • PHP: Every time I write a non-trivial PHP program, I spend 15 minutes wondering why some variable is unset when it should contain data. Then I realize that I've left out a global declaration, and PHP has silently created an empty local variable shadowing some global.

  • w3c-libwww: Libwww has this weird, asynchronous callback model, and the API isn't especially well documented. Once you define a callback, libwww feels entitled to call it at the strangest of times--during some failed network operations (but not others), during library shutdown, and whenever you look at it cross-eyed. And sometimes libwww will pass you a "200 OK" when it hasn't even made a network connection, and your chunk pointer will mysteriously be NULL. So my code is now laced with incredibly paranoid assertions, and basically trusts nothing returned by the library.

And let's not even ask which festering ball of bugs was truncating five bytes off the bottom of every XML document. But at least everything now works, and passes my evil test suites once again.

Jade: While I'm ranting about broken tools, I should mention Jade (and JadeTex, and TeX, and all the other hairy DocBook tools). This stuff is impossible to set up. It's badly broken in RedHat 6.2. It requires you to edit TeX *.ini files.

If you're not careful, you'll start mumbling the following nonsense in your sleep:

pdftex -ini -progname=pdfjadetex pdflatex.ini
pdftex -ini -progname=pdfjadetex \&pdflatex pdfjadetex.ini
# restore the original pdflatex.fmt file:
pdftex -ini -progname=pdflatex pdflatex.ini

(Thanks to Adam Di Carlo for figuring this out.)

It's just unbelievable how bad this stuff is. TeX allocates everything in fixed size buffers, and hard-codes the buffer sizes into all of its format files. Jade spews out ASCII NULLs, causing JadeTex to cough up a lung. TeX fmtutil wants to have a little talk with you, and find out where JadeTeX hid all the *.sty files. And of course, let's not forget the joy inherent in editing SGML CATALOG files to work around RedHat typos.

But the resulting manuals are fairly pretty... :-)

XML-RPC: Zope exports a complete scripting API using XML-RPC. But to use it, your xmlrpc client library needs to support HTTP Basic Authentication (or maybe cookies, depending on how the server is configured).

xmlrpc-c doesn't support any of these things, yet. But let's see if I can figure out how to do them with w3c-libwww...

XML-RPC: Wrote up a little XML-RPC HOWTO, with lots of examples in a bajillion different languages. Added support for CGI-based XML-RPC servers, too, because ISPs typically hate daemons.

Here's a nice little Perl client from the HOWTO, written using Ken MacLeod's Frontier::RPC2 package:

use Frontier::Client;
$server_url = 'http://betty.userland.com/RPC2';
$server = Frontier::Client->new(url => $server_url);
$name = $server->call('examples.getStateName', 41);
print "$name\n";

Took a look at SOAP (a related protocol), and decided that the W3C overdesigns everything to the point of insanity. So for now, I'm going to take Larry Wall's(?) "bear of little brain" approach: If I can't figure it out in half an hour or so, it probably sucks.

School: Latin quiz tomorrow. Ick!

17 Jan 2001 (updated 17 Jan 2001 at 18:46 UTC) »
XML-RPC: Ho, hum. Lots of downloads, but almost no feedack. I added a C++ client API, and discovered all the wonderful new features which have been added to the language in the past few years. (Sarcasm intended.) But several major users like the C++ API, so that's cool.

I also wrote some scripts that build a complete, tested distribution in one step--tarballs, LSMs, RPMs, etc. This required hacking around with RPM's _topdir macro.

What's next? I dunno, since user feedback has been so skimpy. Either an Apache module, or a "Building a Client/Server Protocol in 15 Minutes Using XML-RPC HOWTO".

Car: I figured out why my car heater was broken. Get this: dodgy fan, dead heater core, chronic low pressure in the coolant system, dodgy thermostat, and a crack in the radiator cap gasket. Fixed most of it with off-the-shelf parts, because I don't want to pay for a rent-a-car while mine sits on some mechanic's lot. Other care and feeding included new wipers, window moisture repellent and a car wash.

Personal: It's time to restructure my schedule. This means daily exercise, plenty of solid productivity time, and time off in the evenings. I've done this for long periods of time before, and it makes me happy. I'm sick of erratic shcedules and conflicting responsibilities, so it's time to shape things up.

7 Jan 2001 (updated 7 Jan 2001 at 00:14 UTC) »
XML-RPC for C: Whooo! I just spent the holidays hacking on an open-source implementation of XML-RPC in portable C. You can find more information on the SourceForge page.

To make a long story short, XML-RPC packages up a procedure call as XML, sends it to a server using HTTP, and parses the response. It's mostly useful for gluing together distributed web applications, but it's also handy for cross-network scripting. There are XML-RPC implementations for Python, Perl, PHP, Zope, REBOL, LISP, Dylan, Visual Basic, and a bunch of other languages.

Thesis: Now that Christmas is over, it's time to start work on my thesis again. I've successfully modified the d2c compiler to build dispatch tables; now I just need to compress them and write about the whole experience. :-)

13 Sep 2000 (updated 6 Jan 2001 at 23:58 UTC) »

[ Ranting about the Client From Hell snipped. ]

12 Sep 2000 (updated 17 Jan 2001 at 18:58 UTC) »

CustomDNS: OK, it's time to finally fix the authentication system. The problem: the CustomDNS authenticator wants to use its own database tables, not my customer's. The solution: fix CustomDNS to load the relevant SQL queries from the configuration file.

*hack hack hack* Score! It runs! One more billable feature. :-)

Language hacking: I cornered the new professor last night, and asked him to act as faculty advisor for my project. We had a great talk about multimethod dispatch, efficient bounds-checking, whether scripting languages can be compiled, and other groovy stuff like that.

I hope I didn't scare the poor professor away. :-( I can be a bit too talkative, as several people have pointed out.

Accounts receivable: It's that time of month again. Sample conversation: "Hello! Did you ever get my bill? Great! It's been almost thirty days, hasn't it? Oh, thank you. Have a great day!"

There's another version of this conversation. It occurs on a daily basis past the 40 day mark, and it starts to involve other people.

CustomDNS: Lots of new features! The update server is now more modular, and you can add custom extensions. All the SysV init scripts and daemonizaton wrappers just got smarter, too.

Once I clean up the documentation and make some RPMs, I should probably release 0.5.

Language hacking: Hmpf. Designing a language is easy. Designing a good language is hard. You've got to look at each feature, and throw out the ones which don't do enough. But things are going well--the interpreter core is finally starting to shape up.

I hope to turn my language into a research project, and get some academic credit. :-) I'm going to track some professors down later this week. Here's my pitch: "I'm interestred in compilable, extensible scripting languages. There are these really neat papers by..."

Personal: Once my current consulting project is over, I'm going to buy myself some lego Mindstorms as a reward. ;-)

Work: Ah, I'm back among the living. I was under the weather for a while, and I spent the last few weeks as a complete space cadet. Let's see if I can get caught up today, and spend a guilt-free evening with my girlfriend.

MFTL: I spent a few minutes last night setting up a private ZWiki to hold my lanuage design notes. If I can get a cheap co-lo this week, I'll make the wiki public.

Wikis (of any sort) make good design tools. But ZWiki also provides a great bonus: page hiearchies which still posses the Wiki nature. So I can sort all my language notes into categories and keep track of where I am.

Consulting

My client is looking to hire a server-side Java guy. Through a freak co-incidence, one of the candidates is not only familiar with one of the libraries we're using, but was also the library's first major user. Score!

The candidate is also an open source developer, so I tracked down one of his projects and spent a few minutes reading through his code. Looks pretty good...

My Favorite Toy Language

I spent some time last night thinking about MFTL. The basic data model is starting to shape up, but I still don't know how I want to handle numeric types.

LISP implementations have traditionally used tag bits to label object types. All data values (integers, object references, etc.) are represented by a single word, and you have to look at specific bit patterns to infer the type. For example, you might use the two least-significant-bits as a tag:

xx00: 30-bit signed integer
xx11: 30-bit object reference (mask low-order bits to zero and use as a pointer)

Addition and subtraction are easy (think about it). Multiplication and division require some extra shifting. Looking up objects is easy, too--just mask with 0xFFFFFFFC and indirect normally.

The big win: You can generate acceptably fast code, and your data model is easy to make thread safe. The big loss: Nobody wants to use 30-bit integers, not even in a scripting language. So I'll spend some more time thinking.

Personal

Everybody's leaving for school again! It's going to be lonely up here in the northern woods.

4 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!