How to get started with a Treo 650 on SuSE 10.0 OSS

In your hand you hold a Treo 650. You look at the shiny new handheld, then you look at your Linux box. You look back at the Treo, then back to the Linux machine. “Maybe,” you think, “maybe I can get these two to work together.”

For some weird reason, the Treo 650 comes with software that only works on the Macintosh and some obscure operating system called “Microsoft Windows”. If you’re like me, then you’re probably interested in going with something a little more mainstream, like SuSE Linux 10.0 OSS. Nothing says “mainstream” like a pure Open Source Software Linux distribution put together by Germans.

LOCATE TREO DEVICE

First things first, plug the Treo into your computer via the provided USB cable. Nothing will happen, as is expected. Open up a new shell and monitor the system log:

japan:~ # tail -f /var/log/messages

Now, hit the HotSync button (either the hardware button on the cable, or the icon in the software) and watch what happens in the log:

Mar 19 16:17:54 japan kernel: visor ttyUSB0: Handspring Visor / Palm OS converter now disconnected from ttyUSB0
Mar 19 16:17:54 japan kernel: visor ttyUSB1: Handspring Visor / Palm OS converter now disconnected from ttyUSB1

No, I don’t know why the Treo is connected to two USB devices. And no, I’m not going to spend the rest of the day learning about udev in order to make the device always appear as /dev/pilot. I happen to know from experience that I want to use that second USB device and so I’ll be referencing /dev/ttyUSB1 in these examples. Once you’ve seen what device the Treo gets assigned, cancel the HotSync.

SET USERNAME AND USERID

At this point, your Treo needs to be assigned a username and userid. This isn’t your SprintPCS Vision username – this is a username that you assign to your Treo using the installation software. Fortunately, we don’t need the installation software to do this. As I understand it, you can choose anything for your username and any integer for your userid. Here is how I set my username/userid:

  1. Hit the HotSync button so that the Treo will connect to the software device.
  2. japan:~ # install-user -p /dev/ttyUSB1 -u "theoden" -i 1234

SYNC WITH KPILOT

Fire up KPilot (though you could use JPilot if you want something that looks like crap and pays zero attention to user-friendliness). In the settings you’ll want to make sure that the device is /dev/ttyUSB1 and that you are transferring at 57600 baud instead of 9600. I like to be thorough, so I specified “Backup” in the little menu that pops up when you click-and-hold on the little HotSync button (not the big HotSync button). KPilot will then tell you, “Next HotSync will be: Backup. Please press the HotSync button.” Hit the HotSync button on your Treo and watch the data fly!

MERGE OLD DATA

The next thing I did was take the somewhat risky step of merging data from my 4-year-old Handspring Visor into the Treo 650. Before you do something like this, I would recommend backing up the Treo first (read previous section). In the end, I managed to get my old data on there, but all the category information was missing. This meant that all memos, contacts, and such that I merged had a null category; not “Unfiled”, but empty. So once all the data was merged, I did the following on my Treo:

  1. Open, for example, Memos.
  2. From the category drop-down, choose “Edit Categories…” and add all the old categories.
  3. Select the “All” category to see all entries.
  4. Edit each entry, placing it in the appropriate category.

Doing that was annoying, but certainly better than if I had had to enter all the data by hand. Maybe it is the case that if you enter the categories before merging, the entries will be slotted correctly. I didn’t do extensive web research on the subject, so maybe there is a simple way to merge the categories in there. Anyway, now that you know all that, here is how I merged the data:

  1. Hit the HotSync button so that the Treo will connect to the software device.
  2. japan:~ # pilot-xfer -p /dev/ttyUSB1 -m old_pilot/MemoDB.pdb
  3. When the merge completes, go to the appropriate Palm app in your Treo and make sure that your old data is there.
  4. Repeat for all the *.pdb files that you want to mege.

Happy syncing!

Posted in HOW-TOs, Linux, Smartphone | 3 Comments

How to get a networked Brother HL-5170DN working on SuSE 9.3

CUPS comes with a driver that works with the HL-5170DN, but it does not seem to handle double-sided printing. Fortunately, Brother supplies Linux drivers on their website, though I found the documentation to be somewhat disorganized. This HOW-TO will describe exactly how to get it working under SuSE 9.3 Pro.

