Categories
Linux Palm Tech

How to convert CHM files under Linux

CHM files, known as Microsoft Compressed HTML Help files, are a common format for eBooks and online documentation. They are basically a collection of HTML files stored in a compressed archive with the added benefit of an index.

Under Linux, you can view a CHM file with the xchm viewer. But sometimes that’s not enough. Suppose you want to edit, republish, or convert the CHM file into another format such as the Plucker eBook format for viewing on your Palm. To do so, you first need to extract the original HTML files from the CHM archive.

This can be done with the CHMLIB (CHM library) and its included helper application extract_chmLib.

In Debian or Ubuntu:

$ sudo apt-get install libchm-bin
$ extract_chmLib book.chm outdir

where book.chm is the path to your CHM file and outdir is a new directory that will be created to contain the HTML extracted from the CHM file.

In other Linuxes, you can install it from source. First download the libchm source archive from the above website. I couldn’t get the extract_chmLib utility to compile under the latest version 0.38, so I used version 0.35 instead.

$ tar xzf chmlib-0.35.tgz
$ cd chmlib-0.35/
$ ./configure
$ make
$ make install
$ make examples

After doing the “make examples“, you will have an executable extract_chmLib in your current directory. Here is an example of running the command with no arguments and the output it produces:

$ ./extract_chmLib
usage: ./extract_chmLib <chmfile> <outdir>

After running the utility to extract the HTML files from your CHM file, the extracted files will appear in <outdir>. There won’t be an “index.html” file, unfortunately. So you’ll have to inspect the filenames and/or their contents to find the appropriate main page or Table of Contents.

Now the HTML is yours to enjoy!

Resources

I got help in writing this article from here and here.

Categories
Audio Palm

Podcasts to Minidiscs

I’m making another trans-Pacific flight in two weeks’ time, and I’ll want to have a lot of podcasts to listen to for the long trip. The problem is, the 256-MB SD card in my Palm Tungsten E isn’t large enough to hold the all of the mp3s that I need. So, I decided I could record a bunch of them onto minidisc. My minidisc recorder knows nothing about mp3s. It’s just an audio device. So I have to get my computer to play the mp3 files so that the minidisc recorder can record the resulting audio in real time. I do this while I sleep, so it’s not a problem.

The discs hold 74 minutes of audio in stereo mode, or twice that in mono mode. That’s 2 hours and 30 minutes, approximately. (The newer MDLP minidisc standard can hold 2X and 4X in stereo, but my recorder is too old to do that.)

I’ve already prepared the 2-hour long, four-episode series Hitchhiker’s Guide to the Future by Douglas Adams from the BBC. I’m not sure what will be next in my backlog of podcasts. But I’ve got about 37 episodes from the back catalogue of Evil Genius Chronicles from September to December 2004, that I haven’t listened to yet. In total, they take up 18 hours of playback time. I’ve been listening to these early shows of Dave’s (from August 2004) to track the evolution of podcasting. Where I’m at in the stack, he still hasn’t used the word “podcast”—it hadn’t been invented yet. I love the Evil Genius.

I’ll close by saying that, even though it’s limited to real-time transfer, I continue to love the minidisc format. It rocks!

Categories
China Palm

The Joy of Geek

I was eating in Grandma’s Kitchen last night and I met a cool guy from Seattle named Charles Kuai. He came up to me to ask about my Palm Wireless Keyboard as I was working on email after dinner. He has a Palm Tungsten W and was interested in buying such a keyboard. So, on my Palm, I quickly looked up the contact info I have for a PalmOne wholesale dealer here in Beijing, and handed it to Charles. Now if he actually had his Palm on him, I could have wirelessly “beamed” him the data. But alas, we had to resort to old fashioned pen and paper.

It was a fun encounter. And I made a new friend.

Categories
Astro Palm Python

Working with vCalendar

I couldn’t sleep last night, so I used my time to work on putting Moon phase information for the new year into my Palm’s calendar. I already have a Python script that will calculate the times of the phases of the Moon based on the algorithms found in Jean Meeus’ Astronomical Algorithms (2nd Ed., 1998). But I still needed a way to import this data into my Palm in an automated way. Last year, I did this by hand. Yuck! So I used the Palm Desktop application and the vCalendar file format for exchange of calendaring and scheduling information. I had never used the vCalendar format before, but I found the specifications online and soon modified my Python code to output into this format. Here’s an example of what I produced:

BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20050103T174530Z
SUMMARY:Last Quarter 01h45
END:VEVENT
BEGIN:VEVENT
DTSTART:20050110T120238Z
SUMMARY:New Moon 20h02
END:VEVENT
...
END:VCALENDAR

Note that the times DTSTART are given in UTC (the “Z” is for “zulu”), but I wanted the event description to be in local time (8 hours ahead for China). Since China doesn’t observe daylight savings time, I could apply this +8 h correction into the Python code quite trivially.

If you want to see the code that I used to do this, just email me.

Categories
Audio China Palm Swing

Salsa and Swing concoction brings local boy life-enriching epiphany

So much has happened in the last few days, or even hours. It’s 4h12 in the morning, Saturday morning, and I just finished a very cool Friday night. Since being in the taxi on the way home, I’ve wanted to sit down and write a blog entry. I haven’t done that in a while.

