Sleepycat Software recently released Berkeley DB XML 2.0, a native XML database built on top of Berkley DB. The major change from DB XML 1 to 2 is the addition of XPath 2. and XQuery 1.0 support. Here’s what I did to build and install DB XML 2.0 along with python bindings on OS X 10.3.7.
Having previously built DB XML 1.0 on OS X, I was pleased to see that all of the prerequisite libraries (Xerces-C, Pathan 2, Berkeley DB) are now included in the DB XML source package. After downloading the tarball from the website (see link above), extracting it and building everything was easy:
%> cd /Users/jclark/ext
%> tar -xzf dbxml-2.0.9.tar.gz
%> cd dbxml-2.0.9
%> sh buildall.sh
The buildall.sh script creates an install directory in the build root and installs all of the packages to this location. This gave me the following dir structure:
Users
+ jclark
+ ext
+ dbxml-2.0.9
+ install
+ bin
+ docs
+ include
+ lib
Next I wanted to build python support, which is not built by buildall.sh. The README cautions that the python bindings require the pybsddb package, which ships with python 2.3 and later, but which must be compiled against the same version of Berkeley DB as XML DB (the XML DB package builds BDB 4.3.0 from source). OS X 10.3 comes with python 2.3 installed, but the default copy of bsddb doesn’t seem to work. I downloaded the pybsddb for BDB 4.3 from Sourceforge (via link above), and built it. Because of the nonstandard install location used by buildall.sh, I had to pass an extra param (--berkeley-db) to setup.py. :
%> cd /Users/jclark/ext
%> tar -xzf bsddb3-4.3.0
%> cd bsddb3-4.3.0
%> python setup.py --berkeley-db=/Users/jclark/ext/dbxml-2.0.9/install/ build
%> python test.py
%> python setup.py install
With a working bsddb, It was time to build XML DB’s python bindings. As mentioned in the main README and in the dbxml/src/python README, the custom BDB/DBXML/etc install location requires an edit to dbxml/src/python/setup.py. I adjusted the paths thusly:
if os.name == "posix":
db_home = "/Users/jclark/ext/dbxml-2.0.9/install"
xerces_home = db_home
pathan_home = db_home
xquery_home = db_home
Building and installing was straightforward:
%> cd /Users/jclark/ext/dbxml-2.0.9/src/python
%> python setup.py build
%> python setup.py install
Time to test:
%> cd /Users/jclark/ext/dbxml-2.0.9/dbxml/examples/python
%> python examples.py test
Traceback (most recent call last):
File "examples.py", line 6, in ?
from bsddb.db import *
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/bsddb/__init__.py", line 40, in ?
import _bsddb
ImportError: No module named _bsddb
Uh-oh. However, a quick look inside examples.py reveals the solution. The import from bsddb.db applies when using the version of pybsddb that ships with python; when using a custom pybsddb build you must import from bsddb3. This involved commenting out one line and uncommenting another in examples.py. Let’s try again:
%> python examples.py test
Traceback (most recent call last):
File "examples.py", line 7, in ?
from dbxml import *
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/dbxml.py", line 5, in ?
import _dbxml
ImportError: Failure linking new module: libxerces-c.26.dylib: dyld:
python can't open library: libxerces-c.26.dylib
(No such file or directory, errno = 2)
Still no joy in Mudville. It’s at this point that I began to have trouble with how to proceed; my knowledge of *nix linking, loading, and such is limited. My rough understanding of dylibs is that they are dynamically linked libraries, a bit like Windows DLLs. The errors above (a couple of newlines were added for formatting) seem to indicate that the xerces-c lib can’t be located. I checked the output from building dbxml.py and confirmed that the correct (to my untrained eye) -l
and -L flags were used to locate all of the required libs from /Users/jclark/ext/dbxml-2.0.9/install/libs.
My problem was, I didn’t really understand the dyld process. It was unclear to me whether dynamically linked libraries have the library location linked into the executable (as I suspected, but which didn’t explain the error) or if they rely on a search path (which probably defaults to /usr/lib or somesuch). In the end, man dyld proved somewhat enlightening. It turns out that there’s a slew of environment variables which can influence the locations searched for dylibs. It also turns out that otool -L can reveal information about linked libraries. Let’s see what we can learn (the two-step cd avoids a linebreak):
%> cd /System/Library/Frameworks/Python.framework/Versions/2.3/lib/
%> cd python2.3/site-packages
%> otool -L _dbxml.so
/System/Library/Frameworks/Python.framework/Versions/2.3/Python
(compatibility version 2.3.0, current version 2.3.0)
/Users/jclark/ext/dbxml-2.0.9/install/lib/libdbxml-2.0.dylib
(compatibility version 0.0.0, current version 0.0.0)
/Users/jclark/ext/dbxml-2.0.9/install/lib/libdb_cxx-4.3.dylib
(compatibility version 0.0.0, current version 0.0.0)
/Users/jclark/ext/dbxml-2.0.9/install/lib/libxquery-1.0.dylib
(compatibility version 0.0.0, current version 0.0.0)
/Users/jclark/ext/dbxml-2.0.9/install/lib/libpathan.3.dylib
(compatibility version 4.0.0, current version 4.1.0)
libxerces-c.26.dylib
(compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib
(compatibility version 1.0.0, current version 71.1.1)
For some reason, libxerces-c was linked without path information, unlike all of the other libraries. If anyone knows why this happened, or how to avoid it, please email me or leave a comment. I couldn’t determine how to change this, so I set an evironmental variable to provide the correct search path:
%> setenv DYLD_LIBRARY_PATH /Users/jclark/ext/dbxml-2.0.9/install/lib
%> python examples.py test
Success!
As I said earlier, I’m a bit under-experienced with some of the details of building software on *nix systems. If anyone can provide any help with the xerces-c dylib issue, or any improvements to these directions, let me know; I’ll update this post with any additional information I find/receive.
With one thing and another, I never got around to posting about my pre-Christmas present. Having been very happy with my Powerbook for the past two years, I’ve been planning to buy a desktop Mac, sometime in January ‘05. Originally I had been looking at the PowerMacs, but after getting my hands on an iMac G5 at the Apple store, I began to have second thoughts.
Initially, I was reluctant to consider an iMac G5. As incredible as the machine is, I’ve always had a problem with computers that have integrated monitors. “What happenens if something breaks? It’s just like a TV with a built-in VCR,” I reasoned. Then one day, it occurred to me that I’d owned just such a machine for years - the Powerbook. After that, reason took over, and I forgot my dislike for integrated monitors (surely a mental holdover from my younger, pro-PC days).
A couple of weeks before Christmas, the need presented itself. My Powerbook does not have a Superdrive, but Sherri and I wanted to put together a DVD for her parents as a Christmas present. Last year, a Christmas display her family had visited for 40 years closed down, and we shot some video to remember it by. I could produce a video using iMovie, but without a Superdrive I had no way to put it on DVD.
In an act of ultimate sacrifice, I bought my new computer a month early. I bought the 20″ iMac G5 with the Bluetooth package. What a gorgeous computer. The screen is huge and looks fantastic. The entire design is sleek and elegant. The bluetooth keyboard was an excellent addition, although I’m not using the bluetooth mouse… no amount of love for Apple will ever drive me to use a one-button mouse.
This machine will also become the ‘primary’ computer in the home office. Sherri still has an XP laptop, and the kids still have a PC in the basemaent, but there’s now a Mac that everyone can use. Eventually, I intend to win them all back from the dark side. I’ve already created an account for each of them, and enabled fast user switching.
Of course, now I have to wonder if I’ll miss out on anything this Monday, when His Steveness announces all of the cool new whizbangs in his Macworld Expo Keynote. I’m not too woried about new hardware… this G5 is big enough and fast enough for now. What I’m concerned with is new software… if the much rumored iWork suite and iLife ‘05 start shipping with every new Mac on Monday, will there be any retroactive love for recent Mac buyers? I believe they did something similar last year when Panther shipped, but I don’t recall if that extended to iLife.
Guess we’ll see on Monday.
(p.s.: I’m certain Steve Jobs or Apple marketing or someone refered to the iMac g5 as “the ultimate accessory for the iPod” or something like that. I’ve searched all over the internets (several of them) and cannot find the quote. I’d be grateful to anyone who can provide a link. )
Everyone else, go buy a Mac.
Michael McCracken made the world a better place back in February, and I only just found out.
Incremental Search, or i-search, is the magic that powers Firefox’s in-page search. It’s been around for years in emacs. If you haven’t seen it (why aren’t you using Firefox?), the search takes place in real time, as you type. I miss it in other apps… but not any more.
Michael’s I-Search plugin for NSTextView is a library (a bundle in Cocoa-speak) that adds i-search to all NSTextViews - which is nearly every bit of text you see in an OS X Cocoa application. You just drop the bundle and a keybindings file into a couple of special folders in ~/Library and you’re all set. TextEdit, XCode, and SubEthaEdit all have i-search now.
If you only know i-searching from Firefox, you should note that the I-Search Plugin uses emacs keybindings, not Firefox’s. To begin searching, use ctrl-s. To see the next match, press ctrl-s again (why does Firefox use a second keycombo for this?). To search backwards, use ctrl-r. To exit i-search and return your cursor to it’s pre-search location, press ctrl-g. To exit i-search and keep the current match selected, press return (or esc). Having pressed return or esc, you can return to your pre-search location with ctrl-x ctrl-x (yes, do it twice). You can even make an edit first. In emacs terms, i-search updates the mark before searching. Since Cocoa text editing supports many emacs features and keybindings, it works as expected. (If you don’t know what the last two sentences mean, don’t worry about it.)
While I’m not a fan of their operating systems, I definately like Microsoft’s mice. I’m very partial to the Intellimouse Optical, the beige and silver optical which is omni-handed. I’m not a lefty, I just find every “contoured” mouse I try to be wickedly uncomfortable. I use an Intellimouse on my home and work PCs. In particular, I’m extremeley dependant on the scroll wheel, scroll wheel button (to open a new tab in Firefox), and the thumb button (aka “Button 4″), which acts as a back button in Firefox (and in IE).
Tonight, I plugged my Intellimouse into my Mac, and was surprised to find that it did not work as expected. The left and right buttons worked fine, as did the scroll wheel. However, middle-clicking worked in Safari but not in Firefox. The thumb button did not work at all. Also, the scroll wheel seemed to accelerate as I used it, which I found to be very disorienting. I could find no answer to these problems in System Preferences, or Firefox’s preference panel.
After Googling a bit, it turns out that Microsoft provides Intellipoint software for OS X. I didn’t really think about needing additional software since I already knew that the Mac would handle right-clicking and scroll wheels. As loathe as I am to install Microsoft software on a Mac, I decided to give it a spin; I’ve had largely good experiences with Intellipoint on Windows, and I really needed to get a mouse set up that works like I expect.
Success. I downloaded and installed Intellipoint 5.1 for OS X*, which of course required a reboot (insert Windows joke here). The installation added a new item to System Preferences, which launches the Intellipoint software. Having this installed seems to fix the Back (thumb) and Forward (5th) button automagically. Also, the scrolling settings have an “Enable Accelerated Scrolling” option which was off by default; I no longer see the accelerated scrolling.
Fixing my middle click in Firefox was one extra step. Using the Intellimouse software, I had to change the meaning of middle click from the default “Next Application” to “Click”. Once “Click” is chosen, checkboxes allow you to select modifiers. I set up middle click to equal Cmd+Click, and all is well with the world.
Kudos to Ste Grainer, whose comment on Jeremey Zawodney’s blog outlined the middle click fix, and made me realized I must need some extra software.
P.S. - I’m behind on my blogging, but hey… it’s the holidays. I promise to try and catch up a little; I do have a few good things I need to blog.
*Note: I make no promises about the link above, Microsoft isn’t known for having Cool URIs. If the link doesn’t pan out, just poke around the Microsoft site like I did. One suggestion… I found the drivers on the product page, not in the Support section.
Update: As much as I hate closing comments on a post, this one is just a spam magnet. If you have anything to contribute, drop me a line.
After a long, busy weekend, yesterday was a long, busy Saturday. After everything wound down last night, we decided to go get some dinner at the mall. Of course, this was the perfect excuse for me to wander into the new Apple store.
The last time I was at the Apple store, I played with the iPods for a while. I was impressed by the sound quality of the headphones they use to demo the iPods, but I didn’t have time to inquire about them. Last night I learned that they are Bose Triport Headphones, and they cost $199 at the Apple store. No wonder they sound so good. Of course, the going rate everywhere else is $149. As much as I like the Apple store, 33% markup over street price on third-party merchandising is foolish and insulting.
Speaking of expensive, they also had the new 30″ Cinema Display available to play with. All I can say is “WOW”. What an incredible piece of hardware. Just for fun I opened three browser windows. Side-by-side. And they fit. No way I can justify the expense, but wow. Just breathtaking.
Another product I got to see for the first time is the new 20″ iMac G5. It’s a very slick piece of hardware. I’ve been wanting a desktop Mac for a while, and had been thinking about buying a Power Mac G5 after the new year. Given the price of Power Macs and Cinema Displays, I figured I’d use my existing VGA monitor for now, and look at getting a 20″ or 23″ cinema display in a year or so. But given the price/performance of a 20″ iMac, I’m seriously considering getting one of these.
Apple today released two new iPods: the iPod Photo and the iPod Special Edition: U2. Both have been rumored for a while.
This interests me because I’ve recently decided to get an iPod. I’ve wanted one for quite a while, but hadn’t really been able to justify the expense. I considered asking Sherri to get me one for Christmas last year, but requested the Firewire HD and DVD Burner instead. With the growing size of my music collection and my new interest in Podcasting (I’m tired of burining CDs every day for my commute), I’ve made up my mind to get the iPod. I’ve been trying to decide if I should put it on my Christmas list, or wait until my birthday (in February) since Apple usually anounces new iPod models at Macworld in January. Looks like it’s safe to shoot for Christmas… now, which one?
The field before today had three choices: the 20gig model ($299), the 40gig model ($399), and the Mini ($249). The mini is out- I want storage. Of the standard models, the 40gig makes a much better choice for me. Besides double the capacity for only $100 more, the 20gig model doesn’t come with a dock or remote. I want the dock, and it’s $39 separately. Might as well get the 40gig.
Now we come to the new choices. First, the $349 U2 iPod. It’s a 20gig iPod for $50 more than a standard 20gig iPod. For your $50, you get a black iPod with a red scrollwheel, signatures from the band laser-etched on the back, and a $50 credit towards a 400+ song “digital boxed set” of all of U2’s music from the iTunes Music Store. I find it interesting that there’s no indication of the price of this “digital boxed set”, which won’t be available until the end of November. I’m not a huge U2 fan, so the boxed set is irrelevant to me. The black iPod would be sharp without the red scroll wheel, but with it, it’s quite atrocious (at least in photos… I’ll report again once I see it at the Apple store). This one’s out of the running.
This brings us to the product everyone will be talking about, the iPod Photo. Available in 40gig and 60 gig flavors, it looks like a standard iPod but with a color screen. It can store photos which you can view on the 2″ screen, and it comes with an A/V cable you can use to show your pictures on a TV. The battery life appears to be a bit longer than the b&w iPod according to the spec sheet. The 40gig model is $499 and the 60gig model is $599.
The new device is intriguing. We have taken all of our pictures with a digital camera for a couple of years now. Having a Series 2 TiVo on my home network lets me view photos on my TV, and it turns out to be great. These days, we just dock the camera, push the dock’s sync button, and head to the family room to see our pictures on the big screen. The only downside to the TiVo setup is portability; an iPodPhoto would make an excellent way to show photos to everyone when we visit family. Aside from pictures, the extra capacity of the 60gig model sounds nice.
Being already prepared to spend $399 for a 40gig (standard) iPod, is it worth $100 more for the photo feature? If so, is it worth another $100 for the extra storage? If the photo option isn’t worth $100, is the storage worth $200? I’m sure for some, the answers will be yes. For me, I don’t think the benefit of the photo feature is worth the cost. I would use it some, but not enough. And $200 is too much for the extra 20gigs storage. If they offered a 60gig standard iPod for $499, I might consider it. Then again, Macworld is only a couple of months away….
Another short entry tonight, I’ll try to do something more substantial tommorow. For now, good news for OS X users who don’t want to shell out the big $$ for MS Office. Patch 3 for the 1.1 Alpha 2 version of NeoOffice/J, an OS X port of OpenOffice which does not use X11, has taken another step by moving the menus out of the individual windows and into the System Menu bar where they belong. (Via Tim Bray and TaoOfMac). Tim’s post includes a screenshot.
A note on the particulars: Currently, the main site doesn’t mention the patch except on the downloads pags, and that patch is the wrong version if you want integrated menus. So, first download NeoOffice/J 1.1 Alpha 2] from the NeoOffice/J download page, and then get the Aqua-menus version of patch three from this post.
Yesterday afternoon, I stumbled upon an article (not sure where) about Apple opening new ‘mini’ stores in smaller retail locations. This reminded me that my local mall has an Apple store going in! My location wasn’t listed in the article as a ‘mini’ location, so I searched around Apple’s site looking for some information. Serendipity struck, as it turned out that today was the grand opening. Not only that, but t-shirts were promised for the first thousand visitors. Excellent! I made a plan to be there when the store opened, at 10 am.
My wife warned me this morning that I should arrive early. I didn’t see a need, since I had not seen or heard any press about the opening. Whoops. When I arrived at 10 am, the line to get in the store was at least 100 yards long, maybe longer. It turned a corner and wrapped around a fountain. Visitors were being admitted in batches, as there was no way everyone present would fit in the store. I didn’t have the time to wait in line, so I bid my t-shirt goodbye and left. Kicked myself for not taking my camera for some pictures of the line.
Had to go to the mall this afternoon to take my daughter to a hair appointment. Once she was delivered, I cruised on down to the Apple Store. Very Cool. Been in one once or twice before. Very tempting to grab an iPod while I was there! I’m currently torn between requesting one for Christmas and waiting until MacWorld Expo in January to see what the latest and greatest iPod will be. Of course, my birthday is in early February :)
Didn’t leave empty handed… I picked up Jam Pack 3 for Garage Band. Didn’t even know this was out (or Jam Pack 2) until I poked around the Apple site today in anticipation of seeing the store. Jam Pack 2 is geared towards Dance/Urban/Hip Hop, with lots of “Remix tools”, bass lines, synths, and drum machines, including several classic Roland drum machines. Not my kind of music, especially when composing. I haven’t loaded up Jam Pack 3 yet, but it’s subtitled “Rythym Section”. I’ll post some more on that once I play with it.
Among the sights at the Apple Store… an employee dressed in fult Scottish Kilt and sporting a (presumably real) tatoo of the Finder icon in the right shades of blue. Kicked myself for not taking my camera twice.
The Software Update icon has been waiting patiently on my Dock for a while now. This morning I decided to oblige. There are three updates waiting to be installed:

