Matthew Baldwin has written a great article on how cyclists and motorists can coexist on the road.
High Dynamic Range (HDR) photos try to capture a higher contrast between the lightest and the darkest parts of a picture (see wikipedia). You would normally need a special camera for taking HDR pictures, but you can imitate the effect by taking multiple pictures (>=3) with different exposures. Typical consumer cameras have only very recently introduced automated procedures for taking pictures with different exposures. Hackers have retro-fitted this capability to much older compact cameras such as my Canon IXUS 100IS. Using the alternative firmware CHDK you can run a script that creates the necessary 3 exposures. ( I’ve blogged about CHDK and how to install it before).
So this is the result and it quite impressive in comparison to “reality”
:

When working with lots of remote machines it’s sometimes necessary to reboot them. Then it’s always a pain to wait for them booting up. If the machines have extra interface cards, e.g. RAID, you have to sit there for a while until the machine becomes usable. So being a geek, I made a (Windows) script:
This script requires cygwin on windows and you should install it’s ping implementation — the windows version doesn’t return with an error if the host in unreachable. You also have to run it as an administrator on windows, because it needs these privileges to open a socket.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function waithost() {
if [ -n "$1" ]; then
ping localhost 1 1 > /dev/null
if [ $? -eq 0 ]; then
while ! ping $1 1 1 &>/dev/null; do sleep 5;echo -n .; done
messagebox.sh "Host $1 is reachable now!"
else
messagebox.sh "Error: Need admin privileges!"
fi
else
messagebox.sh "Error: No host parameter given!"
fi
} |
Here’s the script to show the messagebox:
The popop.bat only contains this:
And here’s the final tidbit, a visual basic script to show a messagebox.
This comes in handy in other situations, too. For instance you can schedule an alarm with Windows’ task scheduling:
This script will display a messabox with the text “Lunch” every day at noon. You can choose much more refined date schedules or intervals. Here’s the documentation.
Found at Faust.
I’m still adding little features and working on the design of my lunch organizer app. I’ve added nice javascript widgets for handling the input of dates and times. jQuery UI is a nice library that is the UI extension of the excellent jQuery library. Among many other things it features a very nice widget for picking dates:
Although the HTML5 input type “date” hopefully brings us the functionality with simple HTML, we have to settle for this version for now (only Opera displays a special widget for the “date”-type). Unfortunately there’s no default widget for time fields in jQuery UI. I’m not sure why that is so. Maybe it’s selection process is a bit slow? I’ve looked at a number of widgets for choosing time and it’s very refreshing to see how many interesting approaches have been invented for this:
- François Gélinas’ timepicker
- Maxime Haineault’s inventive approach
- Anders Fajerson’s simple time picker inspired by google calendar
- Keith Wood’s take, which reminded me of Qt’s QTimeEdit
In the end I chose the excellent widget by François Gélinas.
When you download jQuery UI, you can pick and choose which functionality you need. There’s a simple form, so you can minimize the size of the scripts each user has to download. The full package is over 1MB, thus this is really necessary. The simple selection with the datepicker and the position library is only 75KB (+25 KB for the images). The timepicker weighs in at an additional 60KB, which should still be tolerable.
The default size of the datepicker is much too big and it’s not very obvious how you can reduce it. Fortunately the always helpful stackoverflow comes to the rescue. Add this simple style to your stylesheet and you will get nicely size date widgets:
The same technique works for the timepicker:
The next problem I had with these widgets were their default positions. Their default is just below the input field at its lower left corner. That way the datepicker covers the rest of the form and lowers the user experience. Of course there’s a stackoverflow page that helps with that, too:
|
1 2 3 4 5 6 |
$("#id_date").datepicker({
dateFormat: "yy-mm-dd",
beforeShow: function(input, inst) {
inst.dpDiv.css({marginTop: - input.offsetHeight + 'px', marginLeft: input.offsetWidth + 2 + 'px'});
}
}); |
For the timepicker there’s not such an easy way, but it has two position attributes that let me achieve the same effect (at least in Chrome):
|
1 2 3 4 5 6 |
$("#id_time").timepicker({
showPeriodLabels : false,
myPosition: 'right bottom',
atPosition: 'left bottom',
hours: { starts: 11, ends: 14 }
}); |
When using the datepicker with Django, I had to make use Django’s id format. It’s always “id_
|
1 2 3 4 5 |
<link type="text/css" href="/media/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/media/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/media/js/jquery-ui-1.8.20.custom.min.js"></script>
<link type="text/css" href="/media/css/jquery.ui.timepicker.css" rel="stylesheet" />
<script type="text/javascript" src="/media/js/jquery.ui.timepicker.js"></script> |
UPDATE: The new code is available at github. I’ve also added the ability to delete entries and I am preparing to add permissions and user management soon.
Isn’t it funny how old ads seem so nice and candid and harmless in comparison to today’s annoying ads?
Also who would really like to drink beer from fishermen. Would they make it with sea water? That’s not such a great idea…
Recent Posts











