programming

Raspberry PI with HD44780 LCD and I2C Interface Board

Sven Bachmann
After buying an HD44780 compatible LCD together with an I2C interface board (which has an PCF8574T soldered on it) I tried to output some text in C on it but the display just stayed black - or after changing some GPIOs, it stayed blue. I measured every pin of the PCF8574T and got the following scheme: PCF8574T <-> HD44780 P0 -- RS P1 -- R/W P2 -- EN P4 -- DB4 P5 -- DB5 P6 -- DB6 P7 -- DB7 R/W should be mapped to GND if the HD44780 should not talk back to the CPU.

UDP and netcat are no friends

Sven Bachmann
After a long debugging session with an UDP logger I had to find out, that netcat is incapable to receive more than 1024 bytes via UDP at once. Seems this problem is at least known since 2010-02-16 but I wasn’t able to find a solution for this (the trick with sysctl as suggested in the answer to the linked question won’t work with linux). So for now I implemented a solution which divides the UDP output into 1024 byte chunks which seems to work fine.

Embedded Lua-Script into C

Sven Bachmann
This weekend, I played around a bit with Lua and C. My aim was to understand the Lua basics, embed the script engine into C and be able to even call a C function from Lua. With Google and a lot of documentation spread around the web this was a fairly easy task. The result are 2 short files. First file is the C-code main.c which initializes Lua, registers the C-function which will be later called by Lua and then executes the Lua-script.

Bastelprojekt Katzenkamera

Sven Bachmann
Christian und ich haben mal wieder gebastelt. Was dabei rauskam? Eine Katzenkamera die auch im Dunkeln sieht und “Social” ist. Die eigentliche Kamera selbst ist eine Logitech Quickcam die per USB angeschlossen ist. Für die Übertragung des Bildes und das Erstellen von Schnappschüssen hat sich das Tool motion als brauchbar erwiesen. Um die Katze auch im Dunkeln beobachten zu können brauchten wir noch Licht. Da normales Licht die Katze gestört hätte, fiel die Wahl auf Infrarot.

git: Clean .gitignore(d) files from Repository

Sven Bachmann
To keep a repository clean from temporary files, git users can create a file named .gitignore and define wildcards or absolute paths to let git ignore these files. This works for the most users as expected but it does not remove already checked in files. If you also want to clean up your existing repository from these ignored files, there is an easy way to get a list of ignored files.

OpenWrt: Split Toolchain for faster Firmware Build Times

Sven Bachmann
At work we’re using Hudson to automatically build projects whenever something is changed in a SCM. For most projects you’ll get fast results if your checkin breaks something which you don’t mind because you not always rebuild the complete project. Now, OpenWrt brings its own toolchain, which compiles the complete local and cross-compiling stuff because the compiler on the host is normally a bit behind and does not contain latest fixes for ARM and other architectures.

Syntax Highlighting in HTML mit VIM

Sven Bachmann
Hin und wieder möchte ich ein Stück Quellcode online stellen und dies nach Möglichkeit auch mit Syntax Highlighting. Unter Wordpress gibt es dafür Plugins, jedoch für meine normale Website hatte ich dafür noch kein PHP Tool und so machte ich mich auf die Suche nach statischen Renderern, obwohl die Lösung zum Greifen nah lag.Mein bevorzugter Editor VIM besitzt selbst ja ein sehr gut funktionierendes Syntax Highlighting - also müsste man dieses jetzt noch in HTML-Form bringen.

make: just a remark for filter-out

Sven Bachmann
In Makefiles there is a nice command, called filter-out. This command takes 2 Arguments: first, the needle you want to filter out, second the haystack where it is in. This was exactly what I needed. But everytime I tried it, it returned an empty string. The solution was too easy… make doesn’t complain if you write it with an underscore instead of a hyphen - and in makepp its written with a dash, so you will also get good looking Google results :-)

JavaScript: numbers with decimal (thousand) separator

Sven Bachmann
Today, I needed a JavaScript function that converts a number like 1234567 to something more beautiful like 1.234.567. And because I didn’t need to take notice of locale settings (like using a comma instead of a dot) most solutions on the web where just too much for me and I decided to write my own.Mainly its a 3-liner, but packed in a function it becomes a little more. Feel free to use it for your own: