PIDA: Python Integrated Development Application

August 3rd, 2005

PIDA 0.2.2 was released recently. This is truly a novel development in the Python/OSS world. What PIDA provides is a nice plugin system and the “makings” of an IDE. So, in a nice IDE you have a class browser, an integrated debugger, a profiler, maybe even a RAD-like GUI builder, an interpreter console, etc. The one piece that tends to be most controversial in every IDE is the text editor. This is one-part because UNIX people are really crazy about their text editors, but two-parts because text editors are very important programmer tools, and no one wants to learn a different text editor for every language one uses.

vim happens to be awesome for C programming, which is probably why a lot of UNIX hackers use it. But for Python, more advanced support would be nice. PIDA can run and connect to a vim server instance in order to allow you to have an “add-on IDE” for vim.

But even more interesting to me is the culebra plugin, which provides a code-completion-savvy GtkSourceView inheritor, which has the initial support for fancy Intellisense-like features.

I’ve already spoken to the developers of PIDA, and they said they would very much be interested in seeing Python Intellisense features brought to VIM. When I started thinking about different approaches to doing this, I realized that the whole OSS community could benefit from a general Python module that enhances the Python introspection features (and perhaps combines them with source code parsing) to make available nice productivity-enhancing features. I was thinking of calling this beast “Pyductivity.”

More on that later. For now, check out PIDA.

CAFTA: Is this democracy?

August 2nd, 2005

Check out a few links about CAFTA: 1 2 3 4 5.

Disgusting. My take? Globalization in its most ruthless form is going to be seen in the next few years in each of the countries affected by CAFTA. Then there’s going to be a long track record of failure for the theories of globalization, from NAFTA and Mexico, to WTO effects on Jamaica, to CAFTA in Central America and Dominican Republic. And then what are we all going to say? We’re still supporting these theories on “faith”? Or will we wake up and smell the coffee, and realize that “globalization,” the way it is sold now by politicians and even theoreticians, is nothing more than “handing public capital over to corporations, basically for free”.

Or, perhaps more pointedly: restoring the world order of imperial powers and their subjugated colonies.

My only fear is that by the time we realize this, globalization will have so evolved that the “imperial powers” won’t be rich governments, but rich transnationals, and the subjugated colonies won’t be third-world countries, but all countries and all people who don’t have major stakes in the ruling corporations.

Exa: a new architecture for Xorg

August 2nd, 2005

This is exciting news. A Trolltech developer has modified KAA, the acceleration architecture used in Keith Packard’s experimental “kdrive” Xserver, to work with the traditional Xorg tree. He announced this new development in an e-mail that makes it clear it is extremely easy to get drivers to use Exa to gain Apple/Windows-like graphics performance.

I know that the unichrome project generally doesn’t bother itself with these very desktop-oriented features (their focuses are more on MediaPCs, etc.), but I think this may be an excellent way for me to begin hacking the new modular Xorg tree I mentioned last time. If I added Exa support to the unichrome driver, would that mean transparency and full-on graphics acceleration for my X desktop, what I’ve long been waiting for? We’ll see.

I am Jack’s raging anger

August 2nd, 2005

I find myself studying in the Kimmel Center for my Linear Algebra final, which is this Thursday. There I am, minding my own business on the second-floor study lounge.

But then, a group of three girls shows up in the seating area right near me, and starts chatting about whatever inane topic comes to mind. They are then followed by a German foreign student whom they know, who asks them if they know words like blitzkrieg and rammstein. They respond with blank stares and Southern accents conceding they never heard the terms. The German boy responds, “Surely you must know blitzkrieg, I heard you use the term when you study German military history.” Indeed, they probably know the words, but have never heard them pronounced properly by a German, and thus cannot make the connection.

Well enough, however, slowly more and more girls file in. A few guys show up as well. They ask to have the extra chairs around the desk at which I’m working, and make a lot of noise chatting and chatting. After a few minutes, there are probably twenty people, 15 girls and five guys. And they begin their club meeting. What’s the club? Bible study.

Is there a floor dedicated to clubs at Kimmel? Yes, floor seven. Is the second floor meant for study? Yes. Could I possibly focus on Linear Algebra with talk of Leviticus and Genesis in the air? Certainly not. What the hell is wrong with these people?

Xorg goes modular, is now approachable

August 2nd, 2005

It seems that Xorg, as of the 7.0 release, has been split into monolithic and modular development trees. The modular model allows you to compile individual components related to Xorg separately from the whole X server, so that you don’t need to do a two-hour compilation just to work on this or that driver or this or that library.

This is good news for me. My biggest craving lately was to put my C skills to use by diving into a big project that has effects on the Linux desktop, and Xorg is certainly the biggest in that sense. However, in the past I was always put off by the huge amount of groking one needs to do just to understand the Xorg compilation process. After class is over, I’m gonna start diving in.

The Potentiality Argument

July 30th, 2005

In my first philosophy class, I remember putting forth an argument for why abortion cannot be defended on the “potentiality principle,” that is, that the human fetus has the potential to be a human being, and thus must be saved.

Someone on /. recently replied to an article about stem cell research, with some nice observations about the abusers of this principle:

Now, someone might argue that a process is started at conception which would end up with a functioning human. The potential is critical. There are a few problems with that position:

  • When a fertile woman smiles back at me, there is a potential for a new human.
  • The use of condoms stops the potential for a new human being.
  • Soon, all our cells will be potential humans with a little “twist”…
  • Half of all conceptions ends soon with a spontaneous abortion. That means, according to the bible belt, that half of all people dies at an age of a few days. To be consistent, the believers should argue that half of all medical research should try to stop this mass death!

The retort often flung back is that a fetus doesn’t merely have potential to be a human being, but it is a human being. This, however, is interesting when taking this poster’s last point about “spontaneous abortions.” If you’re willing to save a fetus from a willing abortion, shouldn’t you also see spontaneous abortions (and miscarriages, for example) as equally tragic, and thus deserving of serious medical research?

Ah, the arguments against early-term abortions really amaze me. How can you be so philosophically inconsistent?

Amdahl’s Law

July 28th, 2005

Gene Amdahl once applied the law of diminishing returns to computation. He pointed out that when optimizing part of a computer program or computer system, one must take into account what percent of the overall task at hand that optimization affects.

I recently read some articles comparing the speed of Python to Java, most of which concluded that about the only place that Java beats Python is in actual interpreter speed (i.e. how fast statements and parsed and executed), and that since Python opts to provide thin wrappers for standard C libraries, Python performance ends up being really good.

A good comparison of the language features between Java and Python can be found online, along with a nice comparison of code simplicity and efficiency.

I think I agree with the first author: Python is a better high-level language, and should thus be used for higher-level tasks, and especially for one-offs. What’s interesting is that a lot of people look at Python, say “Man, Python is slow, I could do this better in C,” but then forget about Amdahl’s Law. If your program is accessing the network, the disk, or any other non-CPU/non-memory resource, no amount of optimization through lower-level languages will save you an order of magnitude on performance. So why waste the programmer time, when it can be done in a few lines of Python?

(I think one forgotten benefit of Python in both these articles is SWIG: if you’re truly a performance-oriented engineer, you can always profile your code, find the bottleneck algortihm/code fragment, rewrite it in C, and wrap it with SWIG so that you can access it as an object in Python. Not hard to do, and potentially huge performance gains. OTOH, you can even write Python-accessible code directly in C, using the same abstractions the Python interpreter uses.)

“We will not negotiate with terrorists”

July 26th, 2005

Writes the Economist about the London bombings:

Mr. Blair’s blank refusal to acknowledge a possible link to Iraq is wrong. But so what if there was one? Those who would go on to conclude that the right course of action in the light of the bombings is for western countries to flee Iraq are in danger of making a very much bigger mistake. [There is] the need to defend the principle that the foreign policy of democracies should be made by representative governments, not by disaffected young men bent on murder.

This is quite stunning. The last line in particular.

Immediately after 9/11, I thought to myself: the worst possible thing we can do is go try to fight these guys guns blazing. It isn’t “war” until both sides agree it is, and up until Bush made the announcement to go into Afghanistan (and then Iraq, later on), we still had the chance to maintain the principle the Economist describes above. These were terrorists, and we were a Western power. We had seen terrorism before: true, not on this scale, but we had seen it. But rather than scream louder than they, we could have responded with silence and strength. That’s the way a proper president would have responded. We elect public officials to be wiser than we are: we can respond with the knee-jerk “I want revenge,” but policymakers need exercise more restraint.

But it is because neither the Economist nor most of the Western world understands modern terrorism that the Economist doesn’t realize the irony in saying that we have an obligation to preserve this principle now. And that can be seen by the second part of that last sentence, where terrorists who attacked London are described as “disaffected young men bent on murder.”

