Suitable paper rolls for the Sharp CE-150 printer

It’s not that easy as it may sound to find paper rolls for a 30 years old printer, the Sharp CE-150. The printer is used in combination with a Sharp PC-1500/1500A pocket computer.

I’ve looked at my small amount of paper rolls, the leftovers I’ve found in a box on the attic. Interestingly they were differing in size (can’t remember why):

Sharp CE-150 Paper Rolls

(Left to Right) Core Diameter Tube Diameter Outer Diameter Width
Roll 1 7.7 mm 14.7 mm 28.5 mm 57.4 mm
Roll 2 8.3 mm 13.0 mm 29.3 mm 57.6 mm
Roll 3 11.1 mm 17.0 mm 33.0 mm 58.7 mm
Roll 4 9.7 mm - 19.7 mm 58.3

Their width and outer diameters did not differ significantly, but the core diameters did. Paper rolls with core diameters of 7-9 mm are hard to get, the rolls sold today mostly have a diameter of 12 mm. I’ve successfully tested thermal (yes: thermal) paper rolls with this diameter in the CE-150, and these are really cheap to get (e.g. on eBay Germany). The ink doesn’t run, but there might be paper rolls with different coatings. I did not check that.

Maybe as a warning: Thermal papers mostly contain Bisphenol A (BPA), a substance that exhibits hormone-like properties!

The approximate dimensions you should look for are:
Width: 57 mm; Inner / outer diameter: 12 / 30 mm; Length: 10 m

Sharp CE-150 Still available paper roll (dimension)

How to extract a subdirectory from a Git repository while keeping its history

This is more or less to document a procedure I needed a few days ago: the extraction of a sub-directory from a Git repository into a separate (new) repository. The nice thing here is, that the whole history of the respective directory is kept.

First I created a check-out of the existing repository and removed the link to its origin.

git clone SOURCE.git
git remote rm origin

The next step is the actual extraction. We will remove all directories but the desired one throughout the whole history. This also works with more than one directory, i.e. here: DIR1 and DIR2

git filter-branch --tree-filter 'ls -1 |grep -v -e DIR1 -e DIR2 | xargs -i rm -rf {}' --prune-empty -f HEAD

Now the repository should only contain the (here) two directories. But the removed files still are in the packed object references. We have to manually let them expire and remove them.

git reflog expire --expire=now --all
git gc --aggr --prune=now

Finally I did some cleaning, but this is optionally:

git repack -a -d -l
git clean -f -d

Finally we can for example create a new (bare) repository from our NEW-REPO and further use it. I recommend to just remove the extracted directory from the source repository and keep its history, just in case.

The steps are similar if you need to instead remove a directory including its history. The only difference is in the actual removal command:

git filter-branch --tree-filter 'ls -1 |grep -e DIRECTORY |xargs -i rm -rf {}' --prune-empty -f HEAD

Homemade minimal Raspberry Pi (Raspbian) image

I have to admit that I’m a big fan of single-board computers for specific tasks like home-automatation, backup systems, network gateways, or file-sharing. I also like the approach of the Raspberry Pi Foundation to provide an image file with Raspbian (an adapted Debian) for easy use. For most people out there it is the best way to fetch an SD-Card with a capacity of at least 4 GBytes, download and copy the Raspbian image onto the card. I have a few unused 1 and 2 GByte SD-Cards lying around which should be sufficient for my tasks but are too small for the ‘generic’ Raspbian image. So I had to create my own minimalistic Raspbian installation. Here is a step-by-step example of the creation process.

I started with the installation of a few later required packages. I’m pretty sure this list is incomplete as I’ve already had quite a lot dev-tool packages installed before…

sudo aptitude install qemu-user-static \
binfmt-support fakeroot debootstrap git

To get Qemu running to support armhf I had to add a parameter to itc configuration file:

echo "EXTRA_OPTS=\"-L/usr/lib/arm-linux-gnueabihf\"" > /etc/qemu-binfmt.conf

I used “/tmp/” as my working directory which might not be the best location (temporary, as the name says). Feel free to use another dir, but you might need to keep an eye on the (root) access permissions…

cd /tmp/
mkdir raspi raspi/bootfs
cd raspi

Next I downloaded a minimalistic list of Raspian packages that will later go onto the root partition. I’ve tried to avoid working with root permissions as far as possible (therefore ‘fakeroot’).

fakeroot debootstrap --foreign --no-check-gpg --include=ca-certificates --arch=armhf testing rootfs

No we need to (temporarily) add some arm binaries to the root directory.

cp $(which qemu-arm-static) rootfs/usr/bin