1) First you must obtain the LPR driver. I wound up downloading hl5170dnlpr-1.1.2-1.i386.rpm from here.

2) Second, you need the CUPS wrapper driver. I wound up downloading cupswrapperHL5170DN-1.0.2-1.i386.rpm from here.

3) Now install the drivers. According to the helpful folks I emailed at Brother, the errors can be ignored. Note that you need --nodeps on that second command.

uranus:~ # rpm -ivh hl5170dnlpr-1.1.2-1.i386.rpm
Preparing... ########################################### [100%]
1:hl5170dnlpr ########################################### [100%]
/var/tmp/rpm-tmp.12440: line 2: /etc/init.d/lpd: No such file or directory
error: %post(hl5170dnlpr-1.1.2-1) scriptlet failed, exit status 127
uranus:~ # rpm -ivh --nodeps cupswrapperHL5170DN-1.0.2-1.i386.rpm
Preparing... ########################################### [100%]
1:cupswrapperHL5170DN ########################################### [100%]
rm -f /usr/lib/cups/filter/brlpdwrapperHL5170DN
Shutting down cupsd done
Starting cupsd

4) Now the driver is installed so we need to get CUPS to see the printer. Do NOT use the KDE printer manager utility and do NOT use Yast2. I tried setting things up with those and ran into problems. Perhaps I was doing something wrong, or got confused, but in the end I got the printer to work using the CUPS admin interface. To use the interface, you need to make an admin user for CUPS. Here is how I did it:

uranus:~ # lppasswd -a root
Enter password:
Enter password again:

This will create an account with username root having the password you specified. If you’re curious, CUPS stores this user information in /etc/cups/passwd.md5

5) Now point your browser at http://localhost:631/ and you’ll see the CUPS admin interface. You will be prompted for a username/password at some point, at which time you will enter the username/password that you created in the previous step.

6) Click “Manage Printers”.

7) Now you probably want to delete the “HL5170DN” printer that Brother’s driver RPMs added. Their printer config is not set up for the network, and I felt that starting from a clean slate would be the safest course of action. Click “Delete Printer” to get rid of it.

8) Once the printer is deleted, click the “Printers” button, then click “Add Printer”.

9) Type “HL5170DN” for the Name, whatever for the Location, and “Brother HL-5170DN” for the Description. You don’t have to type those words exactly – these fields are more for descriptive purposes. Click “Continue” when done.

10) For the Device, I selected “Internet Printing Protocol (http)” because my printer is attached to the network. Obviously you’ll need to select whatever is appropriate for your setup. Click “Continue” when done.

11) For the Device URI, I entered “http://bro5170.example.org” because I have dhcp/named set up to give the printer that name (though “example.org” is obviously just an example for the purposes of this HOW-TO). Click “Continue” when done.

12) Choose “Brother” for the Make and then hit “Continue”.

13) For the driver, scroll down and choose this exact driver: “Brother HL-5170DN for CUPS (en).” Then hit “Continue”.

14) You’ll be told that your printer was successfully added. Following the HL5170DN link and you’ll see your printer. Click the “Configure Printer” button.

15) Under Duplex, change the option to “DuplexTumble”. You may also need to change “Media Size” to whatever is appropriate (“Letter” in my case).

16) Click “Continue”, then go back to the HL5170DN page. Now click “Print Test Page” to make sure that everything is working. Note that this does not test duplex printing.

17) The last thing is that for some reason KDE does not seem to realize that “Letter” is the default media size, despite having set it in the CUPS admin. I wound up going into the KDE printer manager and changing the default from “A4” to “US Letter”. All this does is create /etc/cups/lpoptions with some specialized options. Here is the entirety of the file:

uranus:~ # cat /etc/cups/lpoptions
Dest HL5170DN _kde-filters media=Letter,Normal,Upper sides=one-sided
Special Advanced%20Faxing%20Tool%20(ksendfax)
Special Mail%20PDF%20File
Special Print%20to%20File%20(PDF)
Special Print%20to%20File%20(PostScript)
Special Send%20to%20Fax

Congratulations, now the printer should Just WorkTM.

