TinyPrinter in a box

raspberry pi and thermal printer in tupperware

After coming across a great tutorial on pikiosk on how to interface a thermal printer with a Raspberry Pi I knew that I had try building one of those. I wasn't as interested in printing graphics rather than making it easily accessible, so I chose to use their code as a basic service for printing text and doing everything else in a small web frontend; which gave me an opportunity to delve into Symfony 2.

Assembly

With the tutorial above, connecting the Pi via GPIO was a piece of cake and most of the time consisted of finding a stable pin connection without soldering it into place (male pin header casing without pin worked very will together with breadboard cabling). The Pi's GPIO connector is really the key element for its usefulness and fills a great niche there. Without a full Linux doing anything non-trivial with networking isn't really fun on. This is especially true for Arduino and Android is still to cumbersome as an intermediary there (but that's a different post).

The casing itself is a pretty durable spare tupperware container I had lying around, a bit too durable to work smoothly with it. Should I work on another enclosure I'll likely choose a thinner plastic or similar material. Nonetheless, a Dremel with a cut-off wheel and a drill was sufficient to cut a square hole in the top and a hole to feed the power cabling through. A spare wifi adapter provides connectivity.

Symfony 2

I really enjoyed working with the structure and tools that Symfony provides and how the documentation makes it easy to create a clean and structured project from scratch. The web debug toolbar (see here) in particular is a nice tool to efficiently debug your application. Having some of those elements such as routing and Twig in Drupal is going to be a great advancement.

The only thing which was annyoing here was the template inheritance structure, the documentation could be a bit more detailed on this topic. In particular how and where Twig uses extend to inherit elements and which are automatically aggregated, which are manually deployed and so on.  

web frontend for tinyprinter

Making printouts with TinyPrinter is surprisingly addictive. The code is on Github.

Quick ad-hoc file transfer with IPv6

Nowadays I rarely use wired networking at home. However, when you want to transfer 50GB or more, the round-trip over the wireless router can take several hours to half a day. 

The easiest solution is of course to attach two ethernet cables to your home router and be done with it. Depending on your setup, though, that might be cumbersome with a desktop in another room or not having 10m or more of ethernet cabling available. So, in those instances it makes sense to dust off a crossover cable or a switch to connect the devices together.

In IPv4-land one would now have to configure a local network with static addresses in the 192.168.0.0/16 or 10.0.0.0/8 range. With IPv6 enabled devices, however, such an address is already present in the form of a link-local address. The following example shows how to discover devices on the local network with a broadcast ping and then how to connect as usual via interface em1:

$ ping6 -I em1 ff02::1
PING ff02::1(ff02::1) from fe80::f2de:f1ff:f1ff:f1ff em1: 56 data bytes
64 bytes from fe80::f2de:f1ff:f1ff:f1ff: icmp_seq=1 ttl=64 time=0.079 ms
64 bytes from fe80::250:8dff:8dff:8dff: icmp_seq=1 ttl=64 time=0.393 ms (DUP!)
$ scp myfile user@[fe80::250:8dff:8dff:8dff%em1]:/home/user/target

Tags:

Things from the attic: Books of links!

Book covers for Internet/Web After Hours, Webbound
 

I have no idea how I ended up with these books or why I did not throw them away a decade ago but browsing through them is definitely amusing, which is why I'm sharing a few screenshots here. They are an artefact of the pre-Google era where web search was in its infancy and the primary navigation for people still consisted of portals and curated indexes like Yahoo. The books you see above are the following:

Contact me if you'd like to be the proud owner of one of these historic tomes (otherwise they'll get recycled).

The After Hours Series 

Pictures 2-13

This two part series is a general introduction for a layperson to the breadth and diversity of the Internet in the mid-nineties. Apart from Netscape Navigator it also shows then still viable methods of using the Internet such as Newsgroups, Telnet, Gopher and Finger (for vending machines!), though the majority is devoted to the World Wide Web, and the screenshots of what counted as a website back are just wonderful. Of course, it also deals with "Browser Wars", though they are here still between Netscape and the AOL browser.

WebBound