Wow, that Sept 16 Security Update has been waiting a while, huh? I have Security Update enabled to run automatically once a week, so why am I so late? Triangles. Those little triangle icons next to each update indicate that a restart will be required. So?

Almost 23 days of uptime since my last reboot, which was, of course, for a OS X software update. Again, you may wonder, why the big deal? For me it’s about the interuption. For example, when I decided to go ahead and install these this morning, I had about 2 dozen websites open in tabs spread across two Firefox windows, several pages open in Mozilla (I’m using it to learn XUL, the book is pre-Firefox), a half dozen terminal sessions, about 10 sticky notes, a dozen documents in SubEthaEdit, and a few other assorted bits. I tend to keep things open and available. Rebooting means closing everything. What a pain. Zero reboots is my #1 most wanted feature in an OS X.
Here’s the kind of uptime I really want.
As detailed in my prior post, I can’t install iLife ‘04, and I think my non-standard disk partioning is to blame. I’ve decided to bite the bullet and format the HD back to a single partition and re-install everything. I’ve copied my /Users directory tree onto my Firewire HD, so I should be ready to go. The notes I made during my upgrade to Panther should be helpful.
This is like Deja-vu all over again. See you on the other side.
Update: I’m back. Hard drive is re-partioned to a single 32gig OS X partition and spare, unformatted 5 gig partition for future use. Panther is installed and software update has been run (twice). XCode tools were installed and software update run again. I’ve transfered my documents, pictures, and music; I’ve moved my mail, keychain, and preferences. Firebird is installed and setup the way I like. I’ll be documenting the process soon, including some tips on how to restore iApps, Mail.app, etc. Haven’t tried installing iLife ‘04 yet, but that’s next.
I did have one good scare… after formatting, installing, updating, etc., I was finally ready to attach the Firewire drive and start restoring my backed up data. When the volume mounted, I only saw the ‘Video’ folder, and not the ‘Users’ folder which contained all of my backup data. I think I might have hyperventalated :) I hadn’t yet installed iTerm, and Terminal wasn’t on my dock, so I had to scramble to find Terminal and check it from there. When I finally was able to ls /Volumes/Teapot there was my Users folder right where I left it. I had copied it using the unix command ditto, which apparently marked it as a BSD subsystem folder. And since Panther hides such folders (like /bin, etc.) in Finder by default, that is what had happened. Quite a little moment of panic, tho.