Copia goes down, thanks to logstats plug-in (?)

So this morning I noticed Copia was down. Requests would hang until they timed out. Apache seemed up, and running pyblosxom.cgi directly worked fine. I enabled the CGI debug line:

import cgitb; cgitb.enable()

But this didn't help. It felt like an infinite loop somewhere in the guts of processing. After fitful debugging efforts (got work piling up), I traced the problem to the logstats.py module. My approach in the end was to use py['load_plugins'] in config.py, comment out all plug-ins, and uncomment them until I found the culprit. It was really cool to uncover comments one by one and see different aspects of the site start working step by step. It really reinforces the power of PyBlosxom's "microkernel" approach. My resulting config was:

py['load_plugins'] = [
  "comments",
  "firstdaydiv",
  "keywords",
  "logrequest",
  #"logstats",
  "meta",
  "metatime",
  "pyarchives",
  "pycalendar",
  "pymarkdown",
  "trackback",
  "xmlrpc_blogger",
  "xmlrpc_metaweblog",
  "xmlrpc",
]
#The above list is only for debug purposes.  If *not* debugging,
#Uncomment the following line
#del py['load_plugins']

I'll have to check later into what;s causing logstats.py to kill the server, but other PyBlosxom users might want to take note.

[Uche Ogbuji]

via Copia

Thinking XML #31 pubbed

Thinking XML: Schema standardization for top-down semantic transparency

Subtitle: The state of the art in XML modeling includes reusing models designed by others

Synopsis: This installment continues the review of the many different approaches to semantic transparency, discussing what they mean to the developer using XML. One way to save resources on a long journey is to hitchhike. In XML, you can take advantage of countless open schema initiatives that, in effect, use schema standardization for top-down semantic transparency. But it's not all a free ride. In this article, Uche Ogbuji looks at the advantages and disadvantages of third-party schema reuse. He also takes a moment to discuss The Semantic Technology Conference 2005, and respond to some recent discussion on the difficulty of modeling people's names.

This is a continuation of Thinking XML: State of the art in XML modeling ("What do developers need to know about the various approaches to semantic transparency?"). One more to go in this sub-series, though I'm a bit worried I may not be able to squeeze all my ranged thoughts on semanitc anchors into one coherent article. We'll see. After that, back to the fun hacking, on Python + WordNet.

[Uche Ogbuji]

via Copia

Moving to MetaWebLog API

Getting BloGTK to play nice with PyBlosxom
Updated xmlrpc_metaweblog.py for PyBlosxom, as used on Copia

Eric Gaumer and Ted Leung continue to be my main support in getting up to speed with blogging in general and PyBlosxom in particular. Thanks, guys. Always easier to go a-hacking when you have fellow hackers in the trenches with you.

So Eric's entry was a nudge to finally get MetaWebLog going on Copia. First of all, I applied his patch to BloGTK. Then I set up xmlrpc_metaweblog.py. But first I had to update it to follow my convention of storing entries within directories for each date. If anyone else would like to go with that convention, you might want to check out my custom version of xmlrpc_metaweblog.py, linked above.

I'll specify a trackback when posting, to see if it does the trick. I'll post a comment with the apparent results.

But first of all, I'll save my blog entry to a local file. I'll be doing that a lot while using BloGTK. It has exhibited a few weird, not-obviously-reproducible quirks from time to time that worry me a bit. Unfortunately, the author has apparently abandoned the 1.1. branch in favor of BloGTK2, so I guess there will be some more hacking to do. Lucky thing I know Python. Even luckier thing Eric's learning Python so rapidly. At least the BloGTK2 preview looks cleaner. I'll look forward to it.

[Uche Ogbuji]

via Copia

Quotidie

                       Now the hedgerow
Is blanched for an hour with transitory blossom
Of snow, a bloom more sudden
Than that of summer, neither budding nor fading,
Not in the scheme of generation.
Where is the summer, the unimaginable
Zero summer?

-- T.S. Eliot -- "Little Gidding"

I already posted a quote from the first movement of "Little Gidding". Leave it to Colorado to impishly reply with a reason to post more from that great work. I wouldn't be surprised if the unimaginable zero summer, when it did venture outside of Antarctica, teased a bit around the Front Range before returning to its home. Then again, winter never seems to have sure dominion here (300 annual days of sunshine and all that), so it's fitting that it gets to sneak up on us at odd times, and give us a smart blow.

[Uche Ogbuji]

via Copia

Quotidie

Six a.m. -- getting out of bed again
Can’t get back in -- ‘cause sleep ain’t gonna pay the rent
Day to day -- they've got you working like a slave
Taking credit for the work you gave and stealing your raise -- well I...
I know you’re down, when you gon’ get up
I see you're down, when you gon’ get up

-- Amel Larrieux -- "Get Up"

Ah, one of the best songs to wake up with (or fall asleep with, or just...). If anyone could be said to have a voice that caresses the ear, ex-Groove Theory chick has it on lock. Her voice is a soft, succulent marvel. And I love the mellow-but-odd stylings of the video. And "Get Up" just the intro to one of the best albums that came out at the turn of the century. Oh, you slept on it like everyone else? I see you ain't down. When you gon' get up?

[Uche Ogbuji]

via Copia

Cookbooked, indeed

I learned from James Kew's blog that one of my Python Cookbook contributions made the second dead tree edition. He even has a nice pic scanned in:

12.10 Merging Continuous Text Events with a SAX Filter

Pas mal, ça. I should point out that I have an even more souped up version of that code available as part of Amara (class amara.saxtools.normalize_text_filter).

Hey, best news of all is that I suppose that means I'll be getting a copy of that book sometime soon (others, including Kew, have reported already getting their copies, but mail trucks struggle a bit making the chug up the hills to the Front Range). Bet. I'm looking forward to it.

[Uche Ogbuji]

via Copia

Serving up UTF-8 in PyBlosxom

It's 2005, people. No room for blogs and other sites without the most basic underpinnings of i18n. Turns out serving up UTF-8 from PyBlosxom is not the complete slam dunk I expected. To be fair, getting it to send UTF-8 was easy, given instructions in the config file. You want to add to your config a line such as:

py['blog_encoding'] = "utf-8"

This does cause PyBlosxom to render UTF-8 pages. But you also have to be sure the browser knows the pages are in UTF-8, or most browsers I've found will default to ISO-8859-1 and thus garble non-ASCII characters. I tried using HTML meta, by adding the following to the head template for my flavor (head.copia):

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

But this was not enough. Browsers rightly prefer to believe the HTTP content type header, so the trick lies in the content_type template for your flavor. Most HTML templates you find out there contain only text/html. You want to expand this to

text/html; charset=UTF-8

Your browser probably gives you a "page info" display of some sort with which you can check that your content type header is right. In Firefox 1.0.2 it's Tools -> Page Info or Ctrl+I. See the following example dialog:

Firefox page info dialog for Copia

[Uche Ogbuji]

via Copia