Posted in HOW-TOs, Linux | Leave a comment

Gentoo: Enough is Enough

I’ve battled through a Gentoo upgrade for the last time. I’ve set my computer compiling for days, restarting after fixing the errors that crop up. I’ve run portlog-info.sh and painstakingly combed through all the little messages and warnings that would otherwise go unnoticed. I’ve run etc-update and meticulously made sure that my custom configurations remained intact. I’ve diligently run revdep-rebuild over and over again to get my dependencies in order. In short, I’ve spent a lot of time.

And I was willing to spend a little more time to get the latest kernel compiled. I decided to start using genkernel and set it work on linux-2.6.15-gentoo-r1. This is what I got for my troubles:

* ERROR: Failed to compile the "EXTRAS="extras/scsi_id extras/volume_id extras/ata_id extras/run_directory extras/usb_id extras/floppy extras/cdrom_id extras/firmware" USE_KLIBC=true KLCC=/var/tmp/genkernel/31155.14552.30166.11430/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" target...

Fine, fine. I hit the Gentoo forums and found that the error was possibly caused by the new udev stuff. Looking in /etc/genkernel.conf I found UDEV_VER="077", despite that my installed version of udev was 079-r1. Reemerging udev and genkernel did not fix the problem. So I changed the version in the config file to 079, and was met with an error about not being able to find udev-079.tar.bz2 in /usr/share/genkernel/pkg. I then copied udev-079.tar.bz2 from /usr/portage/distfiles to /usr/share/genkernel/pkg. I tried compiling the kernel once more:

* ERROR: Failed to compile the "EXTRAS="extras/scsi_id extras/volume_id extras/ata_id extras/run_directory extras/usb_id extras/floppy extras/cdrom_id extras/firmware" USE_KLIBC=true KLCC=/var/tmp/genkernel/31155.14552.30166.11430/klibc-build/bin/klcc USE_LOG=false DEBUG=false udevdir=/dev all" target...

I guess I could spend the rest of my Sunday hammering at the problem until it works. And then I could get sound working again since it got messed up by the upgrades. And then I could get my CD-RW working again. And then I could fix all the other problems that I don’t know about yet. And in a few months I could repeat the process.

But I’m tired. I’m tired of all the time, the endless time, it takes to keep Gentoo updated. I could always try not updating, but you know one day I’ll want to install something. And that something will depend on something else, and that something else on something further. I’m a sysadmin and a consultant by trade; I hack on Linux systems, I code, and I get stuff working. I put in the time and I’m reasonably 1337 – hell, all the hours I’ve put into my Gentoo system helped me get where I am today. But now my free time is precious. I don’t have time to…

  • … compile every single package from source.
  • … learn about every USE flag and what combinations I need so that, for example, I can play music.
  • … figure out why XYZ bleeding edge package doesn’t install or won’t work.
  • … get all my hardware working after each upgrade.

Maybe I’m getting soft, but I want to be able to use my home computer. Maybe it’s anti-geek of me to not want to spend all my time fiddling with my system. Maybe I’ve sold out. Maybe I don’t believe in nothing no more – I’m going to Ubuntu.

UPDATE: Ubuntu has this retarded no-root-account, run-everything-with-sudo thing going on. Forget it, I’m going with SuSE 10.0 OSS.

Posted in Linux, Rants | Leave a comment

Lightwing by Tara K. Harper

Lightwing by Tara K. Harper was first published in 1992 so I suppose it would be classified as contemporary sci-fi. Lately I’ve been sticking to Nebula and Hugo award winners, but I took a step outside that safety zone with this book. A friend loaned me a stack of books that included Lightwing, along with William Gibson’s Neuromancer, Roger Zelazny’s Lord of Light, and others. Putting Lightwing among these sci-fi greats would be like Peter Jackson giving a cameo to Rod Schneider in Return of the King, having Rob sitting on a lawn chair on Mount Doom, shouting, “YOU CAN DO IT!” at Frodo and Sam. I guess what I’m trying to say is that it was a real which-of-these-does-not-belong moment for me.

