Vi var tre tappra B3IT:are som ställde upp i årets upplaga av SpringCross. 6km var distansen som gällde, och själv hade jag som mål att spring på under 36 minuter. Det lyckades jag med, den officiella tiden blev 35:23, vilket jag är väldigt nöjd med! För att vara första gången på denna tävling och första gången i området, tyckte jag det gick riktigt bra. Tyvärr fick jag en del mjölksyra i benen efter halva loppet, och fick ta det lugnare någon kilometer. Men det är bara till att träna mer till nästa år!
Kolla Google Maps för bansträckningen, och GPX-filen från min pulsklocka, en GlobalSat GH625M.
För några veckor sedan var jag med företaget till Prag och tog en cykeltur. Här kan ni se turen på Google Maps! Tyvärr glömde jag slå på GPS:en efter några pauser, därav ”genvägarna”. GPX-filen finner du här! Foton finns på Flickr!
A simple log file roller, that rolls/rotates a file from FILENAME.0, to FILENAME.1, onwards to FILENAME.9. If FILENAME.9 exists, it is deleted. Can be used to keep log files small and managable, and delete old ones. The code is not pretty, I could not get it work with loops. If anyone has a better way of doing this, please let me know!
Usage:
rollLog LOGDIRECTORY LOGFILENAME
For instance, if you have a log at c:logat.log, you can run:
rollLog c:logs at.log
Afterwards, you have one file named c:logsat.log.0. The next time you run it (and there has been something written to at.log) you get two files, at.log.0 and at.log.1.
This is a simple way to get Shoutcast restarted (tested in Ubuntu 8.04) if the inbound stream is lost. You need Lynx installed for this to work, there might be better ways of achieving the same result though. To install Lynx:
$ sudo apt-get install lynx
Put in file shoutcast_supervisor.sh in /usr/bin:
#!/bin/bash
ONLINE=$(lynx -dump localhost:8000 | grep "Stream is up" | wc -l)
if [ "$ONLINE" -eq "0" ]
then
logger -i Inbound connection not found. Restarting Shoutcast.
/etc/init.d/shoutcast restart
fi
Change ownership, group and execution:
$ sudo chown root /usr/bin/shoutcast_supervisor.sh
$ sudo chgrp root /usr/bin/shoutcast_supervisor.sh
$ sudo chmod +x /usr/bin/shoutcast_supervisor.sh
Add the script to cron.d your preferred way, I do it in /etc/cron.d in a file name shoutcast_supervisor:
0 * * * * root /usr/bin/shoutcast_supervisor.sh
15 * * * * root /usr/bin/shoutcast_supervisor.sh
30 * * * * root /usr/bin/shoutcast_supervisor.sh
45 * * * * root /usr/bin/shoutcast_supervisor.sh
Restart cron:
$ sudo /etc/init.d/cron restart
…and the script is run every 15 minutes and will restart the Shoutcast daemon if the inbound connection was lost. Change the interval if you need to check more often. Sometimes this solves connection problems. Check the syslog for any message that the daemon was restarted, like:
$ tail /var/log/syslog
The Autocompleter.Local in the Script.aculo.usPrototype-addon is quite nice. It can be used to get type-ahead into a field if you have a local JavaScript Array. I wanted to extend the functionality to have it behave as a Combobox, which is like a Select with a text input field. Here is how I did it, be advised it has some bugs, let me know if you have a better solution!
var Combobox={};
Combobox.Local=Class.create(Autocompleter.Local,{
initialize:function($super,element,update,array,options){
$super(element,update,array,options);
this.options.minChars=this.options.minChars||0;
Event.observe(this.element,'click',this.onClick.bindAsEventListener(this));
},
onClick:function($super,event){
if(Event.element(event).id){
if(this.active){
this.hasFocus=false;
this.active=false;
this.hide();
}else{
this.activate();
this.render();
}
return;
}
$super(event);
}
});
The CSS I use is a modified variant of the Autocompleter.Local wiki page:
.combo {
background-image:url(combo_select2.gif);
background-repeat:no-repeat;
background-position:right top;
margin-right:10px;
}
I just followed Julian’s excellent guide and it worked! Even though the guide was for previous versions of both Notes, Ubuntu and Wine, I did not have to make any additional steps to get it working. All programs works, I haven’t found anything that is broken (yet), and it’s great having the Designer ”directly” in Ubuntu instead of firing up VirtualBox.