Blake (old posts, page 3)

What I’ve done here: or, yet another way to blog from your Palm.

I thought I’ld take a few minutes to talk about just what it is that’s allowing me to write an entry while I’m walking down the street on my way to the gym. (And on my way home from the gym, and on the subway to work the next day, because while I’m connected, I’m not necessarily fast at either Graffiti or writing weblog entries.)

As I’m sure you know, I’m a computer programmer by trade, and so when I run into a problem, I tend to want to write a program to fix it for me. A long time ago I got a PalmPilot Professional, partially so that I could keep track of my projects and assignments, and partially because I could write programs for it in C. Then, someone wrote a C compiler that ran on the Palm. I was so excited that I could finally write code on the subway! Until the first program I wrote crashed my Palm. I quickly realized that C was just too hard a language for writing Palm programs. (It’s not so bad if you’re working on a desktop, and have an IDE, and an emulator to test on, but for on-Palm development, it really sucks.) I also played around with an implementation of Forth for the Palm, but I couldn’t get enough of a library of utility words built up to do anything useful with it. Later, I learned a language called Python, which was far easier to write programs in, both due to being an easier language syntactically, and due to the wealth of useful libraries it comes with. After a while, someone ported Python to the Palm, and so I played around with that, but I found it, too, was lacking the libraries I needed for it to be useful to me. Finally, someone posted on the Python tutor list about a program called Plua, which was an implementation of Lua for the Palm. There are a lot of things I don’t like about Lua the language, but when creating a screen for a Palm app is as simple as:

ptitle( "PalmBlosxom" )
pmenu( {"P:Server Prefs"} )

name = pfield( 1, 24, 24, catName)
pl = plist( 10, 31.5, lst )
i = pbutton( "Reload" )
d = pbutton( "Details" )
q = pbutton( "Quit" )

I’ll put up with a lot of ugliness in the language.

Of course, I made it sound like a much smoother progression than it actually was. I took side trips into Basic, Smalltalk, Perl, Scheme, Java, Intercal, Visual Basic, and Ruby, but none of those were serious contenders for on-Palm programming, and Java is the only one I still use these days. But I remember enough of them to be the person to ask when someone at the office needs to debug a program written in one of them.

Where was I? Oh, yeah, Plua. Plua makes it really easy for me to create programs for my Palm, and so makes it far more likely that I’ll actually complete whatever random project it is that requires a Palm program to be written. In this case, it was a way for me to write weblog entries in the standard Palm MemoPad application (or, more accurately, in pEdit, a replacement which handles memos of up to 32kb, as opposed to Palm’s 4kb size restriction). Since I was leveraging the standard MemoPad, my application was turning out to be much simpler than a full-fledged weblogging application, but it was still taking me a long time to write it in C++, partially because I needed (or more accurately wanted) to write a generic framework for use in other applications I might write, and partially because I don’t have a lot of spare time for programming. Switching to Plua let me write the application in a day or two, and I can easily change things around in it, or add features, without going through the hassle of a compliation and hotsync.

The hardest piece to get working was the conduit. Since my Palm doesn’t have a WiFi connection, it’s a bit of a pain to use programs which depend on network connections. Conduits, on the other hand, get run every time I hotsync, which is usually once or twice per day. I had been planning on writing the conduit in C++, which was going to be quite a pain for me, since I didn’t know of any libraries that could handle ftp over secure sockets. Fortunately, Rick Price asked me whether it would be possible to write a conduit in Python. "Sure", I said, and then started thinking about how you would do it. You could either wrap the C API up into a Python library, which would take a lot of work, or you could use Python’s COM support to talk to the COM API. I figured that would probably be an easier way to go, and since I had some free time, I started experimenting. It turns out that it was a little harder than I had anticipated, but it still wasn’t too bad, and I think I’ve finished the worst of it. The Secure-FTP library was easy to find, and after some firewall config on my home machine works quite well.

How I've been doing.

I'm hoping to get a plugin written for the area over on the right there which will display some statistics about my last few bike rides. Ever since I got my new bike computer (the Cateye Astrale 8), I've been keeping track of all the data it produces, which is to say trip time, trip distance, average speed for the trip, maximum speed for the trip, and the total distance odometer. I haven't tried to graph any of it yet, but I'm sure that'll come soon enough. In the meantime, it looks like I'm getting faster on average (from 19.2 km/h (12 mph) on my first trip to 21.2 km/h (13 mph) on my most recent trip). It's around 17.16 km (10 .66 miles) to my office and back, and I've gone 175 km (108.75 miles) so far. Of course, I've actually gone farther than that, since I biked to work before I got the computer, but I'm happy to ignore those trips for the purposes of tracking my distance.

Does anyone have any guesses as to what the stats will be by the time it gets too cold for me to bike anymore? Personally, I don't think that I'll get too much faster, either on my max speed, or on average. My trip distance will probably increase by a little bit, since I've found some neat paths that are just a little out of my way, and I think I'ld like to take them. And I'm hoping to more than double my total distance, which should be a no-brainer, since after two more weeks (or 10 trips to and from the office), I'll have doubled it, but I'm not sure if the weather will hold out that long. It's been mightily chilly up here for the past few days. It was only 4°Celsius (39.2°F) when I rode to work this morning, and I could really feel the bite of the wind, even through my tiny cotton gloves. If it keeps up like that, I might have to buy a real pair of biking gloves, or stop biking for a while. Though I've got to admit, it was a nice feeling to not be all sweaty when I got to the office.

That wasn't as easy as I'ld hoped.

I've started writing an installer for my PalmBlosxom conduit, and associated files. It's been both easier and harder than I had thought. It was way easier to get the installer portion written so far, and I don't see any particular difficulties cropping up in that part of it. Sure, there are still a bunch of things to do, like installing the Palm program for users who aren't named "bwinton", and learning the strange variant of Pascal that the installer uses to script things so that I can accomplish the previous task, but by and large that portion of it is done. The uninstall portion of this grand experiment, on the other hand, has been a royal pain in the ass. It was fairly easy when all I did was copy some files somewhere and I was done, but when I switched to registering the conduit with the HotSync application (so that it would run, instead of just sitting there), I started getting errors, and nothing I've attempted so far can get rid of them. I guess I can sort of understand why it thinks it can't delete the file, but I swear to you, I've unregistered the dll it thinks it can't delete about four different ways, and furthermore, as soon as the uninstaller exits I can delete the files either from the command line, or from the Windows Explorer, without any problem. Heck, I can even run the installer again, and it will overwrite them without complaining. I just can't figure out how to do it programmatically. How annoying.

So,if anyone out there has any experience with InnoSetup, and/or uninstalling Palm Conduits, I'ld appreciate it if you could drop me a line, and I'll explain in more detail what I'm trying to do, and how it's failing, or you could check out the source to my setup program (which generates the .iss file for InnoSetup), and hopefully point out my misunderstanding from it.

Update: I think I'm going to switch to NSIS. I tried the innosetup newsgroups, but they weren't as helpful as I would have hoped. I'll continue to read them, in the hopes that someone will answer my question, but I think that I'm not going to get an answer, or at least not one that I like, so NSIS it is.

A New Start.

I got a new computer at work on Monday, and so eagerly switched over all my data to it. But I didn't install all the various programs that were on the old machine. Partly because I had a ton of stuff installed, and my registry was a complete mess, and partly because I wasn't working on a lot of the tasks I used to work on, and so didn't need the tools installed anymore. But one of the results of this is that my oh-so-clever palm-memo-to-weblog-entry conduit isn't installed, and indeed, the components it relies on also aren't installed, so while I have a perfect chance to write and test an installer, I haven't even started that yet, so all the weblog posts I'm writing there are likely going to be delayed by a few days or even up to a week.

Boy was I ever right there. It's taken almost three weeks to get that entry posted. But now my conduit has an installer, and is packaged up into a dll, and registers itself and everything, so I should be able to send it off to other people with just a little more code in the installer. I'm kind of pumped. And apparently other people are interested in doing something similar, so my little bit of code might get released in a couple of other places too. But for now, you can find the conduit, and the setup script which builds the dll and the installer here. (The code is in the conduit directory, and the script is in the root.)

How I got to work this week.

For a while now, I've been meaning to bike to work. It's healthier, less crowded, more relaxing, and costs less than taking the TTC. Okay, so the two middle reasons are kind of made up, but the first one has been getting more and more compelling, and just recently the last one has taken on a new urgency. I calculated that I was spending $19 per week travelling to and from work, and since we had to scrimp on our last grocery trip, having an extra $20 in the fund would have made a fairly large difference. So I started biking to work. It was fairly easy on the way there, but much harder on the way back, and it wasn't made any easier by my working out just before the ride home, nor by the fact that it's mostly uphill. The next couple of times I tried it, however, it was much easier, probably because I'm getting more used to it. So, without further ado, here's the path I take to and mostly from work, with some annotations.

1. This is by far the easiest way for me to get started. It isn't marked on the map, but there's a series of laneways there that take me right to the start of the Belt Line, an abandoned railway track that was turned into a bike/jogging/walking path quite a while ago.
2. Zoom! This big curvy section is all downhill, and there is a total of one stop sign on it. There is also a lot of traffic, and some speed bumps, so on my way to work I get to zip by a billion cars, and feel extra fast. Of course, with every good comes a bad, and on the way back I nearly die trying to get up the same hill. (I take the path just to the right on the return trip.) The first time I rode up it, I stopped halfway up. The next time, I geared down to 1-3 (where the first number means the easiest gear of three on my front wheel, and the second number means the third easist gear of seven on my back wheel). The next time, I only geared down to 2-1. And the last time, I was still at 3-4 when I hit the top of the hill. I spend most of my time on flat roads switching between 3-5, 3-6, and 3-7, so my eventual goal is to stay in that range on large hills. At which point I'll probably look into changing the ratios of my gears, so that I can get more speed on the flat and downhill portions of my trip.
3. For something on a signed bike lane, this is a remarkably hard street to cross, since I have to jog over half a block to get to the new bike lane. The right turn at the light isn't so bad, but the left turn from the major road onto the side street can really suck rocks if traffic is moving. I hope they improve it, but I can't really see a good way for them to, since that's just the way the road goes. It's also a pain coming the other way, involving a left turn at a light onto a major street.
4. I always miss this on the way back, leading to discussion #3 again. (I actually did a little more hunting around, and I found out where that bike lane actually starts, and ends up, and I think I might take that route more often now.)
5. There's a light at John and Queen, but not at Beverly and Queen, so I always cut over a block here, because crossing major streets is a lot easier when the traffic stops for you.
6. I actually lock my bike up about ½ a block north of the door into my office, partially because it's right outside the back door to my office (which is exit only), and partially because it's less likely to be used by the bike couriers who are also tenants of this building.

