ft U+1F596

Sadly, Leonard Nimoy passed away yesterday.

I wanted to use U+1F596 (🖖: “RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS”) in here. But as it turns out, my system doesn't support displaying that, yet (it's new in Unicode 7). Sadness all around. ☹

Posted Sat 28 Feb 2015 01:03:09 CET Tags:

I'm a bit of a fan of Hewlett-Packard. Mainly for their excellent hand-held calculators and for their equally awesome laboratory equipment, like function generators, oscilloscopes and signal analyzers. And they were known for their quality. In 1999 it was decided to throw away that good name and move all non-computing products to a spin-off company called “Agilent”. And by now, that name basically rings as well as the old HP one.

But guess what, someone with Agilent seems to have run weary of that name as well: I was looking for Agilent's entry level oscilloscopes and couldn't find any with the usual distributors. What came up were scopes by a company called “Keysight”. I was like “Wat. Are those knock-offs!?” - But no. That company is a spin-off off of Agilent, that takes care of the electronic measurement products. Meh.

Posted Sat 25 Oct 2014 12:13:59 CEST Tags:

Yet another Update

So, they are calling it “CommonMark”. Not quite as catchy, but who cares. As long as it's technically sound.


Seems like the “Standard Markdown” effort didn't really look at John Gruber's licencing text, that he used for the original description. It allows you to do just about anything you like, but one of the few restrictions the licence includes is that you cannot use the name “Markdown” or the name of any of the original contributors to endorse or promote derived products. At least not without specific prior written permission. So now Gruber is a wee bit pissed, and understandably so, if you ask me.

Yet, having a specification of a language that is used for input into computer programs, that is not ambiguous sounds like a good thing to have. I don't care about what they will call it (I don't know if the panic move to “Common Markdown” makes any sense, since “Common” is pretty much a synonym to “Standard”), but from a technical point of view it is a move in the right direction. If you cannot find agreement, find another clever name and run with that.

Markdown is great. Usual texts are simple, and you get away with minimal markup languages such as this. If you want to do stuff like control text colour for individual words in a document, you should see a doctor anyway. If you'e a reasonable person, markdown is what you are looking for. This blog (and indeed the rest of my website) is also written using markdown, processed by ikiwiki.

Jeff Atwood just blogged about Standard Markdown, which came to be because the original Markdown description by John Gruber isn't an unambiguous specification. That's where the spec of the Standard Markdown comes into play. Sounds great.

The one concern I had was, whether or not this project had John MacFarlane on board. My concern was unfounded, because John is in. Knee deep, as it would seem: He wrote the specification as well as the standard implementations in C and JavaScript. ☺

Why I am such a fanboy? Well, basically because John is the author of pandoc, the most awesome document processing tool you will ever come across. It can - brace yourself - convert Markdown, reStructuredText, Textile, HTML, DocBook, LaTeX, MediaWiki markup, OPML, Emacs Org-Mode, txt2tags, Microsoft Word docx, EPUB, or Haddock markup to - sure, take a moment to catch your breath - HTML (including HTML5 and shiny things like slideshows using reveal.js and stuff like that), EPUB, FictionBook2, Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML, DocBook, GNU TexInfo, Groff man pages, Haddock markup, ICML a markup language used in Adobe InDesign, OPML, LaTeX, ConTeXt, LaTeX Beamer slides, PDF via LaTeX, Markdown, reStructuredText, AsciiDoc, MediaWiki markup, DokuWiki markup, Emacs Org-Mode and Textile. It is positively mind-boggling. The project's website features a diagram, that visualises this paragraph, if you can't believe it…

Write your documents using pandoc's extended markdown, keep them in version control (because markdown is a plain-text format, that's trivial), and generate whatever format you need. Seriously, if you're still using “office” style programs to write your documents with, you can't be helped.

