Managing cron.d with chef

I have recently been playing with the chef configuration management system. I was looking for a way to manage files in a directory such that any that were created by chef would be cleaned up again when they were no longer needed. A classic use case is the /etc/cron.d directory which may be populated by files from multiple sources. There appeared to be no established pattern for this but since chef allows the use of ruby in its recipes, I was able to construct the following. It assumes the use of the cron cookbook.

cron_d 'usercron.chef' do
  minute 0
  hour 23
  command '/bin/true'
  user 'myuser'
end

Dir.glob("/etc/cron.d/*.chef") do |f|
  name = f.split('/')[-1]
  begin
    t = resources("cron_d[#{name}]")
  rescue Chef::Exceptions::ResourceNotFound
    cron_d name do
      action :delete
    end
  end
end

OS X Terminal.app, bash and UK Keyboards

On an Apple UK keyboard, the # symbol is accessed by pressing ⌥-3 (pronounced option 3). Unfortunately the terminal application is only useable when option has been mapped to the UNIX meta-key, which takes precedence over “special” characters such as #. Thanks to this tumblr post, it is possible to work around this problem:

$ cat .inputrc
"\e3": "#"

Unfortunately .inputrc is a bash-specific configuration file and this does not solve the problem for terminal-based applications.

Google Maps and iOS Background App Refresh

I am posting this to the web in case it helps anyone else trying to troubleshoot a similar problem.

Recently I noticed my iPhone’s battery was ending each day significantly lower than usual, causing me to have to charge it every night instead of every couple of days. At first I suspected the extra consumption was caused by communicating to my Pebble smart watch but quickly eliminated that possibility when turning the Pebble off for a day had no effect.

After some experimentation, the change that restored my battery usage to its previous norm was disabling background apps refresh for Google Maps. This was an application I had recently installed because it works very, very, nicely with the Pebble, sending turn-by-turn navigation directions to your wrist as you walk. This completely removes the need to take the phone out of its pocket every few minutes to double check that the road you just passed was not the one you were supposed to turn down! However I do not use it frequently enough to justify doubling my daily power consumption…

Final photographs from Japan

A final collection of photographs from our trip to Japan. We are positioned ourselves on the right side of the train to see Mount Fuji for our trip from Osaka to Tokyo but sadly it was too cloudy. I have included some photographs of the view from the train window because I think it gives a nice impression of what you see when travelling on the Shinkansen. I also managed to get one photo of Mount Fuji from the plane window as we took off for London. Would love to go back one day.

Retrospective of our day in Tomonoura

During our trip to Japan in 2012, we took a day trip to the historic port town of Tomonoura in the Hiroshima Prefecture. I do not remember why I did not blog about it at the time but it proved quite photogenic so I thought I should write something to provide context for the photographs.

The town is on the side of a hill, the upper part provides some lovely sea vistas, and we enjoyed the bonus of some beautiful sea eagles soaring on the warm thermals. At sea level the town has picturesque traditional wooden buildings and quaint narrow streets. Lunch was in a friendly water-side café that served up large portions of satisfying seafood pasta and in the afternoon we took the five minute ferry ride to the island of Sensui Jima. This is undeveloped (except for two hotels) and offered more superlative sea views in return for some light hiking.

Reaching Tomonoura was probably our biggest adventure on Japanese public transport since it required taking a local bus from Fukuyama station. Tomonoura is mentioned in the guide books but it is certainly not on the “standard” tour for Westerners and that made it all the more pleasurable a day. Yet again the people were incredibly friendly, from the bus driver who talked to us about scotch and the Olympics, to the café waiter who translated the Japanese language-only menu and made sure Rosie’s pasta was dairy free.

Wearable Tech: Pebble

I have a new gadget, a pebble smartwatch. The “smart” moniker seems appropriate because it does something in addition to its primary function (telling the time), and as a platform it has a lot of potential, but like the first few generations of smartphones were merely OK phones, this is only a good digital watch rather than a great one.

Why would I want a mini-computer on my wrist when I already have one in my pocket/bag?

It seems to me that large screen phones are popular for a reason: they make better computers. Conversely as the screen size increases they lose all the properties that made smartphones attractive in the first place—easily carried always with-you devices. All the major mobile phone makers have launched voice-based interfaces but not only are they slow and error prone, in many cases the desired responses are fundamentally visual. Hence, the idea is a second screen for the phone that can then safely remain zipped away in a secure location.

What is it for?

For the moment, notifications. There is some rudimentary fitness tracking if you are into that sort of thing, but even being able to read notifications without getting my phone out of my pocket has turned out to be quite useful. For a start, I often fail to notice calls and texts when walking but the pebble makes them much more prominent. I can also see, with one glance and without taking off a glove, whether it is something urgent, or whether it can be dealt with later. People in the habit of leaving their phone in another part of the house will also find it useful since the bluetooth range easily stretches across a couple of floors.

