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]

New Blog on DSLs: Little Languages

It was made official in the coolest way possible, in a [Lambda the Ultimate post](http://lambda-the-ultimate.org/node/1628), that the [LittleLanguages.net blog](http://www.littlelanguages.net/blog/) has begun.

DSLs (domain-specific languages) are hip. The weblog “A Fistful of Languages” is a weblog about them.

> Here’s where the “Fistful of Languages” blog comes in. This blog aims to address all aspects of DSL development, focussing particularly on DSLs embedded in Ruby.

Tobias and Dave are old hands in computer languagery. They also both like weird cinema. I look forward to following [the blog's RSS feed](http://littlelanguages.net/blog/feed/).

[tags]dsl,blogs,programming languages[/tags]

Awk, text processing

Fooling around with load average output on a shared host (where it can be life-or-death):


$ w -s|awk '/load average:/ { print "Load averages:\nPast 1 min:  " $10 "\nPast 5 min:  " $11 "\nPast 15 min: " $12 }'
Load averages:
Past 1 min:  20.94,
Past 5 min:  20.67,
Past 15 min: 18.75

What’s w, you say? The manpage says:

> w – Show who is logged on and what they are doing.

Awk’s got grep rolled right into it. And the default action is “print the line”. Practical. (Above I had to go all fancy, and adding what those fields mean. Sorry about that. I’m like that.)

If you scroll a bit in the little code window above, you’ll see that the significant values are $10, $11, and $12. The tenth, eleventh, and twelvth *words*! If your data is tab-separated, you change the delimiter to a tab instead. Or, to a comma for CSV files. Bam, you can read almost anything right there.

The concatenation (fancy word for adding two strings to one) sign is… nothing. Elegant.

Read more on awk in [the gawk manual (Free documentation!)](http://www.cs.utah.edu/dept/old/texinfo/gawk/gawk_toc.html).

**Update**: Or, read esr’s [damning of awk](http://www.faqs.org/docs/artu/ch08s02.html#awk), in his [The Art of Unix Programming](http://www.faqs.org/docs/artu/).

Nitro: A Rails contender?

I copy-edited [a Nitro article](http://www.oxyliquit.de/tutorial/4) on using the fulltext search index facility [TSearch2](http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/) for [Postgres](http://www.postgresql.org/). (Smart way to read an article slowly enough to let all of it seep in.)

[Nitro](http://www.nitroproject.org) is an MVC web framework written in Ruby. “For Web2.0″, you know.

Interested Nitro neophytes can head over to [Oxyliquit](http://www.oxyliquit.de/), the Nitro Q&A website, which has tutorials, FAQs, articles, and all the other resources you may need. And a link to #nitro at irc.freenode.net.

After reading about Postgres, and hearing about it, from Peter Marklund, I was encouraged enough: I compiled it and installed it on laptop, using [this fine Apple tutorial](http://developer.apple.com/internet/opensource/postgres.html). A thorough, helpful walk-through.

Reading [the Postgres 8.1.4 documentation](http://www.postgresql.org/docs/8.1/interactive/) was a little like paging through a blasphemous tome of ancient knowledge: all of my “Keep Your Logic Out Of The Data Storage” ideas were challenged, and I was often wow’ed with the raw power. On every page, with all the new features. I have some digesting to do. Let the new gospel sink in. Take a stand.

What are your feelings about Postgres’ power?

Learning more Haskell

(Minor update: Removed a double-quote too much. Darn [AutoPairs](http://www.jwwalker.com/pages/autopairs.html). Maybe it can be configured.)

[Jamis Buck](http://jamis.jamisbuck.org/articles/2005/10/30/learning-haskell) brought me back on track with learning Haskell: I have had the [Yet Another Haskell Tutorial PDF](http://www.isi.edu/~hdaume/htut/) on my laptop for ages, but those things don’t read themselves.

A sidenote: using Haskell feels loads more natural to me compared with Common Lisp. I try reading [Practical Common Lisp](http://www.gigamonkeys.com/book/), as well. Grabbing the first item off a list (aka the “head” of the list):

Haskell: head( ["olle", "floyd", "muhammad"] )

Lisp: ( first ( list "olle" "floyd" "muhammad" ) )

That [s-expression syntax](http://en.wikipedia.org/wiki/S-expression) comes to bite me all the time! (I had to review that Lisp statement a couple of times in an interactive environment, to find and remove my C-style parentheses, and make it s-exp’y.) Haskell’s form has a more C-programmer-natural feel to it; YMMV.

[tags]haskell,programming[/tags]

Copenhagen.rb loosely coupled

In a comment here, Jesper said:

> This may be a good place to mention that Jakob Skjerning set up the [Copenhagen Rails mailing list](http://lists.substancelab.com/mailman/listinfo/copenhagen.rb) (in Danish).

Perhaps it even deserves a blog post. [Jakob](http://mentalized.net/) says (translated from Danish):

> We picked the name Copenhagen.rb after some thought. Primarily since it’s a well-spread way of naming Ruby usergroups, but also since Copenhagen Ruby Brigade sounds about 342 times cooler than Copenhagen Ruby User Groups.

> Why Ruby and not Rails? Hm, well, good question, and if you’re very fanatic about the R meaning Rails, you’re welcome to label yourself a member of the Copenhagen Rails Brigade. The Ruby and Rails symbiosis is so clear nowadays, that there isn’t much grounds to separate the two.)

[tags]rubyonrails, rails, copenhagen[/tags]