Tao of the Machine

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

Redirections

When looking for Mac OS X upgrades, I stumbled upon an URL that made GetRight barf. It could not download it because it redirected twice. So, I decided to write a quick Python script to find the "final" URL, following redirections. Nothing fancy, but maybe it will be useful to someone.
# realurl.py
# Follow all redirections until a final URL is reached.

import httplib
import sys
import urlparse

__usage__ = """\
realurl.py url

Follow all redirections until a final URL is reached.
"""

try:
    url = sys.argv[1]
except IndexError:
    print >> sys.stderr, __usage__
    sys.exit(1)

while 1:
    print "Trying:", url
    parts = urlparse.urlparse(url)
    conn = httplib.HTTPConnection(parts[1])
    conn.request("HEAD", parts[2])
    r1 = conn.getresponse()
    print r1.status, r1.reason

    try:
        url = r1.msg["Location"]
    except KeyError:
        break

print "\nFinal URL:", url
(Colorized Python source would be nice. Hmm. Maybe something for in my CMS...)

Posted by Hans Nowak on 2003-01-24 21:58:50   {link}
Categories: Python

Short CoT review

Crossroads of Twilight, book 10 in the Wheel of Time series, by Robert Jordan

(Warning: spoilers ahead)

Before this book came out, I read some previews that said that CoT actually moved the plot along. Nothing could have been farther from the truth. In the newsgroups, many people complain that nothing happens at all. While that judgement is not entirely fair, their disappointment is understandable.

The book can roughly be divided into two parts: what people where doing shortly before Rand cleansed saidin, and shortly after that. That's it. No long timespans are covereed here. People hardly move, and basically still do the same as what they were doing in WH. Elaine struggles with the succession. Mat & co leave Ebou Dar, but don't get too far (not out of Seanchan reach anyway). Perrin still walks around trying to free Faile. Rand recovers from his saidin-cleansing. Egwene and the Salidar Aes Sedai seem to make the most progress, they reach Tar Valon.

So many things don't happen. Mat doesn't marry the Daughter of the Nine Moons. Perrin doesn't free Faile. Rand doesn't do anything interesting, neither do people around him, like Min, Nynaeve, Lan or Cadsuane. Elaine is still in pretty much the same position as at the end of the last book; no war, but nothing is settled either. Egwene and the SAS don't besiege Tar Valon, they just talk. No Forsaken in this book except for Mesaana. (Well, and Halima.) No Fain. No Taim. No fights with Trollocs or Myrddraal. Tarmon Gaidon doesn't seem any closer.

The things that do happen are not earth-shattering, although some of them are important, and others may turn out to be important in the future. Here are some of the events and plot lines:

  • Mat escapes Ebou Dar with Egeanin, Baile Domon, Noal Charin (Jaim Farstrider?) and most importantly Tuon. They get a bit closer to each other, but not by much.
  • One spoiler was right: Perrin does something very much out of character. A reader in the newsgroup suggested that he's undergoing a character change that may be important later on, when he will have to choose between following Rand (and doing his duty in TG), and rescueing Faile.
  • Perrin & co also encounter a strange town with ghosts and stuff. We don't know too much about this yet.
  • Egwene seals the harbors of Tar Valon with cuendillar. The most important event of the book might happen at the last page of the last chapter (not counting the epilogue).
  • Two Aes Sedai in the SAS camp are killed with saidin, probably by Halima (it doesn't say that, but she seems the most likely culprit).
  • Rand doesn't do anything, but plans "something dangerous". No clue what it is.
That's about it. Maybe CoT is really the low before the storm, but there aren't really many clues that Tarmon Gaidon is about to begin. Aside from that, many parts are decidedly boring, especially when Jordan indulges in page-long descriptions of scenery and clothing. Sure, it adds to the flavor, but it's not very entertaining. Too often you think, "when is something going to *happen* already?"

All in all, I didn't find the book really disappointing, but it wasn't a very exciting read either. At least WH moved the story along. Sigh. And now we have to wait two years or so for the next book...

Posted by Hans Nowak on 2003-01-23 23:56:23   {link}
Categories: books

ZODB inspection

ZODB looks nice. I want something like this to use in my CMS. Well, maybe not exactly the same, but a similar principle. Simple persistence. I am also inclined to use an object database rather than a traditional (relational) one. Relational databases are rigid; with an OO database, I can add objects and fields at will, and new versions of a program will work without problems.

(I didn't get the example to work, by the way, the newuser object didn't register that it was changed... but then again I didn't use a BTree (because it wasn't found, I'm assuming it's in the Zope distro). I used a dict, which may make all the difference.)

