I recently ran into the problem that my MacBook Pro (early 2011) dramatically changed the color temperature on the LCD while it changes the graphics engine from “integrated” to “discrete” (I use gfxCardStatus to make this visible).
SMC reset, NVRAM/PRAM reset (see Apple for details) did not help at all, although “Google” reported that this should help.

What actually did the trick: I had plugged in another monitor using a Thunderbolt/Displayport to DVI adapter and I assume that I switched off the MacBook in an obscure way. So I just replugged this monitor (interesting fact: It did only work again after a Windows ™ like reboot), rebooted (see before) and unplugged it again.
Now everything is working as it should …

Things you shouldn’t expect working with a Mac!


Rails Own Logger

On July 16, 2011, in Uncategorized, by tov

I was in need of a logging mechanism that prints all log messages with a “severity” that equals or is higher of “INFO” to STDOUT (I’m using multilog for actual logging stuff).

As I wasn’t able to google a solution I came up with the following (not quite elaborated) code:


class OwnLogger < Logger

    include Severity

    def add(severity, message = nil, progname = nil, &block)
      time = Time.now
        if severity >= INFO
          msg = "#{$$}:#{SEV_LABEL[severity]}:" + time.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec + ":"
          if message.nil?
            if block_given?
              message = yield
              message = progname
              progname = @progname

            msg += message.to_s
            puts msg


So if you put the following lines in your /config/application.rb you’ll get what I got :-)

config.logger = OwnLogger.new(File.dirname(__FILE__) + "/../log/#{ENV['PROCNAME']}#{Rails.env}.log")

AND (most important) you’ll still have the “normal” logfile containing all messages


Schuhmacherei Janisch

On July 12, 2011, in Empfehlungen, by tov

Schamlose Werbung :-)

Wenn Ihr liebgewordene Schuhe mal nicht wegwerfen sondern lieber reparieren lassen wollt und zufällig in der Nähe von Solingen seid, dann besucht doch mal die Familie Janisch.

Die erledigen das dann für Euch…

Details unter Schuhmacherei-Janisch.de

Klare Empfehlung von mir!

Tagged with:  

Just took me 2 hours of Googling…

I found:

[…]The value of the last SERIAL insert is stored in the SQLCA record, as the second entry in the sqlerrd array. Brian’s answer is correct for ESQL/C, but you haven’t mentioned what language you’re using.
If you’re writing a stored procedure, the value can be found thus:
LET new_id = DBINFO(‚sqlca.sqlerrd1‘);
It can also be found in $sth->{ix_sqlerrd}[1] if using DBI
There are variants for other languages/interfaces, but I’m sure you’ll get the idea.

I got the idea and have created the following procedure (obsolete… Please see below)

RETURNING integer;
DEFINE lastid integer;
LET lastid = DBINFO(‘sqlca.sqlerrd1’);
RETURN lastid;

So to get the latest column you just use

select lastid() from table(set{1})

btw.: If you want to make use of this in Rails, I’d some success with:

class InformixConnect < ActiveRecord::Base
self.abstract_class = true
establish_connection :development_informix

def save
self.id = self.connection.select_value(“select lastid() from table(set{1})”)


so a model like

class Customer < InformixConnect


would be able to connect to Informix and to get correct values from the DB without the
usage of sequences!

Unfortunately the stuff above (overwriting the save method) does not work for some reasons.

I have patched

class InformixAdapter < AbstractAdapter

def prefetch_primary_key?(table_name = nil)

def insert(sql, name= nil, pk= nil, id_value= nil, sequence_name = nil)
select_value(“select lastid() from table(set{1})”)



This works!


Found another solution that works also with serial8 columns:

CREATE PROCEDURE lastid_both ()
RETURNING integer;
DEFINE lastid_1 integer;
DEFINE lastid_8 integer;
LET lastid_1,lastid_8 = DBINFO('sqlca.sqlerrd1'),DBINFO('serial8');
IF lastid_1 == 0 THEN
return lastid_8;
RETURN lastid_1;


class InformixConnect < ActiveRecord::Base

def save(*args)
if new_record?
ret = super
pk = self.class.primary_key.to_s
tn = self.class.table_name.to_s
self.class.find_by_sql("select lastid_both() as serialid from table(set{1})").first.serialid)
Rails.logger.info("Informix received the following serial-id: #{self.id}")

ret = super

Tagged with:  

So it happened again:

Most of my application icons were broken, i.e. only visible in a very low resolution.

After googling a bit I found the following discussion:

mdi’s suggestion did the trick for me: http://discussions.apple.com/message.jspa?messageID=10296267#10296267

What I did:

  • open Terminal.app (If you never did… : Try „spotlight-search“ –> Terminal)
  • enter cd /private/var/folders
  • enter sudo find . -name “com.apple.QuickLook.thumbnailcache”|xargs sudo rm -rf

                (you will have to enter your password)

  • Restart Finder.app using „Apple-Menu–> „quit immediately (It’s „Sofort Beenden“ in German. Dunno the english term) or press
  • command+option+escape“. Chose „Finder restart“.
  • Be happy :-)

OK, to be honest I had to restart to be really happy 😐

Tagged with:  

This f…ine error message above has been thrown during a

records = Model.find(:first).

Guess why:

I made use of a legacy table that contained the attribute „type“. I just had to add a


into my model and now everything’s OK.

Rails: Do you consider this as friendly error messages?



On March 16, 2010, in Development, Programmierung, by tov

Hmmm… Kleine Fingerübung in Perl (pre-alpha :-))

Ah ja: Brainfuck: http://lmgtfy.com/?q=Brainfuck

#!/usr/bin/env perl
use Term::ReadKey;
ReadMode 'raw';
my $debug = 0;

my $code;
if ($ARGV[0]){
	{ local $/ = undef; local *FILE; open FILE, "<".$ARGV[0]; $code = ; close FILE }

$code ||=
--------- . -------.>++++[<+++++>-]<+.>++++++++++.";

$code =~ s/[^\.,+-\[\]<>]//msg;
$| = 1;
my @val;
@val[ 0 .. 29999 ] = (0) x 30000;
my $vpt = 0;
my @ls;
my @le;
my $lpt = 0;
my $cc  = 0;
my @c   = split( '', $code );
my $nc  = @c;
while ( $cc < $nc ) {
    $_ = $c[ $cc++ ];
    print "vpt:$vpt \$val[\$vpt]"
      . $val[$vpt]
      . " loop_counter:$loop_counter loop(counter)_start:"
      . $ls[$loop_counter]
      . " loop(counter)_end:"
      . $le[$loop_counter]
      . " cc:$cc command:$_\n"
      if $debug;
    // and do { $vpt < @val and $vpt++; next };
    /\+/ and do { $val[$vpt] = $val[$vpt] + 1; next; };
    /\-/ and do { $val[$vpt] = $val[$vpt] - 1; next; };
    /\./ and do { print chr( $val[$vpt] ); next; };
    /\,/ and do { $val[$vpt] = ord( ReadKey 0 ); next; };
    /\[/ and do {
        if   ( $val[$vpt] ) { $ls[ $lpt++ ] = $cc - 1 }
        else                { $cc = defined $le[$lpt] ? $le[$lpt] : (index($code,']',$cc)+1) }
    /\]/ and do {
        $le[ --$lpt ] = $cc;
        $cc = $ls[$lpt];
print "\n";


Blogging via MacJournal

On March 10, 2010, in Apple, by tov

Ich konnte dem aktuellen http://www.macheist.com Nano-Bundle natürlich doch nicht widerstehen. Monkey-Islands war eine Versuchung wert und vor allen Dingen Tweetie 2.0.

Jetzt habe ich auch noch MacJournal dazu bekommen und bin eigentlich ziemlich begeistert.

  • Blogging mit einem vernünftigen Client
  • Verschlüsselung privater Einträge
  • Export von Einträgen als HTML, PDF etc.
  • Volltextsuche via Spotlight.
  • Synchronisation via Mobile-Me (muss noch TeamDrive ausprobieren)

Und alle so „Yeah“!

P.S. Und die Probleme von Safari mit WordPress brauchen mich jetzt auch nicht mehr zu kümmern


Spendenaktion für Haiti

On January 15, 2010, in Politics, by tov

@johnny von Spreeblick hat eine Spendenaktion für die Erdbebenopfer von Haiti in’s Leben gerufen.

Nicht, dass es nicht auch andere Wege des Spendens gäbe, aber das Problem ist ja (und das löst sich durch solche Aktionen halt), dass “man” (ja, auch ich) in der Regel den A… ja nicht hochkriegt.

Also: Wenn Ihr Eure Kontonummer noch kennt, einfach mal auf obigen Link clicken!

Danke sehr!


How to delete an LVM snapshot

On December 21, 2009, in Hosting, Linux, by tov

Problem: Centos did not boot after a failure with an LVM snapshot.

It got stuck at:

Setting up Logical Volume Management: (part of rc.sysinit)


1) grub “e” (to edit the first line)
2) append “init = /bin/bash” to kernel parameters
3) boot (Enter, “b”)

(append “Single” should work as well but it didn’t as far as I remember)

1) mount / -o remount (enables rw mode)
2) vi /etc/lvm/lvm.conf
3) replace
locking_dir = “/var/lock/lvm”
locking_dir = “/tmp”
(this is because “lvremove” does not recognize the –ignorelockingfailure parameter)
4) cd /sbin
5) ./lvm.static lvdisplay –ignorelockingfailure (not sure if this param is necessary after editing lvm.conf)
6) Find the snapshot path: /dev/your_volumegroup/your_logical_volume_snapshot
7) remove: ./lvm.static lvremove /dev/your_volumegroup/your_logical_volume_snapshot
8) reboot
9) be happy as it works now!

10) ask yourself if you should have re-edited lvm.conf…

I have forgotten to do so but as “/tmp” is more or less recommended in lvm.conf.

Hope that helps either people or me (in future).