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
    }
  }





Saturday, 16 October 2010

Google's Dynamic Feed Wizard + feeding Facebook problem and hacked solution

Google's Dynamic Feed Wizard is really good.


http://www.google.com/uds/solutions/wizards/dynamicfeed.html

BUT I found a problem with facebook feeds. The feed displayed fine BUT the links to go to external feed or items were relative links to local site.
e.g. /posted.php?id=199235386657&share_id=155115854527260&comments=1#s155115854527260 instead of:
http://www.facebook.com//posted.php?id=199235386657&share_id=155115854527260&comments=1#s155115854527260


This is where we're using it: http://lhra.info/
See also the changed javascript: (hardcoded for facebook feed as it is at current moment in time = Oct17 2010) http://lhra.info/gfdynamicfeedcontrol_forfacebook.js

Also changed is ability to default title link to not what is returned by RSS feed.

 wwwLHRA$ diff -u gfdynamicfeedcontrol.js gfdynamicfeedcontrol_forfacebook.js
--- gfdynamicfeedcontrol.js    2010-10-17 01:23:52.000000000 +0100
+++ gfdynamicfeedcontrol_forfacebook.js    2010-10-17 02:39:08.000000000 +0100
@@ -27,7 +27,7 @@
   this.feeds = [];
   this.results = [];

-alert("debug feedUrls:"+feedUrls);
+//alert("debug feedUrls:"+feedUrls);

   if (typeof feedUrls == 'string') {
     this.feeds.push({url:feedUrls});
@@ -45,7 +45,7 @@
       o.title = s.replace(//g, '>');
     }
       }
-alert("debug maybe url:"+o.url);
+//alert("debug maybe url:"+o.url);
       this.feeds.push(o);
     }
   }
@@ -115,7 +115,8 @@
     sortByDate : false,
     horizontal : false,
     stacked : false,
-    title : null
+    title : null,
+    titleurl : null
   };

   if (options) {
@@ -162,7 +163,7 @@
   // The feedControl instance for generating entry HTML.
   this.feedControl = new google.feeds.FeedControl();
   this.feedControl.setLinkTarget(this.options.linkTarget);
-alert("debug this.options.linkTarget:"+this.options.linkTarget);
+//alert("debug this.options.linkTarget:"+this.options.linkTarget);


   // The feeds
@@ -174,7 +175,7 @@
     feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);
     feed.setNumEntries(this.options.numResults);
     feed.load(this.bind_(this.feedLoaded_, i));
-alert("debug feed "+i+" :"+feed);
+//alert("debug feed "+i+" :"+feed);
   }
 };

@@ -217,6 +218,14 @@
   if (this.feeds[index].title) {
     result.feed.title = this.feeds[index].title;
   }
+//alert("debug result:"+result+" tit:"+result.feed.title);
+//alert("debug feed i:"+index+" result:"+result+" tit:"+result.feed.title+" lin:"+result.feed.link);
+  var entries = result.feed.entries;
+  // CHANGE RELATIVE Facebook URL to ABSOLUTE for use in external page
+  for (var i = 0; i < entries.length; i++) {
+    //alert("debug ent i:"+i+" e:"+entries[i]+" tit:"+entries[i].title+" //lin:"+entries[i].link);
+    result.feed.entries[i].link="http://www.facebook.com/"+entries[i].link
+  }
   this.results.push(result);

   if (!this.started) {
@@ -375,9 +384,14 @@
   this.clearNode_(el);
   var link = document.createElement('a');
   link.target = google.feeds.LINK_TARGET_BLANK;
-  link.href = resultFeed.link;
+  // SET The URL the feed title links to (was http://www.facebook.com, we wish to link to facebook/ourgroup)
+  if (this.options.titleurl == null) {
+    this.options.titleurl = resultFeed.link;
+  }
+  link.href = this.options.titleurl;
   link.className = 'gfg-collapse-href';
   link.innerHTML = resultFeed.title;
+//alert("debug title link:"+link+"  link.href:"+link.href);
   el.appendChild(link);
 }

@@ -408,10 +422,13 @@
     var className = 'gfg-listentry ';
     className += (i%2)?'gfg-listentry-even':'gfg-listentry-odd';
     var listEntry = this.createDiv_(className);
