MySQL File Access

June 4, 2018

MySQL out of the box doesn’t permit access to the local file system e.g. for table import or export operations. Quickest fix for this that I found was to run the server from the command line as follows:

mysqld --secure-file-priv=/Users/me/tmp

I can then use statements such as

load data infile '~/tmp/data.csv' fields terminated by ',' 
ignore 1 lines (field1,field2,@field3) set field3=somefunction(@field3);


select field1,field2,someotherfunction(field3) from sometable into
outfile '~/tmp/outdata.dsv' terminated by '|';

Multi-homed PCs and Proxy.pac

November 30, 2016

If writing a proxy.pac file for a site, you may need to determine which proxy to use based on the current IP address. Should your browser host have multiple IP addresses, e.g. you’re running VirtualBox in host-only mode, you may find the built in myIpAddress() method returns the wrong IP address. The following JS extract uses the myIpAddressEx() method – this returns all configured IP addresses as a ‘;’ terminated string.

The following defines myips.isInNet(ip, range) to replace the built in method isInNet (myIpAddress(), ip, range) and will check all configured ipv4 addresses rather than the random single value that your browser picks.

var myips = myIpAddressEx().split(";");
myips.isInNetX = function(ip, range) {
   var matchOne = function (acc, myip) {
       return acc || myip.startsWith("[") ? false : isInNet (myip, ip, range)
   return this.reduce(matchOne, false); 

March 2, 2016

Title Case vs Sentence Case

Today I learned that was I inadvertently part of team Title Case. I was pulled up in it during a review of one of my Technical Documents. Sorry, there I go again. I promise to stop this annoying habit. From now on, any attempt to show prominence will use quotes, bold or italic characters. I will not use underline, nor blinking text.

Follow Me Printing on OSX

October 14, 2014

How I learned how to print to the corporate Windows based Follow Me print solution from my Mac.

Screenshot 2014-10-14 14.40.44Screenshot 2014-10-14 14.49.26

To do this, you first need to modify the Add Printer dialogue so it shows the ‘Advanced’ button. Bring up the System Preferences dialogue, Printer and Scanners then click on the ‘+’ in the bottom left of the window (I’m using OSX 10.9.5). The trick is to then control/click or right/click (or two finger click) on the icon bar so that the option to ‘drag your favourite items into the toolbar’ appears. Drag the ‘Advanced’ icon onto the original dialogue box (I also took the opportunity to hide the Fax icon whilst I was there).

Next click on the new Advanced icon, then select ‘Windows printer via spoolss’. Under URL I entered my FollowMe printer URL (in my case ‘smb://tuwigmps01/TUI_PRINTERS’. Select either the Generic PCL or PostScript printer, and click on the Add button in the bottom right.

A number of ‘setting up’ dialogues then appear, including the option to authenticate. This is your opportunity to log in using your corporate credentials, including the Windows domain controller – so that the printer knows who you are. Assuming you’ve previously created a printer PIN or associated it with your security pass etc. you should be good to go.

Update: if you change your domain password, use the Keychain Manager to update the password for the printer device. You might find some jobs remain in the state ‘Hold of Authentication’ if so you might have to delete these and resubmit them.

SSD Tweaking

May 15, 2012

Summary of tweaks I’ve made so far. Note that there are two sorts of tweaks out there on the net depending on your objective. One is to reduce the amount of I/O to the SSD to prolong it’s life, others are necessary to prevent the kind of system freezes and lock ups I’ve been experiencing.

  1. Turned off anti-virus
  2. Turned off Windows Defender
  3. Turned off Shadow Copies/System Restore
  4. Disabled a whole pile of junk that starts up within Windows using msconfig
  5. Turned off System page file
  6. Disabled Superfetch and Prefetch
  7. Disabled both Scheduled Defrag and the one that runs at boot time, plus some other stuff described here

So far the system is running OK. I’m really only using my laptop now for:

  1. Browsing – using Google Chrome
  2. Reading Acrobat and Office docs
  3. Taking notes using OneNote
  4. Drawing diagrams using Visio

SSD Upgrade

May 14, 2012

In order to breathe new life into my ageing Toshiba Portege R400 I recently purchased an KingSpec KSD-CF18.6-128MJ SSD drive.

To migrate I booted Ubuntu from a USB stick and did a bit copy from my old drive to the SSD using the dd command. This didn’t really work – I could boot into Recovery mode but not Vista itself (it said my System partition was corrupt).

So I booted from my old HD and did a full Windows backup to a USB drive, booted from the SSD and from Recovery and did a full system restore. I was then able to boot into Vista from my SSD.

I’m getting an occasional system freeze but otherwise enjoying the extra disk space and performance. I am researching various suggested SSD tweaks but as my laptop is old I’m only interested in performance gains, not extending the life of the drive.

Work Hard Play Hard in India

February 19, 2011

Averaging 9 hour working days at present, so all the time saved not commuting is going on work. Taxi leaves hotel at 0930 and leaves office at 1930. Usually get back by about 2000. Hotel breakfast is crap, for lunch there is no option but to eat at the office which is basic at the best so we have to go out at night to get a decent meal – which is invariably curry of some sort, so beer is kind of functional. Everything shuts at 11pm here, 1130pm if you’re lucky so we’ve only got a limited time. So it sounds great but in reality it’s all a bit hectic. There is no Internet access at the office so difficult to keep in touch, although I discovered a Wifi access point by reception on the ground floor today, so I can Skype from there and pick up email – but only on my phone as personal laptops are not allowed in the building. I’m also not allowed to take photos of the office. Today was a working Saturday, started pairing with the developers and feel like I’m starting to contribute now, which is a good feeling. I’ve spent the last week trying to understand what they’re trying to build, and assess how best to help. We’re trying to introduce a way of working called Agile which basically gets people to communicate, contribute as part of a team and take ownership of the issues that arise. So far it seems to be helping, but there is a huge amount of work still to do and not much time to do it in.

On arriving at Bengaluru

February 12, 2011

Here I am in a tiny hotel oasis amid the chaos that is the suburb of Bengaluru. There are so many people here, so much traffic and so much simplicity. Outside the hotel is a busy one way street down which flows a never ending stream of mopeds, tuck-tucks, cars, lorries and everything in between. The most used accessory on a motor vehicle is the horn. In the UK it has occasional use, I can go months without ever needing to use it. Here it is normal to sound your horn constantly, because no one trusts the attention of anyone else. There are no traffic lights here. The streets are lined with people, with stalls selling flowers, offering ironing services, shoes, or food. Across the road are three cows, lying on the pavement – tied to a lamp post. Above the heads of the passers by are three-phase electric cables, hanging perilously to what appear to be makeshift pylons. Below your feet is a concrete obstacle course, with broken slabs partially concealing shallow pits of rubbish and drainage. Everywhere is the odour of spice and stale water. The sewers must be full to capacity with the density of housing. This is a real culture shock.

Commuting by Bike

June 3, 2007

I recently created a Google Map to show my route to work. I can also upload photos that I take on route, so I’ll need one of those camera mounted cycle helmets.

I cycle in London to get between Kings Cross and Paddington in good time. I can manage 12 minutes on a good day with the lights in the right order. It takes nearer 20 minutes by tube by the time I’ve walked to and from the station platforms at either end, and with the way the trains work this means I then have another 10 minutes to wait for a connection to Ealing Broadway.


May 22, 2007

Thought I’d mention a great utility I discovered the other day. I was looking for a way I could attach a laptop bag to my bike, a Dahon Jetstream P8. This is a great folding bike but because it has front and rear suspension (tried cycling through Cambridge city centre recently? Cobblestones look nice but shake Bromptons and their riders to bits) I haven’t been able to find a suitable rear (or front) rack/pannier. Anyway in my travels through Google I came across a conversation trail which started with the pros and cons of carrying around a USB memory stick instead of a heavy laptop, and moved onto the service provided by

Remote desktop services are now built into Windows, and tools like VNC and Netmeeting have been around for years, but what this makes this nice is that Logmein provide a hosted service so that I can run up their application on my laptop at work and this connects to their central server. When I get home I boot up my desktop (assuming Son #2 is not playing Fifa 2006) and it connects via the Logmein server to my laptop and voila I get to remotely control my laptop.

I currently use two main products at work. First is Enterprise Architect. This is a per-seat licenced tool and Logmein lets me remotely work with this tool. The second is a local installation of MediaWiki. Now I can access this by using a remote instance of Firefox but of course I want to do better than that!

On the LogMeIn site I found a link labelled ‘Labs’ – and through that I came across their Hamachi service. Hamachi provides a flexible peer to peer network bridge between a cooperating set of user machines. It creates a new network interface on each machine on which it is installed and lets users create ad-hoc network communities that behave like a local LAN. The immediate benefit is that it lets game players form lan based multiplayer games without having to connect to a third party server (including FIFA 2006, but I haven’t told him yet…). The real benefit is that I can install hamachi on my Ubuntu Linux desktop at work, bring up a local instance of Squid as a Web proxy and thus gain access to the intranet instance of MediaWiki.

Now I don’t really want to route all my web traffic through Hamachi, then to work and out through Squid so I needed to find a way to selectively route only requests to my wiki. Firefox lets you configure a Proxy but the way that works is that you can specify sites not to proxy, but not the other way round. The answer is to create a small file called ‘Proxy.PAC’ and implement a small Javascript method. Here’s mine (with the relevant names and addresses changed to protect the guilty)

function FindProxyForURL(url, host){
 var proxy="PROXY";
 if (shExpMatch(url,"**/*"))              {return proxy;}
 return "DIRECT";

So now I can access my company Wiki at home. The only disadvantage is that I can’t boot up the laptop while I’m on the train and work offline but given the level of overcrowding on my train at present I don’t always get the opportunity to work in this way.