Snippet: remove .svn directories

Snippet to recursively drop Subversion control of a directory. It removes the .svn directories, and their contents.

find . -name ".svn" -exec rm -rf {} \;

Credit: Zed Shaw, at the Mongrel mailing list.

(Note to contemporary readers: Crazy old info) Oh, and if you are using Mongrel, and need help with it, there is a new chatroom at http://www.lingr.com/room/3yXhqKbfPy8, where Zed, the developer, hangs out.

[tags]unix,subversion,snippets[/tags]

Rails error messages – in your language

Jesper just put his Rails plugin up at Rubyforge: LocalizationSimplified:

Rails plugin: Fast and easy localization of one-language applications. Adds UTF-8 support for Ruby + database. Modifies ActiveRecord errors + html error helpers, Date/Time helpers, locale time formats, to_currency, to_sentence

Update: Jesper shows the plugin in action at his website. Take a look!

So, the plugin tries to make Rails speak your language, with error messages in your langauge, and so on.

There are FIXMEs in the code, so you can just “patch in”, if this is up your alley.

Congratulations, Jesper.

Back home!

I am back in Copenhagen, at my desk.

Back? Yes, for the last 14 days, me and my wife have been in transit: Sweden, Finland, and Estonia have been well visited.

I should type up a real report on this, but Everyday Life (that lovely thing) makes me focus on getting back on track again.

This is a sign of life, and I have read your emails, I have read your weblogs. I still like you.

More Io Learning

[Io](http://www.iolanguage.com/)’s very self-documenting, at least when it comes to “what parameters does this and that take?” This is a little walk-through that gets you up and running in the interpreter. Get a binary from the downlaods page, and then come back here.

There is a docs slot — with some text about what the method does. First, let’s list a string (in Io, known as a Sequence, a sequence of characters, you know).

Whip out your Io interpreter, and write a string, and send the docs message to it:

Io> "olle" docs

==>  Object_0x6d5020:
  slots            = Object_0x6d5060

There we go, a memory address for the docs, and a list of slots. Open that!

Io> "olle" docs slots

==>  Object_0x6d5060:
  alignCenter      = Object_0x1120d90
  alignLeft        = Object_0x111fcf0
  alignLeftInPlace = Object_0x111e810
  alignRight       = Object_0x1120530
  findNthSeq       = Object_0x1121870
  interpolate      = Object_0x11222f0
  interpolateInPlace = Object_0x11226f0
  removeSeq        = Object_0x111f2d0
  repeated         = Object_0x6d4880

These contain documentation:

Io> "olle" docs slots repeated

==>  Object_0x6d4880:
  args             = List_0x6d4e20
  description      = "Returns a new sequence containing the receiver repeated aNumber number of times."

That is nice. But, there are many more methods on a Sequence. Where are the rest? Answer: not yet documented like this. Let’s go find the others.

Io> Sequence slotSummary

==>  "":
  ..               = method(arg, ...)
  afterSeq         = Sequence_afterSeq()
  alignCenter      = method(width, padding, ...)
  alignLeft        = method(width, padding, ...)
  alignLeftInPlace = method(width, padding, ...)
  alignRight       = method(width, padding, ...)
  append           = Sequence_append()
  appendPathSeq    = Sequence_appendPathSeq()
  appendSeq        = Sequence_appendSeq()
  asBinaryNumber   = Sequence_asBinaryNumber()
  asBuffer         = Sequence_asBuffer()
  asCapitalized    = Sequence_asCapitalized()
  asLowercase      = Sequence_asLowercase()
  asMessage        = Sequence_asMessage()
  asMutable        = Sequence_asMutable()
  asNumber         = Sequence_asNumber()
  asSimpleString   = method(...)
  asString         = Sequence_asString()
  asSymbol         = Sequence_asSymbol()
  asUppercase      = Sequence_asUppercase()
  at               = Sequence_at()
  atInsertSeq      = Sequence_atInsertSeq()
  atPut            = Sequence_atPut()
--- SNIPPED, FOR HER PLEASURE ---

That’s more like it! Notice the difference in the right-hand listing.

asNumber         = Sequence_asNumber()
asSimpleString   = method(...)

asNumber has a fast C implementation (the function name is a hint there), but asSimpleString is pure Io.

The Io-implemented methods have their argument list with them, like alignRight. The ellipsis (…) stands for the method body.

It’s possible to return any Io slot, serialized as a string. That includes all Io-implemented methods! Use the getSlot() method:

Io> Sequence alignRight getSlot("serialized")

==> method(b, if(b ==(nil), setSlot("b", Sequence clone));
b appendSeq(self asMutable replaceSeq("\"", "\\\"") asSimpleString))

So, Io has some documentation, and you can read much of the code in the interpreter.

The [online reference docs](http://iolanguage.com/docs/reference/browser.cgi) are not to be trusted, but they are helpful at times.

Spam control: some choice words now blacklisted

*Public announcement:* Should anyone like to announce anything in the comments section about female breasts, in a colloquial manner, stay away from using the word “boobs”. I just blacklisted it. Use your imaginations.

Also, should you want to discuss females with a homosexual orientation, then refrain from the commonplace word “lesbian”, since this also got blacklisted.

Finding words that are used seldom enough could be the next spammer quest.

bash functions example

Bradley Taylor (of [Railsmachine](http://railsmachine.com/) hosting fame) said this on [the excellent Mongrel mailing list](http://rubyforge.org/mailman/listinfo/mongrel-users):

“Just use these bash functions and put them in your .bashrc:”

  cluster\_restart () { 
	mongrel\_rails cluster::restart -C /etc/ mongrel\_cluster/$1.yml;
  }
  cluster\_start () {
	mongrel\_rails cluster::start -C /etc/ mongrel\_cluster/$1.yml;
  }
  cluster\_stop () {
	mongrel\_rails cluster::stop -C /etc/mongrel\_cluster/$1.yml;
  }

  usage:
  $ cluster_start fluxura


([See the thread in the archives](http://rubyforge.org/pipermail/mongrel-users/2006-July/000780.html).)

That is, when someone asked about if it wasn’t possible to just have a command, and that it’d be cool if Mongrel had such a simple command, he shows code.

Also, the example’s great.

* The $1 to access the first argument to the function call, and that
* you don’t need to put in any parameter lists in the functions, and that
* its control structures looks mostly like any C-like language.

I feel kickstarted by this. Thanks, Bradley.

[tags]bash,unix[/tags]