Tao of the Machine

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

Some Dutch links

Some Dutch links...

Posted by Hans Nowak on 2004-02-27 23:19:15   {link} (see old comments)
Categories: linkstuffs, Nederland

QOTD: How to extract Windows "file properties"?

In Windows 2000 and XP, files have a "summary", which can be viewed by right-clicking a file, selecting "Properties", then the "Summary" tab. These properties include Title, Subject, Category, Comments, Author and more.

How to extract these properties from code? Sounds like a simple question; you'd think there must be some API function for that, or something. But apparently that is not the case; various google searches found lots of people asking the same question, but no real reply.

Well, that isn't entirely true. Here's a Delphi solution (untested), and here's some information about the "Horrible Property Set Format". What I am interested in though, is extracting these metadata from Python. Looking at the low-level Delphi code, that seems a bit difficult.

The best solution I can come up with right now is to wrap said Delphi code in a DLL (if possible) and call the DLL from Python. Is there a better way?

Posted by Hans Nowak on 2004-02-27 23:13:21   {link} (see old comments)
Categories: programming

ZODB & ZEO docs

Looking for a ZODB/ZEO introduction, I recalled a document by Andrew Kuchling. However, I could not find that article anymore (it used to be at http://www.amk.ca/zodb/zodb-zeo.html).

Waybackmachine to the rescue: here's the article as it appeared about a year ago. I don't know why it has been removed. Maybe because there's more complete documentation available now?

Posted by Hans Nowak on 2004-02-26 21:18:14   {link} (see old comments)
Categories: Python

The Little Lisper

What book did I get today? "The Little Lisper".

Is it a weird book? Yes, pretty weird.

Why? Because it doesn't look like a regular textbook at all. Rather, it does this question-and-answer thing, through the whole book. And it places horizontal bars between every Q&A section.

Isn't that a bit annoying? Yes, but it's also an interesting and refreshing approach to learning.

Posted by Hans "and it doesn't need cartoon foxes :-)" Nowak on 2004-02-25 16:51:44   {link} (see old comments)
Categories: Lisp, books

Amiga emulation

I am considering to buy an old Amiga. (Yes, another computer... where I will keep all of them is something else.) I don't know much about Amigas, so I decided to try an emulator first (WinUAE) and play some games.

Well, that was not a great success. There are lots of problems with the controls. In WinUAE, you can select mouse, keyboard and/or joystick. I don't have a joystick, so I'm seriously impaired when it comes to playing most games. The mouse doesn't work very well. It seems fine in AmigaDOS or the Workbench, but in games, the character moves all over the place, even if I don't touch the mouse... and the keyboard layout uses the numerical keypad, which I find very awkward. The normal cursor keys have no effect, nor do "obvious" fire button replacements like Space, Enter or Ctrl. Oh, and sometimes nothing works at all... no mouse, no keys, nothing.

Point-and-click games do seem to work, however. These are games that use the mouse to begin with, so emulation isn't as much of a problem as it would be for the joystick. Defender of the Crown, for example, and Dungeon Master. I am looking forward to trying out some adventure games on WinUAE, like Loom, Monkey Island, Lure of the Temptress, etc. Maybe some RPGs will work too. But I can forget about action-oriented games like Zool, World Games, or Arkanoid.

Of course, the emulation problems are unrelated to how these games perform on the real Amiga. I am not sure if I should get one; if I do, I'll need access to a cache of games as well. I won't use it for hacking, design or development... just games.

(In /links/emulation there are some links to sites with emulators and ROMs.)

Posted by Hans Nowak on 2004-02-24 22:16:57   {link} (see old comments)
Categories: games, nostalgia

Wax 0.1.50

Wax 0.1.50 is available in the download section. New since 0.1.44:

  • Added FlexGridContainer, FlexGridPanel, FlexGridFrame
  • added TaskBarIcon
  • WaxObject grew SetSizeX and SetSizeY methods, which are useful to change just the width or height of a control
  • added some events here and there :-)
  • a bunch of bugfixes

I also added a tools directory, which is going to be a subpackage containing non-rudimentary controls. These will typically be controls that are built from existing Wax controls, rather than wxPython ones. Some existing dialogs qualify, like the ErrorDialog and the TextEntryDialog, which are written in pure Wax. Expect them to move to the tools package somewhere between this release and the 0.2.

