Monday 10 November 2014

Launching Windows applications in Parallels from OSX without UAC prompts

TL;DR; 

Use a scheduled task to avoid UAC prompts in Windows; create a shortcut to the scheduled task; use a shell script to tell Parallels to use Windows Explorer to open the shortcut.

Details ... 

As a .Net developer using an OSX machine I'm a big fan of Parallels Desktop. I'm also a big fan of not taking my hands off the keyboard as I find that using a trackpad or mouse gives me some pain in the back of my hand and wrist. One way I help myself with this is by not using the mouse to launch applications. In both Windows and OSX this is relatively straightforward, but in Windows two of the applications I use a lot I really need to use with admin privileges (the console/command line and Visual Studio). The best way I've found to avoid doing extra mouse work (or just extra key presses) is to use a Scheduled Task in Windows and create a shortcut to it. Details of how to do this here: http://www.7tutorials.com/use-task-scheduler-launch-programs-without-uac-prompts

Great, so now I don't have to say "yes, please let me run this application as an administrator" every time I want to use Visual Studio. But I want more. I want a single way of launching applications on Windows and OSX.

Step forward QuickSilver - free and awesome. It used to be the case that I could just double-click on my Windows Shortcut (.lnk) files to launch the applications in OSX, so I kept them in my Quick Silver catalog and just used QuickSilver in the normal way, but recently this stopped working.

Double clicking on the shortcut in Windows still worked, double-clicking or right-clicking and selecting 'Open with' either 'Parallels Link' or 'Windows Explorer' didn't work either.

I never worked out what had changed (Windows? Parallels? Sun spot activity?) but I did find a solution. I now have a bunch of shell-scripts that look like this:
Which means that I can easily launch the applications I use most, without UAC prompts, from OSX.

Saturday 27 September 2014

OSX, .NET vNext and file paths

I've been playing around with .Net vNext on my OSX laptop and hit a stupid issue with file paths that might possibly trip someone else up.  I was trying to get a .NET program to launch another application and open a file (VLC and an mp3). I had code that looked like this:
var filePath = "/Volumes/StorageHD/Audio/iTunes Music/Air/Talkie Walkie/01 Venus.mp3";
var p = new Process();
p.StartInfo.FileName = "/Applications/VLC.app/Contents/MacOS/VLC";
p.StartInfo.Arguments= filePath;
p.Start();
Console.ReadKey();

This code launches VLC, but each space in the file path is parsed as a new file name, so VLC attempts (and fails) to play iTunes, Talkie, Walkie, 01 and Venus.mp3.

My first attempt to fix this was to escape the file path as a Unix file path i.e.
"/Volumes/StorageHD/Audio/iTunes\ Music/Air/Talkie\ Walkie/01\ Venus.mp3"
which is what I'd use if I were trying to do something similar from the shell:
$ vlc /Volumes/StorageHD/Audio/iTunes\ Music/Air/Talkie\ Walkie/01\ Venus.mp3

This was not the correct option ;) - my little console application threw a lot of stack-tracey goodness, but the main point was "Unrecognized escape sequence".

Instead I needed to escape the path as I would on windows, with the path with spaces in wrapped in double quotes:

var filePath = "\"/Volumes/StorageHD/Audio/iTunes Music/Air/Talkie Walkie/01 Venus.mp3\"";
Notice the escape character ("\") before the wrapping quote.
The final full code is available as a gist https://gist.github.com/StephenFriend/593aa94366cd4733be46

Monday 25 August 2014

Scripting Parallels VM backup

In an attempt to automate all the things, I've scripted the backup of my Parallels VM for disaster recovery.  Ultimately I plan on using something like this in conjunction with Launchd, but for now the script is available as a gist:
https://gist.github.com/StephenFriend/69477732bbb1423942f4

Hopefully someone else will find it useful.

Saturday 21 June 2014

Lean and Agile - what does that actually mean in practice at DrDoctor?

At DrDoctor there is a very strong belief that the business should be Lean (note the capital 'L'), so we analyse data on how our services are used in order to guide product development.  An important aspect of that is that we need to get features out there in order to see how they're used, which fits neatly with a Scrum-based, Agile approach.  We do favour working software over comprehensive documentation and we aim to deliver that working software every sprint (i.e. every two weeks).  Worse than that, following lean principles, we don't just value responding to change over following a plan we acknowledging that a core strength is our ability to change our plans.  Yes there is a vision, but no, I don't pretend to know for certain what I'll be working on in two months' time.

What does this mean in practice?  At a very high level, it means that we need to be able to release features easily.  Or put another way, having a 'release sprint' (which I've seen in lots of places) means we've failed.  We haven't always succeeded in this, but we're getting there and we are now at the stage where we have decent CI and automated deployment, we can ...
  • Push changes to our central code repository
  • Which triggers a build on our build server
  • Which runs our test suite (unit tests, integration tests that exercise the DB and bigger 'Spec' tests that lean on even more infrastructure)
  • We're notified if the build passes or fails
  • With 5 button clicks we can deploy the build to our 'smoke test' environment where we can do a full end-to-end test - our product owners get to run through the feature they've asked for
  • 5 more button clicks and we've deployed to production
To achieve all of this, we use Git, BitBucket, TeamCity, NUnit, SpecFlow, HipChat and Octopus Deploy and I'll write a post on some of the technical details of how that's set up.

However, the main point isn't about the tools, it's about the mindset.  Lots of companies talk about Lean and Agile but don't deliver (if you've ever sat through a 30 minute "stand-up", you know what I'm talking about), but at DrDoctor the value of delivering software rapidly is understood, which translates into investing time into making delivery easy.  There is a lot more to do, but the whole company agrees that we don't say a story is delivered unless the code is running somewhere.