-alert("debug entry create link:"+entries[i].link+"  title:"+entries[i].title);
-    var link = this.createLink_("http://www.facebook.com/"+entries[i].link,
+//alert("debug entry create link:"+entries[i].link+"  title:"+entries[i].title);
+    // adjusting the link URL here (from relative to absolute) worked for list elements but not selected item
+    //entries[i].link="http://www.facebook.com/"+entries[i].link
+    var link = this.createLink_(entries[i].link,
                                 entries[i].title,
                                 this.options.linkTarget);
+
     listEntry.appendChild(link);
     if (this.options.pauseOnHover) {
       listEntry.onmouseover = this.bind_(this.listMouseOver_, resultIndex, i);


Javascript debugger (Venkmann+Firefox) a bit crashy, hence the old alert("") style debugging.


One thing to do to change this from hack to good solution would be detect relative URLs (look for beginning which is not http:// or file:// ...) and do the right thing.




Surprised grepping internet to not find people finding this problem ... ?

Saturday, 11 September 2010

Bus Eireann Route Plan: unintended scenic diversion


This is quite funny if you know Limerick. The route planner adds in 5 bus trips to cover a short distance in the city center.

Dublin to University of Limerick, via Limerick city centre and a selected tour of the city centre and a suburb. Fionnuala was hoping that perhaps the Dublin Bus might still stop at the University on the way.

Beware tourists and computer users everywhere!

:)

Friday, 10 September 2010

bash/sh/ksh syntax: function needs whitespace after initial {

# this is broken:
$ function cdt {cd $TTM_TESTS_DIR;pwd;}

# this is also broken:
$ function cdt { cd $TTM_TESTS_DIR;pwd }

# this is okay
$ function cdt { echo "tcl isn't the only language with whitespace-dependant syntax. though looking mostly like a tokenised parsed language.";cd $TTM_TESTS_DIR;pwd;}

So like tcl sh/bash not really parsed in a properly tokenised way.
Mmmm.
Specifically here:
1. needs whitespace after first { of function
2. needs ; after last command before closing }  (doesn't matter about whitespace here)

Aliases are bad. For many reasons.One reason being vars in aliases expanded at definition time.
So if the variable is redefined then the alias doesn't match. Alias must also be redefined when changing variable.

man bash explains it better and says: "For almost every purpose, aliases are superseded by shell functions."
 http://www.gnu.org/software/bash/manual/bashref.html#Aliases




Best answer ever to question on parsing html tags with regular expressions:
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454
This is more fun as it has a lovely pic of Cthulhu for illustrative purposes.
http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html
Cthulhu  ach, Cthulhu isn’t in my spell-check dictionary!
What an oversight!
Tsk!




Checked functrion cdt on a few bash versions.
These are the errors seen:

GNU bash, version 3.2.49(23)-release (i686-pc-cygwin)
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
sh on qnx is ksh 6.4.1

sh: syntax error near unexpected token `{cd'    (sh on this cygwin IS bash)
bash: syntax error near unexpected token `{cd'
-bash: syntax error near unexpected token `{cd'


qnx$ strings $(which sh) |grep -C8 -i version
The ksh is a public-domain version of the Korn shell. It's a command
interpreter that's intended for both interactive and shell
script use.
For more information please refer to a ksh or unix shell reference.
NAME=ksh
DESCRIPTION=Public Domain Korn Shell
DATE=2009/05/20-17:46:32-EDT
STATE=stable
HOST=cctrunk
USER=builder
TAGID=166
VERSION=6.4.1

Friday, 3 September 2010

Oopsie daisies! http 404 error.

Just had some fun customising http 404 error page:


http://gmds.ie/gehbroked

In the spirit of fun:
http://www.dzinesoup.com/44-amazing-and-creative-404-error-pages/

GMDS, Glencullen Musical and Dramatic Society new web pages: http://www.gmds.ie just got hosting and domain registered with Blacknight. Trying out the default content management: Plesk. Putting some initial content up on site.

logo, sad theatre mask for 404 error page:  :)



TITLE: http 404 error: This page is not found.


Oopsie Daisies!


http 404 error: This page is not found.





Something is broken on the internet.
Do not fear!
We are alerting the appropriate authorities.
The entity responsible for the error will be traced and chastised appropriately.


Please carry on Forwards or Backwards ... or perhaps Sideways or Up or Down ...






And image transparency for logos, banners. In GIMP. Layers - add alpha channel, select part of image, Edit - clear, unselect mask layer before saving, save as png (jpg doesn't handle transparency.


logo:



Friday, 13 August 2010

Concerning inventors|scientists and motivations for inventing|investigating



On mad inventors/scientists the book Jonathan has loaned me is very interesting and excellent.

I'm reading the 3rd in the cycle now: The System of the World.
 The Society for the Raising of Water by Fire. (That is, using steam engines to pump water out of mines.)  has started out. I also have recently read a book for kids: Dead Famous Inventors and their Bright Ideas. http://en.wikipedia.org/wiki/Dead_Famous_%28series%29 
Which through development of steam engines. Very good.
From when steam was used as curiosity/toy - ancient Greeks.
To when it was put to more practical use driving pumps - but very inefficiently.
To when the engines were improved and refined to make more efficient and less likely to explode.
 "Look out! The device for the raeising of water from mining pitts through the use of fyre is going to explode!"
 "What!? I can't hear you! The device for the raeising of water from mining pitts through the use of fyre is making too much loud hissing and creaking noises!"
 :-D lots of LOL!
 Beware, I totally misquote and paraphrase.

http://www.amazon.co.uk/Inventors-Their-Bright-Ideas-Famous/dp/0439981093

http://www.scribd.com/doc/31833394/History-of-Mechanical-Inventions
See p310 (p293 in scanned book = page 308 in search bar, Chap X1 Production and Application of Power 1500-1830, II Pumps.) for the newcomen Engine


Amazing how interesting economics can be made :)


I like the idea that the working inventions seem to fall out as side effects of the efforts of attempting to invent completely mad things! Flight seems to have been a very common starting motive for many to get started. http://en.wikipedia.org/wiki/Robert_Hooke And living forever seems to be another.

Mercury the element/liquid, Mercury the god/planet.


Mercury: or the Secret and Swift Messenger
"Shewing how a man may with privacy and speed communicate his thoughts to a friend at any distance" by John Wilkins


cONcerning cryptography and communications.
see chapter 15 on comms: 
C H A P . I 5 .
Concerning the swiftnesse of informati-
    ons, either by
qualities, as the impressi-
    on of imagination, and the sensitive spe-
    cies; or by spirituall
substances, as
    Angels.






The Method observed in Transfusing the bloud out of one Animal into another.
 Ouch! 



fascinating stuff!