Skip to main content


Showing posts from 2012

Look Ma, no Wires! Raspberry Pi Bluetooth tethering

Bluetooth is a relatively low-powered short-range wireless technology, which can among others provide a networking connection between devices and is widely supported in portable devices like laptops and mobile phones.  Low power and ubiquitous support should in principle make Bluetooth an ideal solution for tethering. Nothing beats the simplicity, robustness and performance of a simple Ethernet cable for a tethered network connection - as long as both devices support it. For the upcoming Raspberry Pi model A or certain ultra-portable devices without Ethernet port, Bluetooth might be serious option. Wi-fi would probably be the most obvious choice of wireless networking technology. However using the ad-hoc wi-fi hotspot option for tethering on my Android phone turns it into a pocket heater and drains the battery in no time  - while not so much when using Bluetooth tethering instead. Besides wi-fi networking is very well documented, while there is very little documentation for Blue

Raspberry Pi tethering

 After some initial experiments  with using a Raspberry Pi as a home server, I wanted to try out some configurations  useful to the intended purpose of the Raspberry Pi: promote computer technology literacy among students. At least some of the initial feedback from trying to deploy Raspberry Pis in a classroom settings seems to indicate that getting the necessary hardware to operate the Pis is non-obvious. Setting up a room full of Pi based workstations requires HDMI or composite connected TVs or monitors, USB mice and keyboards, micro-USB power supplies and ethernet connectivity routed to each workstation. The cost and logistical complexity of doing that seems to defeat the initial low-cost advantage of the Raspberry Pi. Furthermore, many schools might already have fully equipped computer facilities with incompatible equipment (e.g. SVGA monitors, standard on any not-so-new PC), which could be used, but just not "messed with" for low-level programming and system admini

Automated Dependency Injection

In the tradition of modular and object oriented programming, we have long learned to design software by hierarchical decomposition - divide and conquer engineering, where each module/object has a clear function/responsibility. Complex functionality is achieved by delegating some sub-functionality to other modules/objects. In the above example, module A achieves its functionality with the help of B, C and so one. When these functions become stateful, abstract data types or objects, "wiring" up this dependency tree to enable the access to the right instances of data at each level can become non-trivial in large projects. The dependencies can be hidden and encapsulated hierarchically such that if an application needs an "A", creating "A" in turn triggers the creation of the appropriate "B", "C", "D" and "E", hiding all the complexity of the decomposition from the user of "A". However this static setu

Kugelbot - or what to do with a Raspberry Pi

With the Raspberry Pi board now up and running on the network, I needed something "reasonable" for it to do. Maybe an homage to the famous Trojan room coffe pot camera - 20 years later, at a fraction of the cost? Hosting a download mirror for Raspberry Pi boot images on a Raspberry Pi? A probe for network performance monitoring? A twitter robot which recites The Iliad 140 characters at a time? Finally, I settled for a robot which reposted a summary and link to all my public Google+ postings to my otherwise unused Twitter account . In addition to Python 2.7 already included in the boot image, the following ingredients were used: tweepy (Twitter api library, recommended by Twitter ) google-api-python-client (Google+ api library, provided by Google) daemon (small library to run python script as a daemon, easy_install daemon) In order to read public posts via the Google+ API , no authentication is required, but a developer key is needed for quota tracking, which

Raspberry Pi - unbagging and first impressions

Looking for low-cost linux hardware , I had come across the Raspberry Pi project a few months ago and been hopefully intrigued by its goals to promote " computer literacy " (whatever that means). Now that you can actually get them more easily, I ordered myself one from Farnell and surprisingly it arrived in a few days. I am glad to see that the popularity of the Raspberry Pi device is creating an active community, where detailed help and instructions are easily available - not an obvious thing for other niche and esoteric hardware. I was going to set it up as a network server and access it from my PowerBook via ssh, X11 and/or VNC. Getting a bootable SD card was very easy, also in part thanks to such detailed instructions , but requires access to another computer with SD-card reader and Internet access. Using a spare micro-USB cellphone-charger and an ethernet cable to connect directly to the home router was all that is needed to complete the setup. After that, it got a

Google+ - Social Network?

It's been about a year since Google+ launched with great fanfare and even greater anticipation in the tech media. Being late to the party of the currently much hyped "social networking" space, Google+ has the benefit of being of being a more polished and more thought out platform than some of the older, more established players. Being a very flexible and generic platform, launched without a particular pre-imposed usage or application, it was interesting to see how its usage would pan out. Before Google+, I was using at some point or another Linkedin for keeping track of the changing fortunes of my former colleagues Facebook for goofing around and keeping an eye on what friends and acquaintances were up to Blogger for potentially pubic postings which hardly anybody reads Flickr for public photo-sharing Twitter to try out what all the fuss was about  email for most of the purposeful communication with the inner circles of my social graph. On Google+ I was tr

