Tao of the Machine

Programming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.

Things NOT to do in 2003

  • Buying your kids a karaoke machine.
  • Buying cats. (Phew!)
  • Buying a compiler book with C++ examples.

Posted by Hans Nowak on 2002-12-27 12:38:24   {link}
Categories: general


Inspired by Mark Pilgrim's "Pushing the envelope" post, I looked into some lesser-known HTML tags. Especially the code tag seemed interesting.

The page says: "CODE: Designates a fragment of computer code." OK, so let's try to display a few lines of Python.

def f(x, y): if x > y: print "foo!" else: print "bar!"

Does this look good? Not quite. That's why I use the pre tag instead:

def f(x, y):
    if x > y:
        print "foo!"
        print "bar!"
But of course, it's not "semantic". If I wanted to generate a list of code fragments from my blog, then using code, rather than pre, would seem appropriate... except that it doesn't display the code correctly. Well, I suppose C code would still execute after being mangled by code, but Python definitely would not. :-)

Anybody knows what the code tag is good for?

Posted by Hans Nowak on 2002-12-27 10:27:41   {link}
Categories: general

New year's resolutions

Not really resolutions, but some stuff I want to do.
  • Get my own domain name. (I would have already if I could make up my mind about a name... :-)
  • Read comp.lang.python more. (And post more, if I have something useful to say...)
  • Write some articles and essays. (Python-related, probably) Or maybe stories.
  • Create a worthy successor for Kaa, or evolve Kaa into something better.
  • Make a new website, possibly with the program mentioned above.
  • Create a network game. (Probably a strategy game, I've had some ideas about this for years...)
  • Start hacking (on) the Mac.
  • Learn a bit of Java. (Mostly because I might want to use Jython.)
Of course, these are all computer related. What else did you expect from a geek? ;-) A non-computer-related resolution would be, to continue aikido and become more proficient in it. But that is not really a goal, more something that evolves over time.

Posted by Hans Nowak on 2002-12-26 22:14:12   {link}
Categories: general


AndyInJapan left a comment to my LXF post. It seems that there already is a similar format, XBEL. Looks interesting; if possible, I'll use this. No need to create yet another format if it's not strictly necessary. (But does it support categories? Hmm...)

Posted by Hans Nowak on 2002-12-25 14:07:47   {link}
Categories: Python

It's a Mac's world

Some things make more sense in one environment than another.

For example, the tendency of Unix programs to put stuff (or look for it) in your home directory. Windows doesn't really have such a concept, not like Unixen, so I never used it and never saw the benefits of it. Now that I have an iMac running Mac OS X, things become more clear. You store a binary and libraries in a central place (e.g. for vim), then different users keep their .vimrc files in their respective home directories. Much nicer. Making backups is easier too, since binaries (and in general, files that don't change a lot) are separated from profiles, user-generated files, work, etc. I assume that if software is correctly installed, you just backup your home directory (and maybe a few others). This never made sense to me on Windows, but now it's crystal clear.

distutils fits in this pattern too. On Windows, I never really used it. What's the point? It's not hard to copy files and directories to a directory that can be "seen" by Python. And compiling C extension modules with it is a no-brainer, since I don't have a (compatible) C compiler. (Dev-C++ and Cygwin's gcc don't count.)
On Darwin, everything's different, though. I just installed gadfly. distutils happily copies it to certain directories. Same for kjbuckets, which was compiled (using cc) first. All test pass. Nice.

I can't wait for Mac OS X Unleased to get more out of my Mac. ^_^

Posted by Hans Nowak on 2002-12-25 13:43:05   {link}
Categories: switch

Greatest misses

magicthegathering.com is a nice site, but sometimes they goof up.

Like the time that Mark Rosewater did his darndest to explain why leaks (card spoilers coming out before WotC officially released them) are bad for us. That was laughable, and purely written from a marketroid point of view.

This week they goof in a different way. It's the holidays, and to celebrate the editors have decided to give us... repeats of the best articles of 2002. Yes, that's right, we get to look at old articles every day. For those who don't know the site: every weekday a new article is posted, which is usually informative and/or funny, so it's worthwile to come back every day and read the new stuff. Except for this week, when we get old articles.

But wait, maybe articles are taken off the site after a certain time, so it makes sense to read the best old articles again? Eh, not really. All older articles can easily be retrieved in the archive.

Even the Q&A section rehashes old questions! But at least they're funny.

Elaine Chase: "I'm actually the only girl who plays Magic. Besides being a Magic developer and a level 3 judge, I'm also on the Magic rules team, so I make sure to tell the templating team to use 'she' a lot. Every time you see a 'she' on a card, it's talking about me."
Let's hope they start writing again after this week...

Posted by Hans Nowak on 2002-12-24 09:17:17   {link}
Categories: CCGs


