Mittwoch, 4. Juli 2012

TCL for Pascal

TCL (Tool Command Language) is a scripting language widely used as integrated scripting engine. Some time ago I wrote a tool to remote control an EZ-USB chip via USB (soon to be published). It offers a command line interface using GNU Readline and TCL.

Since TCL is implemented in (plain) C, its headers had to be translated to be used with Pascal. I've also added an object-oriented wrapper. Please find the source code at https://github.com/hansiglaser/pas-tcl.

Dienstag, 3. Juli 2012

GNU Readline for Pascal

The GNU Readline library is used to prompt the user for textual input at the terminal. It provides features like a history and completion. When you work at the terminal, e.g. with the bash shell, you are actually using Readline during typing and acquiring previous input lines from the history.

GNU Readline is implemented in (plain) C. To use it with Pascal, I've translated the C headers and added an object-oriented wrapper. Please find the source code at https://github.com/hansiglaser/pas-readline.

Samstag, 23. Juni 2012

Raspberry Pi

Last Thursday, 2012-06-21, the Raspberry Pi has arrived. :-)


The first thing is that I ordered three at Farnell to sell to friends and to share shipping cost. Unfortunately, they reduced the order to a single piece. The guy on the phone explained, that everybody is limited to one device only. So be prepared to spend extra shipping cost.

To play with it, I followed the instruction in the Quick Start Guide. Therefore I downloaded the Debian Squeeze image and copied to an SD card. Then I connected the Raspberry Pi to my monitor, plugged in the ethernet cable, mouse and keyboard and used the power supply of my Samsung Galaxy 3 (note: not S3!) and there we go. It booted like a charm and shows its IP address at the screen.

To access the Raspberry Pi via SSH, you first have to generate a host key. Therefore run the commands

sudo dpkg-reconfigure openssh-server

which will also start the SSH server.

Next, I started the X Windows system by

startx

and got the LXDE desktop environment. The browser is "Midori" and the "LXTerminal" can be used for command line interface. I used "aptitude" to install the packages "vim-gtk" for a powerful editor, "fp-compiler" for a powerful programming language and "scrot" to make screenshots as suggested here. Note that the "scrot" package was not available originally, but after changing /etc/apt/sources.list to use the ftp.at.debian.org mirror and pressing the [U] key in "aptitude", it was there.

Most important thing? Write a Hello World! program, once in FreePascal, once with GCC. :-)

So, what next?

T6 Manager

The T6 Manager is a GUI frontend to manager your trainings performed with the Suunto T6 training computer. It uses LibT6 (included) to communicate to the T6 and to download the training logs. These are stored on disk for later reference. Each training log can be displayed. The heart rate, altitude and distance (and speed) data are visualized.

SourceForge.net Project

Donnerstag, 31. Mai 2012

k7103-USB

Several years ago I wrote a GUI frontend for the Velleman k7103 PC Storage Oscilloscope.

K7103 picture          K7103 Frontend

The DSO is connected to the PC with a parallel printer cable. Most modern PCs don't have this interface any more. USB to Parallel converter cables don't work as interface because special control signals are used by k7103.

Therefore I developed a USB interface for k7103. k7103-USB is a dedicated interface with direct connection to the internal signals of the k7103. It offers all features of k7103 as available with the parallel printer cable. Additionally, an increased bandwidth for the data transfer of the sampling RAM to the PC is achieved. The K7103 frontend is extended with an appropriate driver for the new USB interface. It achieves approx. 70 acquisitions per second at my Core-i7 at 2.8GHz.

An additional PCB (100x76mm) is inserted into the k7103 case and connects to several digital chips of the k7103 PCB. k7103-USB mainly contains a Cypress AN2131Q EZ-USB 8051 microcontroller (MCU) and a Xilinx XC9572-PC84 CPLD.

Find more information on the GUI frontend and the k7103-USB hardware at http://k7103.sourceforge.net/.

Donnerstag, 17. Mai 2012

Colorful svn diff

How to get a colorful svn diff?

First install the program colordiff.

aptitude install colordiff

Now SVN must be told to use colordiff, so edit your ~/.subversion/config and add the line

diff-cmd = colordiff

in the [helpers] section (usually there is a commented template you can use). Now the output of

svn diff

will be a colorful representation of your changes.

However, this creates one problem when piped to less, because it shows the escape characters with caret notation. Therefore the command line parameter -R is used to display ANSI color escape sequences as colors. Set the environment variable LESS with this option.

export LESS="-R"

One more improvement: less wraps the lines at screen width which is often not desired. Therefore use the switch -s to get a line-by-line output. For a permanent setting, put

export LESS="-sR"

to ~/.bashrc or system wide to /etc/bash.bashrc.

One more tip: A recursive search in an SVN working copy with grep also reveals occurences in the internal "backup" files. Therefore the following alias excludes the .svn subdirectory (and backup files of your editor and compiled Python files).

alias rsgrep='rgrep --exclude-dir=.svn --exclude=*~ --exclude=*.pyc'

Sonntag, 5. Februar 2012

LaTeX \boldsymbol and \package{struktex}


The LaTeX package "struktex" for drawing structograms break the "\boldsymbol" command, which is used for bold letters in math mode. A little investigation shows that the sub-package "struktxf" does some font magic to define the commands \nat, \integer, ... Fortunately this sub-package doesn't define anything if the command "\nat" is already defined.

To re-enable "\boldsymbol" simply define the command "\nat" before using the package "struktex".
% Struktogramm
\def\nat{}   
\usepackage{struktex}