From the What’s New in Python 2.6 page: A new data type in the collections module: NamedTuple(typename, fieldnames) is a factory function that creates subclasses of the standard tuple whose fields are accessible by name as well as index. For example: var_type = collections.NamedTuple(‘variable’, ‘id name type size’) var = var_type(1, ‘frequency’, ‘int’, 4) print […]
Whenever I use the web or write email, my working environment displays in black on white and I’m just fine with that. When I edit text, black on white just seems wrong and I always switch things around to be white on black. This never struck me as odd until today. Does anybody else think […]
I love games, but I hate dice. They vex me so. Especially while playing Settlers of Catan. If you’re twice as likely to roll a seven as you are a four, then why in the hell has four come up five turns out of the last six? Etc etc. You get the idea. Inspired by […]
flow|state has a very good UI design piece up currently. Its simple recommendation: make sure the important bits of the UI are front and center. Can you see the disaster in progress? Most users can’t either. This dialog has buried the lede. It focuses the user’s attention on the fact that there is another file […]
Sirs and Madams, Thank you for releasing your CLARAty software to the public. That is a wonderful move that we can all appreciate. However, I have one comment regarding your installation procedures: Csh? Really? Good Day.
I ran in to a situation recently where I had a big mess of code written in Java that I really wanted to call from a client-side web application. I could wrap said code up in a servlet, but that would be a lot of work. As it turns out, you can call methods on […]
I read two very useful articles about Haskell recently. First is Haskell IO for Imperative Programmers which explains how to do simple IO. (It’s less obvious than you’d think, especially if you’re coming from one of the more popular languages like Java or Ruby.) The second is called JSON Parser in Haskell. It covers in […]
Dave Thomas has a fine idea for improving conferences by adding a focus on charitable giving: Just imagine the difference we could make if, as an industry, we turned each of these conferences into a chance to raise much needed money for worthy charities. Imagine if, rather than getting yet one more burlap bag with […]
I spent Thursday and Friday at work essentially without fingers. Well, I had fingers, but only one useful hand of them. Interestingly enough, I learned that I’m at least in the short term incapable of hunt-and-peck typing. Finger muscle memory takes over when I try and everything goes all crazy-go-nuts. Not a good time. My […]
import Control.Monad powerset :: [a] -> [[a]] powerset = filterM (const [True, False]) I saw this over on a rather good introduction to dynamic programming. It does exactly what you’d expect it to do. (i.e., powerset [1,2] = [[1,2],,,].) Outstanding.