• Oct
    30
    2009

    Emacs: Marking lines in source code

    Today I ported some code to a new API. What I really like about that API upgrade: They changed a structure of the interface to a completely new structure, which basically had the same contents with a few new fields. Of course, the order has changed as well and the field names were revised.
    Comparing those [...]

  • Oct
    16
    2009

    Passing optparse results as keyword arguments

    The python optparse package is really handy for parsing command line arguments. When combining this with an extra main function idiom (to allow interactive usage or use as a module), I ran into a small problem – the following code does not run:
    123456789def main(foo, bar):
        print("foo: %s, bar: %s\n" % (foo, bar))
    if __name__ == [...]

  • Oct
    14
    2009

    Windows MAX_PATH limitation

    While writing my last post, I stumbled across the definition of MAX_PATH on Windows:
    1#define MAX_PATH 260
    That’s right, Windows path lengths are limited to 260 chars. I would have expected a lot of problems in big production systems with this limit. Luckily, there is an article in the Microsoft knowledge base with the solution:
    …, select the [...]

  • Oct
    14
    2009

    Calling legacy code with unknown output buffer size requirements

    Ever seen such a function in a C API?
    1int describe_something(const something_t *thing, char *buf);
    The documentation states that the function will write a description of thing into the given string buffer. Err, sure, but how big do I need to allocate buf? If you are lucky, there docs remark that a buffer size of MAX_PATH should [...]

 
Powered by Wordpress and MySQL. Theme by openark.org