Scharfe Kartoffelsuppe

1,5 kg Kartoffeln. 4 kleine Pfaumen-Tomaten. 2 gut angetrocknete Pepperoni. 2 Zehen Knoblauch. 2 Tassen Bruehe (irgendeine). 300g Gelderlaender Speck. Speck gut anbraten, mit Bruehe und Kartoffeln ansetzen und dann den Topf mit Wasser auffuellen, bis die Kartoffeln abgedeckt sind. Wenn die Kartoffeln gar sind, einen Teil der Kartoffeln herausnehmen und durch die Muehle schieben/stampfen. Kartoffelbrei wieder zur Suppe geben.

Aus der Reihe: was kochen wir demnaechst?

Einige Photos von der Mahlzeit die es heute gab. Testlauf fuer den naechsten grossen Kochtermin. Die Photos sind leider so dunkel, das das meiste der Phantasie ueberlassen bleibt.

Farro-Gurke-Tomate. Fazit: Farro auf jeden Fall anroesten.

Photo0029

Russische Eier mit Blauschimmel-Creme und Kapern. Fazit: zu geballt, evtl. Gemuese dazu. Auf jeden Fall warm servieren, sonst ist der Kaese Geschmack zu wenig intensiv.

Photo0034

Lachs, Spinat, Ricotta-Gnocchi mit Bagna Cauda. Fazit: Bagna Cauda ist gross.

Photo0028

Griesspudding mit einem Spritzer Zitrone. Fazit: Luftig wie immer. 75g Griess, 0.5l Milch, ein Ei.

Photo0032

APOD to Desktop Wallpaper

Recently I had a meeting with one of our customers. I was setting up my laptop, plugging it into the beamer. Immediately the customer raised a brow. The beamer was showing a gorgeous HD image of the deepwater horizon oil rig blowing up. The following smalltalk was interesting.

I decided to show some nicer images the next time I'd meet them and this evening I got around to writing a little Perl snippet to download the Astronomy Picture of the Day from http://apod.nasa.gov and set it as the Windows wallpaper. It uses LWP::get to fetch the main page. It fiddles with the text and downloads the linked image to $dlbase, finally using Win32::API to call SystemParametersInfo to set the background.

Be warned: during testing not every valid .jpeg actually would display as a desktop wallpaper. Another thing is that you really want to specify an absolute path, when calling SystemParametersInfo, or it wont display correctly after logging out and back in again, hence the $dlbasew variable.

#!/usr/bin/perl
use strict;
use warnings;

use Win32;
use Win32::API;
use LWP::Simple;
require Carp;

# for both constants see winuser.h

use constant SPI_SETDESKWALLPAPER  => 20;
use constant SPIF_UPDATEANDSENDINI => 3; # SPIF_UPDATEINIFILE || SPIF_SENDWININICHANGE

my $apodbase = 'http://apod.nasa.gov/';
my $dlbase = 'c:/Users/mmeyer/Downloads';
my $dlbasew = 'c:\\Users\\mmeyer\\Downloads\\';

chdir $dlbase or die "Couldnt chdir to $dlbase: $!";

my $content = get($apodbase) or die "Couldn't download image: $!";

Carp::croak 'Content doesn\'t match' unless $content =~ m/<IMG SRC="(.*)"/g;

my $urlend = $1;

Carp::croak 'No url found' unless $urlend =~ m|([^/]+)$|;
my $targ = $1;

my $status = getstore($apodbase . $urlend, $targ);
Carp::croak "Couldn't store image: $status" unless is_success($status);

my $spf = Win32::API->new('user32','SystemParametersInfo', 'IIPI', 'I')
  or Carp::croak "Could not import function.\n";

$spf->Call(SPI_SETDESKWALLPAPER, 0, $dlbasew . $targ, SPIF_UPDATEANDSENDINI)
  or Carp::croak "Could not set wallpaper:\n" . Win32::GetLastError();

exit;

See here: https://github.com/ofosos/scratch

Simple Mojolicious RSS feed

At work we're thriving to conform to the ITIL guidelines. This entails a detailed change management for our infrastructure. Change dates, authors and possible impact are tracked in our Technical Change Management System.

This is all nice and shiny, but how do you get this information to the individual administrator? To put it politely, the interface itself doesn't invite casual browsing. However that's a technical problem. And this time the solution was to write a simple Perl script using Mojolicous. Mojolicous documentation is sparse at the moment, but the cheat sheet contains a note about simply calling

$self->render(format => 'rss');

during the render. I did just that, supplied a proper rss template and it just worked out of the box. The following code just dumps some test data into port 80.

use Mojolicious::Lite;

use strict;
use warnings;

my $data = [
  { author => 'Mark', title => 'Post to blog', description => 'Yadda.',
    date => 'Wed, 02 Oct 2002 13:00:00 GMT'},
  { author => 'Mork', title => 'Scratch an itch', description => 'Yadda',
    date => 'Wed, 02 Oct 2002 15:00:00 +0200'},
  ];

get '/changefeed' => sub {
    my $self = shift;

    $self->stash('items', $data);

    $self->render(format => 'rss');
    $self->render('changefeed');
};

app->start;

__DATA__

@@ changefeed.rss.ep
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">

  <channel>
    <title>The Internation House of Mojo</title>
    <link>http://houseofmojo.com</link>
    <description>Current changes in our IT</description>
    <copyright>The Witch</copyright>
    
% foreach my $item (@$items) {
    <item>
      <title><%= $item->{title} %></title>
      <description><%= $item->{description} %></description>
      <author><%= $item->{author} %></author>
      <pubDate><%= $item->{date} %></pubDate>
    </item>
% }

  </channel>
</rss>

Testing is simple, save it to changefeed.pl and hit

perl changefeed.pl daemon

The above fragment is half code, half template. Even for someone who is dead set against using a framework for web development this is a good ratio. Of course Mojolicous tagline is to grow your application organically by introducing advanced concepts as you go.

If you want to generate the data from the database, the gotcha is to generate an RFC822 date. You can do this either by using DateTime::Format or you can format the date right in the database. I prefer the latter. In MS SQL Server this looks like the following.

left(datename( dw, your_date_column ), 3 ) + ', ' +
convert( varchar(20), your_date_column, 113 ) + ' GMT' as date

No comment.

I make smoke

Several mothes ago - I think - I build a Kemo B102 power supply kit, but didn't get along to set it up and test it. Today I connected it to a transformer and... woosh. Smoke. Darn.

After a minute of looking at the faulty circuit it was clear that I connected the LM 317 in the wrong way. Luckily I had a second kit lying around that was swiftly soldered and tested. I'm rather happy to tell you that it works. The original circuit was specified for a 24V transformer, while I'm using a 15V transformer, so basically I need to do some tweaking the resistors to get the pot to tune over the full range of 0..20V.