I don’t mean to say that Lightwing is bad exactly – it’s just very pulpy compared with something like Neuromancer. In a nutshell, the story follows a woman named Kiondili Wae who uses her intelligence and telepathic ability to assist in the creation of a faster-than-light drive. Kiondili works in a remote research station with human and alien scientists who are desperately trying to get the drive working before their grant money runs dry. So the setting is actually quite interesting, as is the way the whole telepathy aspect is handled. I also enjoyed some of Harper’s descriptions of the aliens and the problems caused by “incompatible species” working closely with one another. The scientific environment – research politics and clashing egos – gave Lightwing an engaging character dynamic.

Unfortunately, I found many of the characters themselves to be a little cartoony. To Harper’s credit, she didn’t pull a complete Michael Crichton and throw out some empty character templates to bumble around her storyline. Kiondili Wae is filled out pretty well with decent character construction. In the end, when you add the silly characters to Harper’s intelligent, but monochrome prose, you get something that feels like a standard Star Trek episode.

But hey, I like Star Trek.

Posted in Books | Leave a comment

Dragon Quest VIII: Journey of the Cursed King

Dragon Quest VIII would be really amazing if I had never played an RPG before. But seeing as I’ve probably played several dozen RPGs, the game isn’t all that enthralling. Here was my logic behind purchasing this game:

  1. Eurogamer gave Final Fantasy X a 9/10.
  2. Eurogamer gave Dragon Quest VIII a 9/10.
  3. Therefore, DQ8 must be as good as FFX.

Do you understand my reasoning? Because both games are RPGs, and because both games received equivalent ratings, it stands to reason that they would be equally enjoyable. The reason I like Eurogamer is because their ratings generally aren’t as inflated as other gaming sites. Here is how most sites rate games:

  • 10 = This game was kind of fun
  • 9 = I played this game
  • 8 = Game exists
  • < 8 = <not used>

I am of the opinion that numerical ratings should mean something. As in, the rating should be some indicator as to the actual quality of the game. I become disheartened when I see a game like DQ8 placed in the same category as FFX.

I’m not saying that DQ8 is a complete waste; the game is actually a fine RPG. DQ8 has attractive, cel-shaded characters, though most of the environment seems to be done in a slightly different style. The game world is 3D with bright colors and a definite “enginey” feel to it. By “enginey” I mean that I could imagine people sitting down with a map editor and dropping tree icons here and there. After the rich, pre-rendered backdrops of FFX, this game had an almost barren feel.

Combat is pretty basic, as is leveling, equipment, and items. Probably the most distinctive thing about this game is its cheeky sense of humor and British voice talent. After playing for over six hours, I found that my interest in DQ8 was completely gone. The story was dry, the characters were empty, the orchestral soundtrack was too simplistically Disney, and the combat was boring. This RPG is well-put-together, but it lacks innovation. Recall my own personal rating system:

  • 10 = Perfection
  • 9 = Must be played
  • 8 = Shades of brilliance, but not complete
  • 7 = An amusing diversion
  • < 7 = Crap

Because I did get a few hours of entertainment out of Dragon Quest VIII, I’ll give the game a 7/10.

Posted in Video Games | Leave a comment

Final Fantasy X

I… I didn’t know it could be like this…

You see, I’m not twelve anymore; I am twenty-nine years old with lots of gaming under my thumbs and discerning tastes. You can’t throw a Lord the Rings: The Third Age at me and expect me to enjoy it just because the graphics are good and the movies are popular. Nor can you tempt me with a Baten Kaitos which, despite its dreamy visuals and intriguing combat system, has a soul made of styrofoam pellets. I’m not sure why they even bothered to make the character art in that game; they should have just represented each character as a sack of styrofoam pellets. These pellet sacks could then be set on a quest to jump into a big cardboard box. And you certainly won’t catch my attention with a Tales of Symphonia – if I want to watch bad anime while playing a twitch-control game, I’ll just pop in some Sailor Moon and load up Street Fighter Turbo on the SNES.