The following step will start the actual installation process of the Raspian packages. For some reason I was not able to continue at this point without root permissions. (Any tips to fix this are welcome.)

sudo chown root.root rootfs -R

sudo chroot rootfs/ \
/debootstrap/debootstrap --second-stage --verbose

You will need some of the Raspberry Pi firmware files. The following commands download and install them . The Git repository is huge (3.1 GB), so this might take some time…

git clone \

sudo cp -r firmware/hardfp/opt/* rootfs/opt/

At this point you could create a custom kernel image based on the downloaded files. In my opinion the stock kernel is just fine so I just used it as is:

mkdir -p rootfs/lib/modules/

sudo cp -r firmware/modules/* rootfs/lib/modules/

Create the boot partition (i.e. copy the necessary files):

mkdir bootfs
cp -r firmware/boot/* bootfs/

Next we can make some adaptions to the future image files: set a new root password, hostname, adapt the sources list, etc…

sudo chroot rootfs/ /usr/bin/passwd

vim rootfs/etc/hostname

cat >> rootfs/etc/apt/sources.list deb testing main contrib non-free rpi

It might also be a good idea to adapt the future system to your local settings, e.g. keyboard layout.

sudo chroot rootfs/ apt-get update

chroot rootfs/ apt-get install console-data \ 
console-common console-setup tzdata most locales keyboard-configuration

sudo chroot rootfs/ dpkg-reconfigure locales

sudo chroot rootfs/ dpkg-reconfigure \

sudo chroot rootfs/ dpkg-reconfigure tzdata

Now we can do some clean-up:

sudo rm rootfs/usr/bin/qemu-arm-static

Next step is the creation of the actual boot and root partitions on a SD-Card. I’ve not documented these steps in detail as everyone has a different favourite partition manager. This step can be done with fdisk, (g)parted, or other tools.

You have to create two partitions on your SD-Card. For the boot partition 64 MB are sufficient, the remaining space is used for the root partition. The boot partition needs to be a FAT32 partition. The nice thing about the Raspberry Pi is, that boots of the first FAT32 partition without further installing a boot block or so.

Here an example how a 2 GB SD-Card could look like:

fdisk -l /dev/sdd
  /dev/sdd1 2048 133119 65536 b W95 FAT32
  /dev/sdd2 133120 3987455 1927168 83 Linux

Now we can copy the files from the two directories we previously created onto the two SD-Card partitions (you might need to mount them first) and test the card.

cp -R rootfs/* /media/USER/root/ && sync
cp -R bootfs/* /media/USER/boot/ && sync

I also have created an image file, mounted is (as a block device), partitioned it similar to the steps above. But I have not yet documented these steps. Might be added in a future update…

Fix Eclipse (luna/mars/neon) display on Ubuntu 14.04 and newer

Update: This ‘trick’ still works for newer versions of Eclipse (e.g. mars, neon, oxygen) and Ubuntu versions (14.10, 15.04, 15.10, 16.04, 16.10). I’m using ‘rolling’ updates so I’ve tested most versions mentioned above.

I recently installed Eclipse ‘Luna’ on an Ubuntu 14.04 system and encountered a few display issues. Eclipse was rendered unusable for some GTK reasons…

It took me a while to find a somewhat related blog post that led me to a solution for the missing views and errors when starting Eclipse.

In case of starting Eclipse from a console two environment variables need to be set in advance  to avoid a corrupted Eclipse window:

export SWT_GTK3=0

In my case I created a desktop entry ~/.local/share/applications/eclipse.desktop to facilitate the startup. Adapt it to your needs:

[Desktop Entry]
Comment=Eclipse IDE
Exec=env UBUNTU_MENUPROXY=0 SWT_GTK3=0 /home/kai/eclipse/eclipse

Linux: Direct Flash Video Download

Update: Found a nice Linux console tool that allows downloading Youtube (and other) videos directly only by passing its URL as an argument: cclive

From time to time I find an interesting video in the web I want to buffer (temporarily store) for later offline viewing. In most cases these videos are hosted on one of the major video sites (e.g. YouTube or Vimeo) and are accessible via Flash plugin. But downloading is in most cases prevented (although many videos are under a creative commons license) and “download helper” tools (at least for Chrome) are not really usable.

When viewing such a video in the browser window, the video is locally cached but not directly accessible — or so I thought. A few weeks ago I stumbled across a posting which describes how to copy the contents of such a cached video into a file and thereby creating a direct copy of the video. Please note: I do not take credit for the following steps — I have read them in a Linux (Ubuntu?) forum but forgot to store a direct link to the original source. Sorry.

The first step is to open the video (and only one to avoid confusion) in your browser. Let the flash video start and thereby being cached onto your hard drive. Flash creates an inode with the name “/tmp/FlashXXzzzzzz”. It keeps the file handle open but deletes the file itself right after its creation, rendering it (in theory) inaccessible. But as the file is still open, the shell command “lsof” is still able to show it. So entering

$ lsof +L1 | grep /tmp/Flash

in the console will show all open files with “/tmp/Flash” in their name (grep) that are unlinked (+L1).

chromium- 12345 kai 25u REG 8,3 121314 0 1425364 /tmp/FlashXX1AbcdE (deleted)
chromium- <PID> kai <FD> REG 8,3 121314 0 1425364 /tmp/FlashXX1AbcdE (deleted)

In the sample above I’m using Chromium as browser, the process ID <PID> is “12345”. The interesting number is the “25u” which represents the file descriptor <FD>. In combination with the process ID it can be used to access the cached video data. (This might have to be done with root permissions.)

$ cp /proc/12345/fd/25 /tmp/video.mp4
$ cp /proc/<PID>/fd/<FD> /tmp/video.mp4

Now the file “video.mp4” should contain the video (stream) data in a playable form. Keep in mind: if the caching process was not finished while copying, the video file will also be incomplete.

Resolving Eagle CAD dependency problems under Ubuntu

This is a short post which I’ve made to show you how to fix dependeny problems of Eagle CAD under a 64-bit Ubuntu distribution. The current installer (Eagle CAD 6.4) works quite well under a 32-bit Ubuntu 12.04, 12.10 and 13.04 distribution. The eagle binary is linked against 32-bit libraries, so installing “all possible” 32-bit libs might be a possible (but uncomfortable) solution. This can actually be done by installing two packages:

sudo apt-get install ia32-libs lib32z1

A nicer way would be installing only the required libraries. The installer does not help you finding missing dependencies, so you have to actually extract the eagle binary by hand to inspect it. This can be done by modifying the installer or even faster by extracting the compressed files out of the installation script. I’ve prepared a short (compact) video tutorial on of the actual process. It’s my first video tutorial so please be indulgent. 😉

DeLonghi Coffee Machine Sound Modification

About a month ago I stumbled across a thread (in German) about improving the sound of DeLonghi ESAM coffee machines. It was said, that with rather few changes the sound profile of the machine can be significantly improved. I’ve used a necessary complete overhaul of our DeLonghi Magnifica ESAM 4500 (Pronto Cappuchino) coffee machine to also add this modification…
…with more or less significant improvements. Only two parts are necessary:

  • The ULKA EP5 pump was swapped for an Innensys CP4/SP.
  • The DeLonghi pressure relief valve was exchanged by a Saeco membrane filter (sorry, no type/model number available).
The original DeLonghi pump.
The original DeLonghi pump.
The new parts installed in the DeLonghi ESAM 4500.
The new parts installed in the DeLonghi ESAM 4500.
The membrane filter and the pump (originally intended for Saeco coffee machines).
The membrane filter and the pump (originally intended for Saeco coffee machines).

The new pump and membrane filter both let the coffee machine sound much deeper and calmer. Although the new pump has about 20 W more ‘power’, it runs a bit slower (about five seconds for one cup of coffee, as shown in the figure with the acoustic profiles).

Comparison of the acoustic profile of the DeLonghi ESAM 4500 before and after the modification.
Comparison of the acoustic profile of the DeLonghi ESAM 4500 before and after the modification.

I’ve also made a video which shows (or should I say: plays 🙂 ) the before/after effect. The most significant change can be heard after the coffee was grounded, when it is actually poured into the cup.

WordPress “twenty twelve” and Rich Snippets Testing Tool

While playing around with my Google+ profile I noticed a posting about Google Authorship, i.e. linking postings from various web sites to your profile. Search results show your profile photo, if activated. This was nothing new for me. But nonetheless I tested the mentioned Google Rich Snippets Testing Tool with my web site and it threw the following error message multiple times:

Rich Snippets Error Missing required field "updated"

I quickly found out that the culprit was my theme “twenty twelve”. Its predecessor “twenty eleven” also led to this error messages, but other themes didn’t. So I dug myself into the PHP code (Appearance -> Editor) and narrowed it down to a single class definition in functions.php (ca. line 326) that had to be changed from “entry-date” to “updated”:

$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="updated" datetime="%3$s" pubdate>%4$s</time></a>',

I have not checked what the difference between “entry-date” and “updated” is, but I have not yet observed any negative consequences; so I will stick to the change. The code in the “twenty eleven” theme looks similar, so if you want to adapt it search for “entry-date” (only one occurrence) in the functions.php file.

Logitech M705: How to fix a defective mouse button

After cleaning and reassembling...

I’m a big fan of Logitech mice, or at least was until a few days ago. My wireless Logitech M705 started to behave strangely: Pressing down the left mouse button resulted in multiple clicks (i.e. double-clicking) and dragging became impossible due to random interruptions when holding down the button.

Without a warranty (which had expired three months ago) I did not feel guilty when opening the mouse to look for the cause. The culprit was quickly found: the microswitch of the left mouse button. Luckily, I had spare microswitches as I’m currently playing around with the optical sensors from other spare/defective mice. I will cover this in another post. To come to the point: after replacing the microswitch, the mouse works again as usual. I’ve made a few photos (a picture is worth a thousand words 😉 ) to help others during disassembly of the housing. Screws are marked red, and I have also marked (in yellow) two tiny springs that can easily be lost.

This fix has a bad aftertaste: at least in Germany, there is much talk about “planned obsolescence”, and I’m wondering if Logitech (and other manufacturers) use cheap microswitches that only survive a certain number of clicks. Especially after my mouse showed the previously mentioned defect so soon after the expiry of the warranty… On the other hand Logitech kept its promise regarding the battery life – I’m still using the first set.

Update (2014-11-22): Just as a brief clarification, after I got some feedback on the M705. (Apparently several users have had similar experiences.) Logitech uses Omron switches that actually seem to be pretty good. So I want to point to posts from Kogos and Ralf  below: First you should try what is recommended in a Logitech forum post. After that you might try resoldering the joints. If that doesn’t help an exchange might be the best option…

HowTo: Running Eagle CAD 6.2 on Ubuntu 12.04/12.10/13.04

Update: Eagle CAD version 6.4 is available which runs fine on Ubuntu 12.04., Ubuntu 12.10 and Ubuntu 13.04. I’ve made a small tutorial on how to fix possible dependency problems with this new version.

Ubuntu 12.04 only provides an older version of Eagle CAD, version 5.12.0 to be exact. A newer version 6.2 (32 bit) is available for download, but the installation fails due to the lack of a 32 bit libpng-1.4 library:

error while loading shared libraries: cannot open shared object file: No such file or directory.

Luckily, I found a detailed post at raek’s blog which covers older Ubuntu versions. Great parts of the following instruction were taken from this post and adapted for Ubuntu 12.04. Thanks!

First of all you need to install some packages to build the missing png library. Open a terminal window and enter on a 32 bit Ubuntu 12.04:

sudo apt-get install build-essential perl
sudo apt-get install zlib1g zlib1g-dev

On a 64 bit Ubuntu 12.04:

sudo apt-get install build-essential perl gcc-multilib
sudo apt-get install ia32-libs lib32z1 lib32z1-dev

Then you need to fetch the libpng source code and the Eagle CAD 6.2 installer, either with “wget” (as I have done it) or directly from the respective webpages. A current version of Eagle CAD is available for download here:
libpng 1.4 can be found on this page:
I will use the “/tmp/libpng-eagle” directory for building the library:

mkdir /tmp/libpng-eagle
cd /tmp/libpng-eagle
tar xvfz libpng-1.4.12.tar.gz
cd libpng-1.4.12/
./configure --prefix=/tmp/libpng-eagle/install CFLAGS=-m32
make check
make install

At this point I assume that your Eagle CAD installation will be located at “/home/$USER/eagle-6.2.0“. If not, simply adjust the location in the text below:

cd /tmp/libpng-eagle/install/lib/
mkdir -p /home/$USER/eagle-6.2.0/lib
cp -a* /home/$USER/eagle-6.2.0/lib/

Now the installer should run…

export LD_LIBRARY_PATH=/home/$USER/eagle-6.2.0/lib/
cd /tmp/libpng-eagle/
chmod 755

After the installation finishes, Eagle CAD will still not run unless you tell it where to find the png library we have just created. The easiest way to do this is by creating an executable start-up shell script (e.g. /home/$USER/eagle-6.2.0/ which contains the following commands:

export LD_LIBRARY_PATH=/home/$USER/eagle-6.2.0/lib

Additionally, you could create a Unity/Gnome menu entry, for example “/home/$USER/.local/share/applications/eagle.desktop
(do not forget to adapt the $USER):

#!/usr/bin/env xdg-open

[Desktop Entry]
Comment=Eagle CAD

Update: A friend told me that the installation procedure also works with Ubuntu 11.10.