Archive for May, 2005

Star Wars and Java…

May 18, 2005

The arrival of the new Star Wars Episode III movie reminds me of a really funny “episode” with one of my sons some time ago:

During the times of Star Wars Episode I, I once came home from work and during dinner, I mentioned that I had started to learn Java and that there is an interesting technology called JavaBeans. My jounger son interrupted me and said: “Hey, I already know Java Bings! He is the funny guy from Star Wars Episode I!”

Not sure if Jar Jar Binks would have gotten the joke 😉

Advertisements

Joining multiline records in (n)awk

May 18, 2005

I like awk (In Solaris, I like nawk better than awk, though 😉 ).
Let’s see how we can deal with multiline records. Here’s an approach I use quite often (if you have a better idea, please tell me!).

Given the following output of:

$ su - demo -c "prctl -t privileged -n project.max-shm-memory -i project user.demo"

which is for example:

Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
project: 100: user.demo
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
project.max-shm-memory
privileged      4.00GB      -   deny                                 -

I would like to have just one line with the most important fields:

project.max-shm-memory  4.00GB  deny

In order to get that, I search for the header line and print the interesting fields of the following lines:

$ su - demo -c "prctl -t privileged -n project.max-shm-memory -i project user.demo" | \
nawk '
{a++;if (a==-99){printf ("%s\t", $1)}}
/NAME/{a=-100}
/privileged/{printf ("%s\t%s\n", $2, $4)}'

By setting the counter a to -100 instead of a positive value, I do not have to initialize it in a BEGIN statement. For each line, I increase counter a. If it reaches -99 which is the next line after the line containing pattern NAME, I print the first field with just a tab but no newline. For the line that contains string privileged, I print column 2 and 4, plus the newline.

As the script does not select lines by just counting from the beginning, this is a very robust solution that works indepentendly of any “garbage” output caused by login scripts of the user I am using.

Spellchecking with Google

May 15, 2005

It has been mentioned before on the web, but whenever I talk about it, people say, “Wow, I didn’t think about that way of using a search engine!”.

Especially for non-native speakers of the English language, if your favorite dictionary (mine is currently LEO, an Online Service of Technische Universität München, powered by Sun Microsystems) does not contain a word that you would like to use, you may want to try a search engine. An example?

Try: “parallelizable” (currently 51,900 hits) and “parallizable” (359 hits). The U.K. style, “parallelisable” gives you 859 hits, so it’s very likely that the second possible way of spelling is incorrect (at least, less people may know what you mean by using that word instead of the first one).

By reading the word in the context, you also get an impression of the meanings, and maybe you’ll discover that the word you wanted to use means something different than you thought;-). And, as you can see in the above example, by looking at the domains of the search results (e.g. .com vs. .uk), you may even get hints about in which countries a special way of spelling is used.

Domemo: The simpler, the better…

May 11, 2005

One of my favorite games: Domemo.

You have to guess your own numbers but only see the ones of the other players. If you cannot get it, you can build it yourself: Create or buy 28 tiles thick enough that they can stand in an upright position and write numbers on the front side (one of the two sides with the largest area) of each: “1” on one, “2” on two, and so forth, until “7” on seven.

In order to play the game, count the players (up to 5), divide 28 by (# players + 1) and let each player put that much tiles in front of her/him, face to the others so that each player can see each other player’s tiles but not her/his own. The rest of the tiles lay face down on the middle of the desk. Then, one player starts guessing and asks one other player: Do I have a (any number between 1 and 7)? The other player responds “yes” or “no” and in case of “yes” pulls at the top of the corresponding tile so that everybody can see it. In that case, the player can continue guessing.

The first player that guessed all his tiles wins.

Have fun!

Currently in my ear

May 10, 2005

Saverio Mercadante: Concerto for Flute and String Orchestra In E Minor op. 57.
Most of you (as I did) may have heard the third movement but do not know the other two. I like all three. When trying out samples from Amazon or other sites, please listen to different ones. As it is often true for classical music, different interpretations cause totally different sounds and impressions.

Unterbiberger Hofmusik
For those of you that like (or hate) Bavarian Music, you should definitely listen to this one: Gruss an Klostergrab (F. J. Himpsl) which is a very good mixture between that kind of music and Jazz. Enjoy!

whoami?

May 10, 2005

Hi all,

I’m Bernd Finger, a Service Engineer working for Sun Microsystems in Walldorf, Germany. My main work area is SAP on Sun proactive and reactive support.
My main hobbies are computers and music, and I will write about those and my other hobbies later.

It’s my first blog, and I wonder how this evolves in the future. As I am sometimes writing letters to the editor, blogging is probably my perfect add-on or follow-up activity.

Feel free to contact me!

Bernd