I'll acknowlegde, that sometimes you'll want full control of your document, and sure, use LaTeX in those cases. But the newest pandoc has support for calling filters during the conversion phase, which open the door for almost any extension you can think of. I'll use markdown&pandoc for the next larger document I have to write. I did use pandoc to produce my latest presentation slides: The filters feature of pandoc allowed me to extend pandoc's markdown to target multi-column slides as well as freely positionable images. It produces LaTeX beamer slides in PDF format, which are plain beautiful anyway.

Pandoc has installers for windows and OSX, too. So there's no way you'll get away claiming it's not available for your platform. Your linux installation will probably feature pandoc packages out of the box; if not: Switch to debian already! PDF output needs a LaTeX installation, but there are open-source distributions for all major OSs readily available for installation.

Posted Wed 03 Sep 2014 22:08:06 CEST Tags:

BT Templeton (bipt) has been working (AFAIK in four consecutive GSOCs now) on porting emacs's Elisp engine to GNU Guile. The Guile-folks have been dreaming about this for a while now (see this mail by Andy Wingo from 2010, for example). I'm obviously not an expert, but I was rather sceptical about the chances of success of this endeavour…

Christopher Allan Webber summarises the current state. bipt said on ‘#guile’, that he was successfully performing tasks like reading mail using gnus and using large systems like org-mode on his build of such a Guile-hosted emacs-binary. This is great news indeed. ☺

Posted Mon 18 Aug 2014 16:10:45 CEST Tags:

Today a user on IRC wondered how hard it would be to indicate the current mode of zsh's vi keyboard mode in grml's new prompt-theme.

The prompt theme is designed to not only be configurable, but also to be extensible with custom information. The theme is not the issue with this request. The issue is to get solid information about the current state of zsh's vi-mode, with ordinary keymap changes, signal handling, recognition of minibuffers and override modes...

