Drawing A Yellow Rectangle

Premise

On the weekend i wanted to perform the task of drawing a yellow rectangle programmatically onto the screen of a Personal Computer:

  • The program would feature a viewport that occupies the entirety of the primary display of the PC.
  • On the viewport, 640 pixels could be adressed in width, 480 in height.
  • The viewport would be drawn in black color by default.
  • A yellow, filled rectangle would be drawn from an upper left corner at pixel coordinates 10 from the left, 20 from the top to a lower right corner at 100 from the left, 75 from the top.

  • When having drawn the yellow rectangle, the program would indefinately await any keypress and then shut down.

I solved this task using several different programming languages and toolkits, having the following goals for the implementation:

  • The program does a simple thing, so it should require little processing and memory resources.
  • The program should still work in 24 months from now.

Creative E-MU 1616m PCIe on Windows 10 64bit

Update: Update 1903 of Windows 10 introduced breaking changes that Creative will not fix anymore. The device can still be brought to operation following this article on answers.microsoft.com by Mr. Freddie Stjerna. Having performed the procedure described therein, my 1616m PCIe works flawlessly on Win10Pro64, also as an ASIO device for Ableton 10 (64bit).
Update no. 2: Unfortunately, the 64-bit ASIO driver as installed using the procedure described in the previous update delivers very bad performance when used with Ableton Live 11. Status now is that i will not use the device in Windows anymore, only in Linux. 😎

On a PC running Win10Pro64 that has no Firewire port i needed a 4in4out audio solution functioning as an ASIO device.

So i dug out my E-MU 1616m PCIe, and – fearing that it would show severe compatibility issues – installed the most recent driver (EmuPMX_PCDrv_US_2_30_00.exe, July 15th 2011). To my surprise, the device started working immediately. So far i have not found any unsupported or problematic features (at 48 kHz samplerate i use WDM audio output, symmetrical input with zero-latency monitoring and ASIO sends and output to speakers through a 4-band EQ as DSP insert).

I think the E-MU 1616m PCIe is a great device:

  • 10 years after i bought it, it works as on the first day.
  • It has good and solid performance, i permanently run it with 10ms buffer size, which in Ableton Live adds on to 23.3 ms global round-trip latency, and i am yet to encounter any dropout or instability.
  • PatchMix looks and feels very functional (apart from the brushed Aluminium skin which i find quite funny and nostalgic). Since it has spent many years in maturity, having no “software development” bloating it with useless features and workflows, it runs rock solid and lightning fast on a modern PC.
  • The breakout box (called “Microdock”) has massive connectivity:
    • copper S/PDIF, AES or EBU (really!),
    • optical ADAT or S/PDIF,
    • four balanced 6.35mm input jacks,
    • two XLR/jack combo inputs,
    • six balanced 6.35mm output jacks,
    • three unbalanced 3.5mm stereo output jacks,
    • a dedicated 6.35 mm headphone output jack with hardware volume control and
    • a stereo pair of RCA inputs plus GND (Phono).
  • It works with Linux (using emutrix instead of PatchMix).

This is the best Creative product ever – ah wait, it’s not really by Creative … 😉

xdraw 1.1

I was very pleased to notice that my small Xlib-utility xdraw has made it across the years unscathed. It compiled after 11 years of complete lack of code or build system maintenance. Hail to the stability of the X Library!

However, i found the visual quality of the drawing results a bit lacking – the drawn lines are too uneasy. So i have added weighted average smoothing to the drawn lines.

xdraw in action.

I have released this improvement as version 1.1 of xdraw here: https://gitlab.tk-sls.de/tilman/xdraw/tree/1.1

Project information not readable.

In Powershell das Piepen bei Backspace abstellen

Folgendes Verfahren habe ich auf Windows 10 Home durchgeführt:

In einer Powershell werden einige Vorbereitungen durchgeführt:

# Profil erstellen, falls nicht vorhanden
if (!(test-path $PROFILE)) {
    new-item -type file -path $PROFILE -force
}

# Skript-Ausführungs-Richtlinie ändern:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

# Profil-Skript editieren:
notepad $PROFILE

Hinweis: Die Ausführungsrichtlinie RemoteSigned erlaubt das Ausführen von Skripten auf den lokalen Datenträgern. Dabei gelten gewisse Ausnahmen (eine “aus dem Internet heruntergeladene Datei” zum Beispiel ist nicht sofort vertrauenswürdig sondern führt beim Versuch der Ausführung zu einem zusätzlichen Bestätigungsdialog). Etwas sicherer wäre die Richtlinie AllSigned, doch das würde bedeuten, dass wir unser  Profil-Skript Windows PowerShell-Skript.ps1 signieren müssen, was ohne das .NET SDK nicht machbar ist. Hurra! 🙂

