VMWare Fusion, Windows 10 November update, Shared folders

My shared folder drive mapping no longer worked after the November update of Windows 10.

To fix this I had to manually uninstall VMWare Tools, reboot, then install and reboot again. (Using the Reinstall option from the menu didn’t appear to fix the problem).

Advertisements

Python 2.7 stack, OpenCV 3, Visual Studio 2013

I’ve started working with Python (2.7 and 3.x) and OpenCV 3 recently, and the IPython Notebook way of working with inline plots is awesome. But the debugging, editing and some other features are not great when compared to working in a Visual Studio environment.

So now I’m trying Visual Studio 2013 as the IDE, OpenCV 3, and Python 2.7 via the numerical and scientific WinPython stack.

I extracted OpenCV and WinPython to:

  • My Documents\OpenCV
  • My Documents\WinPython-32bit-2.7.10.2

From VS2013 I then installed Python Tools for Visual Studio (PTVS).. I did this within VS2013 using the Extensions and Tools dialog.

Finally I configured a new Python Environment:

W10_Dev

From an Interactive Window I can then check everything works as expected. First, Open CV3:

Python interactive window. Type $help for a list of commands.
import cv2
cv2.__version__
'3.0.0'

Next up, NumPy and a MatPlotLib chart:

import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, np.pi * 2, 100)
y = np.sin(x)
plt.plot(x, y)
plt.xlabel('Radians')
plt.ylabel('sin(x)')
plt.show()

This gives us a popup (model) window:

W10_Dev

Now to make it a bit more interesting – inline plots.. ! The Python Interactive Window has options for the Interactive mode:

W10_Dev

The default Interactive Mode is Standard but we can change this to IPython:

W10_Dev

After restarting VS2013 we can now go inline…

W10_Dev

And lastly an OpenCV 3 test:

In [4]: import cv2
In [5]: img = cv2.imread(r"C:\Users\jon\Pictures\Samples\eye.jpg", 0)
In [6]: plt.imshow(img, cmap='gray')
Out[6]: <matplotlib.image.AxesImage at 0x5b8e510>

W10_Dev

In [34]: blur = cv2.medianBlur(img, 91)
In [35]: plt.imshow(blur, cmap='hot')
Out[35]: <matplotlib.image.AxesImage at 0x1edea7d0>

W10_Dev

The great thing is I can now move this code into a Python project, get it into git, distribute among colleagues, and use the excellent intellisense and debugging powers of PTVS ! (Obviously not this actual code !)

JSON editing in Visual Studio 2013 – tip!

Just installed VS2013 on a clean Windows 10 virtual machine, noticed I wasn’t getting the same JSON editing experience I had on my previous VS2013 installation. The colour coding and auto-completion features were missing.

Solved the problem by modifying the installation and including the Microsoft Web Developer Tools:

W10_Dev

Now the editor uses colour coding, auto-completes the various brackets, and highlights errors.

OS X: IPython Notebooks on an an external drive with Anaconda

Anaconda, running on El Capitan, only provides access to files and folders under the current user’s home directory.

Home

My Dropbox folder lives on an external drive and therefore isn’t accessible from the folder list. (I actually use a slimline 128 GB JetDrive card from Transcend.. fast enough for my 100+ GB of Dropbox files).

The solution was to create a symbolic link in my Documents folder which referenced the external Dropbox folder.

$ ln -s /Volumes/SDCARD/Dropbox ~/Documents/DB

From Anaconda’s perspective this looks like any other folder:

Documents_DB_

WCF HttpListenerException

A problem I’ve had for a while:

Running an application from Visual Studio 2013 without administrator privileges and trying to start a WCF service results in a HttpListenerException.

My service host’s URI was http://localhost:8000.

W8x64_2014

The problem goes away when Studio is started with Administrator:

W8x64_2014

But that’s a pain for me for a variety of reasons.

I googled and found lots of information on stackoverflow. I tried to use the developer-reserved Design_Time_Addresses solution on port 8732, and then on 8731, but to no avail.

So then I figured how to look for this URL on my PC. From a command shell run:

netsh http show urlacl

Then I spotted the design time addresses URL:

W8x64_2014

Port 8733 !

So I changed my URI to http://localhost:8733/Design_Time_Addresses and everything worked.

This new URI is only for use when running the service in a debugged session via Visual Studio. For normal runtime use I still use the original URI of http://localhost:8000.

Update: I’m now using the following property to get the URI at runtime:

static public string ServerPath
{
    get
    {
        string serverPath = &amp;quot;http://localhost:8000&amp;quot;;

        if (System.Diagnostics.Debugger.IsAttached == true)
        {
            serverPath = &amp;quot;http://localhost:8733/Design_Time_Addresses&amp;quot;;
        }

        return serverPath;
    }
}

iOS mail signature woes

This morning I decided to update my company email signatures and synchronise them between the MacBook Pro (Mavericks), the iPhone and the iPad.

A couple of hours later I finally cracked it!

The main issue I had was preventing iOS from automatically converting numbers and addresses into links. This is a particular problem when it gets it wrong and doesn’t provide any obvious means of editing/cancelling the links.

First I used an online HTML editor to make my signature:

Online_HTML_Editor__Real_time_online_with_preview

Then I copied the rendered output to the mail app on Mavericks:

Signatures_and_Inbox

Then I tried emailing myself using the new signature. On Mavericks it looked perfect, but on the iPhone it misinterpreted some of the  information:

2014-01-21_10_22_14-3

In this case just the company number was displayed as a telephone number link. But on one of my other email accounts half of the address was converted to a link while the other half remained as text.

I don’t think it’s possible to suppress this automatic conversion, and I can live with it because usually it works quite well.

My iPhone and iPad problems started when I tried to copy the signature to the clipboard and paste it into the signature box on the settings app:
2014-01-21_10_30_19-3

So, the copy and paste has worked, but it’s not what I want. I’ve lost the font type and size, and nearly everything is blue.

I then tried using the online HTML editor on the iPhone but the rendered output had automatic link conversions on the telephone numbers. Not really a problem but it was still doing things I didn’t want.

Then I decided to try a cunning plan: I sent myself an email with the signature broken into multiple lines, so that no one line appeared to contain a useable telephone number or address:

2014-01-21_10_41_02-2

Then I copied the message to the iPhone’s email signature editor but it lost the font!

Finally, as I was considering giving up, I went back to the MacBook and pasted my signature onto Evernote and split it into multiple lines again. Back on the iPhone I copied the mangled signature  from Evernote to the signature editor:

2014-01-21_10_55_02-2

Progress! Next I edited the signature to remove the line breaks:

2014-01-21_10_58_05-2

And finally an email:

2014-01-21_10_58_44-2

Ok, so the telephone numbers have been converted into links but I suspect I can never prevent that, and since these are telephone numbers then I’m fine with it. But I’ve got my font type and size, and the company number is just a number (not a link), and I’ve roughly got what I wanted.

Then I repeated the last few steps again on the iPad.

There are plenty of iOS apps for making signatures but I really wanted to have the in-built signature working. And now I have it. But there must be a better way, either now or in the future. And once Apple and Google start talking to each other I might even see emails as they arrive without having to restart the mail app on Mavericks.