Friday, July 31, 2009

Operating Systems Are A Nightmare

Been having some weird problems with Ubuntu on my main workstation... I want to blame NVIDIA, but I'm not sure. After about 21-30 hours of uptime compiz invariably goes wonky and starts eating CPU like crazy and is just unusable. I can switch back to metacity and then switch to compiz, but it's still wonked until a reboot. I can use metacity, but then for some reason the keyboard input is not quite right; there's a delay and every 80th keystroke or so is dropped. Ugh.

So I thought I might be able to save some time instead of having to reboot every day and clear out all my work by booting back into Vista and just using Ubuntu in a VM, which is more likely to work okay without the NVIDIA drivers. And it does, except for the fact that I can only use one processor core because I bought the wrong dang quad core. And things run a bit more slowly under virtualization anyway so my unit tests take 20 seconds to run instead of 7, which is annoying, but OK.

But then I realized the Vista install was woefully out of date and probably already pwnt by some 12-year-old hacker. I have clicked "Install Updates" and rebooted exactly 12 times, solved some annoying problems preventing SP1 from installing, and been generally unproductive all afternoon, but still haven't managed to get past January 2009 in terms of the updates. And, I think there is still yet another service pack to install.

Haha, maybe I should have just stuck with the raw Ubuntu.

Monday, July 6, 2009

Increase Python's Recursion Limit

There are in fact two steps. Not only do you need to increase Python's internal recursion limit, you also (probably) will have to increase the stack size allocated to your process.

import resource

# Increase max stack size from 8MB to 512MB
resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1))
sys.setrecursionlimit(10**6)

Wednesday, July 1, 2009

Isn't it time for a high-dynamic range computing or web standard?

Luminance and contrast versus viewing directio...Image via Wikipedia
I sometimes bemoan the fact that there's no widespread support for high dynamic range on the web or in computing in general.



The white that most new LCD panels are capable of producing is way, way too bright in most lighting environments to be used as a background color. It's like staring into the sun (ok, not really). And yet, what color is the background of 75% or more of all web sites?



The only practical solution is to run your panel at a brightness close to 0 and sacrifice that great contrast ratio to save your eyes from burning destruction.



The closest thing I've seen to a general-purpose answer to this problem is Compiz's support for dynamically adjusting the brightness and contrast of particular windows. So you could set, say, every instance of a Firefox window to have reduced maximum brightness and use a dark desktop theme. Now you can turn your panel brightness up so you get some real contrast.



This is not a perfect solution of course because it affects the entire window unilaterally. Ideally, you'd have a way to say "any idiot who makes the background color of the website white should have it changed to a medium grey, but darker photographs should be allowed to have brighter than medium grey highlights." Otherwise you are just back to wasting the dynamic range the panel is capable of.



You might be able to get close to this ideal with stylesheet overrides, but they wouldn't work in every situation unless there was some sort of a standard. And of course you're messing with the designers' intentions which is less than ideal.



You could think of an ideal solution as a ReplayGain for the web. But instead of adjusting the maximum amplitude of the sound, we're adjusting the maximum amplitude of your site's luminance.



I doubt anything like this will become popular unless the LCD panel manufacturers get the ball rolling. Until then, we'll just keep chugging along with them turned down to the minimum possible brightness. Except for the people who don't even realize this is a problem, and stare into a bright lamp all day in their dark office. But unfortunately there is no hope for those folks.