PyBlosxom plug-in: latest_comments.py

latest_comments.py

You may have noticed a new feature on Copia. This one was inspired by a feature from Burningbird (Shelley Powers' blog). Copia now lists the last ten comments posted, with links to the author and the referenced entry. This weekend I wrote another plug-in latest_comments.py, which implements this feature. from the doc string:

Generates a template variable, $latest_comments, which contains a listing of the most recent comments to the Weblog, in the form:

<div class="comment-link">
Author 1
on
Entry 1 title
</div>
<div class="comment-link">
Author 2
on
Entry 2 title
</div>

This plugin requires the comments plug-in (comments.py).

This module supports the following, optional config parameter:

latest_comment_count - the number of comments to include in the
                         output (default 5)

It's taken a beating over the past few days, and held up OK. James Governor exposed a Unicode bug when he tracked back to an entry with a title using high characters. That's all fixed now (it took down Copia for a little while).

I release it under Creative Commons Attribution-ShareAlike 2.0 License (I really need to iron out the CC licensing throughout Copia).)

Let me know what you think. I need to get all these plug-ins into CVS and into the PyBlosxom registry one of these days.

[Uche Ogbuji]

via Copia

XML recursive directory listing, part 3

In parts 1 and 2 I discussed code to use Python to recursively walk a directory and emit a nested XML representation of the contents.

Dave Pawson built on my basic techniques and came up with dirlist.py, a fully tricked-out version with all sorts of options and amenities. Well, he wasn't even finished. He sent me a further version today in which he "tidied up [the] program, and added options [for file] date and size."

Cool. I've posted it here: dirlist2.py. If further versions are toward, I'll move it into my CVS. Dave is a self-confessed Python newbie. I had to make some quick fixes just to get it to work on my machine, but I haven't had time to carefully vet the entire program. Please let us know if you run into trouble (a comment here should suffice).

Usage example:

$ mkdir foo
$ mkdir foo/bar
$ touch foo/a.txt
$ touch foo/b.txt
$ touch foo/bar/c.txt
$ touch foo/bar/d.txt
$ python dirlist2.py foo/
Processing /home/uogbuji/foo
<?xml version="1.0" encoding="UTF-8"?>
<directory name="/home/uogbuji/foo">
  <file name="a.txt"/>
  <file name="b.txt"/>
  <directory name="/home/uogbuji/foo/bar">
    <file name="c.txt"/>
    <file name="d.txt"/>
  </directory>
</directory>

$ python dirlist2.py -d foo
Adding file dates
Processing /home/uogbuji/foo
<?xml version="1.0" encoding="UTF-8"?>
<directory name="/home/uogbuji/foo">
  <file date="2005-05-09" name="a.txt"/>
  <file date="2005-05-09" name="b.txt"/>
  <directory name="/home/uogbuji/foo/bar">
    <file date="2005-05-09" name="c.txt"/>
    <file date="2005-05-09" name="d.txt"/>
  </directory>
</directory>

$ python dirlist2.py foo/ foo.xml
Processing /home/uogbuji/foo
$ cat foo.xml
<?xml version="1.0" encoding="UTF-8"?>
<directory name="/home/uogbuji/foo">
  <file name="a.txt"/>
  <file name="b.txt"/>
  <directory name="/home/uogbuji/foo/bar">
    <file name="c.txt"/>
    <file name="d.txt"/>
  </directory>
</directory>

[Uche Ogbuji]

via Copia

Using 4RDFs Triclops from Commandline

I recently merged an old RDF graphing library (within 4Suite) into the 4Suite 4RDF command-line in preperation for the beta release. The library is called Triclops. With this addition, the 4RDF command-line can now render RDF graphs into a representative SVG or Jpeg diagram.

Using Graphviz

Triclops makes use of Graphviz to render .dot graphs (generated from RDF serializations) into various formats. One of the advantages is that Graphviz's neato can be used to apply a spring graph layout algorithm to the final graph. This often results in a more informative layout of the final graph than the default. The downside is the large amount of processing needed by this function.

4RDF Options

Below is a listing of the 4RDF command-line options

The Triclops integration consists of 3 additions:

First, the additional values to the -s / --serialize option:

  • svg
  • jpeg

Second, the -g / --graphviz option (which is required when either of the above options are used) takes the path to the dot / neato executables. And finally, the -l / --spring option requests that neato is used instead of dot. This results in the spring algorithm being applied to the graph.

FOAF example

