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.

Patch day for Rails, in Copenhagen

The inimitable Jakob tells all about the upcoming Rails patch night, so I won’t say more than “it is a great way of getting into Rails” (Rails, the Open Source project; and Rails, the codebase).

(I won’t be there, I have a family thing to travel to, but please fill my seat, you.)

Hm, I shoulda added this to Upcoming.org, too.

[tags]copenhagenrb,rails[/tags]

Look, Ma! (linked Io glimpse)

The Io blog points to a ramshackle example Io thing authored by me and quag.

If you’ve heard about Io, and wonder what it looks like, this is a… very small example.

(I didn’t know they’d gone and published it, and it turned up in my newsreader. Now I have to improve it. Gosh, the pressure.)

[tags]iolanguage,io,programming[/tags]

Copenhagen.rb meetup: Puppet and fringe activity

Juri presented the amazing Puppet framework for controlling servers. He controls about 20 servers with it.

Think of Puppet’s files as “setup Rakefiles for servers” which is version-controlled, monitored, and written in a very terse DSL. Seems slick. Juri might publish his nice slides, who knows.

While he was presenting, me and Lars SG were typing to each other, like kids in the back of the classroom. Quicksilver’s Large Type action was used a lot. It started when I noted he was working on the Counter example in Seaside, using a new Squeak. A fellow tourist in fringe-language-land!

We took quick detours into Io and CLisp (I had read about mapcar, and wanted to show what it was), and Lars turned out to be able to stomach even the most arcane crap. Perfect: a new special interest group in our Copenhagen Ruby Brigade. James Britt reports that this is a common Ruby programmer’s thing, and that it manifests itself in their meetups. See his link to fringedc for a picture of how to understand the “fringe” label.

[tags]ruby,copenhagenrb,fringe[/tags]

RuPy 2007, European hacker meetup

Dear hackers: %w(Ruby Python).each {|lang| lang.discuss }

Thanks for a great weekend. “I’ll see you on the Internets” has never rung
more true than when I and Tomek and Krzysztof hurried out to a waiting taxi
(driven by a talkative bard-type, who talked “about nothing” with many words).

Now: go empty your camera, upload them somewhere, and tag the photos
rupy and rupy2007.

For those of you who just joined this narrative, I have just been to Poland,
to a technical conference. This was my second-ever visit to Poland.

The people I met were passionate, different, full of integrity, imaginative,
at play, and hospitable. The organizers and the attendees were excellent at
keeping a good, nice atmosphere. When something broke, or was postponed, the
moment was used to tell jokes, make friends, and have good times. Not a bad
word, ever. The way I want it to work, don’t change a thing.

As previously advertised on this braggy weblog, I was invited to speak at the
conference. This honour landed me my own room in a central hotel, where me and
the other speakers stayed.

Saturday morning me and Tomek went to the breakfast hall, which we managed to
find, even though the hotel was quite labyrinthine. We’d just sat down, when a
guy introduces himself like this: “I’m Adam, and the bus to the conference
leaves in 9 minutes.”

A yellow shortbus took us to Adam Mickiewicz university, a polytechnical
college on the outskirts of Poznan. I was in an expansive mood, and blabbered
on about Norse mythology being very hippy-like: Loki’s transformation to a
female horse, so he could give birth to Hel, goddess of hell, half babe, half
zombie. Among those that had to listen to this were Chris Arndt (Turbogears
speaker, from Germany) and Cloves X. Jr. (Rails freelancer, and author, from
Brazil-Canada-Dubai). Hands were shaken. Chris told us a bit about how his
local programming group’s shifted meeting format: no long presentations,
lightning-talks only, with follow-up discussions.

Krzysztof, a Warsaw friend of Tomek’s, was to do a talk about the Radiant CMS.
Program items were shuffled around a bit. Very agile, responding to change —
this let as many attendees as possible hear them. A side-effect was that we
wondered when our talks were scheduled. I got lucky, and my talk would wrap up
the first day’s Ruby track.

The rest of this rambling post will detail the talks, but I’d like to add that
the talks were only the starting point for the audience participation, in many
cases at least. You should go to conferences to interact, to do what’s
impossible online, and to learn from the audience if you speak. And the people
were just great: if you were there, and you talked to me, I probably lost your
email address (but hey, we use the Web for all those notes anyway), but I’d
love to be internet-pen-pals with all of you.

Chris A’s TurboGears talk showed step-by-step how to make “yet another
bookmark web app”, and this was good stuff. He took the time to detail how the
conventions-driven way of routing URLs with CherryPy. CherryPy is the
controller in the MVC of TurboGears. (Someone bitterly said: “CherryPy’s URL
dispatching sucks”, but at least I understood more about this. Thanks, Ola E
in Malmö for carefully explaining CherryPy to me.)

Python in embedded devices: This was the talk that my electrician would’ve
wanted to hear. The talk detailed what it was like to work with Python-enabled
hardware, that term meaning either “a small computer with flash memory instead
of a harddrive”, or “a little telephone-like unit the size of a matchstick
box” (from Telit). Inspiring to hear about off-the-shelf devices that you can
program. The term “home automation” stuck with me, a little like “family
atomics.” The downside to the Telit phone device was: their hardware Python
interpreter was at version 1.5.0.2 (or something). “Audience: What are you
using it for? Speaker: I am not allowed to say.” NDAs, man.

PyPy (Python reimplemented in Python): “RPython stands for restricted Python,
and we’ve made it run up to 60 times as fast as CPython.” Full-on mad
professor style, the PyPy project has gone through an EU innovation
high-technology grant. They used the money on sprints with TDD and
pair-programming. One of the two speakers was unable to get to the conference,
but his colleague was ace.

An action-packed demo-filled talk, which among other things featured a
multi-player Bubble Bobble clone in JavaScript. And experimental Python
interpreters of all kinds. The idea is that by adding some new features to a
PyPy Python implementation (“can be done in 2 weeks”) they can optimize,
feature-add, or just experiment. Transparent proxies were an interesting style
of distributed computing, which almost removed the remote/local distinction.
The talk my head spinning with possibility, but Tomasz W. took me down to
Earth when he noted the RPython probably removed the dynamic stuff. “Otherwise
it would be too hard to generate C from it.” I’ll try and see what trade-offs
RPython does.

RLisp (Ruby-with-Lisp): Tomasz W. was very gracious, and let us early leavers
have a training run of his staggeringly geeky RLisp talk. The
implementer-inventor of this Lisp-with-Ruby, or Ruby-with-macros was a decent
presenter, and his material was very interesting. Tomasz writes a weblog, and a version of
RLisp is released, so you can go play with it. His audience was Ruby/Python
folks, so he kept the concept-count low, and explained things clearly. A warm,
nice person, and good at explaining his mindblowing ideas.

Presentation by delegation, Tomek called the second half of my talk. It was
meant to be a beginner’s introduction to making and serving Rubygems at home.
A step-by-step guide. I have to do a Companion Website for that, my material
needed meaty examples. And if I have a website for it, I won’t run out of
space. (Note to self: use the webgen gem for that.)

OK, all in all, this was a conference to remember, to keep friends from, and
to come back to.