Pictures 14-19

WebBound was a U.S. periodical which has vanished at some point in the early 2000s (though someone still pays for their domain name). What can still be found on them is mostly other people (Addendum: site now down) remarking on their obsoleteness, like me. Their niche was to provide an offline categorical index for web sites similar to Yahoo, DMOZ, etc. so basically a yellow-pages for the web. If you do a Google image search you'll see that their prominent argument consistently was to enumerate the number of links, peaking somewhere around 75,000. When we stopped needing directories thanks to Google and weren't tied to long wait times thanks to broadband, such publications naturally had trouble finding buyers.

An interesting side-note is the editorial content in this publication, where some pages got full-page spreads with several cheesy stock photos, which suggests that at least that coverage was not curated by an unbiased editorial staff, if any.

Things from the attic: Stamps!

stamp collection book
Photo CC-BY by itchys

Sometime during primary school, back in the pre-Internet dark ages of the early nineties, I somehow started collecting stamps for a summer or two. While decluttering I came across a stamp collection book like the one above, the content of which I wanted to share. Below you'll find a selection of what I found in there; at least some of the interesting and more bizarre ones.

My primary source for those stamps were preselected bags from the post office (do they still sell those?). I recall them being fairly wide-ranging though there were certain extremely common ones which I threw out right away. Due to those bags there isn't only a selection of then common Deutsche Bundespost stamps – when the German post office was still state-owned – but also a varied selection of US, Eastern Bloc and other international stamps.

Apart from simply comical ones like the bears riding motorcycles and the Victorian telephone operators, it's interesting to see how much political propaganda can be found in something as simply as a stamp on all sides, though the FDR definitely wins that race. The Interkosmos ones are my favourite though, with their beautifully made illustrations and schematics on such a small space.

These stamps are surprisingly interesting, especially in contrast to the current stamps in my drawer which will never be a worth a blog post, since the motives range as far and as controversial as a flower and a small bird. 

Tags:

Drupal quick tip: Ignore custom modules when checking for updates

 

When you are doing Drupal development and have complex deployment scenarios (I blogged about that on the Namics blog [German]), it's not unusual to have several modules containing custom functionality, as well as several Features modules. In a large site this can quickly become a dozen or more, depending on the aggregation and splitting of various functionality across modules. All of those Features will be checked for updates, every time the Update status module is run and will not find any releases for it.

Update satus showing a Features module

Now that's annoying and helpful Stack Overflow/Drupal Answers people have already found the hook you need to fix it. Of course there is a hook for that. The code snippet taken from there is reproduced below. I amended it to also contain a second hook, which then also excludes these modules from being checked when translations are checked by the Localization update module.

function mymodule_update_projects_alter(&$projects) {
  $blacklist = array(
    'collection_feature',
    //etc.
  );
 
  foreach ($blacklist as $module) {
    unset($projects[$module]);
  }
}
function mymodule_l10n_update_projects_alter(&$projects) {
  mymodule_update_projects_alter($projects);
}

And I just found the great prettify module to display it, very nice!

Quick tip: Fixing common name / server name warning messages

When you configure Apache httpd to server SSL you'll most likely define a VirtualHost, give it a ServerName, possibly a ServerAlias and various other settings. If you did everything correctly, the site will come up with the familiar green/gold/blue https markers, instead of a big red warning page. If you got to this point but you are still seeing the following error message in your logs, most likely, you have flipped your ServerName and the certificate's alternative name.

[warn] RSA server certificate CommonName (CN) `example.com' does NOT match server name!?

At least this turned out to be the mistake I made when configuring one server with a certificate which had example.com as the common name and www.example.com as the alternative name. You can find what your certificate delivers (in Chrome) under "Certificate Fields", "Extensions", "Certificate Subject Alternative Name". Your VirtualHost has to match the certificate's preference to not throw the warning. So simply change the former to the latter, even if you are primarily (or only) serving from www.example.com.

Logs an error in my case:

ServerName www.example.com
ServerAlias example.com

Does not log an error:

ServerName example.com
ServerAlias www.example.com

Pages

Subscribe to Front page feed