Wednesday, 19 January 2011

diary news for family

Fionnuala's just about nearly better from a nasty flu that kicked in just at new year.

The cubs & scout are off to Larch hill camping/hostelling this weekend too.
Mary is coming up to visit Fionn & Maeve and get some .xls sheets played with.
The calves are keeping them busy in Cobh now sounds like.

We had some very wet wetness (at least it was warmish wetness).
Back to Brrrrr! Freezing here last night and -1 tonight when collecting scouts from meeting. Lovely sun last few days but ice on ponds today and on windscreens last 2 nights. Dry forecast for hostelling on weekend anyway.

Last weekend Fri night out to Niamh & Renaud's place for birthday bash. We got going late :-7. Fionn home earlyish, loads of people cleared out and there were 4 of us left at 2am. Cleared up a bit and took home some yummy food.
Sat James up early drive scout van and transport theatre set from Nutgrove to Tiernans. Grand little van to drive. With Peter & Tom & Brendan & Garreth. Locked keys in van! Augh. Peter went & got spare set. Packed from trailer into container then with Garreth unloaded van. Container is packed reasonably neatly but very very full. Everything just about fitted in. Back home. Sat evening out to Dundrum with scouting leaders night. Siam Thai restaurant. Good night, I'm a bit too calm and boring sometimes 2 tables split into lads & girls and olderies, and Rob joined our table. Kind of karaoke during meal and surprised restaurant changed into a bit of dancing and cocktail bar later.

Kids fun with scary spider. Though teasing/sniping earlier b4 I got home. Kate writing an interesting story at the  moment. Evil person Frank v.s. Snowrose, Kate, Lucy, ... Maeve read her bedtime story - Dr. Seuss - the one with the two things, Thing 1 and Thing 2 - The Cat in the Hat.

Friday, 7 January 2011

How to iterate through the topmost indices only in a multidimensional tcl array

Using ,(comma)s in tcl array indices is the standard way of using them as multidimensional arrays.

# Test:
if {[info exists aTestHostInfo]} {puts exists}
set aTestHostInfo(node1,ip) 192.168.18.82
set aTestHostInfo(node1,swversion) "Wed Jan 5 21:27:33 GMTST 2011,FORMAL,18666,,,"

set aTestHostInfo(node2,ip) 192.168.18.83
set aTestHostInfo(node2,swversion) "Wed Jan 5 21:27:33 GMTST 2011,FORMAL,18666,,,"

set aTestHostInfo(node3,ip) 192.168.18.84

set aTestHostInfo(node4,foop) 192.168.18.85

# This seems to be a little bit of info missing from the internet.
# How to iterate through the topmost indices only in a multidimensional tcl array:
  if {[info exists aTestHostInfo]} {
    # go through topmost index of multidim array
    foreach sCard [lsort -uniq [regsub -all {,\w*} [array names aTestHostInfo] "" ]] {
      if {![info exists aTestHostInfo($sCard,ip)]} {set aTestHostInfo($sCard,ip) UNKNOWN}
      if {![info exists aTestHostInfo($sCard,swversion)]} {set aTestHostInfo($sCard,swversion) UNKNOWN}
      set swdlOutput "$sCard,$aTestHostInfo($sCard,ip),$aTestHostInfo($sCard,swversion)"
      puts $swdlOutput
    }
  }