While the pebble can run apps, currently these are mostly of novelty value rather than actually useful. The forthcoming 2.0 API looks a lot more capable and has proof of concept apps for things like displaying the last train departures from the nearest tube station. Notably the pebble does not have any built in speaker, microphone or camera which places it a long way from the significantly more expensive Galaxy Gear.

How good a watch is it?

Functional. Its e-paper screen means the time is always displayed (if you want it to be) and there is a cool motion sensor activated backlight. I did struggle to find a nice watch face that matched the functionality of my Timex Ironman digital watch, but since many watch faces are open sourced it would have been possible to modify one to my purposes had I not found one. Since the platform is very immature, sifting the good watch faces from the gimmicky was also part of the problem: it is currently not possible to search for something as specific as “digital 24 hours with seconds date and day of week”.1 The lack of built-in applications for what I would consider standard watch functionality is probably the biggest weakness right now. For example my Timex digital watch comes with chronograph, countdown timer and multi-timezone functions by default; for the pebble I had to search for an app and then try different ones out until I found one that worked well.

I find many normal watches too bulky for my slim wrists but as you can see from the photo, the pebble fits just about OK—I certainly would not want it any larger. The strap is a standard fitting so can easily be replaced and the battery is claimed to last 5-7 days between charges, which seems accurate based on my usage so far.

Conclusion

The pebble is fun and I already find it a useful addition to my every day life. It is by no means essential—yet, that will require several more iterations of both hardware and software—but the pebble proves the concept has utility in the world outside of Silicon Valley’s reality distortion field.

  1. Currently very few faces display seconds at all, it is not clear whether this is an unfilled gap in the market or because it drains the battery 59 times faster. [back]

Buddy online notification in Messages (OS X Mavericks)

In the days when OS X’s instant messenger program was called iChat, I think it was possible to setup a notification when a particular buddy came online. Mostly not very useful to non-stalker-types, especially as some services logged people in and out fairly continuously, but I would occasionally turn it on when trying to get in touch with an elusive friend or family member in a timezone that offers very little overlap with my own. It appears that is no longer an option in the main interface in Mavericks, but Apple do provide the ability to run an AppleScript whenever an event is triggered.

Continue reading

A short visit to Bordeaux

When I looked out of the plane window and saw driving rain as we descended into Gatwick on Friday night, it felt a long, long, way from warm—t-shirt weather—sunshine we had enjoyed as we sat outside to eat a late lunch in Bordeaux.

The reason for the visit was a software workshop so most of the three days were spent cloistered inside a classic 1960s academic building at one of the city’s universities. On the last afternoon though I did get chance to wander around the stately low-traffic and pedestrianised centre admiring its classical 18th century sandstone buildings now listed as a UNESCO world heritage site. For such a picturesque town it was surprisingly functional: the ultra-modern tram system was efficient, although never less than moderately busy.

While the Bordeaux area is most famous for its wine, the city also seemed to cater those who liked shopping with what seemed like un-ending streets of shops. This is part of the historic Aquitaine region so I was sad not to have chance to visit the well-reviewed, and free, Musee d’Aquitaine. For dinner, the concept of an entire restaurant dedicated to cheese, Baud et Millet, and its 94 cheeses, could not be passed up. Despite its anglicised name, Italian owned Le Wine Bar also served up some tasty vittles of ham, cheese and local specialities.

Place de la Bourse captured by the iPhone panorama mode.

Place de la Bourse captured by the iPhone panorama mode.

HTC One V

The HTC One V Android phone was recently added to the list of devices I am called upon to provide technical support for, and this weekend I had the chance to have a good play with it (i.e. its owner found it to be acting up and I had to help).

This is not meant to be a full review but rather a couple of observations, and a record of some “features” that lacked adequate documentation. Overall I found it to be a nicely put together piece of hardware with good ergonomics. On the software side the “pattern swipe unlock” requires less brain power to use than PIN, and gestures to switch between tabs in the web browser made multitasking on the web as easy as multitasking between apps.

On the negative side, the keyboard was awful. I have written entire blog posts on my iPhone keyboard of similar dimensions, yet could not enter a simple web search correctly first time on this one. A few Android users have recommend installing Swype, but that’s not available from the official App Store. It also turns out to be completely unnecessary as the HTC One comes with a built-in “trace keyboard” hidden away behind Settings -> Language and Keyboard -> HTC Sense Input -> Trace Keyboard which, in just a few minutes of testing, seemed much more useable.

General impressions aside, the reason I was called upon was because events added to the calendar application were not being synchronised to Google calendar on the web. This seemed odd, since synchronisation to Google’s services is supposed to be Android’s forte. The problem was that all new events were defaulting to a calendar called PC Sync, that was not synchronised anywhere, and no where did it seem possible to either change that default, or remove that calendar from the phone. Searching the web revealed only other people complaining of the same problem, and no solution—the cause though appears to be that HTC have replaced the default calendar application with one of their own that has this inexplicable and inexcusable “feature”. Fortunately there is now a workaround available—download the official Google calendar app from the App Store!