Friday, December 15, 2006

Help me, Don Knuth, you're my only hope!

If you're typesetting something with pdflatex -- you can't include eps images with the graphicx package.

You can only use figures if they're in pdf format, but the error message for when you try to use eps is non-helpful.

Maybe this will help someone some day.

Monday, December 04, 2006

rapid-feedback poetry and lisp environments

I think, ultimately, TEB is going to want to be less of a fully automated thing and more of a computer-aided composition tool for poetry. Or maybe it'd be better to think of it as a generator, with a human in the loop. Something that would let you get really rapid feedback and come up with suggestions. It would let you build poetry by search, recognizing what you like and what you don't like. And it'll keep versioning information...

Hey, speaking of development environments! On Lemonodor, I just found out that there's an Eclipse plugin for writing Lisp called Cusp. It uses SBCL and swank, like all right-thinking lispers, letting you do SLIME-like things without Emacs -- SLIME being the currently en-vogue common lisp development environment, and swank being the backend. There's a similar project out there that I've been watching too -- Slim-Vim, which is an attempt to make that same swank code work with vim. (the mailing list has been a little quiet, but it might pick up steam again)

Saturday, December 02, 2006

python generators and more live coding music!

I just found out about the yield python keyword, which lets you produce generator functions. This came up, in a practical context, because I wanted a clean way to get n items at a time out of a list, and the Python Cookbook approach uses generator functions. They let you build an object that essentially contains a closure of the current environment, which can be iterated on. Sort of like lazy lists! Of course, the same behavior could be done with C-style static variables, but this is really pretty.

- yield keyword from the Python docs
- a discussion of generator functions over at IBM Developerworks.

Also! Brett alerts us to Impromptu, another live coding environment for making music and stuff! From their site:
Impromptu is an OSX programming environment for composers, sound artists, VJ's and graphic artists with an interest in live or interactive programming. Impromptu is a Scheme language environment, a member of the Lisp family of languages.

Sunday, November 26, 2006

What, he keeps on posting about pluralism and that Sam Harris guy?

These people, on the other hand, don't seem to see religion and religious differences as a problem. In fact, they seem like very nice, reasonable folks.

The Pluralism Project at Harvard
Interfaith Youth Core

IFYC was started in part by Dr. Eboo Patel, who gave a very nice interview on NPR, which I remember hearing on the radio when it was broadcast. He also wrote a This I Believe piece.