Since I use vi-mode in my zsh setup, I did all that a while back (CODE: You may want to take a look at the CONFIGURATION section, especially `zle_use_ctrl_d', which you may want to set to "no" if you like to use ESC like you'd expect in vi). Which means that the only question that remains is how to actually perform the integration.

Turns out, that this is rather easy. Suppose you copied the code that's linked from my old blog post to ~/.zshrc.vi-mode. Let's do the integration in ~/.zshrc.local, which is a file that grml's zshrc loads after all its own code ran. The integration can be done in three lines of code then:

source ~/.zshrc.vi-mode
grml_theme_add_token vi-mode '%1v' '%K{blue}%F{white}(' ')%f%k '
zstyle ':prompt:grml:left:setup' items vi-mode rc change-root \
                                       user at host path vcs percent

And here's how that looks:

vi-mode integration with grml's new prompt theme

I'm kind of glad, we rewrote our prompt code to make things like this possible, clean and fairly easy. :)

Posted Tue 05 Aug 2014 13:47:03 CEST Tags:

Always. Right? RIGHT!?

Neil Young must have thought something along those lines when he started developing pono.

Audio sampled using 24Bit resolution at 192kHz is indeed more. But is it better? Better for audio playback than, say, 16Bit resolution at 44.1kHz (you know, like on regular compact discs)? You won't trust me anyway, so let me link you to an article by Christopher Montgomery of xiph.org, who has much more expertise regarding this topic than I will ever have anyway: 24/192 Music Downloads ...and why they make no sense

The short answer is:

Why push back against 24/192? Because it's a solution to a problem that
doesn't exist, a business model based on willful ignorance and scamming

That punchline is actually rather boring compared to the rest of the article's content, since he completely dismantles all the talking points that proponents of 192/24 usually present. If you thought $400 for a pono sounds like a bargain considering those figures, please do read it before you place yourself onto the preorder list. Samplerate and resolution are not the issue.

Posted Sat 10 May 2014 11:06:03 CEST Tags:

Useful font is useful

Posted Fri 11 Apr 2014 11:34:36 CEST Tags:

Previously I was using matplotlib. Things went fairly smoothly. The only awkward places were those where I tried to customise the looks of things a bit. Having to do that for each and every plot seems cumbersome. And I guess I'm not alone with that feeling, because matplotlib let's you provide a configuration file, that sets up things the way you'd like. You name the thing “matplotlibrc” in your current working directory to have different setups in different places. So I created a file that contains the following:

lines.linewidth  : 1.5
axes.grid        : True
axes.color_cycle : b, r, g, c, m, y, k
xtick.labelsize  : 8
ytick.labelsize  : 8
legend.fancybox  : True
legend.fontsize  : small

Then the plotting script reduces the Python code to only pieces that are pretty self-explanatory:

import numpy as np
import matplotlib.pyplot as pp

data = map(lambda x: [ x[0],
                       complex(x[1], x[2]),
                       complex(x[3], x[4]),
                       complex(x[5], x[6]),
                       complex(x[7], x[8]) ],
           np.loadtxt("wifi-antennas.s2p", skiprows=5))

def column(data, i):
    return [ row[i] for row in data ]

def lin2db20(data):
    return 20 * np.log10(np.abs(data))

xx = np.multiply(1/1.0e9, column(data, 0))
s11 = lin2db20(column(data, 1))
pp.plot(xx, s11, label = '2.4GHz antenna')
pp.xticks(list(pp.xticks()[0]) + [ 2.4 ])
pp.xlim(0, xx.max())
pp.ylim(np.min([s11.min(), s22.min()]) - 1, 1)
pp.xlabel("frequency [GHz]")
pp.ylabel("S11 [dB]")

pp.savefig("wifi-antennas.pdf", bbox_inches = 'tight')


Posted Fri 21 Mar 2014 15:24:38 CET Tags:

I'm a fan of high-quality representation of data. Be it typesetting, plotting, technical drawings or circuit schematics. And when it comes to plots, the output most applications deliver are nothing short of abysmal. If your plots are not available in a vector format, they are useless. If you decide to plot light-green lines on white background, that is utterly useless. If your axis labels read “db(mag(scatter(port1,port1)))” without the option of changing them: useless.

Luckily, most applications recognise that they suck at producing high quality plots and provide ways to get the numeric data out of them to use a dedicated utility to generate publication quality plots. The upside with that is, that all your plots will also look uniformly - which is important if you are working on something like a paper or thesis, where you'll surely want a consistent high-quality look to what you are preparing.

One such program is my good old friend “gnuplot”. I've written a fair number of small tools that turn data from simulators and measurement equipment into gnuplot scripts or into gnuplot-digestable formats. Gnuplot produces high-quality scalable plots and is immensely powerful, to satisfy most if not all of your plotting needs. However this story is not about gnuplot.

Because sometimes, I feel like I either hit the limit of gnuplot's capabilities or the language you control it by seems to get in the way. Sometimes I just want to create a sort of plot, that I think should be trivial to produce, and when I try it's just very very hard, while other things that looks incredibly hard seem trivial to create with it.

When you look for alternatives, your attention will quickly turn to “matplotlib”. That's a Python library for producing all sorts of plots and all of them in publication quality. Actually, together with NumPy and SciPy it forms a set of tools to tackle scientific and numeric problems. But let's not get distracted by that.

In the lab, we got a fairly big number of high-end measurement equipment, like high-bandwidth digital scopes, spectrum-, logic-, network-analyzers and the like. And the plots these things produce vary from mildly irritating to complete and utter crap. But that's okay, since there are usually ways to that the actual data out of them and into our high quality plotting engines (be it gnuplot or matplotlib).

Today I copied a dataset from a Rhode&Schwarz network analyzer measuring the Scattering Parameters of a setup with two wifi-antennas (one for 2.4GHz and the other in the 5GHz band) from 9kHz to 8.5GHz, so I had something to throw matplotlib against in the evening.

What S11 roughly represents (for those of you who are too lazy to read the wikipedia entry on scattering parameters) with respect to the antenna is this: The analyzer blows sine waves of all frequencies in the measured range into the antenna and looks at how much of the wave came back to it. For frequencies at which an antenna works, that value is typically quite small since most of the wave is supposed to be send off into the air. For frequencies at which the antenna doesn't work, a lot of the wave is reflected back to the analyzer. If everything of a wave is reflected and not otherwise lost on the way, incident and reflected amplitudes are the same and the magnitude of S11 at that frequency is 1 - the largest possible value in this kind of setting.

With two ports (like here with the each of the two antennas connected to one port) you get more scattering parameters: S22 is like S11 but for the second port. S21 describes how much of a wave from port 1 arrives at port two and S12 is the same just in the other direction.

Scattering parameters are usually plotted in logarithmic scale (S11log = 20·log10(|S11|)): A value of 1 would correspond to 0dB; 0.1 would be -20dB. So with this 2.4GHz antenna, you'd expect S11 to be small (like -10dB) around 2.4GHz and not-so-small everywhere else.

The network analyzer exports its datasets in touchstone format. A "s1p" file in that format has three columns. Since scattering parameters are complex numbers, the lines look either like this:

frequency   real(S11)   imag(S11)

Or like this:

frequency   magnitude(S11)   angle(S11)

"s2p" files contain the scattering parameters of a two port system (i.e. S11, S22, S21 and S12) in very much the same way. Either:

frequency real(S11) imag(S11) real(S21) imag(S21) ...etc...


frequency magnitude(S11) angle(S11) magnitude(S21) angle(S21) ...etc...

The Rhode&Schwarz analyzer uses the former version. The touchstone files also contain header lines (that define how the lines and columns are formatted, if you don't know the format) and comments at the top.

So. I got a "s2p" file that contains the measurement data and I want to plot the S11 values (representing the reflection data at port one, where the 2.4GHz antenna was connected). This is pretty easy to do in gnuplot, so matplotlib better doesn't make it too hard or I'll be demotivated massively. :)

Some constraints: The Y-axis should be labeled "S11 [dB]" and the X-axis should be labled "frequency [GHz]". It should be a plot, that you can use in a regular document: That means no title, since there will usually be a caption below or above the plot's figure in the document. And it also means that there should be minimal bounding box around the plot, so that no space is wasted. Also, it should obviously be a scalable format. I'd also like an extra tick at 2.4GHz on the frequency axis.

So postscript, pdf or svg. Proper inclusion in LaTeX documents is possible with postscript and pdf. And since there are more standalone pdf viewers than postscript viewers, let's settle for pdf.

Most of the work here is to read the dataset from the touchstone file. Luckily, the NumPy package provides a useful function to slurp in text-based datasets like this: loadtxt. So first things first:

import matplotlib.pyplot as pp
import numpy as np

Now we have access to ‘loadtxt’ as well as matplotlib's ‘pyplot’ API. The thing is, that we need to turn the real/imaginary pairs into actual complex numbers. But that's not so hard, if you know the ‘map’ function:

data = map(lambda x: [ x[0],
                       complex(x[1], x[2]),
                       complex(x[3], x[4]),
                       complex(x[5], x[6]),
                       complex(x[7], x[8]) ],
           np.loadtxt("wiki-antennas.s2p", skiprows=5))

Like I said, ‘loadtxt’ is the work-horse here. The ‘skiprows’ parameter just tells it to ignore the first five lines of the input file (that's the touchstone file's header and comments). The first argument to ‘map’ here is an anonymous function, that reorganises the data sucked in by ‘loadtxt’: It leaves the first column alone (that's the frequency entry) and then it takes the next columns in pairs and turns them into complex numbers. That does the trick.

You have to realise that my Python-fu is rather weak. I didn't know how to cleverly access an array of arrays column-wise. But the internet came the the recue:

def column(data, i):
    return [ row[i] for row in data ]

Now getting the data is trivial:

xx = np.multiply(1/1.0e9, column(data, 0))
yy = 20 * np.log10(np.abs(column(data, 1)))

Then prepare the plot:

# The font-size of the tick marks render a little big
# in pdf output by default. This needs to be tuned early:
fig = pp.figure()
plot = fig.add_subplot(111)
plot.tick_params(axis='both', which='major', labelsize=8)
plot.tick_params(axis='both', which='minor', labelsize=6)

# Prepare the plot, and take into account, that I like
# the plot's lines a tad ticker than the default.
pp.plot(xx, yy, linewidth = 1.5)

Now it's time to tune the plot to our liking:

# Extra tick at 2.4GHz:
pp.xticks(list(pp.xticks()[0]) + [ 2.4 ])
# Data range for X and Y axes:
pp.xlim(xx.min(), xx.max())
pp.ylim(yy.min() - 1, yy.max() + 1)
# A grid helps with orientation on the canvas:
# Axes labels like specified:
pp.xlabel("frequency [GHz]")
pp.ylabel("S11 [dB]")

Finally, write the bugger to a file:

           # Remember? Minimal bounding box!
           bbox_inches = 'tight')
# Also, a PNG for the blog post as a thumbnail
# for the PDF:
           bbox_inches = 'tight')
# Alternatively, if uncommented the following
# shows the data in a plotting window:

And here's the result (the image links to a scalable PDF version):

matplotlib plotting S11 of a 2.4GHz antenna

I can work with that. :)

Posted Thu 20 Mar 2014 21:53:40 CET Tags:

At work, I am (reluctantly) using a windows machine for most tasks. It's a 64-bit windows 7 installation. And to be honest, using the system is not half bad. It is probably the best user experience I ever had with any OS from Redmond (I got cygwin and a tiny virtual machine, that runs a linux system on top of windows, whenever I feel limited by the environment). In particular, the system is pretty damn stable. Sure, the odd third party program would crash every once in a while. But that's hardly Microsoft's fault. …I had almost forgotten what a bluescreen looked like.

Until now. :)

My system has a dual-monitor setup. And I usually have a field-simulator, or EDA software running on one and communication software (email etc.) on the other monitor. When one day, the following transpired: Suddenly, the mouse pointer refuses to react to movements of the pointer device, that usually controls it. Then the left monitor turns black. Then, a second or two later, the right monitor turns black. Then, after a few seconds, both monitors display the same bluescreen, with the OS dumping its memory to disk. After that, the system dies and boots again.

Unfortunately, the camera on my phone didn't start up quickly enough for me to take a screenshot. Bummer, right? But don't dispair, crashes always come in pairs, as the ancient Aztec saying tells us… Two days later, the system crashed again and this time I recognised the early symptoms and got my camera running quickly enough:

Window 7 BlueScreen of Death

When the machine came back up, it greeted me with the following dialog box:

Window 7 Crash Dialog

Cute, right? “Unerwartetes Herunterfahren” or “Unexpected Shutdown” (Reason: BlueScreen). No Shit, Sherlock! That was indeed unexpected as fuck, thankyouverymuch. The simulation software that you forced to the ground alongside yourself also asked me to convey its sincerest gratitude, since the problem it was solving for me was boring anyway.

Let's hope that this was the entirety of my share of BlueScreen crashes for this decade.

Posted Mon 17 Mar 2014 14:26:21 CET Tags:

Sometimes you're forced to use device drivers that upload binary-only firmware blobs to the actual hardware when they boot up (they all suck for various reasons: If there's a bug in it, you can't tackle it; you also got to trust the company to be one of the good guys™ - but hey, who'd suspect companies of being dicks towards their customers these days - Right? Right.). But sometimes, you're forced into using them anyway (unless you got intact principles, I guess…).

Like this one time, at band camp, when I was trying to use Texas Instrument's MSP-FET430UIF. That's an USB connected flash emulation tool (read: a JTAG-thingy) for the MSP430 micro-controller series. Plugging it into my Debian laptop yielded this:

usb 4-1: new full-speed USB device number 2 using uhci_hcd
usb 4-1: New USB device found, idVendor=0451, idProduct=f430
usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 4-1: Product: MSP-FET430UIF JTAG Tool
usb 4-1: Manufacturer: Texas Instruments
usb 4-1: SerialNumber: TUSB3410334C17506C42FFD2
ti_usb_3410_5052 4-1:1.0: TI USB 3410 1 port adapter converter detected
usb 4-1: firmware: agent aborted loading ti_usb-v0451-pf430.fw (not found?)
usb 4-1: firmware: agent aborted loading ti_3410.fw (not found?)
ti_usb_3410_5052: probe of 4-1:1.0 failed with error -5

So the system sees the thing just fine, but it can't locate the blob to upload into the device to ultimately make it work. Now you got three choices: a) Go and cry for a while and pretend this never happened. b) Build yourself a GoodFET; or c) Bite the bullet and find the god-forsaken blob. Solution "a" is not viable, since we're engineers. So that don't fly. Solution "b" is actually quite appealing, but takes time that we might not have. Let's face it, chances are, we'll want to use the blob solution behind door "c".

The device that requires the driver is actually not the FET itself but the TUSB3410 chip (that's a device that turns a USB link into a serial port as far as the operating system and its applications are concerned; which is nice with a great many applications, since a serial link is so much easier to handle than a raw USB connection) that's built into it. And its firmware blob is missing.

I couldn't find a package for debian wheezy containing the blob (yeah, I got non-free in my sources.list, but I'm weary of putting third-party sources in there). My google-fu didn't turn up much useful, which is why we're here in this public service announcement… If you're looking for firmware blobs to use with linux device drivers, here's the git repository that'll help you:

% git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

There's a ‘ti_3410.fw’ file in there, that'll work with the device driver. You'll have to copy it somewhere the kernel will look for firmware blobs (on my debian system that's “/lib/firmware”). Hope that helps you.

Finally, if you're looking for a USB⇔Serial converter for an upcoming project, there are devices available that don't require blobs in the system (one such chip would be the FT232R, the price of which is in the same ballpark as the TI device).

Posted Thu 27 Feb 2014 21:55:15 CET Tags:

An einigen Nummern kommt man einfach nicht vorbei…

In Baden-Württemberg will man Schülern im Unterricht in Zukunft ja erzählen, daß noch andere mögliche Orientierungen neben der Heterosexualität gibt, und daß diese auch eine völlig normale Sache sind. So weit, so unspektakulär. Normalerweise würde ich erwarten, daß das kein großer Aufreger ist.

Nun habe ich beim Spiegel eine Überschrift gesehen: Kirchen lehnen "sexuelle Vielfalt" im Unterricht ab. Gut möglich, daß da Captain Obvious gefragt worden ist, ob er nicht noch eine Überschrift für den Internetarm des Nachrichtenmagazins hat.

Oder um es mit Louis de Funès zu halten: - Nein. - Doch! - Oh! …eigentlich immer noch kein Grund, sich zu der Debatte zu äußern.

Was mich nicht an der Geschichte vorbei kommen läßt ist dagegen ein Satz im Untertitel des Artikels: „Die Kirchen lehnen die geplante Leitlinie ab. Begründung: Schüler würden indoktriniert.” Das muß man sich auf der Zunge zergehen lassen: Die Kirchen lehnen eine Leitlinie, die ihnen nicht paßt mit der Begrüngung ab, daß Kinder indoktriniert würden.

Ich nehme ja an, daß man sich da einfach nur auf die Füsse getreten fühlt, da die Indoktrination von Kindern doch eine der wenigen Kernkompetenzen der Kirche ist…

Posted Sat 11 Jan 2014 10:47:47 CET Tags: