09
Aug 14

Arduino, MQTT, OpenHAB and the Ultimate Room Control Panel

Little demo video of the project so far below!

My idea for a room control panel came about after seeing the vastly expensive options on the market, and because we are building a new home!

Lovely! But I can do *far* better, right?

Lovely! But I can do *far* better, right?

 

I love the brushed stainless steel precision-cut panels they offer – so I plan to make my own.

Not only are the options available a little* over budget, more importantly they don’t come close to addressing my ideals:

* a lot

  • Combine lighting and audio control into one panel. Soft dimming of multiple lighting channels with advanced / user-friendly audio control.
  • Field nodes small enough to be placed in wall back-boxes and controls flush-mounted in the wall.
  • Accessible but autonomous. Should not require changing batteries or worrying about someone hacking the RF wireless protocol. CAT6 and mains powered. RF options with secured MQTT an option, but we have a blank slate with cabling so prefer to go wired.
  • All control to communicate with an automation server (Windows laptop / RPi / whatever) which provides rules that integrate audio, lighting, security, and give me access from out of the home. Must be resilient to server outage; lighting must still work using physical switches.

The audio control aspect is particularly close to my heart:

  • I have always used Squeezebox. Whilst Sonos is more “user friendly” it doesn’t cut the mustard for me!
  • Hardware controls for audio in every room. Physical dials and buttons with tailor-made visual feedback and ergonomic design.
  • Audio to be controlled from anywhere and any device, therefore control panel must show updated volume and status. Volume display using LED ring around a knob (muted colours, no “chav-blue”!)
  • Backlit display showing current artist / track.
  • Discreet display which lights up when you walk past, or move within e.g. 1m of the panel (distance sensors).
  • Presence sensing for added convenience.

You’ll see I have shunned wireless communications and touchscreen control devices. Whilst they might seem sexier, to me nothing beats the reliability of cables and the hard, fast, robustness of a physical knob. Especially when we are controlling digital devices, it’s so hard to get that lovely “feel” when turning things up and down, but we must try!

