< November 2006 >
SuMoTuWeThFrSa
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
2627282930  
Mon, 20 Nov 2006:

I've been playing around with twisted for a while. It is an excellent framework to write protocol servers in python. I was mostly interested in writing a homebrew DNS server with the framework, something which could run plugin modules to add features like statistical analysis of common typos in domain names and eventually writing up something which would fix typos, like what opendns does.

To my surprise, twisted already came with a DNS server - twisted.names. And apparently, this was feature compatible with what I wanted to do - except that there was a distinct lack of documentation to go with it.

7 hours and a few coffees later, I had myself a decent solution. Shouldn't have taken that long, really - but I was lost in all that dynamically typed polymorphism.

from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
from twisted.protocols import dns
from twisted.names import client, server


class SpelDnsReolver(client.Resolver):
    def filterAnswers(self, message):
        if message.trunc:
            return self.queryTCP(message.queries).addCallback(self.filterAnswers)
        else:
            if(len(message.answers) == 0):
                query = message.queries[0]
                # code to do a dns rewrite
                return self.queryUDP(<alternative>).addCallback(self.filterAnswers)
        
        return (message.answers, message.authority, message.additional)

verbosity = 0
resolver = SpelDnsReolver(servers=[('4.2.2.2', 53)])
f = server.DNSServerFactory(clients=[resolver], verbose=verbosity)
p = dns.DNSDatagramProtocol(f)
f.noisy = p.noisy = verbosity

reactor.listenUDP(53, p)
reactor.listenTCP(53, f)
reactor.run()

That's the entire code (well, excluding the rewrite sections). Should I even bother to explain how the code works ? It turned out to be so childishly simple, that I feel beaten to the punch by the twisted framework. To actually run it in server mode, you can start it with twistd -y speldns.py and you have your own DNS server !

In conclusion, I hope I have grossed a few of you out by trying to do soundex checks on dns sub-domains.

--
DNS is not a directory service.
         -- Paul Vixie

posted at: 04:45 | path: /hacks | permalink | Tags: , ,

First, you should go read The Peanut Butter Manifesto. Also get a copy of Jerry Maguire and refresh your memory of the first half-hour of the movie.

The manifesto ostensibly wants to roll back the clock and go back into the past. I'm doubtful whether it is possible to achieve this, mainly because of a few laws of thermopeople-dynamics. Reducing the head count by 20% is not going to improve performance and all you might end up doing is to give the rest a persecution complex and possibly increase their workload. And all that after admitting to bad decisions in investment distribution.

Dilbert Oct 1994 - buy the book !

Then the wage strawman is throw in, always available as a convenient reason for low productivity.

Moreover, our compensation systems don't align to our overall success. 
Weak performers that have been around for years are rewarded. And 
many of our top performers aren't adequately recognized for their 
efforts.

Pay packages are generally a function of the years of experience. A 10 year experienced employee churning out run-of-the-mill code will get paid more than a 2+ guy writing top of the line code. The pay parity that the company keeps is indirectly unfair and enocurages you to be as stupid & worthless as you can be, yet earn more than the hard-working junior.

Those are the rules of the game and some of us have come to accept that as inevitable. But when you hear rumours (in Economic Times, no less) that fresh campus recruits are going to be paid at par, maybe a bit more than what you are earning, the quoted paragraph makes no sense.

As a result, the employees that we really need to stay (leaders, 
risk-takers, innovators, passionate) become discouraged and leave.

Well, duh ! If they didn't leave, they'd hardly qualify as people with initiative. I've put down my take on that, a while back. That bit of wisdom from a senior VP, vindicates my personal feelings (or does it prove that I'm not a risk-taking passionate innovator, because I'm still sticking around ?). And maybe ... just maybe toolz had a point.

dilbert 1996 - buy the book !

All in all, I assume that the author of this Manifesto wrote it out of pure good-will, frustration and naivete, as a last call to turn the company around. For once, I'd like to think the dilbert cartoon above is completely fictional and bears no resemblance to any company, outside of a cartoon.

Either way, que sera, sera.

--
Give me the strength to change what I can, the inability to accept what I can't and the incapacity to tell the difference.
                      -- Calvin prays,

posted at: 04:20 | path: /yblr | permalink | Tags: , ,