To demonstrate, I'm using the Dan Brickley FOAF example (as listed in the specification). In the terminal below, I list the content of the FOAF document, then convert it to a jpeg diagram first and then an SVG diagram right afterwards (using neato to layout the graph). On my machine, the dot and neato executables are located in /usr/bin, so I set the -g option accordingly:

The generated jpg diagram is below while its svg alternative is here.

Another example

Below are jpeg and svg diagrams of the 4Suite Repository Ontology (modeled in OWL):

My long-term plan is to make Triclops completely configurable so that the generated graphs are tailored to the user's specification for things such as the font used for text, how to format blank nodes, etc. Porting it to use Pydot might go a long way in this regard.

[Chimezie Ogbuji]

via Copia

House of Brilliant Cinematography

(Warning: contains minor spoilers)

Every once in a while I see a movie that seems to have no precedent in one or more areas and I recently added House of Flying Daggers to that list. To be honest, cinematography was never a category of film making that made as much a difference to me as story, character development, and originality (in that order, for me). That all changed when I saw Hero. Often, I would remember only select scenes that stood out from movies that were particularly beautiful. Hero was the first where I remembered the movie primarily because of the powerful use of color for the specific purpose of enhancing the process of story telling.

Inevitably this movie will be compared to Hero, mostly because it's useful for those promoting it to associate it with predecessors (such as Hero and Crouching Tiger Hidden Dragon) that made the transition to a western audience successfully.

Besides, the role of Ziyi Zhang (remind yourself to exhale and lookaway) it mostly has only the use of superior cinematography in common with Hero. Firstly, it is less martial arts than it is a powerful love story. Even having never seen an Opera before, I was struck by how the only comparison / analogy I could make with this movie is that of an Opera where the artistic medium was color and motion and not music.

I recall seeing a documentary (The Art of Action: Martial Arts in Motion Picture) chronicling the development of the martial arts genre (narrated by Sammuel L. Jackson) where he mentions that the early martial arts movies grew out of the tradition of Peking Opera and I couldn't help but feel that the director must have had it in mind to bring this influence full circle. The motion, costumes, and use of color and theatric melodrama to underscore the themes of romance and bravery were very reminicent of the footage of early Peking Opera shown in that documentary.

My favorite scene is where Ziyi Zhang (who plays the blind daughter of the leader of the House of Flying Daggers) performs an 'Echo Dance' for a soldier. The scene epitomizes what works so well in this movie: the use of slow-action shots (imagine the scenes from the Matrix without freezing the other elements in the shot) of incredibly choreographed interplay between characters. The martial art scenes (though fewer than probably expected) are very well done and never seem forced at any point.

I would definitely suggest this movie to anyone bored with Hollywood's offerings as of late and looking for something refreshing to hold their attention. I would also definitely suggest this to anyone who saw Hero and was as moved by it's originality as I was.

[Uche Ogbuji]

via Copia

XTech 2005 is coming

XML Europe has become XTech in 2005 (it now covers Web technologies overall, not just XML, and there will be a heavy Mozilla presence). The event is just around the corner, with tutorials on May 24 and the main conference from the 25th through the 27th in Amsterdam](http://www.xtech-conference.org/). Chaired by the very capable Edd Dumbill, this has consistently been my favorite conference. I'll be there again, presenting "Matching Python idioms to XML idioms" on the 25th. Check out the XTech 2005 wiki for more info.

Come to XTech for the technology, but you'll remember it for the people. Here are some of mine from XML Europe's past:

Bob DuCharme's panoramic shots of RDF heads at XML Europe 2004 (Amsterdam):

James Clark and me at XML Europe 2003 (London):

Edd and me at XML Europe 2003 (London):

I'll be in Amsterdam from the 24th (I'll probably be sleeping all that day) to the 29th (leaving early that day), and I expect I look forward to having a good time with colleagues while there.

[Uche Ogbuji]

via Copia

Quotīdiē

December, Christmas left trees gift-less
Looking like Santa lifted all the kids' gifts from their wishlist
Persistent, Stan had a scheme up his sleeve
To get paid and hide away since Y2K New Year's Eve
This year's hype, the price of clothes designer Donna Karan's ice
Worth more than the one Kobe bought his wife
Times square, dressed as cops they let 'em in
Where Donna settled in, Stan had a friend at Con Edison
So 11:59 the ball dropped, ABC...Dick Clark...
When it hit 12 o'clock it went dark
Pandemonium, police pleading: "Please don't run"
Emergency lights, by 12:01 they're done
Donna there, stripped to her brassiere and underwear
Neck and ears clear as Stan and Jerry disappear
Happy New Year!