Modules in tools will *not* be imported automatically, so you'll have to do from wax.tools import foobar and such. But for now, this directory is still empty.

As for the TaskBarIcon, I added this today, based on code at Norfolk Graphics. Here's how to use it. It also illustrates how to add a pop-up menu to a control.

# trayicon1.py
# Based on wxPython example at http://norfolkgraphics.com/python.php

from wax import *

class MainFrame(Frame):

    def Body(self):
        self.tbicon = TaskBarIcon()
        self.status = 0
        self.UpdateIcon()
        
        self.tbicon.OnLeftDoubleClick = self.RestoreWindow
        self.tbicon.OnRightUp = self.ShowTaskBarMenu
        
        self.Show(1)
        
    def UpdateIcon(self):
        """ Update icon based on current state. """
        if self.status == 0:
            self.tbicon.SetIcon('icon1.ico', 'Icon demo - state 1')
        else:
            self.tbicon.SetIcon('icon2.ico', 'Icon demo - state 2')
            
    def ToggleIcon(self, event):
        self.status = not self.status
        self.UpdateIcon()
        
    def RestoreWindow(self, event=None):
        """ Show/restore main window. """
        self.Show(1)
        self.Iconize(0)
        
    def HideWindow(self, event=None):
        self.Iconize(1)
        
    def ShowTaskBarMenu(self, event=None):
        menu = Menu(self.tbicon)
        
        # choose Show/Hide based on current window state
        if self.IsIconized():
            menu.Append('&Show window', self.RestoreWindow)
        else:
            menu.Append('&Hide window', self.HideWindow)
            
        # these entries are always present
        menu.Append('&Toggle Icon', self.ToggleIcon)
        menu.Append('E&xit', self.ExitApp)
        
        self.tbicon.PopupMenu(menu)
        
    def ExitApp(self, event):
        self.Close()
        
    def OnIconize(self, event=None):
        self.Iconize(1) # minimize
        self.Show(0)    # hide taskbar button
        
        
if __name__ == "__main__":

    app = Application(MainFrame, title='trayicon demo')
    app.Run()

The original wxPython code was only tested on Windows NT 4, 2000 and XP. I'm running Windows 2000 and it works for me... I'm not sure about other versions of Windows or other operating systems. This TaskBarIcon thingy is hardly essential, but it may contribute to giving Wax apps a "native look and feel" on Windows.

Posted by Hans Nowak on 2004-02-22 22:16:11   {link} (see old comments)
Categories: Wax

Currently reading...

Rules of Play is about game design. Not development, but design. I just started reading it, so I cannot say much about it yet, but I figure it would be of help for my own game designs... CCG, computer or otherwise. Reviews (not all of them positive, by the way) can be found on the Amazon page.

A related article on game design, mentioned in the book, can be found here: I have no words & I must design, by Greg Costikyan.

Dungeons and Dreamers is mostly the story of Richard Garriott, creator of the Ultima series. To a lesser extent, it also talks about id software, online gaming, games and violence, and early hallmark games like Spacewar, Adventure and Zork. Not a bad book; it's not very informative, technically, but it talks about how games were designed, what inspired their creators, etc. It reads a bit like Hackers, being about the *history* of computer gaming.

Posted by Hans Nowak on 2004-02-22 18:39:54   {link} (see old comments)
Categories: books, games

Artificial Planet

This looks like a cool program, if it would only run on my PC... Artificial Planet.

"AI.Planet is a virtual world for artificial intelligence. The environment has water, land, suns, moons, and atmosphere. Plants, animals, fish, and insects can be added to create a dynamic ecosystem. Clouds, rain, wind, lightning, rivers, and icebergs naturally arise from the sun and other influences. You can explore your planet from outer space, by walking around, by tracking creatures, or by controlling a robot that interacts with objects. Artificial Planet is an OpenSource project built with Delphi and GLScene."

(via Gwork-Portal)

Posted by Hans Nowak on 2004-02-21 23:07:51   {link} (see old comments)
Categories: linkstuffs

--
Generated by Firedrop2.