I knew it would be hard to find a game as good as Chrono Cross, but my search has ended with FFX. Of course, my search probably should have begun with FFX, what with it being the RPG series that tends to set the standard for all others, but I didn’t have a PS2 until recently. Anyway, I think what makes FFX so special is the attention they paid to the plot and characters. I’m not going to lie and say that the characterization is brilliant, or the plotline is amazing, but it was good enough for me to get engaged – and that’s saying a lot if you think about most RPGs out there. I enjoy a game so much more when I have an investment – intellectual, emotional, or both – in the story. FFX makes a strong commitment to telling its tale, and it does so in manner that I would have to describe as compelling.

Well, “compelling” is perhaps too strong a word. The main character is named Tidus; you can rename him so I changed the name to “you pig” so that I would get dialogue like, “Thank you for saving us, you pig!” As I mentioned, I am not twelve, which is why I didn’t name Tidus something like, “dickweed”. Anyway, Tidus is a pretty annoying character for the most part, and somewhat sterotypical as the good-looking, you-can-do-it, J-hero. I guess all the characters are moderately stereotypical, but most have enough personality and backstory to keep you involved. The seven characters you pick up throughout your travels have so many scripted sequences, pre-rendered cutscenes, and involvment in the story, that you almost feel like you’re right in the middle of an anime series. As a player, you gain some attachment to the characters because of this, moreso since you are actually manipulating the characters in battle.

From a mile-high view of the plot, the land of Spira has been terrorized for centuries by a creature named Sin. People known as Summoners travel throughout the land with a group of Guardians, going from holy temple to temple, accumulating powerful creatures known as Aeons. A Summoner has “gotta catch’em all” before they call summon the Final Aeon which is a being capable of defeating Sin. Once Sin has been vanquished, Spira experiences a Calm where Sin refrains from wiping out cities and causing mayhem, but eventually he always returns. Now, that sounds like your average RPG plot, but that outline is just an eggshell that shatters as you delve deeper into the game. Overall, I found the story to be really interesting and quite different from the normal RPG drivel.

One of innovations of FFX is that it does away with “leveling” in the traditional sense and introduces what it calls the “sphere grid”. As a computer scientist, I would change the word “grid” to “graph” because the sphere grid is simply a large, bidirectional collection of connected nodes. Characters start out at different parts of the sphere grid, and are able to traverse it using movement points that they can accumulate when they defeat enemies. Most of the nodes on the grid can be activated to give your characters increased attributes and abilities, but you can only activate nodes to which you are on or adjacent, and only if you have the correct sphere to do so. For example, to activate an HP node, which raises your characters hit points by 200, you would need to use a Power Sphere. The really interesting part comes in when you have the option to take your character down different paths of the grid – should you lead your character to a place where there are more magic nodes, or more warrior nodes. Also cool are the rare spheres that allow you to break the rules of the sphere grid, e.g. a White Magic Sphere lets you activate any white magic node anywhere, or a Friend Sphere allows you to instantly move to a node occupied by another character.

At this point I could probably carry on about all the aspects of the combat system, but I’ll stick to the highlights. One of the things I really enjoyed was that you are presented with a priority queue for all the participants in a battle; if a player or monster is at the top of the queue, then they are up next. The queue appears in all battles and enables you to really plan out your attack. You can also select an action for your character to perform, then see how that affects their status in the queue before actually committing to that action. Also kind of neat is that you can switch your character out for another one with no penalty. Then there is the added dynamic that Yuna, the Summoner, can call forth an Aeon. When she does this, your party runs off the screen and you then direct the Aeon against the enemy. I also enjoyed that weapons and armor were done with a simple elegance that avoided the standard upgrades of most RPGs. You know, replace your copper sword with steel, replace the steel with mithril… Instead, all weapons and armor have slots, and these slots are what defines the weapon. Moreover, you can customize the slots so you can basically build whatever equipment you want, just as long as you have the items to do so. Near the end, one of my characters had a sword with Initiative (gives party chance at preemptive strike), Evade and Counter (dodges most physical attacks, then counterattacks), Deathstrike (instantly kills many enemies), and Sensor (reveals HP and info about enemies).

