On Not | Mo Chit

September 27, 2004

Open Letter to Microsoft I love open letters especially like this one to Microsoft about their handling of the JPEG exploit. I agree with the letter, basements aren't fun when the lights are turned out.
Posted by Dudley at 05:19 PM

September 25, 2004

Vitamin E Vitamin E 'can restore hearing'. That's right, Linus Pauling, it's Vitamin E, not C. Pretty amazing stuff. This should definitely be added as the next ingredient for Coke.
Posted by Dudley at 03:32 PM
Smoking Continued Tribes Go Online To Sell Cigarettes, and Fury Erupts. How dare Native Americans sell cigarettes cheaper than the regular heavily-taxed peddlers of death? Don't they realize that the foundation of our free society rests on the shoulders of cigarette taxes and big business? What's next? Cheaper drugs from Canada? Maybe the FDA will claim that the cigarettes from reservations aren't as safe as the more expensive cigarettes.
Posted by Dudley at 03:19 PM
I took this picture in a supermarket while visiting the UK. It looks like the British government isn't whipped by the tobacco industry like the US government. In spite of the massive warnings, more people smoke over there than here. With labels like that on cigarettes, you've got to wonder what kind of labels they have on condoms.

Anyway, I'm really happy that there's a trend to eliminate smoking for restaurants and other public places here and in the UK. I can hardly count the number of times I've had to rush through a meal because some bastard who has already finished his smoke-free meal feels the need to light up and ruin my food for me. On top of that, I get headaches just from the smell and then I have to drink a ton of coke to bring me back to normal.

