June 2007 archive

29 June 2007

PermutationIterator.java (in honor of GPLv3)

To celebrate this great day, here’s a little bit of free software, released under the terms of the GNU General Public License, version 3: a Java class I wrote to find all permutations for a given string. I may later post some more in the way of documentation, but for now, por ejemplo:

PermutationIterator p = new PermutationIterator(”123″);
while ( p.hasNext() ) {
System.out.println( p.next() );
}

Produces:

123
132
213
231
312
321

Since we can compute the factorial to know how many total permutations there are for a given string length, it’s a little bit faster to avoid the call to hasNext():

for (int i=0; i < p.totalPermutations(); i++) {
System.out.println( p.next() );
}

You can also supply an integer for “N” and get permutations for an alphabetic string:

p = new PermutationIterator(20);
//…yada yada

To get:

abcdefghijklmnopqrst
abcdefghijklmnopqrts
abcdefghijklmnopqsrt
abcdefghijklmnopqstr
abcdefghijklmnopqtrs
abcdefghijklmnopqtsr

2,432,902,008,176,639,993 more permutations…

rstqponmlkjihgfedcba

And now for the code, below the fold. Happy GPLv3 …

28 June 2007

How do you disable the CTRL+T ‘move to trash’ shortcut in GNOME/Nautilus?

10 July 2007, Answered! Thanks to und0 for explaining in the comments. See below…

I just discovered an inconvenient default behavior of the Nautilus file browser. (At least, it appears to be a default in Ubuntu 7.04/Feisty Fawn.) I thought I was in my Firefox window and pressed <CTRL> T to open a new tab, but the focus was in Nautilus and I deleted a file instead. I wasn’t quite sure what I did at first since my attention was on the Firefox window. I immediately checked for an “undo” command in the edit menu, but there doesn’t seem to be one for Nautilus. (Also quite unfortunate.)

Still not sure what had happened, and like a dummy, I pressed CTRL+T again and this time could clearly see a file …

24 June 2007

A Library is a Vault for Locking Up Books

Apparently.

U’S DEAL WITH GOOGLE

Disrespect for property

If I were to walk into a photocopy shop and ask for a duplicate of a copyright-protected book, the shop workers would show me the door. It does not matter whether I intended to distribute snippets of the text around the world or do anything else with the copy — the courts have ruled that the unlicensed duplication of an in-copyright book is illegal.

But when the University of Minnesota announces plans to digitally duplicate books, including copyright-protected works, in a commercial project with Internet giant Google (Star Tribune, June 7), it calls the effort groundbreaking and valuable.

As an author who teaches at the University of Minnesota, I wonder how I will talk to students about academic honesty and integrity when the university

17 June 2007

Using GNU/Linux: Happy, Happy

I’m happily setting up shop in Ubuntu. There’s much to do, and now that I’m actually using it, I’m even more scattered in my approach. I run around getting this or that working as needed. All of which takes time, which is one reason I haven’t written much lately.

Another reason is that my writing resistance has been stronger than my will to open up the WordPress editor. One of the things I did to keep that specter at bay was move my local WordPress instance to Zodiac after having got it all set up on Prometheus. (Which prompted a couple of updates to my installing WordPress howto post.) Wasn’t hard to move, though, so I had to keep diligently practicing writing avoidance in other ways. (Not …

11 June 2007

At the Blue Ox Market

Creative Commons Attribution-ShareAlike License

“Up north” in Minnesota. Yah, sure.

This is the grocery store in Akeley, Minnesota. The mural is of Paul Bunyan’s blue ox, “Babe.”

8 June 2007

Brian Behlendorf: Open Source as a Business Strategy

I just finished reading Open Sources: Voices from the Open Source Revolution, which is a collection of essays about free and open source software edited by Chris DiBona (and others) and published by O’Reilly in January of 1999. It’s an interesting snapshot of free software at the time and it still reads very well today. Much of it is well-tread ground, but there were things new to me, and there is this good passage explaining why we should prefer free and open software and standards over proprietary platforms (emphasis added by me):

There are businesses built upon the model of owning software platforms. Such a business can charge for all use of this platform, whether on a standard software installation basis, or a pay-per-use basis, or perhaps some other model. Sometimes platforms