Monday, April 8, 2013

There, I Fixed It

Got a new hard drive for my Inspiron 1545 - an SSD, at last! Turns out it was probably just in time too, as I found an unrecoverable bad block on the WD it is replacing.

Just one problem. The SSD is smaller than the drive it is replacing. Not narrower (they're both 2.5" drives - which means they're both 2.75" wide). But thinner. I suppose that dimension isn't standardized by anybody. But surely that can't actually be a problem? After all, thinner still fits in the drive bay...

Guess it is a problem after all. Near as I can tell, the SATA port in the Inspiron requires the drive to completely fill the bay in order to force the all the contacts to ... contact.

Good thing the problem is that it's too thin, not too thick. I can fix this.

Problem solved.

Thanks for the well-engineered hardware, guys.

Monday, January 28, 2013

Saturday, December 29, 2012

Distant Scheduled Events Unreliable in Twisted

Someone recently asked a question about whether reactor.callLater could be used to precisely schedule events in the very distant future. The person gave an example of scheduling now - December, 2012 - an event to run at a particular time in December 2014 - a date two years in the future.

One thing to keep in mind about scheduled events (actually, any events) in a Twisted-using application is that the whole system is cooperative and single-threaded. So an event scheduled to run at a specific time - Twisted uses Python floats to represent a time (seconds since the epoch) at which to run scheduled events - cannot run at that time if something else happens to be running when that time comes around. For example, if you have a prime calculator and you're busy calculating a 10,000 digit prime number on December 30, 2014 at 15:30:00 then your event scheduled for that time is not going to run. Instead, it'll run sometime after the prime calculation is finished.

The asker knew this, though, and was only curious about whether there were any intrinsic scheduling limitations related to very distant times. The answer is that there is a limitation, and I've already alluded to it in the paragraph above.

Twisted uses Python floats to represent time. The precision available to floating points declines as the values themselves get larger (this is why they're called "floating points"! The decimal point can move around).

At 2 ** 51, values that differ by less than 0.5 cannot be represented. At 2 ** 52, the range grows to 1.0, and above 2 ** 53, the representation only supports even integers (you can probably see a pattern here - add a bit to the magnitude, subtract a bit from the precision). As Twisted is treating this value as a number of seconds since an arbitrary starting point, this means that 2 ** 53 seconds after that starting point, scheduling granularity has dropped to 2 seconds; ie, there is only one point in time out of every two second interval at which an event can be scheduled. Try to schedule it for a different time and it will silently be adjusted to the time in that interval which can be represented. As a specific example, if you tried to schedule an event to run at 9007199254740993 seconds after the epoch, it would most likely run at 9007199254740992 seconds after the epoch instead.

What does this mean in practical terms? Perhaps not a lot. Assuming our current system of marking the passage of time continues in use until then, 9007199254740992 seconds after the epoch falls about 25 minutes before midnight on November 11th (a Sunday), in the year 285,428,751.

Friday, August 31, 2012

January to August Reading List

Down on the Farm. Charles Stross.
Children of the Sky. Vernor Vinge.
Toast. Charles Stross.
The Etched City. K. J. Bishop.
American Fascists. Chris Hedges.
Why We Get Fat. Gary Taubes.
The Forever War. Joe Haldeman.
The Accidental Time Machine. Joe Haldeman.
Cyborg Assault. Vaughn Heppner.
Planet Wrecker. Vaughn Heppner.
Star Fortress. Vaughn Heppner.
The Restoration Game. Ken Macleod.
The Night Sessions. Ken Macleod.
Redshirts. John Scalzi.
The Ghost Brigades. John Scalzi.
Old Man's War. John Scalzi.
The Last Colony. John Scalzi.
The Year of the Jackpot. Robert Heinlein.
The Vegetarian Myth. Lierre Keith.
Raising Pastured Pigs. Samantha Biggers.
The China Study. T. Colin Campbell, Thomas M. Campbell II.
Orion. Ben Bova.
Vengeance of Orion. Ben Bova.
Heir to the Empire. Timothy Zahn.
Dark Force Rising. Timothy Zahn.
The Last Command. Timothy Zahn.
The Whole Soy Story. Kaayla T. Daniel.
Stop Alzheimer's Now!. Bruce Fife.
Pastured Poultry Profits. Joel Salatin.
Greener Pastures on Your Side of the Fence. Bill Murphy.

Wednesday, August 15, 2012

Heads Up, San Francisco

I will be visiting San Francisco in December and January. To my various acquaintances in the bay area, let's get together and do something fun. To anyone interested in Python or Twisted, my recently formed company would be happy to offer on-site training or other consulting services while I'm in the area. Drop us a line.

Wednesday, May 9, 2012

Commercial support contracts for Twisted

Last week I posted a survey to gauge interest in commercial Twisted support contracts to the Twisted mailing list:

If you think this might be applicable to your interests and you didn't see the initial posting or haven't had a chance to respond yet, please take a minute or two to fill it out (it's very short, no essay questions at all). Thanks!

Friday, April 20, 2012

GNOME Bug Reports

Almost ten years after jwz coined "CADT", they're still at it. Way to keep the dream alive, guys.