May 27, 2007
In messages where a big string may be inserted, prefer “something something %s” over “something %s something”.
Example:
In this example, %s is a long hex-string representing an array’s contents.
Bad:
[DECODE] [DEBUG] Was passed array ‘%s’ for processing
Good:
[DECODE] [DEBUG] Was passed array for processing: ‘%s’
Best:
[DECODE] [DEBUG] Function myDecodeFunc called with myArray = ‘%s’
2 Comments |
Bad practices |
Permalink
Posted by Yoni
May 12, 2007
In popular Unix/Linux shells, there is an option to start a process in the “background” by (i.e. in bash) typing “./something &“, or pressing Ctrl-Z and then “bg“. The process then prints its output to stdout as usual, but the bash runs in the foreground and receives console stdin.
In Windows, something similar (much less powerful than the bash “jobs”, though) can be done by doing: start /b something
Read the rest of this entry »
1 Comment |
Windows |
Permalink
Posted by Yoni
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 »
Leave a Comment » |
Python |
Permalink
Posted by Yoni
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 »
2 Comments |
C, Windows |
Permalink
Posted by Yoni
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 »
5 Comments |
Python |
Permalink
Posted by Yoni
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 »
Leave a Comment » |
Python |
Permalink
Posted by Yoni