Author Archive
What I Learned About XML Today
Unlike most people, I tend to enjoy the days that I get up to my elbows in XML. It’s familiar to me and, let’s face it, there are much better tools today then there were seven or eight years ago when I first starting working with XML content.
Today was the day that I decided that a pure XPath solution was the best — I just needed one value out of a a document around 500Kb. No sense in parsing the whole thing into a DOM, or wrestling with StaX or even putting it into a whole XMLBeans structure.
So it was just me, the markup, and[ Java 5.](http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/package-summary.html) And these are the things that I learned:
* You can’t set a default namespace in XPath. If you have an XML document with one, you still have togive it a namespace prefix and a full URI. And, to boot, you have to implement [`NamespaceContext`](http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/namespace/NamespaceContext.html) in a new object and put that prefix and namespace in that object. Yep, more work than it should be.
* I’m a big fan of the tools that they give you with [`libxml`](http://xmlsoft.org/), particularly with [`xmllint`](http://xmlsoft.org/xmllint.html). But did you know `xmllint` has a command line interface that you can type in XPath calls? Very cool indeed! It goes like this:
% xmllint –shell computerbooks.xml
/ > ls //book[publisher="O'Reilly"]
ta- 3
— 1 title
ta- 3
— 1 publisher
ta- 1
ta- 3
— 1 title
Typing “help” will give you the useful stuff that you need.
sqlplus mode
My workplace has inflicted all of us with Oracle. Not only that but [the company's standard SQL IDE tool](http://www.allroundautomations.com/plsqldev.html) is horrid, IMHO. But I was using, wishing I had something better.
Today I saw an entry for [SqlPlus mode](http://www.emacswiki.org/cgi-bin/emacs-en/SqlPlus) on the [Emacs Wiki](http://www.emacswiki.org/cgi-bin/wiki) RSS feed. I had some time this afternoon to install it. And I think I found the ultimate solution.
It’s command-line and that’s not a bad thing for me. You enter your query on the top part of the screen, his C-Return and the output appears on the bottom. There are shortcuts for some common SQL commands and good syntax coloring. Oh, and the output looked really nice in my NTemacs 22 install.
But I think a picture is worth a thousand words:
![]() |
Mercurial
I’ve been hearing good things about [distributed source control](http://blog.ianbicking.org/distributed-vs-centralized-scm.html) and I decided to give it a shot. When I first attempted [Mercurial](http://www.selenic.com/mercurial/wiki/) (Hg, as I will continue to call it) I knew that it was going to be a keeper. And it has been.
Maybe it’s because I’m impatient, but the [QuickStart](http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart) is where I started. After the intital setup, I found the commands to be very similar to Subversion, which I’m already quite familiar with. But the mindset is different. I can work on something locally and make small commits to that version, and finally push that to my production server when I am good and ready. And I can make another copy as a branch and work on something totally different and continue to pull from my production code so I know I’m working on the latest stuff.
One of the nice things is the `.hgignore` file. I like setting this up for files I don’t want to keep track of (`.pyc` files, anyone?) This is nicest at the beginning, of course.
Of course, this is just for my personal stuff. At work we are moving from MKS Source Integrity to Subversion and there is enough moaning and groaning about it. I can’t imagine how heads would spin around a distributed source control system.
Citizen’s Patrol: Life on the Street
Friday night was my first night on the Citizen’s Patrol. It’s really not that big of a deal — we started at 10pm and quite at about 12:45am or so. I didn’t know the other guy well, but he drove and I kept the paperwork. We drove around and around our neighborhood. I saw more nooks and crannies of the neighborhood than I ever knew was there.
We didn’t do much — chased some kids out of the elementary school parking lot and called some people because their garage doors were open. I knew one family — they have a daughter that plays with Leah once in a while. The lady of the house, Stacy, is a pretty good egg and has a great sense of humor. So I played it up a little:
Stacy: (a little nervous) “Hello?”
Me: “Good Evening. This is Mike Hostetler of the Citizen’s Patrol.”
S: “Yes?”
M: “We thought you should know that you left your garage door open.”
S: (shocked pause) “Really? Oh thank you!”
M: “Just doing our job, M’am.”
So let’s back up a few months. We had a chocolate chip cookie bake-off at our neighborhood picnic and Stacy won. Her prize? A dollar coupon for a nearby cookie store.
Gina was surprised this morning with the sound of the door bell. The visitor? Why Stacy — with a plate full of her prize-winning cookies. And, yes, they are good.
But I was really just doing the job of the Citizen’s Patrol.
On Drupal
If you follow [my delicious bookmarks](http://del.icio.us/thehaas/drupal) you have probably noticed a lot of bookmarks on [Drupal.](http://drupal.org/). I’ve chosen Drupal for the next step of the Secret Project.
Why Drupal? It’s well supported and documented, it has really nice modules, and it’s permissions system seems perfect what what we are trying to do. Of course, with flexibility comes complexity and I’m fine with wading through that. But it’s hard when things just don’t work right.
I wanted to at least try install Drupal in PostgreSQL, and it says it’s possbile but the install only gives you the option to put in MySQL info. Okay, I’ll play with it in MySQL. That went fine — the install itself was incrediably easy.
Next I tried to install [the TinyMCE module](http://www2.drupal.org/project/tinymce) so we could enter entries in a WYSIWYG method. I followed the directions the best I could but they were a little cryptic. There were some hiccups but probably because I hadn’t installed a module before and I didn’t like the docs. But I was soon able to configure the module but it didn’t work!! I did some googles and found that some people had to dig into the `tinymce.module` file. I messed with the file, but that didn’t seem to work. Then, suddenly, it works! I’m not sure why or how, but it’s working now . . .
So then I tried to install [the Control Panel module](http://drupal.org/project/controlpanel) and had worse luck — it won’t even show up in the Module list! Maybe it’s because I have Drupal 5.x and maybe it hasn’t been updated for the 5.x series. I dunno.
There I’m a little frustrated but I’m going to continue on with it. Drupal has features that I need the other CMS doesn’t really have (like Joomla). And many sites use it and, after wading through the configuration I think it will work nicely for us.

