dsandler.org

Tag: code

I got an email this morning asking for help with ds-sleight.js. I subsequently discovered that Google didn’t know anything about it except what other people have written. So here’s some quasi-official documentation:

ds-sleight is a small blob of JavaScript I’ve been using since the year 200X to force Internet Explorer to render the 8-bit alpha channel in 32-bit PNG images. (You might recall me whining about IE’s miserable support for PNG transparency back in 2002.)

There’s a little by way of instruction in the JavaScript source; here’s a slightly more verbose version of the installation procedure:

  1. Save a one-pixel transparent GIF (like this one) somewhere on your server (default path: /images/spacer.gif). Don’t hotlink it off dsandler.org, or I’ll hunt you down and kick your ass.
  2. Copy ds-sleight.js to your server as well.
  3. Add to any page that has a PNG with alpha:
    <script src="«path»/ds-sleight.js" type="text/javascript"></script>

It even (mostly) works on PNGs used as CSS background-images. Enjoy (if you haven’t already)!

Hi. It’s been a while. I beg your forgiveness.

I gave a slightly silly talk about the programming language Python to the Rice CS Club last Thursday. It was a pretty mixed audience (ranging from “I’m not sure what Python is” to “what do you think of the new 2.5 features?”) so I tailored the lecture to experienced programmers and scientists new to Python in particular. The slides, along with some links I promised to the attendees, are collected on my new python page.

While we’re on the topic: If you’re a parselmouth and build web applications for fun or profit, you should be aware that web.py version 0.2 came out last week. The tutorial has been updated to use all the schmancy new features, like the built-in template system (replacing Cheetah, which is a little heavyweight for the web.py approach, which is something along the lines of “the absolute least amount of code that still saves you a substantial amount of work”). I’m looking forward to using the 0.2 release to whip up a redesign of the Beer-Bike tee shirt database in time for the 50th anniversary of the college system (and, hence, of Beer-Bike).

I’m trying to sleep until (very nearly) exactly every minute, on the minute. So I’m perplexed when, expecting to wake up at 10:54, I see the following: (from the Console log output)

2006-05-25 10:53:60.000 CuckooChimeAgent[1654] Wakeup @ 53:59

The code:

NSCalendarDate * now = [NSCalendarDate calendarDate];
int min = [now minuteOfHour];
int sec = [now secondOfMinute];
NSLog(@”Wakeup @ %02d:%02d”, min, sec);

So I woke up at 10:54, but the calendar date still shows 10:53 and, apparently, sixty seconds. What the hell kind of time is 10:53:60?

Take a look at the new python.org and see for yourself. The bizarre, quirky, pseudo-unnavigable, recognizable blue design has been replaced with…what, exactly? It’s not quite a facelift. More of a Botox treatment—seemingly smooth and youthful, but upon closer inspection weirdly plastic and static. And while I do like the new logo (at right), it seems a little feeble in execution—I feel it could be made stronger.

It looks like the open-sourced Binder (the fancy multithreading component framework underneath Palm OS 6, which began its life as BeIA 2.0 during the final months of Be, Inc.) has finally been officially released:

Contributing to the Open Source Community - ACCESS and PalmSource have contributed Open Binder, a component object framework, similar in general concept to DCOM and CORBA, but better scaled for use on small devices. Open Binder provides a unique inter-process communication (IPC) paradigm implemented as a kernel-loadable driver, and incorporates a broad range of programmatic utility classes and frameworks. PalmSource and ACCESS have released the Binder driver and its associated frameworks to the open source community. For more information, see www.openbinder.org.

Elsewhere: Jason (pretty much the mastermind behind the open-source effort).

Update: Eugenia has posted what I think will prove the definitive reportage of this release: OpenBinder introduction & interview with Dianne Hackborn.

Update 2: Slashdot covers the general PalmOS-Linux announcement. Nobody seems to have noticed the Binder part (except Eugenia); who can blame them, given the way it was buried in the press release?

Update 3: Wow, look at that cluttered architectural block diagram. A lot of unpleasant things there, like GTK and GStreamer (when we had a perfectly awesome rendering engine and media framework already built—that is, completed—for Binder). And hey, check it out, the nebulously-named “messaging framework” lives on! I swear, that thing will never be finished until someone decides to actually throw a team at it (instead of a pale blue rectangle on a diagram and a checkbox on a features list).

Wow.

After chasing a FeedTree memory leak for a solid week (actually longer if you count the time during the semester that I half-heartedly feinted at the problem), I’ve finally narrowed it down. It’s a bug in the way the finite entry caches interact with the replay defense mechanism, which tracks UIDs for very old entries; that tracking system keeps them alive long after they ought to have expired from the cache, eventually eating up all your memory with ancient news.

Fig. 1: Memory leak. Like the Price is Right cliffhanger, this graph of the app’s memory usage goes up and up and up, until you hear an awful crashing noise.

Now allow me to briefly hate on the Java runtime memory profiler (-Xrunhprof:heap=all) and HAT (heap analysis tool): Once I figured out that I needed to use them, figuring out how to get them to work correctly was almost as unpleasant as not having them at all. (Answer: update your entire system to J2SE 1.5, and then try the tools on your program 50 times; it will crash inexplicably for the first 49.)

This leads to Dan’s garbage collection lemma: It’s impossible in a GC system to leak objects by losing them. But if, rather than losing them, you merely misplace them, you are well and truly screwed without good heap analysis tools.

(continued…)

I just spent hours discovering that you should never, ever use setAction() on a JMenuItem on Mac OS X. The end result is an empty menu (that is, no text in it at all). Why? Who knows. (The correct answer is to use setActionCommand() and addActionListener().) Unfortunately, this same fix does not seem to fix my empty JButton, which will not show its label no matter how hard I try. Update: Wait, no, this fixes the button, too. GRAR!

Write a million times, run nowhere!

subscribe to dsandler.org

  •  
  • for faster updates, subscribe with FeedTree

mac software made on premises

toastycode.com: toasty software for the mac pyrotheque: a new (old) fireworks screensaver for the mac
Cuckoo—the bell tolls for your Mac.

twitter/dsandler [RSS]

    loading…

elsewhere

highlights

between the couch cushions

strongly connected

  • erinmak is not to be trifled with
  • pixelknave says moof when upside-down
  • dave is dangerous
  • rod is one groovy mother
  • adam is googling us all
  • amar is not really a pirate
  • angi sees little blue dots
  • harbinger lets you know it's coming
  • jason looks like an idiot in that hat
  • jeff is keeping austin weird
  • regan seems to tolerate jason
  • emann will not abide your IM-speak
  • jim is a stranger in ein anderes Land
  • liscio is pronounced "lee-show"
  • darryl has no need of identifying objects
  • friends as they appear on dsandler.org
  • sportsgirl reports…on all the pro courts

Search

Recent

Archives

dsandler.org is Dan Sandler's website and notebook.

Powered by WordPress and here's why.