I personally think that the government should ban filters on cigarettes so these nicotine receptacles (they're not people) can get the most bang for the buck with every puff. After all, smoking is just one of nature's many ways of sorting out the weak so why slow down the process?
Posted by Dudley at 02:04 PM
Squeaky New Wiki I've largely ignored Wikis for the past couple of years just because I didn't like the name. I still don't like the name, but the idea is pretty cool. Actually, the other problem with Wikis in general is that their default themes can cause eye paralysis. Not too long ago I installed MoinMoin on my own machine to fool around with the wonderful world of Wikis. Unfortunately, my Wiki is collecting dust because I don't really have an explicit use for it at the moment and it's ugly, but I'll keep it in mind for the next project.

So since I'm mildly interested in Wiki stuff at the moment, I came across TiddlyWiki via Educational Weblogs. The idea is that the whole Wiki is contained in a single HTML page. The content expands out using DHTML as you click on links starting from the original text. Saving changes looks to be a bit of a pain in the butt, but apparently some people have hacked some stuff together to save changes to a server. It looks good, works well, and so now I'll have to figure out a use for it.

I guess we could have a Wiki for Gush features. That makes too much sense. Ah, nevermind.
Posted by Dudley at 01:21 PM

September 24, 2004

Agray Photoblog We've featured Andy's pictures several times, and now he finally has his own photoblog. Lots of good stuff to come from over there. My sources tell me that Andy is about to buy a Canon 20D in a couple of months which means more spectacular photos.

If you're interested in seeing what the Canon 20D can do take a look at these two photos from Constant Camera: first photo and second photo.

With the way that these cameras are progressing, it looks like the photographer is becoming an annoying accessory to the camera.

By the way, if anyone is willing to trade a Canon 20D for some GMail invitations, let me know.
Posted by Dudley at 12:19 PM
RSS == Hourly DDoS attack? I saw Nick Bradbury's post, RSS Hype, where he methodically explains why Jim Rapoza's "Don't Believe RSS Hype" is just plain ignorant. There's no use paying lip service to those kinds of people, but I did remember something that's troubled me for a while. People keep on talking about the hourly surge in RSS traffic from newsreaders updating.

This doesn't make a whole lot of sense to me. Wouldn't you expect to see a pretty even distribution of traffic over the hour? Maybe other newsreaders only update at the top of the hour, but I'd be hard pressed to believe that. Gush updates news feeds by periodically looking to see how long ago the feed was last updated and then downloading if the last update was over a certain period of time.

I'm pretty sure that most other newsreaders work like Gush does so this hourly surge must be pure crap. Granted, RSS feeds may still use a lot of bandwidth, but the RSS/Atom download distribution should be uniform over the hour. I'll take a look at our Atom/RSS download stats and see if this is correct.
Posted by Dudley at 12:05 PM

September 20, 2004

Feed Your Reader The news RSS support in Firefox is great in that it takes care of feed auto-discovery, but not so hot since it doesn't let you easily subscribe to a feed with your own news reader. Well a lovely Firefox extension by Michael Koziarski has taken care of that. Now any RSS reader supporting the feed: protocol, including Gush, can be used with the extension to subscribe to feeds from Firefox. Anytime Firefox discovers an RSS feed, you should also see this, fyr_tray.png, in the lower right corner. Using Firefox? install the extension now.
Posted by Wes at 11:10 AM

September 16, 2004

Forgot your key? Use a pen If you have a Kryptonite U-lock with a circular key, consider it about as good as a paper weight. Apparently taking the cap off a ball point pen, jamming into the lock, and turning it will open the lock. Forum and videos are here.
Posted by Wes at 09:22 PM

September 12, 2004

Web Innovation of the Year I have a query for monitoring all Jabber/XMPP related news. I picked up on a MacDailyNews post about voting for iTunes as the "internet innovation of the year". The reason it picked it up is because one of the other contenders is "Jabber Open IM". You've got to love PubSub.

Anyway, I obviously voted for Jabber Open IM over iTunes. Other contenders were ONSPEED and Skype. In my opinion, iTunes shouldn't count. iTunes has been very successful and it is the first service of its kind, but this is just because Apple was able to cut a deal with devil...er...the music industry.

Technically, Jabber Open IM isn't an innovation of this past year, it's been around since 1999, I think. Well, I guess there's no reason to get all technical about it. Go Vote for Jabber.
Posted by Dudley at 01:59 PM

September 10, 2004

Getting urllib2 to use HTTP/1.1 Python's urllib2 uses HTTP 1.0 by default. HTTP 1.0 is dated, and using HTTP 1.1 is preferable. Thankfully, urllib2 relies on httplib which has support for both HTTP 1.0 and 1.1.

A small bit of background information. urllib2 has a convenience function called urlopen which takes a URL and will attempt to return the results provided that it understands the protocol scheme e.g. http:// or ftp://.
urllib2's urlopen function is just a thin wrapper around a globally instantiated opener. An opener is a manager class for a set of protocol handlers, and it's the opener's job to dispatch a request to the correct handler. Openers have a default set of handlers for all the support protocols. For example, urllib2 contains a HTTPHandler which handles HTTP requests on behalf of the opener. It's possible to provide a handler to be used inplace of a default handler. To displace a default handler, a new handler has to be subclassed off of the default handler, and then passed to the opener when it's created.

To get urllib2 to use HTTP/1.1 by default with urlopen, you would use the following:
import httplib, urllib2

class HTTP11(httplib.HTTP):
    _http_vsn = 11
    _http_vsn_str = 'HTTP/1.1'

class HTTP11Handler(urllib2.HTTPHandler):
    def http_open(self, req):
        return self.do_open(HTTP11, req)

opener = urllib2.build_opener(HTTP11Handler())
Theoretically this is all you need to get HTTP/1.1 working with urllib2. Unfortunately, it doesn't work but more about that later.

The class HTTP11 is a subclass of the HTTP class which defaults to 1.0. However, you can coax it into using HTTP 1.1 by just overriding _http_vsn and _http_vsn_str class attributes. There's more to supporting HTTP/1.1 than changing the version number, but thankfully that's already in the httplib machinery.

urllib2 for HTTP requests uses HTTPHandler by default which in turn relies on httplib's HTTP class, but that's HTTP/1.0. So, we now create a new handler that uses our new HTTP11 class for requests instead of the regular HTTP class.

The last two lines of the code example instantiates a new opener that uses the HTTP/1.1 handler, and then makes the new opener the default for urllib2.

So why doesn't the code example work? There are two problems. First, the do_open method for HTTPHandler doesn't account for the HTTP/1.1 functionality in httplib. If you use the code example from above, you'll get a request that looks like this:
GET /atom.xml HTTP/1.1
Host: 2entwine.com
Accept-Encoding: identity
User-agent: Python-urllib/2.1
Host: 2entwine.com

The do_open for the HTTPHandler injects the Host header but so does httplib for HTTP/1.1 connections.

The other problem with the example above is that unlike HTTP/1.0, the connection doesn't necessarily close immediately after the request is returned. This seems to cause problems because httplib waits until the connection times out before returning the results to the caller.

Since urllib2 doesn't make use of HTTP pipelining of requests, the expected behavior is for the connection to close immediately after the request has been handled by the server. To do that, the client has to send the Connection: close header.

Here's the version of the code example above with the two fixes inside of the do_open method:
import httplib, urllib2

class HTTP11(httplib.HTTP):
    _http_vsn = 11
    _http_vsn_str = 'HTTP/1.1'

class HTTP11Handler(urllib2.HTTPHandler):

    def http_open(self, req):
        return self.do_open(HTTP11, req)

    def do_open(self, http_class, req):
        host = req.get_host()
        if not host:
            raise URLError('no host given')

        h = http_class(host) # will parse host:port
        if req.has_data():
            data = req.get_data()
            h.putrequest('POST', req.get_selector())
            if not 'Content-type' in req.headers:
            if not 'Content-length' in req.headers:
                h.putheader('Content-length', '%d' % len(data))
            h.putrequest('GET', req.get_selector())

        h.putheader('Connection', 'close')

##      scheme, sel = splittype(req.get_selector())
##      sel_host, sel_path = splithost(sel)
##      h.putheader('Host', sel_host or host)
        for name, value in self.parent.addheaders:
            name = name.capitalize()
            if name not in req.headers:
                h.putheader(name, value)
        for k, v in req.headers.items():
            h.putheader(k, v)
        # httplib will attempt to connect() here.  be prepared
        # to convert a socket error to a URLError.
        except socket.error, err:
            raise URLError(err)
        if req.has_data():

        code, msg, hdrs = h.getreply()
        fp = h.getfile()
        if code == 200:
            return urllib2.addinfourl(fp, hdrs, req.get_full_url())
            return self.parent.error('http', req, fp, code, msg, hdrs)

opener = urllib2.build_opener(HTTP11Handler())
The do_open method was borrowed from AbstractHTTPHandler which HTTPHandler subclasses off of. do_open should probably be refactored, but that's for another discussion. h.put_header("Connection", "close") has been added to make sure that the connection closes right after the request has been handled by the server. The three lines that have been commented out are responsible for adding the extra Host header.

This recipe is working for me right now, but it's possible that something may be overlooked. I really wish this functionality was provided by default inside of urllib2.
Posted by Dudley at 04:28 AM

September 03, 2004

Invitations I've got 5 GMail invitations that are burning my pocket. Just drop a comment. First come, first served.
Posted by Dudley at 01:57 PM
Wet Seal It looks like Wet Seal has been clubbed like a baby seal.
Posted by Dudley at 04:16 AM

September 02, 2004

Judge Judy Let me start off by revealing a dark secret: Not too long ago, I actually didn't like Judge Judy. My impression was that she was too harsh on the people in front of her. That verdict was far too hasty. Taking a close look at the characters that appear before her, and it's plainly obvious they've got everything that's coming to them.

Without fail, everyday a group of people appear before Judge Judy to present their case. In every case there's at least one person clearly in the wrong, and sometimes both people are in guilty to a degree. In spite of that, every person attempts to guile Judge Judy with their supposed innocence.

Judge Judy relentlessly applies common sense to cut through the layers of poorly strung exaggerations and lies. It's really an awesome sight.

So the big idea for the day is to make Judge Judy part of Congressional oversight committees. Not only would CSPAN's ratings shoot up wildly, but she'd cut through all the partisan crap. Imagine George Tenet going before Judge Judy having to explain the intelligence failures. My prediction is that he'd crumble like a cookie.

The same goes for the upcoming presidential debates. It's going to be an hour long political slogan contest. No thanks, what we need instead is for George Bush and John Kerry to appear in Judge Judy's court room and present their case to Judge Judy. Of course, she doesn't have to render a verdict but just ask all the tough questions. That's the only way we're going to get some real answers.
Posted by Dudley at 03:38 PM
US Broadband Sucks Saw Fixing American Broadband on SlashDot and it just made me foam at the mouth again. Most Americans are unaware of the plentiful broadband in places like Japan, South Korea, and else where. I was lucky enough to enjoy stable 8Mbit DSL in Japan not too long ago, but now I'm Cox land where our service cuts out at least once a day. Our connection has been inspected several times, so I attribute the outages to incompetence at headquarters.

Here's a shining example of how poor the state of broadband is in Rhode Island, and I expect elsewhere. My dad connects to his work using a VPN. While at home, he gets disconnected every couple of hours so it eventually became just another fact of life. Recently he traveled to a refinery in the far western part of China. He showed up in a small town where his cellphone had no coverage and his long distance calling cards didn't work. But lo and be hold, this tiny town at least had a broadband connection. So he connected to his VPN, and found out the connection to his office network in Massachusetts was more stable half way around than in Rhode Island.

To sum it up: even a remote region in a communist country half way around the world has better connectivity to a Massachusetts office than one of America's leading free enterprise cable corporations only 50 miles away.

So I've been eager to sign-up for Vonage or a similar service, but there is no way in hell I'm going to reduce my phone service to the same level quality as my broadband connection.
Posted by Dudley at 02:53 PM

Creative Commons License
This site is licensed under a
Creative Commons License