The Evolution of the FOR loop

The most widely and commercially used languages today are largely based on the imperative and structured programming paradigms and many have a direct and strong roots in the C language of the early seventies. Even though there seems to have been little fundamental change in main stream programming languages over the  last 40 years, there have been subtle shifts in usage patterns, even for things as simple and fundamentally low-level as doing some things repeatedly or in a loop. As a perfectly and randomly useless example to illustrate the evolution of looping, we are creating a list of squared numbers from the positive members of an input list. In C or any similar imperative language of its time, the most basic way to do something like this would be something like: out_size = 0; for (i = 0; i < in_size; i++) { if (a[i] > 0) { b[out_size++] = a[i] * a[i]; } } Languages like C++ and Java, which includes a standard library of higher level collection data types, thi

Learning Computers

On Feb 29, the Raspberry Pi foundation launched the sales of a $25 credit-card sized computer, which sold out in minutes. The goal of the Raspberry Pi is to stimulate computer literacy education in schools, inspired by the impact which the BBC Micro computer had on schools in the UK - compared with a similar wave of popular home-computers elsewhere - e.g. the Commodore 64 . I understand the elements of nostalgia of people growing up around the 1980ies for the time when computers where new and exciting. Around that time, I thought myself programming in C and M68000 assembler on a Commodore Amiga and probably learned more in basic understanding about programming and computer architecture than during the years afterwards in engineering school. The home-computers of that era were hackable enough to encourage tinkering and simple enough to allow really getting to the bottom of how they worked. The gap between what could be produced by determined hobbyists and professional software pu

Tiny, low-cost Linux Device

Recently I was looking around for cheapest, smallest device which easily can run linux and which can be bought in small quantities down to one. The particular application in mind was to build a linux based print-server which exposes legacy USB or network connected printers via Apple AirPrint for iPads and iPhones or Google CloudPrint for ChromeBooks or some Android devices and maybe could provide some other services to such thin-client, "cloud-top" devices (local file server and/or backup, wifi/network gateway etc.). A few years ago, I had a first compact, fan-less home-server in the form-factor of a mac-mini, i.e. about the foot-print of the optical drive it contains. Like the mac-mini, this was basically a compact PC, made largely out of laptop parts. It seems that the clear winner in terms of cost today is the new Raspberry Pi board at $25/$35, whose launch this week caused an Apple-style opening-hour stampede on the online store selling its first production batch

Securing Gmail

For heavy users of Google services, the gmail account has over the years evolved into a "Google account" and holds the key to an increasing amount of our online activities and presence. Judging from a random sampling of the gmail support forum or some reports in the press (E.g. this recent article from the Atlantic Magazine ) - gmail account hijacking is an increasingly widespread and serious problem. Stolen account IDs from major web-mail providers (gmail, hotmail, yahoo mail etc.) seem to be collected and used at industrial scale for spam generation and fishing for  419 style advance fee fraud  schemes like the infamous " mugged in London " scam described in the article above. The mechanics of some common threats used to steel account passwords is described in this blog post in some detail, but in short it boils down to weak passwords, password re-use and password sniffing malware. Given how prevalent malware infestations are on major OS platforms, even use

GWT - An Experience Report

As noted before , I am not a big fan of JavaScript as a language for complex web application projects. Recently I got the chance to get some first-hand, comparative experience with GWT (Google Web Toollkit)  as part of an application re-write/upgrade. The original system was a web-app built web 1.5 style in Java, on top of the OpenSymphony WebWork  framework, combined with an XML based template engine and guice for dependency injection on the server side. On the client side, there was a growing amount of JavaScript code for each page, using the Closure JavaScript compiler and library . The app is reasonably non-trivial, resulting in about 40k client-side Java code after the rewrite. For a project of this nature and complexity, I am very positively surprised and impressed with GWT. For the base architecture of the new client, we had basically followed some of the best practices advice for large-scale GWT applications from GoogleIO talks in 2009 , 201 1 or in this document : use MVP

Why Time is hard

At least since the "Y2K problem" entered the public consciousness around the turn of the last century, nobody doubts that correctly representing time in computer systems is somehow hard. While today nobody is hopefully trying to save a few bytes by representing years in 2 digits, the state of time computations in many programming environment is still over-simplistic to say the least. Having (almost) gotten caught by surprise by last years changes to civil time in Russia, this article is an attempt to understand, what it takes to handle time somewhat correctly for business related computer applications. There are 2 common uses of time in computer systems: a monotonically increasing measure representing a global reference clock of some sorts and which can be used to determine an absolute ordering of all events in the system as well as their relative duration. Representation of civil time as it is used by communities of people living in some particular place to go about t