The game does have its annoyances. Whenever you try to obtain a new Aeon, you have to go through a temple that contains a really annoying puzzle. Some of them were okay, but most of the time it was just work. In other words, it was less of, “find mate in five moves” and more of, “solve this Sudoku puzzle”. Then there was Blitzball. You are forced to play one Blitzball game – a really shoddy, difficult-to-control, underwater polo/soccer sport. Following that, you can play Blitzball at any save point, and even scout for players throughout your travels. You can buy contracts for your players and compete to win the big prize. I avoided all that because I found Blitzball to be ridiculously awkward. Another thing that frustrated me was the 9,999 damage limit imposed on all characters. This was a problem near the end of the game when Auron (the battle-scarred veteran full of wisdom and secrets) and Tidus were easily hitting for 9,999 every time. You can solve this problem by finding the secret “celestial weapon” for each character. Not only do you have to get the weapon, but you then need TWO more items to enable all the abilities of the weapon. So to obtain and enable all the the celestials for all 7 characters, you need to do 21 extra tasks, and many of those tasks are a huge pain. I wound up getting 2 or 3 of the weapons and getting Tidus’s weapon to full strength. This was a blessing because I could then make certain attacks for like, 30,000 damage, which both saved my ass and kept the game moving along.

I had best stop writing before this entry gets any longer. FFX is a deep game with a high-value presentation: gorgeous backdrops, beautiful music, and even decent voice acting. From a mile-high view, the game is simply: 1) battle through a random-encounter area, 2) reach a town/city/outpost, 3) enter a “temple” where you face an annoying puzzle, 4) repeat. But as FFX progresses, you find that the designers have struck a pretty pleasing balance between story, puzzle, mini-game, and good ol’ dungeon crawling. When your party finally reaches the hauntingly melancholy scene that appears whenever you power up the PS2, you’re struck by the game’s sense of poetry. In order to rate this game, I’ll first invent my own 1-10 scale:

  • 10 = Perfection
  • 9 = Must be played
  • 8 = Shades of brilliance, but not complete
  • 7 = An amusing diversion
  • < 7 = Crap

I give Final Fantasy X a 9/10.

Posted in Video Games | 2 Comments

Foundation and Earth by Isaac Asimov

Foundation and Earth by Isaac Asimov was first published in 1986 and represents the fifth book in the Foundation series. This is definitely the best book in the series I have read thus far; there were actually some parts where I stayed up late because I didn’t want to put it down.

This book continues with some of the characters of Second Foundation: Golan Trevize, a confident masculine character who has a knack for being right, Janov Pelorat, a professorial historian whose has spent his entire life studying myths about the long-lost planet Earth, and Bliss, a woman who is part of a collective consciousness known as Gaia. These characters were pretty badly stereotyped in Second Foundation, but Asimov manages to flesh them out a little bit in Foundation and Earth.

Foundation and Earth chronicles the attempts of these three characters to locate Earth. They manage to locate a number of uncharted worlds and have an entertaining adventure on each one. Asimov opened the sci-fi throttle on this one so you get a lot more than just a bunch of babble about “psychohistory”. And someone apparently gave old Isaac the green light to open the sex throttle as well – you get all kinds of sex talk, characters getting laid, descriptions of breasts, etc. And I didn’t really have much of a problem with that. I guess it made the book a little more pulpy, but Asimov writes so intelligently that it balances out.

Some of the revelations at the end were pretty cool. Throughout the book, Trevize is tasked with choosing a path for humanity, and he finally makes his decision. But the “revelation” on which his decision is based was somewhat disappointing. It’s something where through the entire series you’re like, “I wonder why this subject hasn’t been brought up yet”, and all of a sudden Asimov throws it out there. Anyway, a good book – infinitely better than the sterile novels he wrote in the 50s. Only one more to go!

Posted in Books | Leave a comment

Flatlander by Larry Niven

Flatlander by Larry Niven is a collection of short stories that detail the adventures of a futuristic detective named Gil “The Arm” Hamilton. I don’t see this on the Hugo or Nebula lists, but the book represents some quality sci-fi. In the back of the book, Niven talks about the challenges of writing these stories. Not only does he need to think up engaging sci-fi, but also a believable mystery. I was amused that he talked about how he wouldn’t “cheat” by suddenly introducing a sci-fi device that would change the rules, i.e. “Oh, he just used his Invis-o-ray to sneak past the guards.”