And that's my transportation. I've skipped a couple of days for various reasons so far, and I expect I'll continue to skip some days, but I am getting a lot more exercise than I used to, which can't be bad. I'm really pretty excited about it, which you could probably have guessed by my creating an entire new category just for this post. Surely I wouldn't do that if there was only going to be one post here, would I? On the down side, I now want a lot of new toys for my bike, like a bike computer to tell me how far and how fast I've gone, and clipless pedals, and maybe a more comfortable seat.

Another Clié Weblog Entry.

#datetime 28/7/04 19:11

So the infrastructure has gotten much closer to being done, without being any closer to being done. What I mean is that I built a Palm conduit in Python, using Palm's COM API, so I can take advantage of all the nice, high-level Python libraries for things like threading, and network access, and security, instead of having to locate and figure out how to use other people's, or worse, code them up myself!

There are still a few problems with the framework, I can't seem to call anything with a Variant Out parameter, and I haven't tested writing records, but other than that, it's golden, and I expect those bugs will be fixed as soon as people start playing with it. And none of the actual sync code is written, either, but that will be trivial, right? Right. Still, if you're reading this, then I must have gotten something working...

Update: It is working! It doesn't synchronize in any way, it just uploads the entries and hopes for the best, but I'll fix that later. You can grab a copy of the conduit code here, and the Plua source for the app itself here.

Coming soon: marking the memos which have been uploaded, so that we don't upload them again. (I've got the code to ignore them working just fine, but I haven't delved into the black art of writing a record back to the Palm yet.)

Test pEdit Weblog Entry.

#datetime 4/5/03 15:38 Someday, this entry will be coming to you from my Clié. I have a dream, you see. A dream that I can update my weblog whenever I get a chance, instead of only when I'm at my computer. A dream that, just by putting memos in a specific category on my Clié, I can add new entries and update older entries with new information whenever I feel like it.


I've been keeping a small tupperware full of miso paste in the fridge at the office for the past few months. It seemed like something that I could use to supplement my lunches, or as a nice alternative to coffee when I was in need of a hot liquid. In related news, I'm feeling a little under the weather today due to being in the middle of a cold I got from my wife, or perhaps daughter, and since all I have for lunch is a baloney sandwich, and some salad, I thought that it would be the perfect thing to clear my sinuses, and give me a little boost of wellness. Hah.

I'll be the first person to grant that miso paste looks a little like something that's gone off, and it's nice that people are clearing out the fridge, but man is that ever bad timing. Worse, since payday isn't until today, and there wasn't enough in the bank account for me to take out any spending money, so I can't even buy an overpriced chicken noodle soup from the food court. So I ended up having a cup of coffee, but it just wasn't the same somehow. At least I got in early, so I'll be able to go home in a couple of hours, and have some soup there.

Hah! And just as I finished writing my tale of woe, it started raining. Man, what a day!

No More Text!

The idea of IDEs not being forced to rely on text files has been popping up in several of the weblogs I read. While I think Alan has part of the reason correct (there's a lot of infrastructure dedicated to dealing with text files), I don't think he has it all. There are definately some major advantages to putting things in plain text files, which seem to be being ignored For instance, my company has moved from a binary resource format to a text-based resource format precisely because of the advantages it brings. (Well, okay, we never went with the binary format, but that's because the people making the decision saw the problems it had at previous places.) Those advantages being:
  • No tool/vendor lock-in.
  • Easier to fix when something goes wrong.
  • Easier to see the differences when something changes.
I suppose these benefits could also be had by using a standardized text-based (or xml-based) representation of the image for loading and saving, along with smarter tools for editing, but I'm not sure that making the tools smarter is such a good idea in the first place. Should my source code control system really be forced to know about my programming language? What if I change languages?

Rewriting Progect.

In my copious free time, I've started helping Rick Price rewrite the internals of Progect (a project management application for the Palm) in a more object-oriented manner. It's an interesting task, getting to redesign an application with a well defined set of features, and I'm glad to be able to help, even the little that I can. As the project progesses, and as I get the free time, I'll add more of my thoughts on the topic to this category, so that we will have a record of what the decisions and thought processess were that went in to the new design.