I started the evening in the afternoon. After researching what needs to be done to get me a new passport, I headed over to Qiao Ying’s tea house. I spent the afternoon drinking tea and speaking Chinese with her and my friend Zhang Hua. Sometimes Qiao Ying gets in these moods where she refuses to speak English. So I played along and I didn’t speak English either. It’s really good for me, actually. It really helps. I went through three kinds of teas during my stay there, met a new friend of Qiao Ying’s, and then left to join Mandi for her farewell dinner. I didn’t have far to go, and traffic wasn’t bad, but there were no empty taxis. I waited, changed locations, and then waited some more. So I eventually took a bus.

It was a direct route that I needed to follow, just 2 or 3 km up the street. And the trusty Route 120 took me there. I met my friends at Ya Show market near San Li Tun Bar Street. Most everyone was late (like I was—even I was the second person there!) cause traffic was really bad. It ended up being a party of 18 and then some, and miraculously we managed to find a restaurant to house us. Even to pick a restaurant. I was impressed. It was a Xin Jiang Muslim restaurant. Very good food, roasted lamb and such. I had my first Budweiser beer that night. The restaurant ran out of the local beers, so that was all that was left. Damn expensive and not very good. (Sorry, he says to his friend Karen who works for Anheuser Busch.)

On the way to dinner, Joanne pointed out to me that my backpack was open. Did I leave it open from the tea house, all the way on the bus ride? Or did someone open it while I was walking or talking to Paul in front of Ya Show? Yikes! I didn’t find anything missing until later. My minidisc was still there as well as my USB sound card and Palm Wireless Keyboard. (Yes, my backpack is an arsenal of geek electronics. Go Darren!) It was only after dinner that I realized that my $300 Etymotic ER-4P earphones were missing. I’ll never see them again. The disappointing thing is that the new owner will have no idea the true value of their new prize. Damn. Back to el-cheapo $10 earbuds for a while. At least the Etymotics are well coated with a couple month’s worth of my ear wax. Hope the new owner doesn’t actually use them.

I skipped out on Mandi and drinks on San Li Tun at 22h30 after dinner cause I wasn’t in the mood. It’s really not my scene. Adam and the gang were going to be at The Big Easy a few kilometres away, so I decided to join them. I wasn’t feeling so hot, actually. Mostly just tired from being sick all week with the flu. But I found myself telling the taxi driver to go there, so I just went with the idea. The Big Easy was alright, but nothing too great. The band was swinging a bit so Adam and River danced, and I got one dance in with River. I would have liked to spend time chatting with Adam and River, but an impromptu business meeting between them and the owner cut our time short. The belly dancer gave a couple of performances, but I wasn’t impressed. I just couldn’t get into it. Besides, her hair was dirty and her costume (what little costume she was wearing) had big food stains all up the front. Pretty yucky.

But, during one of the belly dances, I looked up at the balcony and, to my surprise, saw my friend Cheng Lei there. So I immediately left my friends and went and said hello. This is the second time that she and I have met “by luck” in this area. The other time happened at Latinos, next door to The Big Easy, about a month and a half ago, just before I left Beijing. (And I never go to Latinos.) So we were quite happy and surprised to meet like this again. It made the whole evening worth it. Plus she smiles so nicely at me. We chatted for a while until Adam phoned me looking to see where I was. I literally had disappeared on the group without a trace, so they wanted to know where I was. I felt loved. So we came down and said hello to Adam, River, and John for a few minutes. Cheng Lei had friends over at Latinos, a Brazilian dance performance group that was in Beijing for the week, so she invited me to join her over there. I hesitated, but finally agreed. I have never felt comfortable at Latinos, especially since Latin dancing/music isn’t my thing.

But I’m so glad I went with her. Although Cheng Lei likes dancing (she’s a salsa teacher, even) she just wanted to watch the others dance. But when I told her that I wanted to dance with her, she invited me to dance Swing to the Latin music. I was surprised that it even worked, but I guess it can be done cause we did it. And it was fun. She made me feel so comfortable there that I had no problems being there, dancing my own way, and enjoying myself. We met up with her friend Julia, and after the Brazilians left, the two of them decided the music at Salsa Caribi would be better. So, back to San Li Tun, and I got to try out a new club. Since I never dance Salsa in Beijing, they’re all new to me.

Salsa Caribi seemed not too bad. An acquaintance, Mustafa, was there outside the club, so already I had a friendly face to welcome me. The two girls, Cheng Lei and Julia, took to the dance floor immediately, so I just waited at a table. I saw my friend Irene dancing there too, and eventually discovered that all of my friends of Irene were there: Karen, Maple, and Christine. Seeing them was a treat, especially Karen since I haven’t seen her in so long. She’s been busy with work-related travel for many months now.

I had the best time with Cheng Lei and Julia at Salsa Caribi. They were dancing pretty hard, and when I joined them, I started dancing hard too. We danced and danced and danced. Some of it was Swing (but not to Swing music). Some just disco, and lots of Latin. I started to figure out the arm thing, twisting you and your partner’s arms in and out of pretzel contortions. Lots of fun. We played with it a lot, sometimes doing the pretzel thing with all three of us holding hands.

A very sweet night. I’m really feeling blessed by the whole thing, how it all turned out. I’ve been dealing with a lot of internal struggles and realizations lately, stemming from events in and related to returning from Canada. (I can only post weblog stuff when I’m being outgoing and external, which is why my posts are as infrequent as they are.) So I think tonight’s events have corrected my thinking in various ways, helping me to keep on the correct path that I need to follow. It’s what I needed.