Monthly Archives: January 2016

Java JTable


Java – Swing – JTable – Set Color for Selected Row, but not Cell
Trying to color specific cell in JTable… getTableCellRendererComponent Overide
change background color of row in jtable after selection
color selected row in jtable by another color
Swing JTable – Highlight selected cell in a different color from rest of the selected row?


Adding rows to JTable in the right order.


How to scroll to last row in a JTable
JTable autoscrolling to bottom problem
JTable autoscroll to the bottom in Java (not working properly!)


Java Tip 77: Enable copy and paste functionality between Swing’s JTables and Excel
JTable copy and paste using Clipboard and AbstractAction
Clipboard copy and paste
Copying to Clipboard in Java


Adding a row to a jTable on downarrow at bottom

Linux Kernel Development: Modules

Module Parameters
Passing Command Line Arguments to a Module
How do I list loaded Linux module parameter values?

cat /proc/modules | cut -f 1 -d " " | while read module; do \
 echo "Module: $module"; \
 if [ -d "/sys/module/$module/parameters" ]; then \
  ls /sys/module/$module/parameters/ | while read parameter; do \
   echo -n "Parameter: $parameter --> "; \
   cat /sys/module/$module/parameters/$parameter; \
  done; \
 fi; \
 echo; \

C# and .NET (C sharp and dotNET)


Visual Studio Express or shortcut: Visual Studio Express
Visual Studio Editions
ic#code SharpDevelop
Free C# (csharp) compiler for Windows 7 and Windows 8 (Microsoft Visual Studio Alternative)

Open Source

Mono Project


.NET Framework
Common Language Runtime
Best way to check if a DLL file is a CLR assembly in C#

Einfache Typen

C#, int or Int32? Should I care?
Difference between int and System::Int32
ecimal vs double! – Which one should I use and when?
Get int value from enum
Cast int to enum in C#

YourEnum foo = (YourEnum) Enum.Parse(typeof(YourEnum), yourString);

YourEnum foo = (YourEnum)yourInt;

General Number:
YourEnum foo = (YourEnum)Enum.ToObject(typeof(YourEnum) , yourInt);

How to convert from System.Enum to base integer?
Enum ToString with user friendly strings
Enum value to string

Microsoft’s DataGridView

#: is there a JTable equivalent?
How to create a DataTable in C# and how to add rows?

Mono’s DataGridView

Mono is not 100% compatible with Windows .NET: example DataGridView!

Bug 9653 – DataGridView after one cell is edited crashes when selecting a second cell
Fix for issues 9653, 22297 #1486
DataGridView with ICustomTypeDescriptor looks empty on Mono
DataGridView and ICustomTypeDescriptor

Alternative: GTK

DataGridView for Linux and MonoDevelop

ADO.NET / Database Access

Database Access
SQLClient (ADO.NET Provider for Microsoft SQL Server)
MySQL C# tutorial
Connecting a MySQL table to a DataGridView control in C#

Linux Kernel Development: Network Drivers

Linux Networking Subsystem, 2004 for Linux Kernel 2.4.18
Linux Kernel Networking (Presentation), 2007 for Linux Kernel 2.6.23
A Map of the Networking Code in Linux Kernel 2.4.20, 2004


Understanding the Linux Kernel, 3rd Edition, 2005
Understanding Linux Network Internals, 2005
Linux Device Drivers, 3rd Edition, 2005

Oracle Linux: 6.7 About Network Device Drivers
linux network drivers — net_device_ops
struct net_device and net_device_ops

Understanding TCP/IP Network Stack & Writing Network Apps
Networking in the Linux Kernel
Queueing in the Linux Network Stack
Scaling in the Linux Networking Stack (TXT)
Networking › kernel_flow
Single RX queue kernel bypass in Netmap for high packet rate networking

struct net_device, struct net

what is the difference between register_pernet_subsys and register_pernet_device?
Getting list of network devices inside the Linux kernel

#include <linux/netdevice.h>

struct net_device *dev;