Sam Harris still isn't convinced, of course. But you'd think they could come up with a better debating partner for him than Dennis Prager? (there's a fairly interesting email debate between them on jewcy; he must not have read my previous post, Sam didn't, because he didn't address my concerns.)

Genetic algorithms for Dr. Mario Strategy!

It turns out that one Paul Kuliniewicz has decided to build an AI to play Dr. Mario -- or more accurately, to learn to play Dr. Mario and then play it, using, ironically, genetic algorithms. It's called Wallace, and it builds up and breeds different strategies for pushing pills around. This seems like a pretty good domain -- and I suppose puzzle games of this sort are in general... I wonder if anybody's done something like this for Tetris? Other real-time puzzle games?

The interesting thing about this -- he's hooked his evaluation function for evolutionary candidates into the NES emulator. Pretty clever stuff!

Saturday, November 25, 2006

"I know you don't know..."

So this fellow Sam Harris has recently come onto my radar. He's in the Richard Dawkins "religion is pretty immediately harmful and we need to get rid of it" school of thought, and he's published a pair of books (The End of Faith and Letters to a Christian Nation) in which he spells out his position. There's a video of him giving a talk out there, and I think he's a pretty good speaker...

But it might just be because I'm inclined to agree with what he's saying. I've been trying to work this out systematically. There are some very clear ways in which religion-inspired positions can be detrimental to people's health and happiness -- we've got the oft-cited condoms-in-Africa and the stem cell research and the homophobia... and all sorts of positions, say environmental ones, that you would rationally take if you thought that these were the End Times, that Jesus was coming to save the day in the next 50 years or so -- which supposedly almost half the country buys into. And that's just not a healthy belief for people to have, if the rest of us want to establish a sustainable living environment for people in the long-run.

And deep down inside, I think a property of people (for now) is that we want a holy war -- we need something to rally against, some sort of emergency situation to respond to. And we think, "well, this is wrong. These well-meaning people are misled, and it's so pervasive, particularly in this country, and you can't really talk about it..." So they're talking about it, Harris and Dawkins are.

However, I think where Dawkins and Harris fall down is in two major ways:

Firstly, not all religious people take all the purported beliefs of their religion to their logical extremes (and why not is an enormously interesting issue). This is a central point in Harris' argument, and I'm trying to work out what I think about it -- he says that religious moderation and pluralism essentially ropes off faith from rational discourse and makes it okay to believe whatever you want, and nobody's going to question it, which provides cover for extremists... and as moderately-minded folks, we have trouble believing that people really believe this schlock, but he assures us that they do -- and that genocides and jihads really aren't just about economics and education like we want to believe they are, but are honestly religiously motivated.

And yet the world is full of people who identify with one particular faith and still do wonderful things for the world. Many Christians feel the need to be good stewards of the planet, they save the water and the air and the narwhals, they feed the hungry, they provide medical attention all over the world. And many are full of love and hope and tolerance, and they stand up for their gay friends and make beautiful works of art and fill the world with music.

Of course, these people might do these exact same things without religion -- maybe they're just beautiful people. But then, in a world without faith, I wouldn't be writing this post. So it goes.

Secondly: the biblical god is perhaps not in the same class of entities as Zeus or Inari, and I think it's an oversimplification to put statements like "there is a giant diamond buried in my back yard" (an example from Harris) in the same class as statements about the nature of a more abstract deity -- at least without further examination. Now the idea that Jesus is physically coming to end the world soon, maybe that's in the same category as the giant diamond, but what about the proposition that there's an inherent moral structure to the universe, or that your dead friends and family aren't really gone? Or that things Will Ultimately Work Out? ... Of course "I wouldn't want to live in a world where X is not the case" isn't really a knock-down argument to convince us of any of these things.

So anyway, BG, as we'll call it, is something a little different, with a fluid identity somewhere between that of Zeus (the old-testament local sky-god, rooting up the local fertility cults and being mad at some people while briefly favoring others), a mythological sun-hero, and something like a Lucasian Force or the Tao or even identifying with all of the world, like you might find in Spinoza.

Richard Dawkins had quipped that everybody is atheist about most of the gods that have ever been dreamt up -- some of us just go that last step. And I think that's an oversimplification, because for a lot of people, god is just that abstract-orderliness-principle... if your view of god is, like this fellow RJ Eskow puts it, the sheet music of the universe, then this isn't all that different from believing in causality and some initial state of things, is it? And don't a lot of people hold beliefs like that?

I think what Sam Harris really gets at is that it's almost taboo to talk about faith as an absurdity in polite society. Many people get really defensive about their theology, if you bring it up. There's this weird feeling of guilt, at least for me, being an unbeliever bringing this topic up. I don't believe like you believe; in fact, I think you're wrong about some pretty fundamental things and I'm trying to gauge whether it's harmful. And that's where the guilt comes from, I think -- we're faced with the prospect of explaining to our loved ones that they and some large chunk of society hold possibly-destructive beliefs. It feels wrong because we know folks who are nicer people than us (and furthermore more devoted social activists) and it's hard to find fault with them and what they believe -- no harm, no foul, right? Is it so destructive to believe in a universe that has some sort of underlying order to it, that wants, in some sense, for you to be nice to people, wherein you identify the BG with a kind and loving parent?

I mean, it's Wrong, of course. And I still haven't addressed Sam Harris' idea that toleration and letting people believe what they want provides cover for fundamentalists. And the propositions that the wonderful and nice people hold true might even be largely the same as the ones that folks we might label as societally destructive believe in... this is a difficult and tangly problem. The mind is vast and greatly partitioned.

So at a higher level, do we believe in truth and the search for it, or is what we believe pretty much unrelated to any objective world that might be out there? And how can you possibly sit still when you know in your heart that you have this truth that's vitally important for everybody's eternal well-being that snot-nosed AI kids on the internet are calling schlock? Doesn't religious pluralism lead the way to trivializing religion as a whole? The idea that there's some abstract higher truth that's filtered into different societies in different ways is attractive to many, but I think it breaks down when you get into the specifics of what religions are actually saying. Unless everybody's just speaking in metaphors and hyperbole most of the time.

(This last cluster, the "abstract orderliness to the world" has its problems once you try to work out the details, of course. Particularly, it doesn't square with BG as well as many would like -- you start ascribing all of these perfections to BG, maybe with an aim to working out an ontological existence proof and then you're left with The Problem of Evil or justice anyway. Let's leave this to another post, or perhaps a book.)

(although many in Christian contexts have preached against the God-as-the-Force idea in favor of a more personalitied BG, Huston Smith interestingly characterizes Hinduism as encouraging whichever idea about Brahma one personally finds more worshipable)

Here are some interesting blog posts: alls I'm gonna say is that people who argue against Sam Harris seem to mostly rely on ad hominem attacks and the idea that he has a faulty moral compass.

- RJ Eskow: Reptiles of the Mind -- giving thanks for rational atheists
- RJ Eskow: The sad state of atheism today
- Sam Harris: In Defense of Torture (seriously, Sam, wtf?)
- Steven Pinker: Less Faith, More Reason
- Marty Kaplan: Atheists for Cheney

Wednesday, November 22, 2006

GWT and ChucK

So maybe two years ago, our good friend (noted security researcher and computing maven in general) Tim J had been kicking around an idea for developing web applications: he wanted to use a more general interface mechanism, say Swing or GTK, for laying things out, with some other layer figuring out how to express what you put together in terms of web languages. At the time, I didn't see the need...

But Google did, apparently! GWT lets you design webapps in terms of Java, running on your local machine for testing purposes. GWT then compiles them down to Javascript when you're ready to deploy for the rest of the world. I'm probably the last to find out. It's open source; you can go play with it if you want. Pretty crazy.

http://code.google.com/webtoolkit/



Also; after rather a while of hearing my friends work with and develop the music-programming language ChucK, I finally took the time to go play with it. At first I tried to use the Audicle -- which is a really pretty IDE, all done up in OpenGL -- but it crashed on my Mac, so I tried miniAudicle instead. That worked just fine, with a nicely intuitive, minimal interface. After just a few minutes, I was making some interesting bleeping-and-booping noises. It was very satisfying! I think I like the square-wave generator best.

ChucK definitely warrants checking out, if you have any sort of urge to make cool noises, or even cheesy music. Graham Coleman, who wrote said cheesy music tutorial and has in recent months been performing live with ChucK in Atlanta, was just now on the radio, and he proceeded to rock the airwaves pretty hard. Hooray!

Wednesday, November 15, 2006

The Enron Email Dataset!

So they might not have really been the smartest guys in the room... but one really good thing coming out of Enron is all those emails. 2.6 gigabytes worth, for your perusal or data-mining, social-network-mapping, and language-modeling pleasure. Thanks, guys!

The corpus is here!
(thanks, CMU!)

Sunday, November 05, 2006

"Here, lemme take a Pikachu..."

So say that you want to pepper your speech with non-sequitur references to some particular topic -- like whenever you use a string of words that rhymes with the name of a Pokémon name, replace that string with the name of said Pokémon.

That wouldn't be that hard -- there's a pretty happenin' metric for finding rhymes, ready to go.

So you'd just have to have a list of the words for the domain you want to substitute in, make sure that you have phonetic descriptions of each of them (Bradley Buda's rhyme metric uses the CMU Pronouncing Dictionary's format)... then run through your input text searching for substrings that rhyme with words in your list with a score over some particular threshold. And hilarity ensues.

A similar technique could be used for generating phrases like "my feet are staying!" for "auf wiedersehen!" -- you could something hill-climbing-like (with a parser in the loop, so as to try to maintain grammaticality) to substitute out common phrases...

The only problem is -- what rhymes with "Psyduck"?

Tuesday, October 31, 2006

JES Prerelease!

I packaged up the next release of JES, our "Media Computation" environment for helping beginning programmers today. Honestly, if I was teaching kids about programming, I'd probably use this. It's a lot faster than the previous versions, it has a better layout and clever integrated help, it has LOGO turtles!, and like always -- it's really good for doing funky stuff to pictures. (gallery 1, gallery 2).

Fresh code! Here!

Any feedback would be greatly appreciated!
(slides for cs1315, the course where we make use of JES can be found here, in case you want to play around with JES but don't know what it's good for yet!)

Monday, October 30, 2006

Beautiful educational software :)

So many of you are probably aware that my job (ie: research assistantship, ie: how I'm getting gradschool paid for) is to work on JES, the Jython Environment for Students -- it's the little IDE that we use at Georgia Tech to teach introductory CS classes to non-majors and for summer camps as part of our "media computation" effort. A number of other schools use our stuff too, which makes me pretty happy. We're releasing a new version soon, and it's going to rock hard and be faster and include LOGO-style turtles! I'll put up links when it's out.

But speaking of LOGO-style turtles and media computation:
- The KDE Project has KTurtle out now, which looks pretty cool. It's part of their bigger KDE Edutainment effort.
- TuxPaint is also pretty cool! My friend (and noted cartoonist) Brett finds it pretty amusing. It reminds me of KidPix, which you might remember from your childhood if you're about as old as me -- and that's still out there, apparently?
- Tux Paint comes to us from New Breed Software, which has a bunch of other cool educational products.
- And if you only click one link on this post: Pictures Kids Made With TuxPaint

And, for completeness:
- Alice is a programmable 3D environment up outta CMU that rocks harder than I can describe in a quick blog post. As they put it on their site, "Alice will make programming a means to an exciting end." That exciting end is really easy 3D storytelling.

Friday, October 27, 2006

reading on the web

I'm not a fan of most web design out there. I know that's not an uncommon opinion. But say you're a site that has some nice articles that people might want to read -- why clutter up the page with sidebars and crap so that the majority of the screen is taken up with things that aren't the intended article?

Take for example: this DevX article about J2ME. Horrible! And you have to click through to get the different pages! Why do we have "pages" on articles on the web? Non-techy news sites are usually even worse about this.

Articles, I'm thinking, should be "printer friendly" to begin with. Having to look for the "make this readable" button is dumb. I'll let you know if the article is any good.

Monday, October 16, 2006

More on the horoscope remix project...

So my plan so far for remixing horoscopes doesn't seem to be going so well. It went like this:

- Take in the text or texts to be mixed and tag them, so you know what every word's part of speech is.
- Shuffle all the words together randomly.
- Do something like simulated annealing to hillclimb towards a more sensible output text: at every step, swap two words somewhere in the shuffled text, and keep the swap if we think the series of words that it would produce is more likely (as determined by looking at our transition-probability model) than the previous series of three words in that area -- and sometimes make bad choices, probabilistically, to avoid getting stuck in local maxima. Now our transition-probability model works in terms of parts of speech ("tags", to those hip to the NLP lingo), and we learned those tables from tagging a previous corpus...

I'm not quite sure why this isn't working. It might be that using trigram transition probabilities (on the tags) doesn't capture enough structure to get coherent sentences? Because this method doesn't produce coherent sentences very well.

I'm thinking about what else I could do. Perhaps I could use longer n-grams in the model -- or maybe I should look to use a parser, and reward the hill-climbing when it produces longer and longer parsable sentence chunks. The other possibility is that maybe my tagger isn't as accurate as I think it is... it could be mislabeling more words than expected (and it's expected to mislabel a bunch of them.)

The problem is totally not that I'm training my models on James Joyce.

Sunday, October 08, 2006

NLTK and generating horoscopes

Have I mentioned that NLTK is the hotness? NLTK is the hotness, particularly if you want to do your language-y things in Python.

It's intended for educational use, but it has what you need, and it lets you compare different algorithms for tokenizing, tagging, and parsing chunks of text, very pluggably. The API is nice too -- you can very easily tell taggers (the parts of your program that decide which part-of-speech a given word is) to make calls to one another in case they can't figure out the right tag independently.

There's of course the OpenNLP tools in Java, but they don't seem near as quick or awesome.

Soon: using transition probabilities on parts-of-speech to shuffle chunks of text and generate new moderately-sensible horoscopes? Yes! (also: this should be helpful in the long term for my automatic poetry project, which will eventually be more Python-and-ML than Lisp-and-formal-rules)

Thursday, October 05, 2006

Wednesday, October 04, 2006

Type-inference weirdness in Java 1.5 with Generics

Surely this has come up for somebody out there before, but I haven't yet found anything about it. It came up today. Essentially: in Java, if Chair is a sort of Thing, a Vector of Chairs is not recognized as a subtype of Vector of Things... this seems wrong.

What I wanted to do was have a method that takes a vector of a certain type (an interface particularly), then pass to it as an argument, a vector of a type that implemented that interface.

So for example:
- Make an interface "Thing" that requires its subclasses to provide "doSomething()"
- ... and a class Chair implements Thing.
- A variable Vector<Chair> chairs
- And a method doEachThing( Vector <Thing> things).
So you should be able to pass chairs as an argument to doEachThing, right?

I get the error:
ThingDoer.java:17: doEachThing(java.util.Vector<Thing>) in ThingDoer cannot be applied to (java.util.Vector<Chair>)

I don't understand this at all. Surely the type-checker should be able to do that inference, that every element in a list of Chairs is in fact a Thing? Am I totally missing the point, or is this a design wrongness about Java?

Anybody else run into something along these lines?

Tuesday, October 03, 2006

Red pandas and rhinoceri and turtles? ...

Why is there not a client-side javascript version of LOGO?

How cool would that be? Turtles in your browser? ... Small children having access to Papertian goodness wherever the Internets are tubin'?

Monday, October 02, 2006

Lisp is still really pretty.

So I'm building some decision trees for a project I've been working on -- this automatic typo correction for tiny blackberry-style keyboards. The motivation for this is pretty obvious -- we have to decide when to do the correction and when to let the user type what they're typing!

I'm going through some code I'd had for an earlier project, this one done in Common Lisp. And I've been really excited about Python recently -- but man, Lisp is so nice for data structures. There's so little punctuation for building things. I mean, goodness -- it's as if the language was made for dealing with recursively nested things. I'm a little reluctant to translate this stuff -- why am I not just using CL, again? ...

Oh yeah, because I need to make it talk to other programs.

Also! Roughly the hippest thing ever is the __call__ construct on Python classes. If an object has a __call__() method defined on it, then for object foo, you just go foo(arg), and it does its Pre-Defined Thing. Check it out! ("emulating callable objects")

Thursday, September 21, 2006

link-o-rama

It's funny, starting up blogging in a new place. I'm not sure what my voice is going to be like here, so I usually write about my thoughts about the medium for a little bit first. In fact, almost every time I've started writing in a new place, I've done this. I think this blog is going to be a little more of a public version of my earlier Penguin Parens blog, which had lived on hackmode.org, and on which I would semi-occasionally put up little howtos and technical discussions. I'll still try to do that here, but I'd also like to expand out to talking about philosophy and also just linking to techie things. My more personal stuff lives on LJ, and I'll try to keep the personal and techie/professional/pseudointellectual more segmented...

We'll see if anybody reads this, heh.

Today is about buttons and games!!

Links:
- On Saturday, I participated in Out Of Hand Theater's production of The Game. It was a large-scale scavenger hunt and puzzle-solving game, run through the few miles surrounding the Little Five Points area. It involved a lot of puzzle solving, clue-finding, and confusion as to what was a clue on the part of our team. (We came in a very respectable fifth-out-of-dozens.)

- History of the Button has been making its way around the Internets recently, but it's a super-interesting site. What could possibly be more integral to today's technology than buttons? And they're fairly new -- as you'll see if you look at their very nice presentation on the subject.

- AVANT GAME is Jane McGonigal's site about all of the interesting stuff that she does, which largely includes research on games, computer and otherwise! She travels to different universities and teaches classes about game design. Also, Jane's been known to work with Ian Bogost from the EGL, and recently, they produced Cruel 2 B Kind, "a game of benevolent assassination". It's sort of like water-gun assassination games that some of you may be familiar with, although probably much funnier for uninformed bystanders. Because you can kill people by complimenting them on their shoes, and you have no idea which ones. (or even who's playing).

- Come Out And Play -- the last day of the festival is today! But it's about all sorts of wild outdoor games, including large, real-life versions of classic video games, such as Space Invaders, and apparently a version of the well-blogged Pac Man played outside.

Monday, September 18, 2006

FP? ...

Movin' over to blogspot...

I'll migrate my older stuff from the wordpress blog probably tomorrow. Can you backdate things here?