Flatlander is set in an over-crowded future where humans have made major steps in populating the moon and asteroid belts. People born in the different environments have begun to change form; Belters are short and stocky with muscular legs for maneuvering in zero-G, Lunies are very tall and slender which I suppose enables them to leap around the moon better, and Flatlanders and those who dwell on Earth.

Overpopulation is a major theme of this book. Society has basically perfected organ transplantation such that one can live a long time by having organs replaced. This creates a high demand for organs, leading to the crimal activity of “organlegging” – kidnapping and breaking people down into component organs to sell on the black market. In society’s attempt to meet the organ demand almost all crime is met with the death penalty, meaning that you’ll be broken up and placed in the organ banks.

The main character, Gil Hamilton, works for a specialized law enforcement organization that deals with these organ-related crimes. He also happens to have telekinetic powers, as do a small number of people in the Flatlander universe. So what you get is mostly murder mysteries with a sci-fi twist, generally involving organleggers.

One thing I found interesting was that Niven once again creates a more or less jealously-free society where free love is the norm. He does the same thing in Ringworld which I believe is supposed to be the same universe (though at a different time) in which Flatlander is set. I’ve seen this idea in Arthur C. Clarke novels as well; a guy has multiple wives and any additional sex partners he happens across with no ill consequences. Niven does a little bit better job than Clarke at examining this idea and not just throwing out a rosy view of an all-you-can-eat sex buffet with no backing. In Flatlander I think that Gil enters into an arrangement with two lovers and another guy. I believe how it works is that they stay in this 4-way relationship to provide some stability while Gil and one of the lovers exercise their “birthright” to have a child. I haven’t seen Clarke give much thought to the raising of children in these free love type of societies so I was happy that Niven examined the idea.

I found Flatlander to be solid both in terms of sci-fi and murder mystery. Because of the way Niven fleshes things out, the private-eye-in-space thing is less of a gimmick and more of quality read.

Posted in Books | Leave a comment

Foundation’s Edge by Isaac Asimov

Foundation’s Edge by Isaac Asimov is the fourth book in the the Foundation novels. This is the only book in the series to win a Hugo award for best novel – it did so in 1983. This book is a pretty good Star Trek episode, but I don’t know if I’d give it a Hugo. Certainly it’s the best book in the series so far, and I did find myself caught up in a few parts, but… I don’t know, I have yet to find myself blown away by the Foundation series.

In this book you still have a conflict between the First and Second Foundations, but now a third player enters the arena: Gaia. I’m not going to give anything away, but basically you learn some interesting and deep information on the origins of humanity in the Foundation universe. In some ways it’s a little out there, but pretty cool.

I only have two more novels left in the series, three if you count the prelude. I’m curious to see how this thing ends.

Posted in Books | Leave a comment

Tip #1: All functions should include an unexpected, random operation

Beginning programmers often make the mistake of writing functions that perform a specific, useful task. For example, perhaps the programmer finds that s/he is often converting DOS newline characters into UNIX newlines. The programmer will generally make the typical novice mistake of creating a little function that simply replaces all “\r\n” with “\n”. They might then name the function something that they feel is sensible such as convertNewlines() or dos2unix().

The obvious problem is that then people start to rely on the name of the function to tell them its purpose. But if a function could reveal its purpose solely by its name, then there would be no need for documentation. Of course you don’t want to name your function something random, so instead you should include some random operation in the body of your function. This way people using your functions will be forced to look at your documentation in order to discover the random operation.

The Microsoft® Corporation is loaded with seasoned programming veterans so they know how to write a function. A perfect example can be found in the len function of SQL Server. Most beginners make the brash assumption that len would return the length of something. Any seasoned programmer knows to check the documentation to find what random operation is included in the function. Quoting from the link:

“Returns the number of characters, rather than the number of bytes, of the given string expression, excluding trailing blanks.”

So here we see that the random operation is to subtract the length of all trailing whitespace from the length of the string. This is solid design and good programming practice, though it will no doubt leave the unexperienced coder a bit confused.

I can certainly see how something like the following might confuse someone:

len(' Theoden') = 8
len('Theoden ') = 7
len(' Theoden ') = 8

But a true coder knows that this function was written by the experts.

Posted in Coding Tips, Micro$oft | Leave a comment