Archive for December, 2007

Dec 30 2007

How To De-C++-ify Your Java: EnumSet

If you’re still on Java (like me), and you’ve got some enumerations and/or bit flags kicking around (like me), then you really want to know about EnumSet. I just found out about them, and I thought I’d share.
Continue Reading »

Popularity: 4% [?]

One response so far

Dec 29 2007

Take who’s power away?

Published by Brian under Politics

There’s an important aspect in the healthcare debate that I think has gotten, not overlooked, but less attention than it deserves. And that is the issue of power. Now, obviously, the Democrats seek to gain political power via health care. Or, at least I wish (as a Democrat) that the Democrats would seek to gain political power via health care, but that’s a different discussion. But what’s underdiscussed is that the Republicans also seek power by denying health care- and, by extension, denying the Federal Government is, or can be, a force for good at all. I wanted to point out a choice quote from this article from Mr. Anti-Tax himself, Grover Norquist:

He also confessed to Reason that he feared that Clinton’s effort to implement universal health care could have relegated the Republicans to permanent minority status: “Had the Democrats taken over health care, I think we would have become a social democracy and we could have never undone it. We wouldn’t have won in ‘94, and even if we did, it wouldn’t matter because 50 percent of the population would be on the take.”

Ignore for the moment the insulting insinuation that providing health care to the poorer half of the country means that they’re “on the take” (I assume it’s the poorer half- he didn’t specify which half). The entire Republican philosophy hinges on the belief that the Federal Government cannot help. If the government can help, then obviously it has a moral obligation to help. If people believe the government can, and thus should, help, then those who do not want the government to help will be headed for political exile for another generation. Universal, affordable, federally funded health care would be an electorial disaster for the Republicans. And the Republicans themselves know this.

The Republicans have already spent 40 years in the “electoral wilderness”- from 1932 to 1968 the only was Republican got elected was to run as a Democrat-lite. And even then, they often didn’t get elected. Note, the same is not true for the Democrats. The Democrats tried for universal health care- in ‘48, again in the 70’s, and again in the 90’s, and are currently 0 for 3. And they’re still here. They lost elections, sure, but nothing like what the Republicans faced after the New Deal.

The battle over health care, and by extension the New Deal and progressive government in general, will ramp up again, the next time a Democrat is elected. If not this election, then the next, or the one after that. And when it does, expect the Republicans to play no holds barred. To go even lower than they normally do. Because this isn’t just about an election, it’s about 40 years in the political wilderness. When they present their spin on the issue, keep this in mind. This might call for an even larger grain of salt.

Popularity: 4% [?]

One response so far

Dec 29 2007

Inside the Library Architect’s Mind: Stream-of-Consciousness on JConch

(This is a stream-of-consciousness blog post: I’m just going to spew whatever comes into my head. If you haven’t taken a look at it before, see JConch on GoogleCode to get an idea what I’m talking about. I’m on SVN revision 77 at the moment.)
Continue Reading »

Popularity: 3% [?]

No responses yet

Dec 29 2007

Functional Programming Language de Saison

Has anyone else noticed that there’s a new “hip” functional programming language every 3 months or so? The first one I heard of was Erlang, about a year ago. And then that fell out in favor of Haskell. Then OCaml seemed to have its turn. Now it’s looking like it’s Scala.

What gives?

Popularity: 9% [?]

10 responses so far

Dec 28 2007

I think my brain just exploded

Haskell is making a real strong bid to wrestle the coveted title of “Brian’s Favorite Language” away from the current title holder (Ocaml, in case you haven’t guessed).

The thing that just happened was that I wanted to find some pythogorean triples- you know, groups of three numbers x, y, and z such that x2 + y2 = z2. So, without really knowing the language in any sort of deep way, and without thinking about it too much, I wrote the quick program:

f :: Int -> [ (Int, Int, Int) ]
f n = [ (x, y, z) |
x <- [ 1 .. n ],
y <- [ x+1 .. n ],
z <- [ y+1 .. n ],
(x * x) + (y * y) == (z * z) ]

You basically don’t even need to know a lick of Haskell to figure out what it does- anyone who’s gotten far enough in math to have encountered sets would probably guess correctly. Well, they might use the term “set” instead of “list”. The fact that it’s returning pythagorean triplets would be blatantly obvious. OK, so it’s an O(N3) algorithm, and you could probably do it in O(N2). When calling it with small numbers, who cares? I can find out that f 20 is [(3,4,5),(5,12,13),(6,8,10),(8,15,17),(9,12,15),(12,16,20)] so fast that I don’t see the computer pause, and that’s the answer I was looking for. And it’s hard to beat this code for succinctness and clarity.

Popularity: 41% [?]

16 responses so far

Next »

Green Web Hosting! This site hosted by DreamHost.