(Also I have a huge surplus of CAT6 cable 🙂

My budget includes laser cutting some screwless faceplates, and even with this custom work, it’s looking very likely it will still be around 5-10 times cheaper than anything else I’ve seen… and SO much better.

Check out my progress so far!

In this video I’m perhaps unfairly harsh about OpenHAB and provide no detailed information about MQTT, but I’ve spent a great deal of time assessing OpenHAB vs. alternatives like Domoticz, and I’m sold. I believe it will become the glue that will hold the increasingly disparate world of automation together. It provides persistence, data access layers, and a binding for pretty much any automation device or system you care to think of.

It’s true that OpenHAB is daunting for the non-coder, but v2 is set to address these problems. Most importantly for me, OpenHAB has an advanced rule engine and a lovely array of software control interfaces.

MQTT as a transport protocol is a winner; HTTP is clearly not appropriate for sensor networks and REST is for sleeping. I may post about MQTT in more detail later but I’m really satisfied by how sophisticated and simple it is, and I find it highly intuitive. I like the mindset behind MQTT which you can read about here.

 


03
Aug 14

A world of home automation opening up

So I became pretty obsessed with home automation. You know, the type where your home detects you walked through the door, turns the lights on, and says through the speakers, “Hello Mat, did you have a nice day?”

Actually the above, whilst it sounds a bit sci-fi, is something I already tested out in my home to great success. My home automation system can now speak to me and tell me things. It’s a fine line tweaking it to only communicate useful things, such as “I see you are getting ready to go out, don’t forget your kitchen window is open”, but it’s important that the automation system doesn’t become a gimmick. For example, and this is something I tested, using a combination of cheap wireless sensors in different rooms allows me to write rules: bedroom door shut, lights off, bathroom detects movement, front door opens, BANG – he is leaving the house. Automatically check windows and if any are left open then speak a message through the home network audio system using Google’s voice servers. Then send a notification to my iPhone.

Sounds far too neat to be true, but it works a treat, and reliably too. It really is “set and forget” once you get the rules right.

Whilst I ditched the “hello Mat” bit spoken through the speakers (it got annoying after a while), you must agree the hallway lights coming on when you enter the home is a rather warm and lovely thing you might want to keep.

Using a combination of cheap and free bits of tech, it’s rather easy to do this*.

* I say easy. It’s easy for the geek or the technically-minded, but sadly out of reach for the technically-challenged at the moment. No doubt this may change in the coming years.

First of all you need to replace your lightswitches with the lovely RF controlled dimmer types available from manufacturers such as Z-Wave / Fibaro, or closer to home, an English company called LightwaveRF who make very cheap multi-way multi-gang dimmer switches that pair with controllers also manufactured by LightwaveRF. These were until recently found in B&Q, I think stock may come back shortly. After playing with those for a while you can stop using the LightwaveRF handheld radio remotes (they are radio, not infrared. That means they work anywhere in the house), lovely as they are, and for £80 buy an RFXtrx which is a little USB device you plug into your laptop or server or Raspberry Pi and it transmits and receives signals and talks to your lights.

Now hook the RFX with a computer running one of the excellent open source automation products, all free of course, and hey presto – you can now control your lights from the nearby park from your iPhone! One-touch access to moods, scenarios, dimmer sliders, you name it.

A lightswitch is an “actuator”. LightwaveRF – and many others – also sell “sensors”, such as PIRs to detect movement in a room, or door sensors, which feed into the system too.

Many home automation products – the one I have settled on is called OpenHab – allow you to integrate with a number of systems you might already own. Network home audio? You bet! OpenHab has a binding for Sonos and Squeezebox. They integrate with Google Voice. No extra cost and only a bit of extra playing to get it working. The world of opportunities now opens up – you can now control your music AND your lights from your light switches…

Actually it turns out that of course the LightwaveRF switches only receive signals, they don’t send them out. They ship with remote controls that can be re-purposed for controlling your volume and play / stop etc., but the lightswitches themselves will clearly need upgrading to the more expensive Z-Wave RF types which have 2-way communications in order to do such a thing. Well I don’t plan to do that because I’m a cheapskate, and more importantly I love the challenge of building my own room audio controller. This gives me a chance to integrate a pretty flush-mount digital display into my walls showing the current playlist.

Next post: the new home.


03
Aug 14

Arduino – the beginnings of a journey

Warning: geek post to follow.

Anyone who has been unlucky enough to know me over the last 3 weeks will realise my obsession with all things Arduino has got out of hand. From the initial buzz of realising “I can do ANYTHING with one of these things” to the late-night shopping sprees with Amazon sellers who distribute from warehouses in Hong Kong (I placed my 18th Ardunio order in 3 weeks yesterday night at 4am … gladly most of these purchases come in around a quid per unit so it’s not even that expensive a hobby so far), it has been a fun journey so far.

My first stop was to give myself a brief refresher in electronics and coding in C, so I followed some excellent examples from the Arduino “getting started” book. Right, after 13 minutes of making a little circuit that pulses an LED at the speed set by a knob and a few other beginner projects, I thought I should dive right in and do something serious.

I mean *REALLY* serious. A piezo tune generator. #sarcasm

The key array basically sets out the diatonic notes of a scale for 8 notes. The ones following those 8 notes are a random selection of semitones that I snuck in just so that I could program “You are my sunshine”. Musos will understand why.

Next instalment: how to control your hi-fi volume using an Arduino, RF signals, and a rotary encoder!

Here’s the sketch:

// Whack a piezo between 8 and GND
// Comment or uncomment the tune array definitions

int key[] = {261,294,330,349,392,440,494,523,587,622,659,698,784,880,987,1046};

// "You're Just Too Good To Be True"
// int tune[] = {5,5,5,6,5,3,5,0,5,5,5,6,5,3,5,0,5,5,5,6,5,3,5,0,5,5,4,5,4,5,4,0,4,4,3,5,4,3,4,0,4,4,4,4,3,2,3,0,3,3,3,3,2,1,2,0,2,2,2,2,1,1,1,0};

// "You are my sunshine"
int tune[] = {5,8,9,11,0,11,0,0,11,10,11,8,0,8,0,0,8,9,11,12,0,14,0,0,14,13,12,11,0,0,0,0,8,9,11,12,0,14,0,0,14,13,12,11,0,8,0,0,5,8,9,11,0,0,12,9,9,0,11,8,0,0,0,0};

int tunelength = sizeof(tune) / sizeof(int);
void setup() {
}

void loop() {
int currentnoteindex = 0;
while (currentnoteindex < (tunelength)) { if (tune[currentnoteindex] == 0) { delay(180); currentnoteindex++; } else { tone(8,key[tune[currentnoteindex++]-1],90); delay(180); } } currentnoteindex = 0; }


27
Jul 13

How To Touch Type (for beginners)

Today I came across my old website which is hosted on the University of Manchester Compsoc server. I had an account on this server since I studied Computer Science at Manchester which was in 1999 (before I gave it all up to read music instead). I can’t even log on to my account, but I’m glad to see my account and therefore my webspace / website is still online. For posterity, I am salvaging some of the stuff I wrote back then when the word “blog” didn’t even exist, and blogging it here…

Introduction
It seems to have become the norm that in order to learn to type fast you should pay for a software package or take evening classes.

Well, I strongly disagree with this need for ongoing typing lessons. Perhaps they are necessary for some people – but if you are able to practise on your own and motivate yourself, then the only thing stopping you from typing at 80 words per minute is a lack of knowledge of the basic principles.

Health and safety
Goodness knows why the user manual for the Microsoft Mouse has in it the following advice:

“Eat a balanced diet and get adequate rest.”

Sounds like my mother. Oh well – even though it seems a little random, I’m sure Microsoft pay their medical consultants lots of money to come out with such gems. More importantly when considering the health and safety aspect of computing, however, you must ensure that your sitting position at your computer is natural.

  • Straight back
  • Don’t rest your wrists on hard surfaces (in fact not at all unless you have a wrist-rest: “rest not your wrists without right and ready wrist-rests”). Best of all, get a chair with adjustable rubber armrests
  • Both feet flat on floor
  • Forearms almost horizontal
  • Eyes at same horizontal level as the top of the viewable area of your monitor. (Tilt monitor up slightly.)

Know the default typing position
The basic tenet of good typing practise is found in the following directions:

  • Place your index fingers over the F and J keys. Thumbs over spacebar. There should be little bumps on F and J: these are useful if you are blind, but they also exist should you want to find the default position without looking (hint: you should want to do this).
  • Place all other fingers over the keys that are directly next-door to F and J. Your fingers should now be on all of the following keys:

A S D F J K L ; SPACE

Establish a personal regime
The following step is possibly the hardest because it involves re-learning to type, and also it involves making some critical decisions about your preference and the way your hands work.

  • Consider each key on the alpha side of the keyboard (i.e. excluding the numeric pad on the right hand side). When your fingers are in the default position, which finger is closest to each key? This step will take some time to figure out, but must be done in full. This step is vital to the process.
  • A S D F J K L ; …. all these keys have one and only one finger option. H and G will be pressed using only the respective index fingers. Shift buttons will be pressed by each little finger. T and V are pressed by left-hand index finger. U and N and possibly Y (preference) are pressed by the right-hand index finger.
  • Try to use both left and right shift keys equally, instead of just using the left one. This kind of variation is necessary to equally disperse the number of key presses per hand per volume of text.
  • Once you have established a regime for your typing presses, practise typing a sentence v-e-r-y (painfully) slowly. Be absolutely sure that each key you press is the one you initially thought should be pressing it. Be strict in this respect. Again tedious – but vital to the process.
  • Start slowly, and speed-up your typing by practise and repetition.

If you are a key-prodder (1+ words per minute!), the above should be relatively straightforward if tedious.

If you are fairly new to typing, but can already do it fairly well – be reminded that this is probably easier for you than for those who can type 35+ words per minute!

If you type over 35 words per minute, or you use computers a lot – but do not ‘officially’ touch type – this process will be exceedingly annoying. Indeed, you may be able to say the following: “I don’t officially touch-type, but I can do 60 words per minute”. That is a good result: now re-learn and attempt 90+ words per minute. You will probably be quite taken by the whole thing. You will probably see how much faster you could type if you try the above. You will probably want to give up after 5 minutes. If you want to type faster, you need to start-off properly, so don’t give up.

If you are already an OK typist, then you may simply not be able to re-learn properly (supposing you have work to do and can’t afford to type at 5 words per minute to start off with). In this case, you should try to set aside ‘typing time’ – preferably every time you use a computer, preferably for at least 5 minutes depending on your time constraints. When you get acceptably good at proper-typing (i.e. typing under your strict regime), then try to mix this in with your ‘old-style’ that you have been using till now for the sake of practicality. Personally, I see nothing wrong with this crossover approach. Learn properly alongside carrying on the way you were working before – and then gradually mix the dodgy old technique with the new with a long-term view to fully substituting new for old. It’s worth it. Because I’m worth it.

  • Whatever level you are at: start slowly, and speed-up your typing by practice and repetition. Do not let your speed overtake your accuracy at any point, unless you are ‘mixing’ techniques as described above.
  • I believe that the more time you can give to abandoning your current typing technique and adopting a systematic technique, the more time you will save in the long run. Be motivated.

Use shortcuts
This isn’t part of touch-typing, but if you class yourself as an efficient computer user you should at least be using the following Windows shortcuts (it should be second nature):

  • Ctrl-S (hold down control key and press S) to save your work
  • Ctrl-C to copy a bit of selected text (or Ctrl-X to cut)
  • Ctrl-V to paste
  • Alt-tab to cycle through the different programs you have open
  • Alt-F4 to close the program
  • Alt-S to send email (or save and exit items)
  • Ctrl-B; Ctrl-I to bold or italicise text.

09
Jul 12

How to configure your NTL 250 to work with wireless

If you are merely browsing this blog, don’t read the below. It’s dull as dogs. This is for incoming google searches.

(Hint. If you actually want to configure wireless for your NTL 250 cable modem, skip to the far quicker and superior “Option B”.)

This blog is for the benefit of anyone who might be going through the same problem as I did…

Option A

  1. Call Virgin Media and request a new wireless cable modem router, because yours is faulty. Argue with them over 3x 25 minute phone calls because they say they didn’t provide the original, and your only option is to upgrade your internet connection and take-on another 12 month contract because the NTL 250 cable modem is out of date and they no longer provide separate wireless routers.
  2. Choose “a bit of classical” as your hold music. Hey, I can choose hold music! Oh wait, they are playing “Jurassic Park”. #fail
  3. In a cavalier fashion, purchase a wireless access point on Amazon
  4. Review the “order dispatched” email and immediately KICK YOURSELF when you read the words “wireless access point”. You need a “wireless router”. Who the hell buys those things? The NTL 250 is a cable modem, and is not a router.
  5. Await shipment. Maybe the Wireless AP you purchased can handle routing as well. It seems to do everything else under the sun, it’s one of those TP-Link devices that seem to have taken over the low-end market. They have awesome chipsets and a web interface that doesn’t make you want to pull your hair out, which more than makes up for the unbelievably cheap plastic they are made from. Take THAT Netgear…
  6. Stop kidding yourself. Really, a router is a router. A Wireless AP is a Wireless AP.
  7. Out of desperation head to Maplin. Make sure you get a Wireless *Cable Modem* Router this time. Uh oh. The only wireless cable modem router in stock is a Netgear.
  8. Scream and struggle and tear your hair out because your Netgear web interface randomly hangs, you never know if it actually ‘applied’ the settings you painstakingly entered, and you can’t get the thing to play ball.
  9. Attempt to use the Netgear “auto detect modem settings”. Yeh, that was never going to work.
  10. Attempt to manually set the router’s IP address and DNS servers (even though they should be dynamically assigned) as if this will somehow help.
  11. Hit Google, pore over various VirginMedia broadband forum posts, none of which assist in configuring your NTL 250, all of which conclude with “Virgin will send you their new Superhub”. Call Virgin once again to say your wireless router is faulty, can they send you a “Superhub”, no they can’t, not unless you upgrade, take-on another 12 month contract, etc.
  12. Ask to speak to Virgin’s tech support team, you need assistance configuring a wireless router for your NTL 250 cable modem. “What is the make and model?” Netgear. “We are unable to support Netgear wireless routers”.
  13. Phone up again and lie, tell them you are setting up a Linksys. They tell you “set your router’s settings to ‘dynamic’. No need to enter any logon information. No connection username and password. DHCP will provide your router with the correct IP address, DNS, gateway”. ARGUE. Say you’ve done that but it is simply not getting an IP address. Angrily explain you have no way of getting online because they won’t upgrade your router and won’t replace your existing one, then eventually hang up because they can’t help you.
  14. Curse, Google some more, etc.
  15. … notice a setting on the Netgear. A strange setting, one that allows you to hard-code the MAC address of the router’s cable modem interface. Think to yourself “surely they don’t filter MAC addresses at the exchange, given they haven’t even bothered to set up any kind of connection encryption in the first place”. (Or perhaps it’s their way of helping NAT to actually work. Either way, it’s dumb.)
  16. Get online within a few minutes of the above.

Option B

Here’s how to set up your wireless cable modem router with your NTL 250 or 255 (thanks to Virgin Media for all their wonderful help):

  1. Make sure you buy a Wireless Cable Modem Router
  2. Find the MAC address of your cable modem. If you are lucky, it will be written on the underside of your NTL 250 or 255 cable modem
  3. Input this MAC address into your wireless cable modem router
  4. Most modern wireless cable modem routers should magically work once you have done the above
Easy, huh?

22
Sep 11

How Sociable is Facebook towards Developers?

If Facebook wants to be the social ‘platform’ on which the web resides – a grand vision, but an attainable one – it had better start being nicer to web developers.

For years, Facebook has been a taker, not a giver. What other platform begs you to feed information into it in the form of personal user data, communications, shared web content (and its corresponding metadata), provides proprietary mechanisms for you to identify your own independently-hosted web content to Facebook, and then refuses to let you feed anything out again except by using a tiny suite of ‘widget’ style, iframe-based pieces of javascript: unstylable, uncool, and uncooperative. God forbid you should try to scrape anything to create your own feeds from these stubborn widgets – or from anywhere else – lest you put your own Facebook account in jeopardy for violating their terms.

And should you ever try to interpret the meaning of anything that isn’t ‘being a friend’ – for example you need to engage users with your company – you really must let Facebook call the shots on these interactions, too. It was only a year ago Facebook decided you would rather “Like” an entity than “Become a fan” of it. And now – subscribe? Is that the same as like? Is it similar to what you do with an RSS feed? I don’t have a problem with the evolution of change, but it’s frustrating seeing businesses having to tweak their social media paradigm just because Facebook didn’t get it right first time.

Facebook has taken a lot of unfair flack in the last decade, mainly because of their refusal to be pigeonholed into either a platform for private data (e.g. email) or one for public data (e.g. blogs). Despite a number of iterations in its privacy interface (ranging from the bizarre/arcane to the really-quite-sensible), Facebook still struggles to convince its users that controlling the privacy of their data is not exactly rocket science. It was solely because of its popularity, and the fact it became lowest-common-denominator for personal communications online (read: “it attracted stupid people”) that Facebook suffered an exponential amount of bad press regarding its ‘security issues’. I shudder even writing those words, for one thing Facebook has not had major PR problems within its lifetime, at least as compared with any other social network you care to mention, is security – in the technical sense. It’s merely the media’s interpretation of the word I’m using here.

Of course, Facebook was absolutely right to keep strong tabs on its data and interface early-on. I’m sure it wasn’t as much a branding reason as the fact Zuckerberg didn’t want to get sucked in to the same issues MySpace did, where users were encouraged to ‘personalise’ their pages, ultimately resulting in a social network that was unusable for all.

But surely the time to open-out (I’m not talking about styling one’s profile page) came and went about three years ago? Instead, at this time, Facebook was buttoning-down its strategy so as to retain as much data as possible whilst making it slightly more interactive with the rest of the web. And so was launched the adoption of the “Social Graph” model.

I’m hoping that any changes taking place over the coming months may involve Facebook adopting an open standard. Not the kind of “open” mentioned in Zuckerberg’s blog post from a year ago, but a real kind of “open”.


30
Aug 11

Amazing Robocopy

There was a time when my home server was a large computer with RAID drives and loud fans that stayed on 24/7. Gladly that time is no longer, and I’ve moved to a more power-friendly netbook-based thing which generates hardly any heat and can therefore be left in a small cupboard without airflow concerns. The disk performance is, naturally, horrific, but it serves files up fast enough for me to stream music around the house.

I now do pretty much all my photo editing work on my laptop, which I take around with me.

As I still have the requirement for archiving large volumes of data to the desktop PC with hardware mirrored drives, unfortunately this machine has to stay. But I can keep it turned-off for 95% of the time, and only turn it on to copy / archive my data to it when needed. As well as saving energy, this should increase the lifespan of my disks by a long way too.

My netbook also acts as a web server from which I am hosting a simple ASP.net application to send WOL (wake on LAN) magic packets to my desktop PC. This is secured using Basic Authentication over SSL. It is therefore now possible for me to securely start my computer up when I’m away from home, then log on remotely using RDP (or establish a VPN connection). However – this is unrelated to my post.

I tend to do the large file transfers when at home, and given the regularity of these transfers, I’ve set up a directory on my main laptop into which I can dump everything ready for transferring, then run a robocopy batch file to move this data across.

Cue: “Amazing Robocopy“. (This is a super batch file which runs the robocopy routine and does a load more. I may have wasted an entire evening writing this batch file.) Hopefully the above gives you the context you need to fully appreciate why I need such a thing.

“Amazing Robocopy” does the following:

  • Checks if the remote machine is on. If not, send a WOL Magic Packet
  • Keeps pinging the remote machine until it responds, then attempts to check the fileshare (CIFS) visibility
  • Verifies some level of stability to the network connection before continuing
  • Run the robocopy and log to a file.
  • Provide the prompt at the very beginning as to whether user wants to shutdown machine when done
  • Provide feedback throughout the process
  • All timeouts and response limits set using variables
The screencap says it all:

 

Amazing Robocopy goes something like this.

It may be best to paste this into notepad before attempting to read.

Notes: download Depicus Wake On LAN for command line, and put it somewhere in your PATH. You’ll need to set the WOL arguments manually, as they can’t be configured with variables.

Also you’ll need to set the robocopy parameters to suit you.

 

: This script does a basic robocopy, but also it does the following:
: - test connectivity to the machine (ping). Send WOL Magic Packet if it doesn't respond.
: - after WOL, wait until the machine appears on the network
: - regardless of whether or not we got the machine up using WOL, we still verify a level of ping response consistency before continuing
: - verify the network path is visible before continuing
: - prompt at the start whether you want to shutdown the machine when finished
: - no further prompts during the process

@ECHO OFF

: SET THE FOLLOWING VARIABLES

: Set robocopy destination into two variables. They are used individually to test CIFS and PING connectivity then combined to insert into robocopy command
: We'll strip quotes from the outsides of these, so feel free to use quotes around each varilable - or not. 
Set remotemachine=mat-pc
Set copytoshare="f$\transfer\in"

: Time to wait after sending wol packet, before bothering to try to do anything else (approx startup time of remote machine)
Set timetowol=30

: If, after sending wol and waiting, there's still no response, we'll wait 1 second and try again.
: This is the total number of tries. TBH, may as well set this really high and Ctrl-C if you get bored.
Set pingfaillimit=25

: What do you consider is a good number of ping receipts to get back before deeming your connection to remote machine is stable? 1 = impatient. 10000 = paranoid. 10 = normal.
Set stabilitysatisfaction=10

: Once stability, by the definition of how many pings specified, is attained, we check the copy-to network path is available
: Frankly, if it isn't, it probably won't become available. And you'll have to figure out the problem separately.
: But this gives us the option to keep trying x number of times before continuing.
: Note: this number doesn't correspond to an amount of time. Windows is unpredictable when trying to check fileshares.
Set filesharefaillimit=15

: NO MORE VARIABLES TO SET NOW

CHOICE /M "Shutdown when done?
IF ERRORLEVEL 1 SET copyshutdown=1
IF ERRORLEVEL 2 SET copyshutdown=0

Set consecutivepingcheckcount=1
Set consecutivepingfailcount=1
Set filesharetestcount=1

:pingandcheck

ping /n 2 %remotemachine% | find "TTL=" >nul
if %errorlevel% == 0 goto reply

@echo No Reply on that IP! Tried %consecutivepingfailcount% of %pingfaillimit% times

IF %consecutivepingfailcount% == 1 (
@echo Let's try to WOL...

wolcmd.exe 001320164898 192.168.0.5 255.255.255.0 9
@echo OK ... WOL Magic Packet was sent. Let's wait for %timetowol% odd seconds then try to ping again...
ping 127.0.0.1 -n %timetowol% >null
@echo Fine - let's try to connect now.
Set consecutivepingfailcount=1
)

Set consecutivepingcheckcount=1
Set /A consecutivepingfailcount+=1

IF %consecutivepingfailcount% == %pingfaillimit% (
@echo We didn't get very far did we?
@echo I sent a WOL, waited, but nothing!
@echo Increase the pingfaillimit variable?
GOTO fin
)
goto pingandcheck

:reply
@echo IP Replied! Checking connection stability... %consecutivepingcheckcount% of %stabilitysatisfaction%
Set /A consecutivepingcheckcount+=1
IF %consecutivepingcheckcount% == %stabilitysatisfaction% (
@echo Connection appears stable!
GOTO checkfileshare
)
GOTO pingandcheck

:checkfileshare
@echo Now checking fileshare
IF EXIST \\%remotemachine%\%copytoshare% (
@echo Fileshare is visible. Good to go. Starting copying.
GOTO docopy
)
@echo Couldn't find fileshare - tried %filesharetestcount% of %filesharefaillimit% times.
Set /A filesharetestcount+=1
ping 127.0.0.1 -n 2 >null
IF %filesharetestcount% == %filesharefaillimit% (
@echo Failed to find the fileshare. Oh no!
@echo Maybe verify the fileshare is accessible yourself?
GOTO fin
)
goto checkfileshare

:docopy
:first three lines strip quotes if found then combine the machine name and share to give path
for /f "useback tokens=*" %%a in ('%remotemachine%') do set remotemachine=%%~a
for /f "useback tokens=*" %%a in ('%copytoshare%') do set copytoshare=%%~a
Set destination=\\%remotemachine%\%copytoshare%
ECHO on
robocopy f:\transfer\out\ "%destination%" /E /R:20 /W:10 /MOVE /NP /LOG+:logfile.log /TEE /XF *.bat *.log

IF %copyshutdown%==1 (
ECHO off
shutdown /m \\mat-pc /s /f /t 0 
)

:fin

19
Jan 11

Confessions of a GTD junkie

My background is music, my teens were spent in music lessons, music centre rehearsals, practising for gigs, listening to music, and my university studies were classical music.

My speciality is improvisation, and if you put me in front of a huge audience and gave me a grand piano and a song request of pretty much anything I could hum (especially something interesting like a jazz tune), I would confidently play the song without music, form my phrases correctly, play with the rhythms, and make a piece out of it. (A skill which is second nature to me, but seems to impress most non-musical people I know.) I am fearless when it comes to musical improvisation, and I know that small mistakes are sometimes what gives a piece character and spirit.

The same is not true of life.

Small mistakes – or forgotten thoughts – lead to lost sales, decreased efficiency, and generally adds to the feeling that there is something important that I haven’t thought of.

(A small example: having to go back to the supermarket because you bought all ingredients for an amazing recipe except the critical one.)

In reality the small mistakes don’t get in the way of my efficiency and rarely lead to lost sales.

It’s more that the fear of small mistakes, and I’m sure this is irrational, the fear of small mistakes is something that hovers over me like an impending huge mistake in itself, unless I have a mechanism to thwart it. Unless I have a tried and tested system.

GTD stands for “getting things done”, and the theory and tools are a very popular subject for discussion on websites such as lifehacker.org.

I have a strong suspicion that many people who place a little too much emphasis on searching for the perfect method of getting things done (rather than just… getting those things done!) have this same affliction.

To put it in a more positive light, I actually enjoy the process of recording tasks. It sounds ridiculous, but in the same way I get caught up with the intricate process of brewing my coffee, with the exact right brew ratios, water temperature, coffee age, pouring technique; I like to get a bit caught up in the process itself. Perhaps it’s because it gives me time to think about other things. Or perhaps it’s just how my brain is wired. I fought it for a while … futile.

By ‘caught up’ I mean that I sometimes stay up late reading the blogs of people who write various GTD (task list) applications, contributing to discussions, and the like.

I flip from one method to another. Windows application, iPhone application, application that syncs between Windows, iPhone, and ‘the cloud’, hosting own php task-list applications online, I even toyed with the “pen and paper” method, which is whereby you write a list on a bit of paper (or in a book) – magic I know.

(This didn’t work out for me as soon as I realised that I keep different writing books for different things, and that my Moleskine exists for me to brainstorm my life mid-week. It’s useful for drawing connections between notes, writing freestyle, and the like, but not appropriate for recording things in a running list whilst I am on a job, in bed, for good, in a searchable, archivable manner that you can come back to at any point.  Also I have this belief that paper should not be used for things that have to be properly recorded, due to their annoying habit of getting lost when you need them.)

I’m a GTD whore, and I often declare my allegiance to one application over another then change my mind.

I am currently using a sub-optimal solution on my iPhone that syncs with a cloud-based system that gives me access to my tasks on a laptop if I need. It’s extremely flexible, safe, and efficient, but sub-optimal for many reasons I won’t go into here.

I have compared tonnes of apps (for an idea of what I mean, see this list – I’ve looked in detail at every one of them myself, and spent many hours customising a number of them for my needs. Yes, I know. Not efficient).

I probably shouldn’t disclose here how many apps I have also purchased for this.

Confessions over.


11
Jan 11

Sync with cloud – Today ToDo

Please don’t read this post unless you are interested in the title. It will bore the socks off you!

With that out the way, here’s what I think about the subject.

First point. Resist ALL temptation to host own service. This will invariably lead to an enormous amount of dissatisfaction with the app itself as even the slightest outage will globally affect the perception of the entire application, potentially losing an enormous number of users, reputation, etc. User data is personal, business critical, and task lists are extremely important to the everyday running of users’ lives. Even if the service runs slow for 10 minutes in one year, it’s enough to put a large section of the user-base off investing their time in ever using the software again. Even if you have the infrastructure and personnel to provide high-reliability 24/7/365 coverage, with globally distributed failover servers, this will fail unless you are Google, Apple, or someone with a proven track record (Toodledo). It can never go well for you! At least if using a third party service, the blame can be transferred. Enough said.

Now for more observations:

  1. People like me are serious about using cloud services, recommending them to business associates, colleagues, managers, and cloud sync can go very well. For the same reason, it can go very badly.
  2. Even some of the high reliability services (Google, Apple, Amazon, Dropbox, etc.) do not have published statistics as to their *absolute* uptime limits. It’s simply not possible as it depends on too many variables (i.e. global politics). At least if you use one of these services, their reputation is large enough to cover any problem.
  3. On the matter of politics (sorry this is really boring), the most democratic way to run cloud sync service is to provide the software to anyone, open source, so they can either run their own private / personal clouds, or so small companies can start up providing free or paid services. This is less relevant to the argument, but it’s worth stating as the utopian ideal. The problem is that the liability for code vulnerability is shifted then to the developer… big pitfalls there!

Onto the issues of interoperability, usability, usefulness, and profit.

  1. We all know Google is King when it comes to providing reliability of service that is free, as well as reliable APIs. Problem is they have a history of changing their APIs (in the name of development) with little or no notice, meaning you may have to be quick-off-the-mark in providing updates. In reality this isn’t an issue, their service offerings have arguably settled down of late, with the exception of new offerings such as Wave.
  2. ToodleDo and other GTD/task-specific cloud-based services are a great way to reach new customers because you get a listing on their site. It would doubtless impress the majority of existing Today ToDo customers as well. I would judge ToodleDo to be the most reputable service provider, but they have their own business agenda which will impact on your users’ data. For example, unless you have a paid account, archived tasks are removed after 6 months. Therefore your users are forced to pay them a subscription charge in order to keep a perpetual log of what they have done. Many won’t care, and you could provide another way to back this up, but this would force users to remember not to forget to back up their stuff. For me this is a deal breaker. I don’t want to pay a subscription charge for keeping a task list, and I don’t want to have to make sure I back-up every 6 months. This will never happen; I’d rather use pen and paper.
  3. The options with Google as far as I know are to sync with their own task list implementation OR have a custom interface using e.g. Google docs or some kind of implementation whereby tasks are stored as emails / attachments. The task list implementation provides the best usability as it’s reasonably good and supports multiple lists. Access is also good, iGoogle, Chrome and Firefox extensions, and the like. The same is true of ToodleDo. (Though it’s not as good in this sense.)
  4. Dropbox or similar file-based cloud service is designed for storage of files, not custom access to their data. It could be a good way to export list summaries for printing, but then so is email. Unless you committed to providing other interfaces for users to get to their tasks on their computers using Dropbox or Skydrive you would be forced to implement some kind of flat file XML/text storage of items, and deal with the ensuing concurrency issues etc. Not nice.

Of course other services should get a look-in, like MobileMe, but they don’t really provide free options as far as I know. I don’t like the idea. As I said, I would rather use pen and paper.

My ideal solution would be for you to develop a personal PHP or ASP web server with HTTPS connection options, because anyone could host their own on a shared host for the same price as ToodleDo, but in reality this probably isn’t an option. (Is it?)

In summary I would say a clever use of Google tasks would be the most suitable and satisfying for the most users.


11
Aug 10

Roasting my own coffee beans

I used to be able to buy that Lavazza ground stuff (or Illy, or whatever), put it into a stovetop, and drink it with warm milk.

How things have changed. I now freshly grind my coffee (with a Baratza Vario coffee grinder) no more than 30 seconds in advance of the espresso extraction. It’s the only way to get that freshness and crispness I’m used to. I use a Rancilio Silvia to make my poison, and I can only buy my beans from Monmouth Coffee, where I know they have roasted them within at least the last few days.

The reason is that the beans deteriorate after about 10 days after roasting, in a way that is noticeable in the cup. I’m not a snob, I just have picky tastebuds. I can’t help that.

(It always amuses me, therefore, when people talk about the relative merit of one type of coffee over the other, in a supermarket. How any of it can be considered good is beyond me, when the stuff has been on a shelf for months. I guess it serves a purpose, but – yuk.)

The problem:

  • Freshly roasted beans – really fresh – are expensive in the first place
  • They are more expensive when you throw them away because they are no longer fresh and you didn’t get through them all quick enough
  • Getting freshly roasted beans (really fresh) is costly – postage from mail-order, a trip into central London
  • The beans are never there and fresh, when I want them.

A for-instance:

  • I buy 750g of beans because I made a special visit to Monmouth Coffee, use 125g, then because life is unpredictable I have to go away for 7 days then the remaining beans get thrown away (ack). Then I get back … to no beans (double ack). I have to wait at least a few days before I can get fresh stuff again (ack). During that time I have to visit cafés three times a day. Wow. A LOT of wasted beans, time, and money.

That’s 9 shades of annoying. And 4x ack.

I go away, I come home, I want fresh beans, right here, right now!

Cafés don’t have this problem. They get through so many beans each day they can afford a shipment every day. If they overorder / undersell one day, they can use rollover beans the next day, and reduce the order the following day. Beans always fresh. Not so chez Mat.

The solution:

Buy a home roaster. Store my own green beans for 6 months. Cheap! Fresh!

I have no desire to roast my own beans other than to get around the terrible feeling of coming home to no coffee.

Actually, that’s a lie. I love the thought of defining my own roasting profiles, choosing the type of roast according to my mood, experimenting.

So I am the proud new owner of a Behmor coffee roasting machine. None of this pokey air roasting rubbish. A proper drum roaster thank you. Complete with chaff and smoke management systems.

I’ll post back when I get some results from this thing!