![]() | Ned Batchelder : Blog | Code | Text | Site January 2005 » Home : Blog |
« December 2004 | » Main « | February 2005 » I've been building a small GUI program with wxPython, and it's mostly a straightforward experience (if you're accustomed to the way GUIs tend to be built). wxGlade helps a lot with building the visible components of the UI. But I was going nuts trying to figure out why my Windows icons didn't look right. I went to the trouble of reading a technote (Icons in Win32) to decide which sizes and depths of icon I needed to provide to get a nice looking taskbar icon and alt-tab icon. But my taskbar icon always came out smeared, clearly having been scaled down from a 32×32 image. I was ready to start reverse-engineering Windows' algorithm for picking the icon image, when I thankfully decided to look into the wxGlade-generated code first. Here's what it gave me for setting the icon in my main frame: _icon = wx.EmptyIcon() This clearly seems to be picking a single image from the icon, then setting it as the icon. That defeats the whole idea of a multi-image icon. No wonder Windows seems to be scaling a large image for the taskbar. The .ico bitmap loader probably just picks the highest quality image it finds. Digging deeper into the wxWidgets docs, I found wxIconBundle and wxTopLevelWindow.SetIcons, and came up with this instead: ib = wx.IconBundle() This works like a charm, giving me pixel-perfect icons for the taskbar and the alt-tab image. Bliss! I couldn't find much discussion of this issue, or use of these methods in existing code, and I don't know what it does on other platforms, but it works great on Windows.
tagged:
python,
how-to» 6 reactions Part of my continuing effort to help facilitate clear communication among engineers: Things to say when you're losing a technical argument:
tagged:
funny,
geeky
/
via:
Keith Devens» 4 reactions I've been getting back into wxPython coding, and have been trying to find a clean example of the Model-View-Controller pattern, but haven't been having much luck. For example, I'd like to have menu commands where the main frame doesn't have to know to invoke a method on the current view. I'd rather that some generic event machinery found that the view could handle the event, and let it do just that. Matthew Scott's uberwx technique, which uses the dispatch module to move events around, may just the ticket, but I have to try it out to know for sure.
tagged:
python» 2 reactions InkscapeFriday 28 January 2005 Inkscape is an open source vector graphics program (Inkscape is to Adobe Illustrator as GIMP is to Photoshop). It's native format is SVG. I haven't used it much, but it looks quite full-featured. For a more in-depth review of Inkscape's good and bad points, see Jakub "Jimmac" Steiner's review of Inkscape.
tagged:
tools,
graphics
/
via:
del.icio.us» react MongooseThursday 27 January 2005 Mongoose is a Python library for handling uncaught exceptions cleanly, and providing some support for incident reporting along the way (motto: "Mongoose catches runaway Pythons"). It looks like one of those small tools for a specialized job that are such a treat in the Python world. (Via a comment to Ian's good catch all exceptions post.)
tagged:
python,
exceptions,
libraries» react More exception handling debateThursday 27 January 2005 First Raymond Chen wrote that exceptions are cleaner, more elegant, and harder to recognize:
Max Ischenko responded, writing about exception-based code and exception-based code antipatterns:
So everyone agrees that exceptions (or any other comprehensive approach to error checking) is hard. In response to Max, Ian Bicking writes about good catch all exceptions:
I've written at length about my philosophy of exceptions. As David Byrne said, "say something once, why say it again?": Exception vs. status returns and Exceptions in the rainforest.
tagged:
exceptions» react Misaligned fragment URLsMonday 24 January 2005 If you find yourself following URLs that have fragment identifiers (you know, the part after the "#" hash mark), and they take you to the right page, but not the right place on the page, then most likely the page you've landed on has images without width and height attributes. The browser loads the page, and finds the spot identified by the fragment id, but then the images load in, and move the page around underneath you. The fix is to make sure all of the images on the page have width and height attributes. That way the page is laid out correctly even before the images are loaded, and the fragments will work properly. As you may have already guessed, I updated my blog software to add width and height attributes to all my images. Using Python Imaging Library, it was a piece of cake. Links to particular blog entries on this site will now work much better.
tagged:
site,
web» 1 reaction BlizzardMonday 24 January 2005 So far, we've survived what is being termed "Blizzard '05". We got between two and three feet of snow, including drifting: Compare it to my Snowcakes picture of two years ago. The town of Brookline (like the city of Boston) has closed school for two days, which seems completely unwarranted. Better safe than sorry, I guess.
tagged:
photos» 10 reactions New Picasa and GIMPSaturday 22 January 2005 There are updates available for two free graphics packages I use on Windows: Picasa (a photo organizer), and The GIMP (the GNU Image Manipulation Program). Picasa 2 is out, and it has a bunch of new features. Since being acquired by Google, it is free, so why not run it? And no, I don't know what Google plans to do with it. It has a Blogger button, but buying Picasa seems a long way for Google to go to get a little Blogger integration. The GIMP is up to version 2.2.2 (though the Windows install kit is only up to 2.2.1). If you haven't tried GIMP since version 1, take a look: version 2 is a huge improvement.
tagged:
tools» 1 reaction Kubi Software (my employer) is looking for QE contractors, or possibly contract-to-hire. See the job posting at dice.com for details! Hurry! Limited time offer! Send me an email if you're interested. CategoriesThursday 20 January 2005 I finally implemented a categorization scheme for this blog. It was interesting going back over the last three years and trying to see patterns in the posts. In the end, I created 77 categories, some of which I couldn't have predicted. I didn't realize I'd made 12 posts about Lego, for example. And going through the movie posts, I almost made a separate category for The Matrix. As of now, I haven't actually categorized everything. There are still lots of uncategorized posts, because it's hard to identify their buckets. (Also, I got tired of doing nothing but categorizing old posts). I didn't want to make one gigantic "Writing Software" category, but I don't know what to call some of the smaller buckets within it. For example, what do you call the topics about how to design classes and modules? Pattern topics would go into it, but it isn't just patterns.
tagged:
site» 4 reactions ColdWednesday 19 January 2005 I live in the Boston area, which means that January is cold. It was 8° (Fahrenheit) here yesterday. That's not that big a deal around here, but here's the thing: Somehow during the drive home in the evening, I managed to get my right index finger frostbitten. It was pale and numb, until I soaked it in some warm water and it returned to the same cold-pink as the others. Today: gloves.
tagged:
me» 3 reactions Grid designTuesday 18 January 2005 I am not a graphic designer, but I have long admired what they do. One of the things I like about the hassle of rolling my own blogging software is the chance to do a little bit of design, both cosmetic and interactional. Khoi Vinh is a graphic designer, and shows his skill with his new improved design. This is a classic example of a grid design, where a page (or screen) is conceptually divided into a grid. The grid serves as a foundation for the content fitted into it, and ensures a consistency of geometry to the page. Interestingly, though the grid is intended as a constraint on the structure of the page, a hallmark of the technique is the flexibility of deciding how to place content within the grid. See Khoi's illustration of his grid for a demonstration.
tagged:
design,
blogs
/
via:
mezzoblue dailies» react HTMLareaMonday 17 January 2005 Because I may need it someday: HTMLarea, a very impressive HTML editor that runs in IE and Mozilla Firefox. It was written by Mihai Bazon, who also makes some great menu software and other DHTML goodies at dynarch.com.
tagged:
tools,
web» 2 reactions Let me be braveSunday 16 January 2005 My wife Susan has an op-ed in today's Washington Post: Let Me Be Brave, about the Special Olympics and the death of Rosemary Kennedy (which I wrote about here last weekend). Of course, she says it all better than I could...
tagged:
autism,
susan» 2 reactions ¶ NASA Details Earthquake Effects on the Earth
tagged:
music,
science,
video games,
quick links» react First image from TitanFriday 14 January 2005 The first image from the Huygens probe on Titan shows the surface of the moon of Saturn:
Some remarkable factoids about the mission:
tagged:
space» 1 reaction IBM releases 500 patentsWednesday 12 January 2005 IBM is releasing 500 patents for use without payment in open source products. Here's the list of all 500 patents. I don't know what this means from a business point of view. As an engineer, I scan down the list of patents and get the same glazed-eye look as anyone else. They all sound very similar, and all sound like either completely fundamental principles or trivial crap, like most patent titles do. Also of interest to me is that none of the three patents that I authored in the IBM portfolio are in the list:
Does this mean my patents are worthless? Or irrelevant? Or too valuable to disclaim? Maybe they just don't have much to do with the hotspots of open source. Who knows?
tagged:
business,
law
/
via:
ongoing» 5 reactions Bjarne Stroustrup has written a very interesting paper outlining some radical ideas for operator overloading: Generalizing Overloading for C++2000. He includes the notion of overloading no operator at all, so that "x y" can mean "x*y" the way physicists and mathematicians want it to mean. Note: I got about halfway through this before realizing it was a joke...
tagged:
c++
/
via:
Borkware Miniblog» 7 reactions Autism car magnetsTuesday 11 January 2005 AutismLink (Pennsylvania's Statewide Resource for Autism Spectrum Disorder) is selling Autism Awareness car magnets. There are other sources for these magnets, but AutismLink helps the cause more directly. The digested readSunday 9 January 2005 The UK's Guardian Unlimited has a section called The Digested Read, in which books are reviewed by way of condensing them into a single page in the style of the book itself. The whole thing is then snarkily summed up in a single sentence titled "The digested read ... digested". Judging by two samples from books I had actually read (Vernon God Little and Life of Pi), for some books they do a pretty good job nailing the tone and subject of the books. For others (Harry Potter and the Order of the Phoenix, for example), they seem to settle for mere parody.
tagged:
books
/
via:
LinkMachineGo» react MAME arcade machinesSunday 9 January 2005 I've heard of MAME, the arcade video game emulation software. I hadn't known that there's an entire cottage industry springing up to provide arcade-style enclosures for computers running MAME: SlikStik, DreamAuthentics, MAMEroom, and Dream Arcades, to name a few businesses. You can even get MAME-branded arcade tokens!
tagged:
video games
/
via:
Coding Horror» 2 reactions Tricks of the tradeSaturday 8 January 2005 Matthew Baldwin collected a bunch of tricks of the trade from all sorts of professions (clown, butcher, nurse, photographer). He ended up getting more from all over, enough to start a whole blog about it: Tricks of the Trade. Some are edifying, some are horrifying (for example, mortician), all are fascinating.
tagged:
how-to,
blogs» 1 reaction Rosemary Kennedy, 1918–2005Saturday 8 January 2005 Rosemary Kennedy, the disabled sister of JFK, and the inspiration for the Special Olympics, died yesterday. This is a remarkable story, for both good and bad. On the bad side, a mildly retarded girl is lobotomized, leaving her profoundly disabled. She's hidden from view to prevent scandal to an ambitious and powerful family. On the good side, she inspires that family to create the Special Olympics, one of the best things to happen for disabled people in the last century. I don't know how much Rosemary's story is unique for that era. There certainly were not the options and understanding that there are now. I'm saddened to think of her plight as an individual, but glad to benefit from the organization and attitudes that she helped, however indirectly, to create.
tagged:
obituaries» 1 reaction Deleting code in RussianFriday 7 January 2005 Alexander Belchenko has translated another page of mine: Удаление кода. Nat's Pooh pictureThursday 6 January 2005 My 15-year-old autistic son drew this picture today: He's drawn four characters (Piglet, Tigger, Pooh, and Eeyore), each in their characteristic color, and labelled in the same color. He's signed his name in red. I really like this picture, partly because Nat never draws pictures. I was considering using this picture as a jumping off point for writing about one of the many philosophical quandries facing parents of disabled children: the disparity between his chronological age and developmental age, or the difficulty of choosing appropriate educational goals, or discerning the fine line between his personality and his disability. But I'm not going to write about any of those things. Instead, I think I'll just enjoy the picture.
tagged:
autism,
parenting» 8 reactions SQL injection attacksThursday 6 January 2005 Steve Friedl has written a detailed and comprehensive guide to how to crack into relational-based systems: SQL Injection Attacks by Example. Also included (for those of us on the hook for building these systems) are tips for how to prevent injection attacks.
tagged:
databases,
security» 1 reaction Music notation modernizationWednesday 5 January 2005 Last Sunday's investigation into musical navigation demonstrated to me once again just what an ad-hoc hodge-podge music notation is. It's developed over centuries, with odd symbols mixed together with abbreviations of Italian words, and so on. But even with its flaws, it's so well established that no one would propose changing it, right? Wrong. The Music Notation Modernization Association is proposing exactly that. They have a set of detailed criteria that they used to evaluate over 500 different proposals, winnowing them down to a few dozen. These notations have merit, but let's get serious here: there's no way music notation is going to change. There's just too much music already out there, with too many people already trained on the current system. If we can't manage to change English spelling, we aren't going to be able to change music notation. On the same topic, it had to be out there, but I had never seen it: MusicXML.
tagged:
music» 3 reactions Formula engine rewriteWednesday 5 January 2005 Damien tells the story of his Formula Engine Rewrite:
It's a good story of how a major feature got built against the odds by one determined engineer.
tagged:
work» 2 reactions Post #1000, take twoTuesday 4 January 2005 Picture me standing at a lectern. A spray of microphones nearly obscures my face. Camera flashes strobe the room. I am near tears, but resolve to deliver my message:
Lessons:
tagged:
site» 2 reactions Blogging for jobsTuesday 4 January 2005 Scoble has advice for job seekers:
I don't know whether this is true or not. I guess a blog couldn't hurt. Someday I'll need a job, and this will be a prime place to announce it. In fact, one of the things that got me to start this blog was the idea that I'd need a place someday from which to shout, "Help!" I'm glad at least one person thinks it will help.
tagged:
work» 9 reactions @icon sushiTuesday 4 January 2005 I've long been surprised at the dearth of good tools for dealing with Windows icons. For example, considering how mainstream a format it is, I'm surprised to find that neither Photoshop nor Gimp can handle it. Perhaps it's because of .ico's inherent multiple image nature. In particular, there haven't been any useful freeware icon editors that I've found. Well, now I've found one: @icon sushi It isn't exactly an icon editor, since it focuses on all aspects of icon other than the color of the pixels (in other words, all the things that are unique to icons). For painting pixels, use your favorite image editor, then use @icon sushi to pull the pictures together into an icon.
tagged:
tools,
windows
/
via:
blog.dreampro» 3 reactions Alex Gorbatchev has another solution to the problem of syntax-coloring code snippets on blogs: ship the whole problem over to the browser, then do the coloring in JavaScript. It's a very interesting solution, and the JavaScript code itself is very cool. What I need is syntax coloring that can handle true Unicode characters. I don't know whether JavaScript regexes can do it. I've been using SilverCity, but have been thinking about a new solution. Maybe client-side JavaScript is the way to go.
tagged:
tools,
javascript
/
via:
Coding Horror» react Post #1000Sunday 2 January 2005 This is the 1000th post on this blog. Don't believe me? See for yourself. I don't have anything wise to say to mark the occasion, no touching reflections on the 999 posts that have preceded it. In keeping with my aversion to marking special occasions, I'll allow myself the freedom to wax poetic about my blogging when I feel like it, rather than when the odometer happens to have a few zeros in it. I've been blogging for close to three years, and I've enjoyed it, so I'll keep on doing it until it starts to suck. Knowing me, I'll probably keep doing it for a while even after it starts to suck. I've gotten some nice feedback from people, and that helps keep the momentum going. Thanks for reading.
tagged:
site» 5 reactions Musical navigationSunday 2 January 2005 I was playing some piano music today, and saw that familiar notation "D.S. al Coda". Although it was familiar, I didn't actually know what it meant. I knew it had to do with going back and repeating some part of the music, but that detail of my piano education had withered long ago. So I looked it up online, finding this great online music notation reference: Music Theory Online. Chapter 24 is Repeats, and told me what I needed to know. Acoustic Guitar also has a handy online lesson about notation. So: "D.S. al Coda" means go back to the percent-over-S sign, then play to the other plus-over-O sign, then play the coda (the end). But when I looked at my sheet music with this new understanding, I saw some oddities: First, the percent-over-S sign was placed at the beginning of the piece, so why not use "D.C. al Coda", which means go back to the beginning, and so on? And when I looked at the end of the piece, it seemed clear it could have been written more compactly without changing the music: the same measures were in the coda as in the normal repeat that was skipped. I guess music can be refactored just as code can. What I saw in the music were duplicate lines of code that could have been eliminated by rewriting the loops with different termination conditions! Fascinating. BTW: Back in March, I asked about MIDI-to-notation converters. I really appreciate the shorthands of music notation after looking at the output of these programs. All the loops have been unrolled, all the trills, grace notes, and arpeggios have been literalized, and so on. A simple three-page song becomes a twelve-page mess of mind-numbing repetitive scribbles.
tagged:
music» 2 reactions Happy New Year everyone! I have to say this about New Year's Day though: I don't like special occasions, for two reasons:
For example, everyone's making resolutions today. Why today? Shouldn't we be introspective and purposeful the rest of the year? Why can't I make resolutions on February 5th or October 18th? Everyone tries to make their birthday special by doing just what they want to do. Why can't I do what I want to do every day? And since we've just left the Christmas season, how about maintaining a little good will toward others the whole rest of the year? Hallmark shouldn't dictate our mood. So my resolution for the new year: treat every day as special, regardless of the position of the Earth in its travels around the sun.
tagged:
philosophy» 2 reactions « December 2004 | » Main « | February 2005 » | |