dev = first_net_device(&init_net);
while (dev) {
    printk(KERN_INFO "found [%s]\n", dev->name);
    dev = next_net_device(dev);

Linux Kernel Development: Proc


Creating a read write proc entry in kernel versions above 3.10
proc_create() example for kernel module
Using structures to set the functions
Driver porting: The seq_file interface Linux Training

The Kernel Newbie Corner: Kernel Debugging Using proc “Sequence” Files–Part 1



CrashCourse: An introduction to Linux kernel programming

Lesson 11: Adding “proc” files to your modules — Part 1

The Linux Kernel Module Programming Guide

2005-12-31 ver 2.6.3 for Linux Kernels 2.6.x (2.6.14)
5.3. Manage /proc file with standard filesystem

Common LISP

Unterlagen PSPP HS15


Common Lisp Quick Reference
Practical Common Lisp
The Common Lisp Cookbook
COMMON LISP: A Gentle Introduction to Symbolic Computation (PDF)
Land of LISP, No Starch Press github Source Code
Learning Lisp for CMPT 310
Implementation Notes for GNU CLISP
CLiki Common Lisp wiki
Using and Installing CLISP


Eclipse Common Lisp
CLiki: Development – Editor/IDE support
CLiki: Dandelion
CLiki: Cusp Eclipse IDE plugin
CLiki: Steel Bank Common Lisp (SBCL)
Dandelion – Eclipse Lisp Plugin Eclipse Update
Develop Lisp applications using the Cusp Eclipse plug-in
Does anyone have a CUSP plugin for Eclipse (Common Lisp)
Getting Cusp running from source
What are the good “rich” IDEs for Lisp?
LispWorks Personal Edition (free)

Common LISP

Clozure Common Lisp

5.3 The Data and Control Flow Dictionary
14.2 The Conses Dictionary

LIST (System Class)
VALUES (Accessor)
PROGN (Special Operator)
KEYWORDP (Function)
LET (Special Operator)
NULL (Function)
COND (Macro)
REDUCE (Function)


Top Level Loop
lisp, how to eliminate restarts

The following restarts are available:
USE-VALUE      :R1      Input a value to be used instead.
ABORT          :R2      Abort debug loop
ABORT          :R3      Abort debug loop
ABORT          :R4      Abort debug loop
ABORT          :R5      Abort main loop
Break 4 [6]> :q
[1]> (bye)
[1]> (exit)
[1]> (quit)


    • a. one of possibly several objects that are the result of an evaluation.
    • b. (in a situation where exactly one value is expected from the evaluation of a form) the primary value returned by the form.
    • c. (of forms in an implicit progn) one of possibly several objects that result from the evaluation of the last form, or nil if there are no forms.
  1. an object associated with a name in a binding.
  2. (of a symbol) the value of the dynamic variable named by that symbol.
  3. an object associated with a key in an association list, a property list, or a hash table.

multiple values

  1. more than one value.
    • “The function truncate returns multiple values.”
  2. a variable number of values, possibly including zero or one.
    • “The function values returns multiple values.”
  3. a fixed number of values other than one.
    • “The macro multiple-value-bind is among the few operators in Common Lisp which can detect and manipulate multiple values.”

form/forms vs. datum

Forms and the Top-Level Loop
Definition of “lisp form”?

The things which you type to the LISP interpreter are called forms; the LISP interpreter repeatedly reads a form, evaluates it, and prints the result. This procedure is called the read-eval-print loop.

Some forms will cause errors. After an error, LISP will put you into the debugger so you can try to figure out what caused the error. LISP debuggers are all different; but most will respond to the command “help” or “:help” by giving some form of help.

In general, a form is either an atom (for example, a symbol, an integer, or a string) or a list. If the form is an atom, LISP evaluates it immediately. Symbols evaluate to their value; integers and strings evaluate to themselves. If the form is a list, LISP treats its first element as the name of a function; it evaluates the remaining elements recursively, and then calls the function with the values of the remaining elements as arguments.

For example, if LISP sees the form (+ 3 4), it treats + as the name of a function. It then evaluates 3 to get 3 and 4 to get 4; finally it calls + with 3 and 4 as the arguments. The + function returns 7, which LISP prints.

form = datum + program, that can be evaluated without an error.
This is a lisp datum, it’s a list of 3, 4 and 1. This is not a form however as trying to evaluate it does not result into another datum. But rather an error:

(3 4 1)

This is a datum, and a form, also called a ‘normal form’ or a ‘self-evaluating datum’, it evaluates to itself:


This is a compound form, evaluating it results into the normal form 8:

(+ 3 4 1)

Apart from normal forms and compound forms, compound forms can be subdivided into procedure calls and special forms (also called syntax) but more properly, the head of a special form is the syntax, as in:

(if (oddp 2) (print "me") (print "or me"))

This is a special form because it’s head is syntax, and not a procedure, the only difference between procedure calls and special forms is that procedure calls see all of the arguments of the form as forms in itself and try to evaluate it first and special forms not necessarily do that. As we understand, only the second and fourth member of this compound form get evaluated, the first member is syntax, and the third is discarded in this case.
As we know for instance this code. But it’s not a form in Common Lisp:

((a 1) (b 2))


(let ((a 1) (b 2)) (+ a b))

Is a special form, it does not evaluate its second member, and evaluates its third member in a different fashion than what would be expected if it was not a special form. That is, a and b as subforms of its third form have a different binding. let in this case is a syntactic keyword that signals the special form.

arguments &optional, &rest and &key

&optional = optional argument(s)
            Optionale Parameter

&rest     = rest arguments(s)
            Werden in eine eigene Liste zusammengefasst.
            &rest steht an letzter Stelle, nach notwendigen
            und optionalen Parametern

&key      = key arguments
            Statt Parameter-Reihenfolge über Key/Value

(defun foo (&key a b c) (list a b c))

(foo)                ==> (NIL NIL NIL)
(foo :a 1)           ==> (1 NIL NIL)
(foo :b 1)           ==> (NIL 1 NIL)
(foo :c 1)           ==> (NIL NIL 1)
(foo :a 1 :c 3)      ==> (1 NIL 3)
(foo :a 1 :b 2 :c 3) ==> (1 2 3)
(foo :a 1 :c 3 :b 2) ==> (1 2 3)

keyword or keys in arguments (colons 🙂

What is the colon (:) in Emacs lisp?
Why colons precede variables in Common Lisp

[1] :yellow

(list) vs. (values)

Most forms create only one value
A form typically returns only one value. Lisp has only a small number of forms which create or receive multiple values.

Normally multiple values are not used. Special forms are required both to produce multiple values and to receive them. If the caller of a function does not request multiple values, but the called function produces multiple values, then the first value is given to the caller and all others are discarded; if the called function produces zero values, then the caller gets nil as a value.

Constructs for Handling Multiple Values
Essential Multiple Values
alues function in Common Lisp
`values` vs `list` for returning multiple values from Lisp form

(cons) vs. Consing

Why is consing in Lisp slow?


Object-Oriented equivalent of LISP's progn function?

(setq) vs. (setf)

Lisp style: setq vs. setf

(set symbol  foo)   = set symbol to foo (Deprecated!)
(setf place  form)  = set place to primary values of forms (Macro to setq)
(setq symbol form)  = set symbol to primary values of form


Tips on Writing Comments


Basic topics



[1]> (+ 2 3)

[2]> (print "hello world")
"hello world"
"hello world"
[3]> (defun hello-name (name) (format nil "Hello ~A" name))

[4]> (hello-name 'matt)
"Hello MATT"
[5]> (load "power.lisp")
;; Loading file power.lisp
;; Loaded file power.lisp

[6]> (power 3 4)



Why 'x' doesn't be recognized?

[13]> (defun beispiel (a b c) (list a b c))

[14]> (beispiel 1 2 3)
(1 2 3)

[15]> (beispiel x y z)

*** - SYSTEM::READ-EVAL-PRINT: variable X has no value


How to return a value?

[1]> (defun test123 ()
(print "hallo")
(print "welt")
(print "!"))

[2]> (test123)


[3]> (defun test123 ()
(print "hallo")
(print "welt")
(print "!")

[4]> (test123)

Modula-2 / Modula-3


GNU Modula-2 (gm2)
Critical Mass Modula-3 (CM3)





$ gm2 -g hello.mod
/usr/bin/ld: cannot find -lpth
collect2: error: ld returned 1 exit status


[Gm2] Re: still won’t compile and link

$ sudo apt-get install libpth-dev
The following NEW packages will be installed:
  libpth-dev libpth20

$ gm2 -g hello.mod
<no output>


$ gm2 -o hello -g hello.mod
failed to find definition module InOut.def


Every compiler has other libraries with exactly the same functions/procedures:

  • InOut (ulm)
  • Terminal2
  • StrIO
$ ls -la /opt/gm2/lib/gcc/x86_64-linux-gnu/4.7.4/m2/
total 48
drwxr-xr-x 8 root root  4096 Jan  7 13:43 .
drwxr-xr-x 8 root root  4096 Jan  7 13:43 ..
drwxr-xr-x 2 root root  4096 Jan  7 13:43 cor
drwxr-xr-x 2 root root 12288 Jan  7 13:43 iso
drwxr-xr-x 2 root root  4096 Jan  7 13:43 log
drwxr-xr-x 2 root root  4096 Jan  7 13:43 min
drwxr-xr-x 2 root root  4096 Jan  7 13:43 pim
drwxr-xr-x 2 root root 12288 Jan  7 13:43 ulm
$ sed -i -e 's/InOut/StrIO/g' hello.mod
$ gm2 -o hello -g hello.mod
<no output>


$ gm2 -flibs=ulm,pim -o hello -g hello.mod


There is no procedure “RealRandomNumbers”


Only in “Stony Brook Modula-2” or the successor “ADW Modula-2” there is a procedure “RealRandomNumbers”.
Stony Brook Modula-2 Development System
Stony Brook Software Home Page Stony Brook Modula-2

There is a library to generate random numbers:
Ulm’s Modula-2 Library: RandomGenerator

$ grep -r Random /opt/gm2/lib/gcc/x86_64-linux-gnu/4.7.4/m2


There are no string procedures (like Length or IntToStr).


ISO Modula-2 Modules Reference


String Conversions

The string conversions library allows the conversion of the values of numeric data types to and from character string representations. The modules WholeStr, RealStr, and LongStr provide simple high-level facilities for converting to and from strings and whole number and real number data types. Low-level facilities are provided by the corresponding modules WholeConv, RealConv, and LongConv. Common data types and values that are used in the definition modules are defined by the module ConvTypes.

FROM WholeStr   IMPORT IntToStr, CardToStr;
FROM RealStr    IMPORT RealToStr;


Use additional libraries (= modules)

$ grep -r "PROCEDURE Length" /opt/gm2/lib/gcc/x86_64-linux-gnu/4.7.4/m2

$ gm2 -flibs=iso,pim -g -c MyLib.mod
$ grep -r "PROCEDURE StrToInt" /opt/gm2/lib/gcc/x86_64-linux-gnu/4.7.4/m2
iso/WholeStr.def:PROCEDURE StrToInt (str: ARRAY OF CHAR; VAR int: INTEGER;
iso/WholeStr.mod:PROCEDURE StrToInt (str: ARRAY OF CHAR; VAR int: INTEGER;
ulm/StrToNum.mod:   PROCEDURE StrToInt(str: ARRAY OF CHAR; VAR integ: INTEGER): BOOLEAN;
ulm/StrToNum.def:   PROCEDURE StrToInt(str: ARRAY OF CHAR; VAR integ: INTEGER): BOOLEAN;
pim/NumberIO.mod:PROCEDURE StrToInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;
pim/NumberIO.def:PROCEDURE StrToInt (a: ARRAY OF CHAR ; VAR x: INTEGER) ;

$ vi Main.mod
FROM WholeStr   IMPORT IntToStr, CardToStr;

$ gm2 -flibs=iso,pim -g -c Main.mod


How to use files



Modula-2 “cat” in ISO-style


Dynamic Strings



(* Description: provides a dynamic string type and common methods. *)