If one believes that all terrorists are simply people “bent on murder,” or people who “hate the American way of life,” as Bush sometimes puts it, then one misses the whole point.

More important perhaps is that these terrorists, before 9/11, constituted a radical minority, that believed the only way to solve the problems of the invasion of materialism and godlessness from the East was to engage in a holy war. This, this minority thought, was the only way this could come to an end: a battle of epic proportions.

There was a major problem for this epic battle though: no one else was willing to fight it. The radical Islamists constituted a minority: the great majority of Muslims did not believe in violence, and did not consider Westerners “at large” to be “guilty” and “murderable” under Allah. They wanted health and prosperity for their countries, economic advancement, and of course the respect for basic Muslim traditions and morality. But they were by no means energized and galvanized to fight a holy war.

But this radical minority also realized something: what if they committed an act that was so spectacular, symbolic, and violent, that the other side would see it as a great attack and respond in kind? The damage done in the vengeful response might just be enough to convince the moderate Muslims that the “holy war has begun,” and that it’s senseless to debate it any further. Pick sides, they probably said: you’re either with us, or you’re with them.

And so also the President said: you’re with us, or you’re with them.

After September 11, America had a choice. We could have focused to study the problem of terrorism, and root out the conditions that cause it in the world. We could have tried to eliminate the political power and clout of Islamist movements. We could have worked with governments to make sure law enforcement in every country is up to snuff so that intelligence is good and solid for prevention.

Instead? We went on a bounty hunt. We went in, guns blazing. And then we pretended that Iraq, a longtime pet peeve of ours, was involved in terrorism. So we went guns-blazing in there too. We rolled in our tanks, we treated Iraqi civilians like prisoners of war, and we declared martial law. And in our wake, we left a shitload of angry Easterners, who we’re still fighting today. Not only that, we loaded the country up with corporate contracts, almost inviting Easterners to see us an evil imperialist power.

And now that the moderate Muslims have seen what evil people we are, they are ready to fight us. We declared war on them, and they’re not going to step down now.

So, what the heck is the Economist talking about? The age of “We will not negotiate with terrorists” is over. We played right into their hands, and anyone who doesn’t think so just isn’t seeing straight. They wanted this war, they wanted this global hysteria, they wanted this exaggeration of threat. Now they are a force to be reckoned with, even if only symbolically. The symbol is strong enough: the people, in large numbers, are coming, and will continue to come, so long as we keep giving them a reason to.

Google Maps is scary

July 26th, 2005

Check it out.

Joel Spolsky on programmer creativity

July 26th, 2005

Joel has a new article entitled “Hitting the High Notes”, which probably deserves a link.

I happen to fully agree with Joel, that good programming is about finding that “clever solution,” not just a solution that “barely works.” These little epiphanies may not just be the best product of good programming, but also the reward–another striking similarity to conventional artists. I started to realize this similarity myself a few years ago, when I scribbled in one of my notebooks that programming actually seems a lot like sculpting, in that the task is both highly creative and highly technical, where the goals are simultaneously to solve a complex problem and produce something “beautiful” (or, in programmerspeak, one might say “elegant”).

This ideas of mine didn’t find themselves blooming until I came across Frederick Brooks (who, in fairness, Joel mentions), in whose wonderful collection of essays is a very useful distinction between two components to programming. The more important one, says Brooks, is the essential component, which should be contrasted to the accidental. The essential problem to programming is that it is fundamentally a creative act, and as such it requires long periods of uninterrupted thought and even a spark of inspiration to result in amazing products. The accidental component to programming is everything else that incurs cost in time: dealing with the programming languages, the text editors, the compilers, software revision systems, documentation, and all the other software development tools. Brooks’s theory (which, in my opinion, held) is that there was “no silver bullet” for programmer productivity; that even if major leaps are made to reduce the effect of the accidental problem, the essential problem would remain, and without an improvement in the essential, there would be no order of magnitude improvement in productivity.

In other words (and metaphors), even though word processing is a lot easier than typing–which was itself a lot easier than writing by hand–it doesn’t seem that any of these advancements in “text editing” made the creation of great novels much easier, since it is the content of a novel that matters–presumably–and that comes only from within the author.

But Joel is mostly right: to fight the challenges inherent to the essential problem, one must have:

  • A great work environment
  • Talented colleagues
  • Challenging problems
  • Visionary direction
  • Lots of alone time for each developer
  • Lots of brainstorm time among developers

There are probably a couple of others that deserve to be on there, but that’s a pretty good list in itself.