Skip to main content

Posts

Showing posts from June, 2007

Just leveled up.

I'm on to you, garbage collector... import math import sys class ClassThatWantsToBeAModule(object): # This line is worth 6000 experience. _my_module = sys.modules[__name__] def pi(self): return math.pi my_class = ClassThatWantsToBeAModule() sys.modules[__name__] = my_class my_class.pi()
Read more

__import__ is stupid.

Does anyone else think __import__ is completely ridiculous? I always end up wrapping it to do what I want. Example: >>> from os import path >>> path <module 'posixpath' from '/usr/lib/python2.4/posixpath.pyc'> >>> mod = __import__('os', locals(), globals(), ['path']) >>> mod <module 'os' from '/usr/lib/python2.4/os.pyc'> >>> mod.path <module 'posixpath' from '/usr/lib/python2.4/posixpath.pyc'> >>> mod = __import__('os') >>> mod <module 'os' from '/usr/lib/python2.4/os.pyc'> >>> mod.path <module 'posixpath' from '/usr/lib/python2.4/posixpath.pyc'> >>> When I tell __import__ to get 'path' from 'os' it gives me 'os'. If I wanted that, why would I have passed it a from list with ['path'] in it? Seriously, guys. How can this be considered reasonabl...
Read more

Learning Haskell

I'm spending some of my time during the next two weeks to learn Haskell. My original goal, back in May, was to be able to write some simple utility scripts. Now, I'd like to have something a little more concrete. While going through various tutorials, I'm trying to come up with a relatively simple project. My impressions so far are positive. It's fun to be thinking about recursion again.
Read more

Fesity, Apache2, SSL, and Firefox

If Firefox is complaining that your SSL server is using an old, insecure version of SSL, this fixed it for me. /etc/apach2/httpd.conf: SSLProtocol -all +SSLv3 SSLCipherSuite SSLv3:+HIGH:+MEDIUM:+LOW:+EXP ...
Read more