Python: Why to assign functions’ return values to dummy variables

May 12, 2007

In response to Kototama’s comment in the previous post:

There is a need, when running directly under the interpreter (code placed in the global namespace, not inside a function or method), to assign the return value of any function to a dummy variable.

Read the rest of this entry »


data: URI

May 11, 2007

(None of this works in IE – use Firefox.)

The data: URI is a type of URI that contains the data that is returned, in the URI itself.
Read the rest of this entry »

RealtimeCmd – hotkey for running cmd.exe in realtime priority

May 5, 2007

Sometimes your system hangs because some process enters a busy-loop that does evil things, like allocating huge amounts of memory and causing the swapfile manager to make Windows crawl. In those cases it would be nice to have something that runs in high priority that can kill the offending process. Microsoft addressed this by running winlogon.exe and taskmgr.exe in “High” priority, but that’s just not enough…

Read the rest of this entry »

Windows features you didn’t know existed: clip

May 5, 2007

    Redirects output of command line tools to the Windows clipboard.
    This text output can then be pasted into other programs.

Parameter List:
    /?                  Displays this help message.

    DIR | CLIP          Places a copy of the current directory
                        listing into the Windows clipboard.

    CLIP < README.TXT   Places a copy of the text from readme.txt
                        on to the Windows clipboard.

Python tricks: “Press Enter to exit” on unhandled exception

May 5, 2007

When I write Python scripts on Windows, I often write a main() function, and when it throws an exception I don't handle, the console window closes immediately before giving me a chance to look at the traceback.

Read the rest of this entry »

Writing matrix-style scripts

May 5, 2007

I like to write what I call “matrix-style scripts” – those are scripts that work in a command line window, get a few parameters at first and then just start running, filling the screen with text as they go along, like in The Matrix (or in Hollywood productions in general).

Read the rest of this entry »

Magic values on the MSVCRT debug heap

May 3, 2007

I’d always had a feeling that the MSVCRT heap (malloc, free, new, delete) don’t just call the Win32 heap-management functions, but do some work of their own. So I investigated…
Read the rest of this entry »