Wordsworth—from "12 Months", Mirror Music

If you watch MTV, you probably know Wordsworth from The Lyricist's Lounge Show, a sketch comedy program where the sketches were rapped in rapid-fire New York style (my guess is that the show didn't last because listeners who were not used to the best lyrical rap just couldn't follow quickly enough). My favorite LL skits include Mos Def's political debate with Master Fuol ("Fuoliani"), the one with the thug trying to convince St. Peter to let him into heaven (I forget who played the parts now), and the one with Wordsworth trying to rap Mos Def out of a suicide bid on a supposed high-rise ledge.

Wordsworth uses his B.A. in English (from Rutgers University) to full effect, but he puts a very hard-core battle-rap edge on his articulate flows, and it's all quite well polished on Mirror Music. It's almost a no-FF record (meaning that I'm not tempted to skip any tracks), and coming close to that status is very impressive for any record. "12 Months" is my favorite, though. W shows off his very tight story- telling in this yarn of two broke kids who try out bottom-of-barrel jobs, and then take up petty theft, and finally pull off a big robbery of Mrs. DKNY. Probably nothing kids would be assigned to listen to at Sunday school, but, hey, entertainment is rarely much for morality. The point is the writing: past-paced, and yet with enough detail to paint a vivid picture, with clever little touches such as the mention of Y2K, which suggests that the New Year's gala attendees would have assumed the blackout was the result of the infamous bug, rather than a pair of stick up kids and their accomplice at the electric company.

If you're the sort that cares about music reviews, you'll find that I'm not the only one loving Mirror Music. On Amazon it nabs 5 stars over 13 reviews. See also (1 2).

Lest I forget to mention W's superlative record of guest spots on other records, check out the lyrics to W's part in “Twice Inna Lifetime” on Blackstar:

“Yo, we fortified live, supporting allies
The wack is trying to shorten our lives, it sorta waters my eyes
But here is something the crying talk about
The verse on that cassette you and cousin fought about
That led to God and Satan's falling out
Encourage the liquor for those who ain't here that you pouring out
On 3-way, your parents, preacher and spouse called my house
Revive or ruin, my theories of mics
Sony or Aiwa, black or white, I fit in all stereotypes
Search for a cast to plot, I make you a laughing stock
So shook, I could walk a half a block and feel the aftershocks
Rain of acid drops, seek some help
Now don't rewind, get it the first time,
Shouldn't have to repeat myself
Eternally verbally, I have numbers, succumb to time outs
In rhyme bouts you'll dial 9, just to get a line out
Known fact or factors and non-rappers fractured
Results in more cast appearances than a hundred actors
Emcees I'm testing like diseases injected in gerbils
Wordsworth, Kweli, Hi-Tek, Reflection Eternal..what...

[Uche Ogbuji]

via Copia

Just ixnay on the Sys-Con, hey?

I've kept a curious eye on the whole Maureen O'Gara/Pamela Jones soap opera (1 2 3 4). Looks as if it's come to yet another head today as ("The entire senior editorial staff of LinuxWorld Magazine has today announced that they will be leaving the magazine, effective immediately.". (via Micah Dubinko).

We regret that Sys-Con Media has been unable to apply a standard of journalistic ethics that we can comfortably operate under. We feel that recent articles published with the consent of Sys-Con Media fail to meet minimum generally accepted journalistic codes, and because the management of Sys-Con Media has failed to acknowledge that the articles are by all informed judgment ethically unsupportable, we have decided we must find other avenues for our work.

Turner's move is certainly common sense principle, given the facts, but it's also brave, given the economy. Where common sense seems to have failed is in the management of Sys-Con media.

I've always looked rather askance at this outfit, but for lesser reasons in the past. For one thing, their policy standard of payment to authors of original work is abysmal, especially in light of how thoroughly they saturate all their outlets with advertisements. I was particularly amused recently when they invited me to "channel" my blog through their aggregator, and when, out of curiosity I wen to see the expected destination site, I found that the space in which actual blog entries would be presented was completely wreathed in loud, overbearing advertisements. I declined the invitation, of course.

But this latest display of fecklessness on Sys-Con's part is quite enough for me. Never mind the ninnies that perpetrated DDOS attacks on Sys-Con Web sites, the civilized response is the direct opposite of DDOS: just stay away from Sys-Con. I, for one, plan to do so quite conscientiously from now. In order to help me be sure I know their slime well enough to avoid it, I put together a list of Sys-Con properties:

If anyone knows of other outlets used by these buffoons, please leave a comment, and I'll try to keep the list updated.

[Uche Ogbuji]

via Copia

Quotīdiē

I was born in Calabar and my first musical impression comes from there. I listen to the Efik inhabitants. and lgbo settlers there. And of course you know, in that area they play a lot of drum.

—Bayo Martins—biographical interview by Wolfgang Bender of The Music Foundation, Nigeria

That's our heritage here on Copia. Through our father, Linus Ogbuji, we're from Umunakanu, near Owerri (Igbo area). Through our mother, Margaret Ogbuji, we're from Ikot Ana (Umon area), about 50km from Calabar (Efik area) with which our family has strong ties (I, Uche, was born there). The strong ties between Calabar area peoples and Igbo peoples are just as Mr. Martins describes, and in music it's a very interesting combination, as shown by the Igbo/Efik grounding of the late Prince Nico Mbarga, one of Africa's greatest musicians (despite the tragedy of his early death). Prince Nico is best known for Sweet Mother, the biggest African hit ever, and still one of the best-known songs throughout the continent.

Mom and Dad (Mom especially) introduced us to Prince Nico's music even while we were living in the US, before returning to Nigeria, where we found ourselves amazed at the diversity of musical styles from Nigeria alone, never mind all the imports from the rest of Africa (and the inevitable pop hits from the US and Europe). Prince Nico's music is highlife, which is a Ghanaian style that merged with Zaïrean style (which informs Zap Mama) and found a very warm home in Eastern Nigerian. The predominance of that Eastern Nigerian musical tradition were very strong everywhere, despite the combination of political concerns and musical experimental that brought about a rapid growth in regional styles. It's important to note that the third point on that triangle was Lagos, which despite all its problems has always been an amazing furnace of cosmopolitan energy. This is where the Eastern musicians joined their Western colleagues in legendary jam sessions to hammer out styles that are now world famous (not always through direct appreciation of the specific musicians, but always through their influence on music worldwide).

[Becker, asking about the attendance at the launching of the Zeal Onyias Band (started by Martins and friends) at the Ambassador Hotel Yaba, Lagos]: Were they all Yoruba?

[Martins]: No, it was mixed: Igbo, Yoruba, Hausa, Efik, Nigerians. It was a big scene, a crosscultural gathering. Apart from the English language, popular music was another great rallying point for all Nigerians. Like we say Highlife was the melting pot of the various ethnic musics. In fact it is for me the first Nigerian culture that evolved. Before then if one was from another ethnic group it was difficult to understand or to dance or even appreciate the music of another ethnic group. But with Highlife every Nigerian could dance: Be they Yoruba, lgbo, Hausa or whatever, Highlife was one thing that crossed beyond the traditional specialized mould. It was something every Nigerian could identify with because it was 'detribalized' and de- ethnicalized. And then we did not only play Highlife, we played classical ballroom music too, waltz, tango, foxtrott, blues etc.

(Throughout the excerpts I've corrected typos that look like the result of OCR applied to scanned originals, leaving other typos as they are).

Mr. Martins describes his journey from Calabar through Lagos, Enugu (Igbo country), and then the leap to Accra and Kumasi in Ghana, and the further leap to London, and later on, to Germany. The following is from his very entertaining description of some of the hazards of the journey from Lagos to Accra.

Few months after that we had to go to Accra because Bobby had a six month contract there. From Lagos to Accra in those days unlike today was rough and we had too many bridges to cross and two or to three rivers upon which the car is ferried across. Like from Lagos to Idiroko. On getting to Togo there was a place called "Grand Popo". l am not sure if it exists anymore. l think its been swept away by the sea. There was a tug boat used to ferry the trucks and passengers from one end to the other before one could drive into Togo. And after Togo there was another crossing on the Volta-River before getting to Accra where we disembark and get into the pontoon to be ferried across. Sometimes, we slept in the middle of nowhere in the bush. Nothing around us but us. The car parked, we made camp fire besides the car and everyone climbs to the top to sleep. That was on our own risk. It was fun and we enjoyed doing it.

This is a good example of Martins' plain and matter-of-fact style. He writes mostly about the '50s, which is a time when West Africa was vastly different in so many ways. He doesn't shrink from the awful memories as well as the precious ones (his story about cleaning up overflowed sewage is sickening in an understated way). By the time I returned to Nigeria in 1980, things had changed greatly, some for better, some for worse (mostly for the better in that case). By the time I left Nigeria again eight years later things had changed greatly again, some for better, some for worse (mostly for the worse that time). The stories of all these changes are important for us to keep, especially from the personal viewpoint of sharp observers such as Martins. He talks about playing for some of the names whom all Nigerians will recognize as having been crucial players in these changes.

This was the period that the modern elites those who were to become permanent secretaries, solicitors general, prime ministers and presidents were returning home from Britain and the United States, and congregated in Lagos. The night-club, apart from the billiard tables and tennis courts, was a social outlet where they freely integrated and interacted with others. Dancing was a favourite past time of most them. And what marvellous dancers most of them were! l still remember a few like Bayo Braithwaite (the insurance and assurance magnet), Sunny Adewale (Chief, lawyer)'the boy is good', T.OJ:). Benson (Chief, lawyer, former federal minister of information in the first Republic), Dr. Nnamdi Azikiwe ( first President of independent Nigeria), Fani Kayode (Chief, lawyer former deputy premier of the now defunct Western Region), Freddy Benson ( 'Baba Kayode', an automobile engineer of Benson Transport Service ), Bode Thomas (Chief, lawyer and nationalist). Shola Macauley (business man) amd Tommy Rose (our taylor) among others. Chief Awolowo was the one man who hardly danced and betrayed emotions at such gatherings he attended in which l played with a band. l used to wonder often about that. So l was pleasantly surprised when he formed a band in 1979 for the Unity Party of Nigeria. However for the smart ones in the band to meet and talk with these eminent and distinguished men was a great privilege. Therefore the night- club for us was a great institution of learning and of assimilation: Ideas and knowledge floated freely from both black and white audiences.

It's fun to get the occasional etymology lesson

[B]: What about other expressions for prostitutes like waka-waka baby and ashewo?

[M]: Yes, waka waka baby like Rex Lawson termed it. Ashewo is the Yoruba word for prostitute. Waka waka is Pidgin English or coloquial for a women that goes from one setting to the other. She was a walk-about woman, thats what waka waka means in short.

[B]: And that expression in Yoruba could have other meanings or is it a traditional expression? Or is it a common place in Yoruba?

[M]: Well, ashewo itself means exchanger of money.

[B]: [It] doesn't mean more than that?

[M]: No, it implies that you exchange money for your body.

Straight rolled into a street sociology lesson

[B]: What women were these usually? What training did those women have? Where did they come from? From the city, from the country?

[M]: They belonged to various categories. Most of them had been married some time in their village to men they did not like or something like that. Some just wanted to experience life in the city and to get away from the villages. Others simply wanted good time. There were some fresh from the schools who didnt actually know what to do but throbbed with the music, the modern music and they loved it. They liked the socialization in the club. Then there were educated women who were ambitious and seeking opportunity to further enhance their lives. So it was a mixture of all these interests and backgrounds that one sees in the night-clubs. Not all of the women that one saw in the night club were dedicated prostitutes. Some were there just for the fun of it and satisfaction.

[B]: That reminds me of the argument that Highlife provided liberty or that kind of feeling to men and women in a way. Not to say that these women were prostitutes. Some of these were women breaking away from their traditional bondage and tyranny?

If you find these excerpts interesting, do read the entire interview. It's long, but very entertaining. Since the interviewer is German, Martins takes care to explain a lot of the phenomena that may be hard for a non-Nigerian to understand.

[Uche Ogbuji]

via Copia

Reconsidering blogrolls (and what the heck are "folks", anyway?)

In Shelley Powers entries "Ms Pancake" and "Let’s keep the Blogroll and throw away the writing", I've learned that there is some controversy about blogrolls. When I threw together Copia I tossed in a blogroll, which was just a random list of blogs I read. I hardly worried that the list would grow too long because I have limited time for reading blogs.

Shelley's posts made me think about the matter more carefully. To draw the basic lesson out of the long and cantankerous points in her blog entries (and comments), a blog is about communication, and in most cases communication within a circle (if an open and, one hopes, expanding one). Based on that line of thinking, Chime and I had a discussion and thought it would be best if rather than having a "blogroll" list of blogs we read, we had a list of other Weblogs with which we have some more direct and reciprocal connection. This includes people with whom we've had personal and professional relationships, and also people who have taken the time to engage us here on Copia. There is still some arbitrariness to this approach, and there is some risk of turning such a listing into the manifestation of a mutual back-slapping club, but it does feel more rightly to me. We do plan to post an OPML as a link on the page template, so people can check out what feeds we read (if they care); this feels the right compromise to me.

So there you have it. The list of "folks" on the left hand side, are people we feel to be in the Copia circle. We hope and expect it will expand.

[Uche Ogbuji]

via Copia