Today I started writing a program to collect links. It should be able to store them, publish them, categorize them, etc. I have no name for this program yet; maybe "LinkThing"?

There is no actual application code yet, but I wrote a module that manages the link collection, and reads and writes collection in the LXF format. This is an XML-based format that I hacked up myself. Nothing fancy; it just stores information about URLs and categories.

Here's an example with just one URL and some sample categories:

<lxf version="0.1">
    <author>Hans Nowak</author>
    <updated>2002-12-22 13:30:00</updated>

    <item name="programming" />
    <item name="python" parent="programming" />
    <item name="perl" parent="programming" />
    <item name="zope" parent="python" />
    <item name="important" />

      <title>The Python homepage</title>
      <description>*The* place to go for all things Python.
I'm getting tired of having my links scattered over 5 or so browsers, so I want to manage them in one central point, classifying them using categories rather than a hierarchical folder structure. The new program should be able to publish (create & upload) the links as a HTML file, but also as LXF. This way, I can share my link collection between computers: download, add links, and upload again. Or I can import other people's LXF files, etc.

The general direction of the program isn't entirely clear yet. Some crossovers come to mind... what about storing local links (shortcuts) to applications, and launching those apps? Or, what about mixing it with the "stalker" idea (keeping track of when a web page changes and notify you)? But maybe those belong in separate programs...

Posted by Hans Nowak on 2002-12-22 23:08:31   {link}
Categories: (unclassified)

More Mac troubles

...and like yesterday, they're really at beginner level. *frown* This time I tried playing movies. iMovie isn't meant for that, as I soon found out. Instead, there is a Quicktime Movie Player (with an annoying nag screen, aside... fortunately, the MM has a tip for how to remove it).

So I tried playing some .avi files. Quicktime should be able to handle them, but complains that it cannot play them. That may be a matter of getting online and getting the right codec; maybe later, I didn't feel like crawling behind my desk to move the modem cable from the PC to the Mac. I will have to test that some other time.

An .mpeg file, then? Nope. Quicktime complains again. I'm not sure it's a matter of a missing codec here. Then I tried my Video CD (Princess Mononoke, I "won" it on Ebay but the box only contained disc B; the seller promised to correct the mistake but I haven't heard from him since). Nope, that didn't work either.

I haven't been able to play any of my movies, which doesn't really speak for the Mac's multimedia capabilities. Or for my intelligence, maybe. :-)

So far I've been struggling with the Mac over basic things, but at least I'm using it (or trying to). I ordered Mac OS X Unleashed from Amazon today, that should get me up to snuff soon. Not for my Quicktime problems of course, but if I want to make it my main hacking box, then I need lots of insider info.

For a weblog that regularly contains Mac OS X tips rather than complaints <wink>, see bbum's rants, code & references. And it's Pythonic too...

Posted by Hans Nowak on 2002-12-22 22:51:55   {link}
Categories: switch

My new mp3 player :-)

The iMac is truly a wonderful machine. On the surface it's more user-friendly and intuitive than Windows, and below it's the raw power of Unix.

So why am I not using it?

Hmm. One reason is that I don't have a good work place to use it. It's standing next to the Windows computer (which I use for work), and due to its position on the desk, it's awkward to put a chair in front of it, the keyboard is hard to reach, and the mouse even harder and it has little space. In other words, it's not easy to use it for a long time.

Another reason is that I cannot use Python to its full extent (yet), the way I can on Windows. I hack on command line tools, Tkinter apps (like Kaa), and wxPython apps (like Charm). Tkinter and wxPython don't work too great yet on Mac OS X (using Carbon, of course).

On top of that, there is lots of stuff to learn, and I don't have too much time (and reason #1 makes long learning sessions awkward). Lots of annoying things get in my way, like bash and vim settings, programs I don't know well, etc. I'm sure most of these things can be solved once I know more, but until then, it's just irritating.

So I figured I can start using the Mac for mundane tasks. Like playing mp3s. Turning the Mac into a music box. There is this program called iTunes, which seemed suitable. I don't like it too much though, because it doesn't let me do what I want. How can I add one mp3 to the play list? I don't have a clue; drag & drop doesn't work. It works for folders, but the moment I dragged & dropped a folder, it proceeded to import the whole CD, not just the mp3s in that folder. Hmm. This software is a bit overzealous. If I cannot select individual tracks, then there's simply not much reason to prefer iTunes over WinAmp. (MacAmp, anyone?) Yes, this seems a minor complaint, but I do this kind of stuff all the time.

If anyone knows how to "tame" iTunes, let me know. In the meantime, I study the Missing Manual again.

Update [11:18 PM]. According to the MM, you can select certain files, then select "create new playlist" and everything that is selected will be included in the new list. This is not really the same, but it will do. Different computers, different customs...

Posted by Hans Nowak on 2002-12-21 22:40:58   {link}
Categories: switch

Generated by Firedrop2.