Question is, will I use ZODB? Probably not. Points against it: this makes for another download, and I don't really need all the magic and power that it offers. Something simple and home-grown might be better. I don't want to reinvent the wheel, but I don't want to rely on third party packages too much, either. If it was an app for personal use, no problem... but not in this case.

Posted by Hans Nowak on 2003-01-23 22:37:17   {link}
Categories: Firedrop

Design decisions

Picture a new content management system, waiting to be written. It will be client-based, much like Kaa.

» Should it be feature-rich, or minimalistic?

» What GUI should it use? (Tkinter and wxPython are the main contenders.) Or should it use something radically different, like Jython? Maybe even web-based?

» Should it have a friendly user interface, or something more terse and powerful?

» Should it be portable? Of course, the more platforms it supports, the merrier, but this has consequences for the choice of GUI, among other things.

» What database should it use? Plain text files? Gadfly? ZODB? MySQL?

» Should it be a small, self-contained download, or something that requires several third-party packages? (Kaa is an example of the former. All you need is Python; download Kaa and it's ready to run.)

Lots of decisions to be made, and some of them will affect decisions in other areas. Thoughts? Drop me a mail or leave a comment.

Posted by Hans Nowak on 2003-01-21 21:36:51   {link}
Categories: Firedrop

Flaky

My CVS repository at zephyrfalcon.org has been created, but I can't use it yet. Maybe I'm doing something wrong. Maybe it's a matter of incorrect permissions.

Mac OS X has its little problems, too. The icons in the harddisk root are always jumbled when I start up, no matter how many times I correct it with Show View Options. (It does work for other folders.) Also, I specified TigerLaunch to start when the Mac starts, but nothing happens. (Other programs, like DragThing, do start up.)

Of course, I don't even have to *start* about Windows. Sometimes you can view PDF files by doubleclicking them, something you can't. Regularly it decides that my folders need a different sort order, even though I told it no such thing. Sometimes it just crashes. How could it be otherwise?

I also had some trouble with threads the other day. A method that does some database updates acquires a lock, so nothing should interfere with the database communication. Do the other threads care? No. They happily continue even when the aforementioned update thread is running.

Sometimes things are just flaky. Sigh.

Posted by Hans Nowak on 2003-01-21 21:30:52   {link}
Categories: general

Another weblogging tool

Vellum. Looks interesting; I'll try it out on my server later.

There are some obvious differences between Vellum and Kaa. Most importantly, Kaa is client-based, while Vellum is server-based (like most other weblogging tools, like Movable Type). Also, Vellum's embedded Python is more like ASP, meaning you can write code like this:

<h1>My list of numbers</h1>
<% for num in range(5): %>
  The number is: <strong><% print num %><br>
<% end %>
I personally don't like this approach much, but it does have benefits over Kaa's method, since you can mix HTML and code.

This, and some comments on Kaa that I read yesterday, got me thinking some more about the next step. I have my domain name now. Maybe it's time for a complete CMS in Python so I can build and manage a whole site.

Update (9:21 PM). Vellum works... sort of. I managed to install it without much trouble. I can also post. The question is, however, how can I view my weblog? That is something the installation instructions don't tell you.

Posted by Hans Nowak on 2003-01-20 13:13:20   {link}
Categories: Python

5 months later...

...I am still not very proficient in using the Mac, mostly because I lack time, and a decent workplace. In spite of that, I took most of this weekend to play with it, and work through the Missing Manual. Once that is done, I can install Jaguar (which has been gathering dust since September or so) and use Jaguar-based programs, like Safari.

I am appreciating the Mac more and more. It has style *and* substance, as opposed to Unix (substance but no style) and Windows (neither). You can work on a very high-level, using very user-friendly tools. For example, I plugged in my digital camera, and iPhoto did the rest (easy downloading). No special drivers or software needed. On the other hand, you can work on a very low level as well. For example, today I was staring at old C code that wouldn't compile. ;-)

DragThing is great. So is TigerLaunch. Chimera is nice (although I wish it was more like Phoenix on Windows). I can still babble on ICQ or YM, using Proteus. Have to find a decent news reader, though. Mozilla's?

More later, if I actually have something interesting to say about my Mac adventures...

Posted by Hans Nowak on 2003-01-19 22:28:55   {link}
Categories: switch

--
Generated by Firedrop2.