Wednesday, 23. June 2010
Extent Badboy to write a CSV-Logfile by using a JScript Tool Element 
From time to I use tool "Badboy" from Simon Sadedin to create functional tests for websites or web-based applications. Now I needed to extend the tests for logging the runtime of certain steps and the whole test, but the Badboy Tool doesn't offer such a counter out of the box. To I created some lines of JavaScript that can be used in Badboy via the the "JScript" tool element to log into a csv-file, which can be processed in Excel or Openoffice later on.
Instructions to setup
- Create a variable called "logfile" and set it's value to the name of the desired logfile, e.g. mylogfile.csv. (You can also define it with a path like "c:
myfile.csv")
- Create a test file called "logentry.js" and place it in the same directory as your test. The content of the file is the script shown at the end of this blog entry.
- Add a "JScript Tool" to your testplan at the points where you want to write a timestamp into the logfile, select checkbox "Allow Access to Plugin Priviliges" and set the source to to the formerly created "logentry.js" file. (You can reference the script file with absolute or relative pathes. If you go for relative ones, the whole test can be simply transferred to other machines)
That's it! You can copy that element to all that points in your test, where you want to log a line. The logline will contain the host-Variable as well as the parent steps name and the name you gave to the JSctipt tool element.
The Code:
var datumzeit = new Date();
var stepname = badboy.script.find(badboy.current).parent.get('name');
var value = '"' + badboy.getVariable('host') + '","' + stepname + '","' + badboy.script.find(badboy.current).get('name') + '","' + datumzeit.toUTCString() + '","' + datumzeit.getTime() + '"' + " rn";
var fso = badboy.plugin.createObject("Scripting.FileSystemObject");
var textFile = fso.OpenTextFile( badboy.getVariable('logfile') + '-' + badboy.getVariable('host') + '.csv', 8, true);
textFile.Write (value);
textFile.Close();
Saturday, 02. January 2010
Context Menu (ServiceMenu) in KDE4 for "Send as e-mail" 
Quite often I send multiple files via e-mail. My Desktop is driven by KDE4 and I use Icedove (Thunderbird) as Mail-Client. Sadly in KDE4 there is no context menu in the file-manager (dolphin / konqueror) that give the functionality to create archive of multiple files on the fly and send the achive as e-mail.
So I created a KDE4 ServiceMenu file in /usr/share/kde4/services/ServiceMenus/sendwithicedove.desktop
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin,all/allfiles,inode/directory
ExcludeServiceTypes=kdedevice/*
Encoding=UTF-8
Actions=sendwithicedove;sendtargzwithicedove;sendzipwithicedove;
[Desktop Action sendwithicedove]
Exec=icedove -compose
"$( echo -ne "subject=Attachments,body=Files:n
"; for i in $(echo %F); do echo ' '$(basename ${i}); done; echo -n ",attachment='
"; for j in $(echo %F); do echo -n file://${j},; done; echo "'
";)"
Icon=icedove
Name=Send as E-Mail Attachment (Icedove)
Name[de]=Als Anhang per E-Mail senden (Icedove)
[Desktop Action sendtargzwithicedove]
Exec=icedove -compose
"$( echo -en "subject=tar.gz-file: archive.tar.gz,body=Content:n
"; for i in $(echo %F); do echo ' '$(basename ${i}); done; mytmpdir=$(mktemp -d --tmpdir sendtargzwithicedove-XXXXXXXXXXXX); tar czf ${mytmpdir}/archive.tar.gz --transform='s#^.*/##' %F 2> /dev/null; echo -n ',attachment=file://'${mytmpdir}'/archive.tar.gz'; )"
Icon=icedove
Name=Send as tar.gz Attachment E-Mail (Icedove)
Name[de]=Als tar.gz-Anhang per E-Mail senden (Icedove)
[Desktop Action sendzipwithicedove]
Exec=icedove -compose
"$( echo -en "subject=zip-file: archive.zip,body=Content:n
"; for i in $(echo %F); do echo ' '$(basename ${i}); done; mytmpdir=$(mktemp -d --tmpdir sendzipwithicedove-XXXXXXXXXXXX); zip -9qjr ${mytmpdir}/archive.zip %F 2> /dev/null; echo -n ',attachment=file://'${mytmpdir}'/archive.zip'; )"
Icon=icedove
Name=Send as zip Attachment E-Mail (Icedove)
Name[de]=Als zip-Anhang per E-Mail senden (Icedove)
(If you are using Thunderbird, then you must replace icedove with thunderbird manually)
It provides there menuitems the dolphins and konquerors context (right-click) menu:
- Send as E-Mail Attachment (Icedove)
- Send as tar.gz Attachment E-Mail (Icedove)
- Send as zip Attachment E-Mail (Icedove)
The script has some disadvantages:
- It doesn't clean up the /tmp directory: It can't to, becuase the archive must say there until the user really send the e-mail.
- It does store directories recursively, but the file-list in the e-mail body only list the directory and not the files within (Hereby I define this as feature :-))
Wednesday, 30. December 2009
JQuery Boxy Plugin with Iframe Content 
Today I was struggling with a lightbox-alike feature for a customer's intranet-website. I chose the boxy-plugin for JQuery, because JQuery itself was already used on that particular site, so I kept the library-overhead at a minimum.
The problem was, that a "boxed overlay" ("boxy") consists only of a basic <DIV>. There were no scrollbars inside the boxy and the overlay didn't work as expected in IE6, as it was not able to hide <SELECT> elements under it (in newer browsers it worked fine, though).
I decided to embed an <iframe> into the boxy's content as a solution to both problems mentioned above. This works like this:
[...]
<script type="text/javascript">
function showboxy(myactuator) {
mycontent='<iframe border=0 src="mycontentfortheiframe.php">You need a Browser which can display iframes</iframe>';
new Boxy( mycontent, { unloadOnHide: true, draggable: false, show: true, modal: true, title: "Replaceme!", closeText:"[ Close ]", actuator: $('#'+myactuator)[0]} );
}
</script>
[...]
<a id="boxyfoo" title="tutorial" onclick="showboxy('boxyfoo');" href="#" style="visibility:hidden; text-decoration: none;">
<button type="button" >Click here to boxy!</button>
[...]
The tricky part is to access the boxy's properties from _within_ the iframe. You need to access the DOM element the boxy is linked to on the main page, not on the iframe:
window.parent.Boxy.linkedTo( window.parent.$('#boxyfoo')[0]).setTitle('I am replaced');
(This example replaces the boxy window's title from within the iframe).
Monday, 21. December 2009
WiFi-/WLAN-Authentication at T-Mobile Hotspots (ICE Train) 
At the moment I take the ICE train of Deutsche Bahn twice a week. The particular train does offer Internet-Connection in cooperation with T-Mobile. The authentication is done via a captive portal and one needs a T-Mobile Hotspot Account, which is part of many Deutsche Telekom and T-Mobile products.
The usability of the captive portal sucks a little, as the browser does not save your credentials. So I captured the https-communication via Firefox liveheaders extension, extracted what's needed for authentication and wrote a little bash script to simplify the logon :-) It's free, public domain, so use it if you like. Keep in mind that the script does accept the terms of use (AGB) automatically!
Simply start it like this:
shell$ wlan-auth.sh yourlogin yourpass
If you use wicd as WiFi-Manager, you can also make the script run automatically if wicd connects to the T-Mobile_ICE Hotspot :)
And here is the wlan-auth.sh script:
#!/bin/sh
HSUSER=$1
HSPASS=$2
echo
"You accepted the terms of use (AGB)!";
if [ -e /tmp/tmobilehotspot-cookie ]; then rm /tmp/tmobilehotspot-cookie; fi
curl -c /tmp/tmobilehotspot-cookie \\
-F username=${HSUSER} \\
-F password=${HSPASS} \\
-F strAGB=AGB \\
-F strHinweis=Zahlungsbedingungen \\
-F x=48 \\
-F y=3 \\
https://hotspot.t-mobile.net/wlan/index.dowhile (
true );
do
curl -b /tmp/tmobilehotspot-cookie
https://hotspot.t-mobile.net/wlan/index.do > /dev/
null
sleep 300
done
Monday, 11. May 2009
Quagga, Debian and SNMP-Support 
Currently I try to make the Quagga Routing Daemon talk SNMP in order to monitor it's status (number of routes, changes, etc.).
It's not as straight-forward as it could be. First of all, Quagga has to be complied with the "--enable-snmp" option. Due to licensing issues with the OpenSSL library, the Debian maintainer of the quagga-package had to build the package in Debian without that option. So, the best way is to rebuild the package from Debianized sources with that option enabled.
Here is a 3-Step recipe / howto / tutorial:
Step 1: Build Quagga with --enable-snmp
# cd /usr/local/src
# apt-get source quagga
# apt-get build-dep quagga
# apt-get install libsnmp-dev libsnmp9-dev libsnmp9 libsnmp-base debhelper dpkg-dev snmpd snmp
# echo edit quagga-0.99.10/debian/quagga.preinst
… remove the "grep ^smux" block at the end …
# echo be sure to be in still in /usr/local/src !
# export WANT_SNMP=1
# apt-get -b source quagga
Hint: If you are on a 64-bit system, you currently need that patch additionally:
http://lists.quagga.net/pipermail/quagga-dev/2008-December/006301.html
Update: The newest release included the 64-bit fix. See changelog: smux 64-bit fix for lib/smux.h SNMP_INTEGER() macro
The is result will be a .deb paackage, e.g. quagga_0.99.10-1lenny2_amd64.deb.
# dpkg -i quagga_0.99.10-1lenny2_amd64.deb
...to install it. Quagga is now prepared to connect to snmpd via "smux". But before smux must be enabled in the snmpd.
Step 2: Prepare and configure snmpd
To do so, edit /etc/default/snmpd. Remove the "-smux" option from the SNMPDOPTS line. By that way you probably want to add additional IPs snmpd should, listen on. By default it only listens to localhost, but your monitor will be probably on a different box. Then add to /etc/snmp/snmpd.conf
smuxsocket 127.0.0.1
smuxpeer .1.3.6.1.4.1.3317.1.2.1. yourpasszebra
smuxpeer .1.3.6.1.4.1.3317.1.2.2. yourpassbgpd
smuxpeer .1.3.6.1.4.1.3317.1.2.5. yourpassospfd
(For details about the OIDs see here:
Quagga MIBs . Mind the dots after the OIDs! They currently do matter! )
# /etc/init.d/snmpd restart
Now prepare each of quagga's daemon to talk to snmpd's smux. (in the above example only the OIDs for zebra, bgpd, ospfd were added). vtysh does _not_ work here!
Step 3: configure Quagga
# telnet localhost 2601
Trying 127.0.0.1…
Connected to localhost.
Escape character is '^]'.
Hello, this is Quagga (version 0.99.10).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
User Access Verification
Password: ....
quagga# en
quagga# conf terminal
quagga(config)# smux peer 1.3.6.1.4.1.3317.1.2.1 yourpasszebra
quagga# conf terminal
quagga(config)# exit
quagga# wr mem
Now you should set up snmpd ACLs and users as usual. Use snmpwalk to test, if you see .1.3.6.1.2.1.4.24 etc.
An example how to find out the AS number:
# snmpwalk -v 2c -c $community -O fn $ip .1.3.6.1.2.1.15.2
.1.3.6.1.2.1.15.2.0 = INTEGER: 20755
You can find more about the BGP MIB in an
OID browser.
Monday, 13. April 2009
Augenentzündung beim Hund? 
Unser neuer "Pflegi" hat einen seltsamen Ausfluss am Auge. Wahrscheinlich hat er eine leichte Entzündung, möglicherweise ist diese bakteriell bedingt. Ich behandele ihn derzeit mit Augentropfen, die durch ein enthaltendes Antibiotikum die Bakterien bekämpfen. (Danke Dr. B. aus O.! Ohne Homepage kann ich keinen Link setzen!)
Als ich das Problem festgestellt habe, konnte ich im Netz leider keine guten Bilder zu dem Thema finden, deshalb hänge ich hier welche an.
Achtung! Ich bin kein Mediziner! Dies sind alle Hinweise eines Laien! Im Zweifelsfall zum Tierarzt gehen!
Sunday, 12. April 2009
LSI RAID and Linux Support 
For some time I am struggeling with LSI RAID controllers in project-based work (my own setup use Linux softraid). My Experience now convers U320-SCSI-based HBAs as well as SATA HBAs. LSI is a somewhat a de-facto standard in the server business for RAID controllers, but IMO not the best solution around. Anyway admins probably don't get around that stuff as it is included on-board in maybe systems or available as OEM ware, e.g. as DELL PERC controller. And: it's not that bad at all and at least most of their HBAs are supported by Linux and VMWare ESX.
They offer several software packages for Linux. You'll find them under "downloads" on the LSI website, but at the first sight it's not quite quite what they are good for. So here in short:
- megamon linux: This one monitors the RAID's status and writes it into a logfile. Plain text.
- megarc linux: With this one you can control anything on the LSI via command line. Plain text/commandline tool. The README says "First version for DOS" :)
- megamgr: This one resembles the "CTRL-M"-style BIOS. It's like curses-based or "text menu driven". With that you can mange your RAIDs menu-driven. (But no good diagnosis support, you'll need megamon for doing so)
Saturday, 11. April 2009
Donald - keine Ente! 
So, Gestern ist
Donald von der Gass zu Tomelloso :-) in Deutschland eingetroffen. Er ist mit vielen anderen Doggies im Transporter hergekommen. Als erste Amtshandlung habe ich ihn saubergemacht. Anschließend ging's in den Wald zum Joggen. "Donnie" ist ein echter Muskelprotz und wollte erstmal eine andere Route einschlagen - wir haben uns aber ganz schnell geeinigt, wo's langgeht und er lief eine Stunde lang brav neben mir.
Unsere
Chile Binks-Gabor zu Nasenhasuen :-) hat ihn anfangs ignoriert und war wohl etwas entsetzt, dass wir einfach so einen anderen Typ mit nach Hause genommen haben. Nach der ersten Nacht haben die beiden sich schon angefreundet: Als ich heute Morgen aufgestanden bin, kamen beide propellerschwänzelnd vor Freunde zu mir gelaufen. Als die bösen Küchengeräte anfingen zu brüllen, lagen die beiden gemeinsam auf einem Kissen dicht beieinander.
Derzeit versorge ich Donnies Schürfwunden mit Salbe, insbesondere auf der Nasenspitze ist er etwas verletzt und "nackt" - das stört aber nicht weiter und wird sicher von selbst heilen. Ich wundere mich aber über einen leichten eitrigen Schleim, der am linken Auge aus der Tränendrüse fließt - evtl. hat eine eine leichte Augenentzündung. Ich behalte das mal im Auge ....
Tuesday, 24. February 2009
Nachruf Podenca Lilly 
Unsere geliebte Podenca Lilly tot. Sie ist gestern um etwa 15 Uhr überfahren worden. Sie war erst zwei Jahre alt. Seit etwas über einem Jahr hat unsere "Himbeernase" unser Leben bereichert, die Wohnung aufgemischt und uns stets freudestrahlend begrüßt. Ihre quirlige Art hat immer ein Lächeln in unsere Gesichter gezaubert.
Wir vermissen Dich!
So fing Alles an …
Was ist ein PodencoSunday, 23. November 2008
Hapkido Schwarzgurtprüfung (1. Dan): Stefano 
Am Samstag, dem 22.11.2008, fand im Saarland eine Hapkido-Danprüfung statt. Prüfer waren Mark Klinger (6. Dan Hapkido) aus dem Saarland und Ivan de Wever (6. Dan Hapkido) aus Belgien. Es wurden die Themenbereiche Tritt-, Schlag und Hebelschule, Faust- und Fusstrittabwehr geprüft. Formenschule und Langstocktechniken waren ebenfalls ein Bestandteil der Prüfung und ein Bruchtest stelle den Abschluss der Prüfung dar.
Zum ersten Mal trägt einer meiner Schüler einen schwarzen Gürtel, deshalb war diese Prüfung auch für mich ein ganz besonderes Ereignis.
Ich wünsche den drei Prüflingen alles Gute und weiterhin viel sportlichen Erfolg!