Insulted!

I was just insulted. By a paperback. The book that insulted me was “Five equations that changed the world” by a Dr. Michael Guillen in 1995.

His psychologizing take on Newton’s youth was demeaning to the reader’s intellectual capacity, and after having experienced the Baroque Cycle by Neal Stephenson, which contains quite a lot of newtoniana, Guillen’s baby-talk was… grating. Luckily I was able to put the book down after the insulting five pages of Newton-talk.

Instead I picked up the next book that my friend, the Fortran expert, lent me: a memoir of Richard Feynman. It shows verve and storytelling promise. Have you read Feynman? Any thoughts?

Pinter’s political stuff played in Malmö

A friend, who I met via Luisa, just sent me information about the stage design work she has done in the period of time. Keywords are, according to Sarah: Site-specific, literary, installations, video, and an amazing trombone player.

So, without much further ado, I hereby inform you, the interested public, that there is great possibility to see the play “Amerikansk Fotboll” at Inkonst (Bergsgatan 29, Malmö). (I guess it’s in Swedish. But their website says the group consists of Scandinavian and English actors. Well, who knows.)

The theater group Insite is the first group to get permission to play Harold Pinter texts in a collage of 4 shorter dramatic pieces and some of his poems.

Dates are May 10, 12 + 16+17+18+19 + 24+25+26 . Book the tickets online (Swedish interface, ugh!).

A good book

Today I got “Fascicle 1″ of Don Knuth’s 1999 reworking of his classic 1960s work The Art of Computer Programming. Great book. No fuss, just stuff. I might write more about that here, if I keep reading it. It’s one of those books that are an experience to go through. Like GEB.

Knuth explains how a “mythical computer”, the MMIX works. The first sections go through its op-code list, and explain how it works on a quite basic level. It’s mental rye-bread, and you acquire a taste for it.

Reading it sent me back to my teens, back when my friend and self-taught programming genius Johan had typed little 68000 assembly-language lessons, and printed them on tractor-fed paper, and provdided me with development tools for the Amiga computer I had. Thanks Johan, and thanks Don, for showing me the machines.

You rock.

unix search-and-replace: rpl (and sed)

Evan showed the world his “weak Ruby script” to find-and-replace in multiple files, and was pointed to the amazing rpl utility.

Let’s see what the port maintainer has written about the rpl tool.


$ port info rpl
rpl 1.4.0, textproc/rpl (Variants: universal)

http://www.laffeycomputer.com/rpl.html

rpl is a Unix text replacement utility. It will replace strings with new
strings in multiple text files. It can scan directories recursively and
replace strings in all files found. The search can be limited to files with
certain filename suffixes (e.g. '.html', '.c', etc.).

Platforms: darwin
Maintainers: mich@freebsdcluster.org

Usage context: When you work on auto-setup of new projects (say, making your simplification pipeline even simpler) you can use rpl on configuration files, say, and have non-conflicting markers like MEGASKULLYOUR\_PROJECT_NAMEMEGASKULL which would be replaced by your configuration strings.

Or, when you find a new name for something, and just need to try out this tool

Update: got it to work with sed, which is everywhere. The machine I worked on had FreeBSD, but the port command didn’t answer.


  sed -e 's/max_preview_size = 262144/max_preview_size = 10000000/g' -i boook trac.ini

A breakdown, dear reader:

-e means add a command. s is for substitution of one sequence for another. g is for globally in given files, it could also be a number, say 1, meaning “replace match number 1″.

-i means “irritatingly in-place editing”

-i boook means “…and since it is irritating, add the backup file trac.ini.boook as it were before those edits, to not annoy more than necessary”

[tags]textprocessing,unix[/tags]

IoPython, raw but cool

I nosed around in Io’s “addons” folder, which you also can pull from the Git repository, see the Io homepage.

Update: of course, this was reported when it was fresh, with nice examples, too: pinupgeek’s blog is full of Io goodness. (Thanks, trevor!)

While nosing, I met the Python module, which lets you run Python functions in Io. It was written last year, the copyright statement shows:

  docCopyright("Aslak Gronflaten", 2006)

IoPython lacks tests, real documentation, and such, and it does not do memory management:

* Convert an Io object to PyObject.
* At the moment, we can't pass in any objects, just those that can be translated,
* until I build a python wrapper around an io object, reverse of what I did here.
* TODO: Memory management!!!

Does not seem impossible.

But I get a nice vibe from these lines:


  # Import a module
  sys := Python import("sys")

  "Which version of python are we running?" println
  sys version println

  "System path is returned as a list" println
  sys path foreach(p, p println)

  "Load the string module" println
  string := Python import("string")

  "Split a string" println
  str := "Brave brave Sir Robin"
  str println
  string split(str) println

  "Load a C module (.so)" println
  t := Python import("time")

  writeln("Current time is: ", t time)

  "Another way to invoke a method" println
  str = "UPPERlower"
  write(str, " --> ")
  string invoke("swapcase", str) println

Io could improve its library situation, if IoPython were less raw. Things will improve with time. In the meantime, I’m gonna learn more Io.