In das Profil-Skript wird folgender Befehl geschrieben:

# Akustisches Signal in der Powershell deaktivieren
Set-PSReadlineOption -BellStyle None

… und das Generve hat ein Ende.

Angepasstes Bootstrap-CSS selbst erstellen

1. NodeJS und npm installieren.

Wie das geht, hängt vom Betriebssystem ab.

Auf jeden Fall sollte man ein möglichst aktuelles NodeJS verwenden. Ich habe das folgende Verfahren mit v7.8.0 durchgeführt.

2. grunt-cli installieren.

~$ npm install -g grunt-cli

3. Aktuellen (stabilen) Source von bootstrap holen.

~$ git clone https://github.com/twbs/bootstrap.git
~$ cd bootstrap
bootstrap$ git checkout v3.3.7

4. Abhängigkeiten installieren.

bootstrap$ npm install

5. Bootstrap übersetzen.

bootstrap$ grunt dist

6. Verzeichnis für eigene Anpassungen erstellen.

bootstrap$ mkdir ../boostrap-custom
bootstrap$ cd ../bootstrap-custom

7. Dateien für eigene CSS-Anpassungen erstellen:

bootstrap-custom$ touch custom-variables.less custom-other.less
bootstrap-custom$ echo '
@import "../bootstrap/less/bootstrap.less";
@import "custom-variables.less";
@import "custom-other.less";
@import "../bootstrap/less/utilities.less";
' > custom-bootstrap.css

8. LESS CSS-compiler installieren:

bootstrap-custom$ npm install -g less

und schließlich:

9. Angepasstes bootstrap-CSS erstellen:

bootstrap-custom$ lessc -x custom-bootstrap.css > custom-bootstrap.min.css

Damit steht ein angepasstes Bootstrap-CSS als custom-bootstrap.min.css zur Verfügung. Diese kann anstelle von bootstrap.min.css verwendet werden.

Quellen:

Producing salted Password Hashes using the MD5 Algorithm

As an exercise in password storage i implemented a PHP function that takes a UTF-8 encoded Unicode cleartext, generates a random salt and produces a password hash using the MD5 algorithm.

Please note that this is just an exercise and should not be used in production.

  • This code has not been properly tested and has never been reviewed. I think it’s OK for educational purposes (otherwise i would not have published it), but it is very likely to have bugs.
  • There are computational attacks on MD5 that break the algorithms fundamental promises, they can be performed without extraordinary effort. That makes MD5 unusable for security-related purposes in the general case.
  • For PHP version 5.5 and later, you can use the password hashing API instead.

At any rate, it can be helpful to understand what the use case is and what “password hashing” actually can accomplish. Read on for further observations.

Read More »

Einige Bemerkungen zur neuen Webseite des Verkehrsverbundes Rhein-Neckar GmbH (VRN)

Einleitung

Ich bin selbstständiger Web-Entwickler und bin immmer auf der Suche nach interessanten Fallbeispielen, und zwar nicht nur nach den Gelungenen sondern auch nach den Problematischen. Heute möchte ich ein Beispiel für Letztere aus meinem persönlichen Erfahrungsbereich präsentieren.

Als zahlender Kunde freut es mich zwar, dass der öffentliche Verkehrsverbund der Region, VRN GmbH sich zu einer Modernisierung seines Online-Angebots www.vrn.de entschlossen und eine Webseite mit vielen sinnvollen und interessanten Informationen und Funktionen umgesetzt hat.

Leider muss ich aber feststellen, dass sich die Leistungsfähigkeit der Webseite seit deren Erneuerung insgesamt verschlechtert hat und dass gerade bei wichtigen Funktionen wie der Fahrplan-Auskunft spürbar höhere Ladezeiten und störende Fehlfunktionen auftreten, die die Bedienung langsamer und umständlicher als bei der Vorversion machen. Dies möchte ich im Folgenden anhand von vier Beispielen belegen.

Read More »

USB-WLAN-Adapter mit externer, ausrichtbarer Antenne

Habe jetzt den Edimax EW-7811UAC (Hersteller-Seite) am Linux-Laptop im Einsatz, um Probleme mit der Verbindungsqualität beim Einsatz im Aussenbereich zu beheben.

Treiber: https://github.com/diederikdehaas/rtl8812AU

Hinweis: Andere Varianten des rtl8812-Treibers haben es nicht geschafft, das Gerät zu erkennen bzw. zu initialisieren.Ich verwende Linux Kernel Version 4.1.0.

Alles bestens:

  • Das Gerät funktioniert mit diesem Treiber problemlos, es etabliert 150Mb/s mit 2,4 GHz an einem TP-LINK TL-WR941ND.
  • Das in der README, Abschnitt “DKMS” beschriebene Verfahren funktioniert ebenfalls.