Home
Jp Calderone's Journal
 
[Most Recent Entries] [Calendar View] [Friends]

Below are the 20 most recent journal entries recorded in Jp Calderone's LiveJournal:

    [ << Previous 20 ]
    Saturday, April 26th, 2008
    1:11 pm
    February through April Reading List
    • Something Wicked This Way Comes.  Ray Bradbury.
    • The Eyre Affair.  Jasper Fforde.
    • The Star Rover.  Jack London.
    • Travels With Herodotus.  Ryszard Kapuściński.
    • Omnivore's Dilemma.  Michael Pollan.
    • Lankhmar.  Fritz Leiber.
    • Suite Française.  Irène Némirovsky.
    • Persepolis: The Story of a Childhood.  Marjane Satrapi.
    • Persepolis 2: The Story of a Return.  Marjane Satrapi.
    • Maus 1: My Father Bleeds History.  Art Spiegelman.
    • Maus 2: And Here My Troubles Began.  Art Spiegelman.


    Current Music: The Velvet Underground - Some Kinda Love
    Friday, April 11th, 2008
    12:21 pm
    pyOpenSSL 0.7 final released
    Alright, it's done. Here are the highlights since 0.6:

    Bug fixes:
    • Memory leak in X509.get_pubkey eliminated
    • Memory leaks in X509Name.__getattr__ and X509Name.__setattr__ eliminated
    • RuntimeWarning from X509Name comparison eliminated
    • X509Name reference counting issues resulting in memory corruption eliminated
    • Uninitialized PKeys are now rejected by X509Req signature APIs
    • Memory leaks in X509Name.__getattr__ and X509Name.__setattr__ eliminated
    New features:
    • SSL_get_shutdown and SSL_set_shutdown exposed as Connection.get_shutdown and Connection.set_shutdown
    • SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN exposed as SSL.SENT_SHUTDOWN and SSL.RECEIVED_SHUTDOWN
    • X509_verify_cert_error_string exposed as OpenSSL.crypto.X509_verify_cert_error_string
    • X509.get_serial_number and X509.set_serial_number now accept long integers
    • Expose notBefore and notAfter on X509 certificates for inspection and mutation
    • Expose low-level X509Name state with X509Name.get_components
    • Expose hashing and DER access on X509Names


    Current Music: Kings Of Leon - Velvet Snow
    Saturday, March 22nd, 2008
    2:13 pm
    pyOpenSSL 0.7a1
    Hot off the presses, pyOpenSSL 0.7a1 released. Give it a spin and let me know how it goes.

    Current Music: Grateful Dead - Not Fade Away
    Wednesday, February 6th, 2008
    2:07 pm
    Ever relevant
    It is good to re-read Alan Perlis' epigrams in programming from time to time.

    Some which stand out to me today:

    32. Programmers are not to be measured by their ingenuity and their logic but by the completeness of their case analysis.
    41. Some programming languages manage to absorb change, but withstand progress.
    64. Often it is the means that justify the ends: Goals advance technique and technique survives even when goal structures crumble.
    94. Interfaces keep things tidy, but don't accelerate growth: Functions do.

    One which I don't think has ever stood out to me before:

    20. Wherever there is modularity there is the potential for misunderstanding: Hiding information implies a need to check communication.

    And of course, there are the old favorites:

    11. If you have a procedure with ten parameters, you probably missed some.
    95. Don't have good ideas if you aren't willing to be responsible for them.
    101. Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You've solved the wrong problem. Work hard to improve.
    117. It goes against the grain of modern education to teach children to program. What fun is there in making plans, acquiring discipline in organizing thoughts, devoting attention to detail and learning to be self-critical?
    Saturday, February 2nd, 2008
    8:14 pm
    October through January Reading List
    • Smoke and Mirrors. Neil Gaiman.
    • The Long Tomorrow. Leigh Brackett.
    • Norstrillia. Cordwainer Smith.
    • Nova. Samuel R. Delany.
    • Iron Sunrise. Charles Stross.
    • The Lies of Locke Lamora. Scott Lynch.
    • The Road. Cormac McCarthy.
    • Paradise Lost. John Milton.
    • Lord of Light. Roger Zelazny.
    Friday, January 4th, 2008
    8:48 am
    notes on netgear support website
    • comments are mangled incorrectly, doubling single quotes, presumably in a confused attempt to prevent SQL injection attacks.
    • page caching behavior is wrong, so after a ticket is updated by netgear support staff, the update will not appear unless the browser is made to disregard its cache.
    • timestamps on comments are wrong, perhaps by roughly (UTC - PST) hours.
    • netgear support staff can't actually fix any problem you have.


    Current Mood: pissed off
    Current Music: Fallible, Blues Traveler
    Thursday, January 3rd, 2008
    9:18 pm
    One in twenty eight and falling...

    Asteroid on near-miss course with Mars

    No one taught these guys to label their plots, unfortunately (nice of them to put "mars" and "sun" on there though). To make it clearer, the cyan line is the probable trajectory of 2007 WD5. White dots indicate a possible position at the time it would intercept mars' orbital, if it does.

    Will there be a collision? Probably not. One in twenty eight odds, though? Those are most certainly not astronomical odds.

    Friday, December 21st, 2007
    4:58 pm
    Filesystem structure of a Python project
    Do:
    • name the directory something related to your project. For example, if your project is named "Twisted", name the top-level directory for its source files Twisted. When you do releases, you should include a version number suffix: Twisted-2.5.
    • create a directory Twisted/bin and put your executables there, if you have any. Don't give them a .py extension, even if they are Python source files. Don't put any code in them except an import of and call to a main function defined somewhere else in your projects.
    • If your project is expressable as a single Python source file, then put it into the directory and name it something related to your project. For example, Twisted/twisted.py. If you need multiple source files, create a package instead (Twisted/twisted/, with an empty Twisted/twisted/__init__.py) and place your source files in it. For example, Twisted/twisted/internet.py.
    • put your unit tests in a sub-package of your package (note - this means that the single Python source file option above was a trick - you always need at least one other file for your unit tests). For example, Twisted/twisted/test/. Of course, make it a package with Twisted/twisted/test/__init__.py. Place tests in files like Twisted/twisted/test/test_internet.py.
    • add Twisted/README and Twisted/setup.py to explain and install your software, respectively, if you're feeling nice.
    Don't:
    • put your source in a directory called src or lib. This makes it hard to run without installing.
    • put your tests outside of your Python package. This makes it hard to run the tests against an installed version.
    • create a package that only has a __init__.py and then put all your code into __init__.py. Just make a module instead of a package, it's simpler.
    • try to come up with magical hacks to make Python able to import your module or package without having the user add the directory containing it to their import path (either via PYTHONPATH or some other mechanism). You will not correctly handle all cases and users will get angry at you when your software doesn't work in their environment.
    Monday, December 3rd, 2007
    2:52 pm
    Incompatabilities between classic and new-style Python classes

    radix asked me if I had a blog post about why changing a class from classic to new-style is a bad idea. After I told him that I didn't he insisted that I should write one. Since doing so will take less work than finding something else to distract his attention, here it is:

    • attribute lookup

      Attributes on instances of classic classes override attributes of the same name on their class. For example:

      >>> class SimpleDescriptor(object):
      ...     def __get__(self, instance, type):
      ...             print 'getting'
      ...             return instance.__dict__['simple']
      ...     def __set__(self, instance, value):
      ...             print 'setting'
      ...             instance.__dict__['simple'] = value
      ...
      >>> class classic:
      ...     simple = SimpleDescriptor()
      ...
      >>> x = classic()
      >>> x.simple = 10
      >>> x.simple
      10
      >>> class newstyle(object):
      ...     simple = SimpleDescriptor()
      ...
      >>> x = newstyle()
      >>> x.simple
      getting
      Traceback (most recent call last):
        File "", line 1, in ?
        File "", line 4, in __get__
      KeyError: 'simple'
      >>> x.simple = 10
      setting
      >>> x.simple
      getting
      10
      
      As you can see, the descriptor on the new-style class can both handle the setattr and continue to operate after shadowing itself with an instance variable.

    • Special methods

      A particularly interesting consequence of the previous point is that the behavior of special methods changes in some cases:

      >>> class x:
      ...     def __init__(self):
      ...             self.__eq__ = lambda other: True
      ...
      >>> x() == 10
      True
      >>> class x(object):
      ...     def __init__(self):
      ...             self.__eq__ = lambda other: True
      ...
      >>> x() == 10
      False
      >>>
      

    • MRO

      Rules for determining the method resolution forbid new-style classes in places where classic classes are acceptable. Consider:

      >>> class x: pass
      ...
      >>> class y(object, x): pass
      ...
      >>> class x(object): pass
      ...
      >>> class y(object, x): pass
      ...
      Traceback (most recent call last):
        File "", line 1, in ?
      TypeError: Error when calling the metaclass bases
          Cannot create a consistent method resolution
      order (MRO) for bases object, x
      >>>
      

    Hopefully that's enough to satisfy radix. Know of other incompatibilities? Please comment.

    Saturday, November 10th, 2007
    12:39 pm
    Tuesday, October 2nd, 2007
    7:49 pm
    Hair today...
    Some pictures of Quechee Gorge up. Including a 360° panorama I assembled. Which took forever with stupid gimp. And it didn't come out very well anyway. Stupid parallax, I'll get you next time.

    Off to San Antonio tomorrow, back next week. If there's anything worth taking pictures of (other than my brother) maybe those'll show up in a week or so.
    Sunday, September 30th, 2007
    8:14 pm
    September Reading List
    By way of The Book of Jhereg:
    • Jhereg Steven Brust.
    • Yendi Steven Brust.
    • Teckla Steven Brust.
    Also some Milton, for class: On the Morning of Christ's Nativity, At a Solemn Music, L'Allegro, Il Penseroso, Lycidas, On the New Forcers of Conscience, To Mr. Cyriack Skinner Upon His Blindness, and sonnets 11, 12, 15, 16, 19.
    Tuesday, September 11th, 2007
    10:38 pm
    chevre, pine nut, raisin, onion, garlic, bacon, duck pizza

    Current Mood: rejuvenated
    Saturday, September 1st, 2007
    1:37 pm
    August Reading List
    Not much going on in August:
    • Player Piano. Kurt Vonnegut, Jr..
    • The Execution Channel. Ken MacLeod.
    • Rainbows End. Vernor Vinge.
    Tuesday, August 21st, 2007
    12:29 pm
    Twisted Trial performance improvements

    Trial, Twisted's xUnit(-esque) testing package (library, discovery tool, runner, etc), has long inherited its overall testing flow from the Python standard library unittest module. It's quite simple, actually: iterate over a sequence of test cases and invoke each one with the result object. Lately, this has actually led to some noticeable problems with its performance. Creating a test case instance for each test method isn't extremely unreasonable, but in the process of running them all, more and more objects are created and the process balloons to an unreasonable size. The Twisted test suite typically uses about 800MB of RAM by the time the last test method is run.

    So, in order to be able to run the Twisted tests on machines without 800MB of free memory, we changed our TestSuite so that it drops each test after it runs it. The suite now takes about one quarter as much memory to run. As an unexpected bonus, it also runs almost 50% faster (66% for trial --force-gc which calls gc.collect in between each test method). I can only explain the speedup as time saved inside the garbage collector itself due there being far fewer objects to examine (this is not a completely satisfying explanation, but I cannot think of a better one).

    If you're using trial to run your test suite, you may notice reduced memory requirements and reduced overall runtime, too. :)



    Current Mood: happy
    Current Music: Led Zeppelin - Custard Pie
    Friday, August 17th, 2007
    4:49 pm

    Typespeed v0.4.4

    Best score was:

    Rank: Computer
    Score: 1187
    Total CPS: 8.492
    Correct CPS: 8.352
    Typo ratio: 1.6%
    Typorank: Secretary


    exarkun@charm:~$


    Current Mood: accomplished
    Thursday, August 16th, 2007
    10:09 pm
    Child process improvements in Twisted

    Thomas Hervé merged his process/pty-process branch into Twisted trunk today. He's been working on integrating the two separate implementations of POSIX child process creation in Twisted, one for child processes connected to a PTY and one for child processes connected to a set of pipes. A long time ago, someone copied an entire class full of code and started twiddling it to support PTYs. This led to a lot of duplication, obviously, and some bugs where the two classes diverged.

    With this re-unification, some behavior which was inconsistent between the two variations has been removed, some bugs which were present in one or the other of the two classes have been fixed, and a lot of duplicate code has been completely eliminated. Best of all, there is now some actual unit test coverage for this code (it was originally developed long before Twisted's current high testing requirements) and a test double which will make it easier to write more and better unit tests for this code in the future.

    One other piece of fall out is that on Windows, if application code tries to signal an already-exited process, an exception will be raised indicating that it is not possible to do so. This brings Windows process support closer still to POSIX process support.



    Current Mood: happy
    Thursday, August 9th, 2007
    12:12 pm
    It's Official
    http://www.guardian.co.uk/environment/2007/aug/08/endangeredspecies.conservation

    Unfortunately, this is hardly surprising. It's been pretty clear for at least a decade that this would be the outcome. Maybe the saddest part is that it shouldn't have been inevitable.

    Current Mood: apathetic
    Saturday, August 4th, 2007
    1:16 pm
    Side-by-side Twisted plugins installation issue fixed

    Since its introduction a little over two years ago, the "new" Twisted plugin system has had a minor bug which manifest whenever two or more separate copies of a plugin packaged were available (ie, in sys.path). Normally, the first of these should obscure the second. However, the plugin system would allow both to be discovered. This could lead to confusing results in some cases.

    This bug is now fixed in trunk@HEAD: only the first plugin package on sys.path will be considered for plugins. Plugin directories (not packages) will still be considered.



    Current Mood: cheerful
    Thursday, August 2nd, 2007
    3:29 pm
    The Internet Is Filled With Wonderful Things
    You were probably just wondering about these effects, anyway. Of course, I don't see the text online anywhere, so you'll have to keep wondering.

    Current Mood: happy
    Current Music: Plain White T's [sic] - Breakdown
[ << Previous 20 ]
My Website   About LiveJournal.com