Read more...

Vue-router Keepalive

When using vue-router (v4) for your Single-Page-Application, one of the options is to combine it with the <keep-alive> tag. However, this may break your page components in unexpected ways, if done naively.

Read more...

Passing file descriptors over Unix domain sockets

So you can send file descriptors over AF_UNIX sockets, easy right? It’s done by sendmsg/recvmsg calls, using the ancilliary data mechanism. Ok, the API is a bit cryptic when it comes to the ancilliary message data buffer (CMSG_ALIGN what?), but fairly usable.

But consider a SOCK_STREAM socket. When am I going to receive the ancilliary data? Is it logically a separate stream? What happends on partial reads? What happends on partial sends? Did i write my socket code correctly? POSIX is silent, Linux manpages likewise. Let’s see what happends on Linux and FreeBSD.

Flask file upload in 32-bit Debian Stretch

If you upgrade to 32-bit Debian stretch and suddenly file uploads start failing in your Flask applications, this is caused by a bug in mod_wsgi. Just grab a never package from debian testing (4.5.17 seems to be ok).

The bug causes the application to produce “Bad Request” errors. I will affect anything based on Werkzeug and probably all mod_wsgi based applications. The bug is fixed in mod_wsgi commit 9192fd36620 and the patch is not in Stretch as of today.

Thinkpad Coil Whine

ThinkPad Coil Whine

Some ThinkPads have a slight coil whine, derived from the CPU load. Mine (T550) does. It is not really loud, but it can get annoying when working in quiet environment.

The coil whine is caused by the processor entering and leaving its power-saving states. This causes a change in the current going into the processor and the power circuitry around it emits a noise (some people also suggest the processor itself makes such a noise).

More info: ThinkWiki

Playing music

I have noticed that the coil whine is much more prominent under my Windows installation than on Linux. Windows has a continous note, whereas Linux emits sort of a buzz/noise/clicks (similar to noise of a seeking harddisk). Clearly Windows wakes up the processor in regular intervals.

In a similar fashion installing a non-tickless Linux kernel should also make the noise a continuous tone and much more prominent. Some people on the internets have made the observation that installing tickless kernel improves the situation a lot.

Note: I don't want to bash Windows, it could be one of the programs running on Windows. But the installation is mostly clean, with the exception of Lenovo's shovelware. It would be a bit ironic if that was the cause :).

Ok, what if we control the frequency of the wakeups? We could make any sound we want ... So I wrote a little program to do exactly that. If you have a whining ThinkPad (or any other computer with a CPU whine) and Linux, you can try it. It periodically wakes up all CPU cores with a given frequency and thus can play notes.

Downloads

The program below plays Imperial March on a notebook with coil whine.

Tips

  • Make sure your processor is mostly idle.
  • For high quality reproduction, unload all drivers except acpi and tpacpi, to reduce interrupts.
Read more...

Star Micronics LC24-15 printer with CUPS

Introduction

LC24-15 is a 24-dot matrix printer produced by Star Micronics in the late 80's. The company is still alive and you can even download the manual for LC24-15 and LC24-15 II from their site. With a few hacks, it is fairly usable even today.

The printer is capable of priting text and graphics, with the highest available resolution being 360x180 DPI. It also offers various features, such as downloadable fonts, which are not really usefull today, since the text will be rendered on the computer and sent to the printer as graphics anyways.

The printer is already supported out-of the box on Linux, as a Generic Epson Printer (because it emulates the Epson's ESC/P command set). The command set is supported by CUPS in its rastertoepson sample driver fairly well.

However, the page margins are wrong, which cause problems, such as pages being split in two (the second page contains the last few lines). Also not all resolutions offered by the driver are actually supported by LC24. To fix those problems, download the printer description files in the PPD section.

Connection

Setting up CUPS to use your printer is out of scope of this guide. However, the following commands should work:

1 of 1