Uncategorized

SVN Hooks

Hi there, within a big php project you make typos. here is a small prehook script for svn that will actually prevent commits with several common and annoying mistakes:

  • Spaces in filenames
  • Spaces prior to the first <?php tag
  • PHP Short Tags
  • windows line endings

[bash]#!/bin/bash

# configuration
DO_DOS_FILE_CHECK=1
DO_SPACE_FILE_CHECK=1
DO_PHP_SHORT_TAG_CHECK=1
DO_SPACE_BEFOR_PHP_CHECK=1

REPOS=”$1″
TXN=”$2″

SVNLOOK=/usr/bin/svnlook
TMPFILE_ORIG=/tmp/svnhook_$TXN
TMPFILE_UNIX=/tmp/svnhook_unix_$TXN

FILES=`$SVNLOOK changed “$REPOS” -t “$TXN” | sed -r ‘s/^[D].*$//;s/^[AU]{1,2}s+//’`
DOS_FILES=””
SPACE_FILES=””
PHP_SHORT_TAG_FILES=””
SPACE_BEFOR_PHP_FILES=””

IFS=$’n’

for FILE in $FILES
do
LAST=${FILE#${FILE%?}}

# echo “FILE = ‘$FILE'” >&2

if [ “$LAST” = “/” ]; then
continue
else
if [ -n $DO_SPACE_FILE_CHECK ]; then
# space in filename check
SPACE_VIOLATIONS=`echo “$FILE” | grep -l ” “`

if [ -n “$SPACE_VIOLATIONS” ]; then
SPACE_FILES=”$SPACE_FILESn$FILE”
continue
fi
fi

$SVNLOOK cat “$REPOS” -t “$TXN” “$FILE” > $TMPFILE_ORIG || continue

if [ -n $DO_DOS_FILE_CHECK ]; then
# check windows line endings
VIOLATIONS=`grep -cIls $’r$’ $TMPFILE_ORIG` >&2

if [ -n “$VIOLATIONS” ]; then
DOS_FILES=”$DOS_FILESn$FILE”
fi
fi

if [ -n $DO_PHP_SHORT_TAG_CHECK ]; then
# check php short tags
VIOLATIONS=`grep -rn ‘&2
if [ -n “$VIOLATIONS” ]; then
PHP_SHORT_TAG_FILES=”$PHP_SHORT_TAG_FILESn$FILE: $VIOLATIONS”
fi
fi

if [ -n $DO_SPACE_BEFOR_PHP_CHECK ]; then
# check for space prior to php tag
VIOLATIONS=`head -n 1 $TMPFILE_ORIG | grep ‘^s&2
if [ -n “$VIOLATIONS” ]; then
SPACE_BEFOR_PHP_FILES=”$SPACE_BEFOR_PHP_FILESn$FILE”
fi
fi
fi
done

rm -f $TMPFILE_ORIG
rm -f $TMPFILE_UNIX

if [ “$DOS_FILES” != “” ] || [ “$SPACE_FILES” != “” ] || [ “$SPACE_BEFOR_PHP_FILES” != “” ] || [ “$PHP_SHORT_TAG_FILES” != “” ]; then
echo -e “n” >&2
if [ “$DOS_FILES” != “” ]; then
echo “ONLY UNIX LINEENDINGS ALLOWED!!!” >&2
echo “the following file contains Windows / Mac Lineendings:” >&2
echo -e $DOS_FILES >&2
echo -e “n” >&2
fi

if [ “$SPACE_FILES” != “” ]; then
echo “SPACES ARE NOT ALLOWED IN FILE / FOLDER NAMES!!!” >&2
echo “the following file contain spaces:” >&2
echo -e $SPACE_FILES >&2
echo -e “n” >&2
fi

if [ “$SPACE_BEFOR_PHP_FILES” != “” ]; then
echo “SPACES ARE NOT ALLOWED BEFOR THE PHP TAG IN THE FIRST LINE!!!” >&2
echo “the following file contain spaces:” >&2
echo -e $SPACE_BEFOR_PHP_FILES >&2
echo -e “n” >&2
fi

if [ “$PHP_SHORT_TAG_FILES” != “” ]; then
echo “SHORT PHP TAGS ARE NOT ALLOWED!!!” >&2
echo “the following file contain short tags” >&2
echo -e $PHP_SHORT_TAG_FILES >&2
echo -e “n” >&2
fi

exit 2
fi

# All checks passed, so allow the commit.
exit 0
[/bash]

Uncategorized

Kubuntu 11.04 Upgrade “no init found. try passing init= bootarg”

Hi there,

yesterday I did a small dist upgrade that actually bricked my system. The only thing I was able to reach was busybox which told me after invoking “sh init”

mount none failed for /dev, device busy
mount none failed for /sys, device busy

Booting from a Live CD showed that I was indeed able to mount the partitions without any trouble. Invoking update-grub or update-initramfs did’t improve the situation.

What finally worked was to disable the raid autodetect in grub:

raid=noautodetect

Thanks to that my system boots and I can finally work again on some real stuff 🙂

Uncategorized

Die Wand muss weg!

Vor 2 Wochen war es soweit – mit Schlagbohrmaschine, Vorschlaghammer und Hacke gingen wir auf die Wand los. Das Team: Willi, Sara, Klaus (Vater von Sara) und ich.

Fotos sagen mehr als 1000 Worte:

Ein paar Überraschungen gab es:

  • Man sollte nicht zu viel in ein Auto verladen – sonst nehmen einen die “normalen” Mistplätze in Wien nicht und man muss zur Deponie fahren die wiederum 69€ pro Tonne Bauschutt verlangt (die ganze Wand waren in etwa 4 Tonnen)
  • Auch wenn der Vorbesitzer sagt er hat überall neue Kabeln eingezogen jedes Kabel prüfen! Wir haben ein ganzes Bündel alter Kabel entdeckt die verschiedenste Verwendungszwecke haben (Steckdose Wohnzimmer + Küchenlicht + hintere Steckdose im Arbeitszimmer)
  • Ziegelwände gehen weit hinauf… (aber zum Glück nicht so weit wie befürchtet)
  • Gipskarton Platten findet man überall (hier im alten Türstock)

An alle die mitgeholfen haben: DANKE! Ohne euch wäre es nicht gegangen – und ganz fertig sind wir ja eh noch nicht.

Uncategorized

A1 Developer Challenge

Liebe(r) Michael Schramm,

die A1 Challenge for Apps 2010 steuert auf das große Finale zu. Im Rahmen des Prämierungseventswerden am 3. August 2010 aus den 78 eingereichten Österreich-Apps die Sieger gekürt.

Das Prämierungsevent findet am 3. August 2010 um 18.30 Uhr im A1 Shop – Mariahilfer Straße 60, 1060 Wien – statt.

Da Du Deine App erfolgreich eingereicht hast, möchten wir Dich herzlich zum Prämierungsevent einladen. Bitte melde Dich im Login-Bereich auf  www.a1innovations.at an. Die Anmeldung für den Prämierungsevent läuft bis Sonntag den 1. August um 23.59 Uhr MEZ.

Wir freuen uns jetzt schon auf Dich und sämtliche Gewinner …. und natürlich auf die Sieger-App für Österreich!

Dein A1 Challenge Team

jetzt bin ich schon gespannt ob meine App gut genug war / ist 🙂

Falls ihr sie noch nicht gesehen habt: http://code.google.com/p/railticket/ (für Android)

Uncategorized

Its working!

A few days ago I started to have problems with my nvidia graphics… Every reboot meant reinstalling nvidia drivers (almost every reboot)

Yesterday I just tought: well everything should be better with 2.6.35, why not give it a try? Doing that yesterday evening was a bad idea since the initramfs package was brocken. (I shouldn’t expect much more in the current ubuntu maveric repos)

Today the package was fixed and I can at least start the system. Right now I’m not using any Xorg file and have the screen running at 1920×1080. Unfortunately I fell the absence of 3d acceleration :(.

The MOST IMPORTANT step this time was to ditch grub2 in favor of grub1. This solved almost all problems with one try.

I’ll post more once I’ve found out anything else!

EDIT:

  • BAD: No sound

EDIT 2:

  • apt-get purge pulseaudio and sound is working again 🙂
Uncategorized

Long day…

Hi there – today I switched to the 2.6.32.23 and updated the nvidia driver to 195.36.31, till now everything seems to work + the temperature of the graphics card (in nvidia-settings) dropped from ~80°C to ~60°C!!! EDIT: I do not know wether it was my system but somehow it didn’t work after a reboot… With sudo apt-get install nvidia-current and an reinstallation of the nvidia driver it works again.

Besides that I found a really bad bug in a php package today:
if(sizeof($path)==0 || substr($path,-1)!="/") $path.="/";
that might look good in the first place but the moment you think about it you should realize it sets the path to / (root dir on Linux)…

To further mix stuff here is a Link to an exercise I had to do.

And the last part: if you’re interested in Android and live in Austria / or somewhere else and the railways system supports tickets by sms or a webservice, tell me! http://code.google.com/p/railticket/ << working on that one