johnsonroad.net

Quidquid latine dictum sit, altum sonatur.

Archive for October, 2007

a brief word from our sponsors

I watched episode 407 of The Office on NBC’s web site tonight, which couldn’t have been interrupted more than 5, 6, maybe 7 times by commercials. As they hoped and expected from a young male representative of the 18-35 demographic, I was left feeling entertained and oddly compelled to buy a new Mazda coupe and/or kill Middle Easterners for the US Navy to support our petrochemical-based foreign policy… neither of which, I reckon, would benefit the world’s second largest corporation and owner of NBC, General Electric, a prominent defense contractor for the US military. I used to think these guys just made toasters.

When you’ve had a few years of relief from constant exposure to commercials, watching a program laced with them feels like getting smacked over the head. They’re relentless.

  • 0 Comments
  • Filed under: Politics, Rants
  • The city of Fort Collins, CO, has set up a Yahoo Group for their Leaf Exchange program:

    Wondering what to do with all those fallen leaves, or do you need leaves for composting or mulching? The City of Fort Collins offers a web-based service through Yahoo! Groups making it easy to exchange your leaves by communicating directly with people who want leaves or have leaves to give away.

    As a courtesy, leaves should be free of rocks, trash, tree limbs, grass clippings and garden debris, and if they’re bagged, be sure to empty the leaves and take your bags back home with you.

    Not being a homeowner and thus not responsible for leaf disposal myself, I doubt I’ll muster the motivation to organize something like this in Madison, but I’ll be mentioning it to the homeowners I know.

    I used PyWin32 on a Django 0.96 instance after struggling and giving up on using python-ldap. This doesn’t query any of the AD user object’s attributes; it just lets them log in to the Django site and creates a Django user object for them.

    Thanks to Benji York for posting the code that talks to Active Directory using PyWin32 to the python mailing list.

    from django.conf import settings
    from django.contrib.auth.models import User, check_password
    from win32security import LogonUser, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT
    import pywintypes
    class ADBackend:
    """
    Authenticates against Active Directory.
    """
    def attempt_ad_login(self, username, password):
    try:
    handle=LogonUser(username, None, password,
    LOGON32_LOGON_NETWORK,
    LOGON32_PROVIDER_DEFAULT)
    # We're not going to use the handle, just seeing if we can get it.
    handle.Close()
    return True
    except pywintypes.error, e:
    # Because of the sheer number of Windows-specific errors that can
    # occur here, we have to assume any of them mean that the
    # credentials were not valid.
    return False
    def authenticate(self, username=None, password=None):
    if self.attempt_ad_login(username, password):
    try:
    user = User.objects.get(username=username)
    except User.DoesNotExist:
    # Create a new user. This password will not be checked during login, so it doesn't matter.
    user = User(username=username, password='dummy password')
    # Comment or uncomment these as appropriate.
    user.is_staff = True
    #user.is_superuser = True
    user.save()
    return user
    else:
    return None
    def get_user(self, user_id):
    try:
    return User.objects.get(pk=user_id)
    except User.DoesNotExist:
    return None

    Save this to a file such as “ADBackend.py” in the same path as your application, then add the following to your settings.py, replacing mysite and myapp to match your Django site and application:

    AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'mysite.myapp.ADBackend.ADBackend'
    )

  • 2 Comments
  • Filed under: Django, Python
  • Secret prisons in the name of national security…what nation is this? What ideals does this policy protect? Freedom?

    from the Washington Post:

    The Supreme Court declined [Tuesday] to open U.S. courts to a German citizen who said he was abducted, imprisoned and tortured by the CIA because he was mistakenly identified as a terrorist.
    [...]
    Masri, who is of Lebanese descent, has said he was detained by Macedonian police while on vacation on Dec. 31, 2003, and handed over to the CIA a few weeks later under a secret program that transfers terrorism suspects to other countries for interrogation. He said he was taken to a secret CIA-run prison in Afghanistan and physically abused before he was flown back to the Balkans without explanation in May 2004 and dumped on a hillside in Albania.

    The government had invoked its “state secrets” privilege and said there was no way for Khaled el-Masri to bring his lawsuit, or for the government to defend itself, without the disclosure of information that would endanger national security.

    from MSNBC:

    At the height of Cold War tensions between the United States and the former Soviet Union, U.S. presidents used the state secrets privilege six times from 1953 to 1976, according to OpenTheGovernment.org. Since 2001, it has been used 39 times, enabling the government to unilaterally withhold documents from the court system, the group said. (emphasis mine)

    We had nuclear missiles pointed at us and “state secrets” was invoked 6 times in 23 years. Now it’s been used 39 times in 6 years. You know that old aphorism “if you’re not doing anything wrong, then you have nothing to hide?” The Bush Administration has been doing nothing but hide ever since it descended upon this country.

  • 0 Comments
  • Filed under: Politics
  • I am a twit.

    I just installed a widget so that my infrequently-updated Twitter messages will appear on my even-less-frequently-updated blog. I also installed the Twitter Updater plugin, which hopefully will create a “tweet” with a link right back to this blog. Ah, self-reference.

  • 0 Comments
  • Filed under: Uncategorized