Linux on Windows 10 is Awesome

gravonw10.PNG

I’m doing some web site work at the moment for Connected Humber. In the process I found about about Grav, which is another nice way to make static web sites that are simple to host, even on sites like GitHub.

I thought it might be nice to have Grav on my machine so I could play with it. Only problem is that it really needs to run on a Linux box. A while ago I mentioned how easy it is to get a Linux box running in the cloud with Azure. It turns out it is even easier to get Linux on a Windows 10 device using the Windows Subsystem for Linux. This procedure here is a good start, but I used this one because it also covers the installation of lots of tools that you will want to use.

Now, to be clear, the Windows Subsystem for Linux (WSL) is not the same as running Linux on your computer. It is also not the same as a virtual machine running Linux. You start it running and you instantly get a shell command prompt that you use to talk to you “Linux” installation which is really just a process on your Windows PC. There is no graphical interface (unless you are prepared to do a lot of fiddling about) and you would never use this in production. But it is fantastic for development.

You can install all your favourite Linux tools and they will just work. All your Windows drives are mapped into the WSL environment. Network connections just work. You can host websites and services locally and then hit against them from Windows programs and browsers. There is even a plugin for Visual Studio Code that lets you write the code on your PC and then deploy and test it on your WSL.

It has always annoyed me that sometimes I have to scrabble around for a Windows version of a tool that is readily available for Linux. However, with WSL I can just install and use it. In no time at all I had Apache2, PHP and all the underpinnings needed to run Grav. And after a bit of fiddling around with the apache2.conf file I had it running. The lack of a Linux windowed environment is not a problem for me at the moment. Lots of tools, such as Grav and NodeRed (which also works great) are used from the browser, which works a treat.

I’ve been using the Unix command prompt for longer than I’ve been using Windows (what with Windows not having been invented when I started). It’s really nice to be able to use those commands again on my Windows box.

If you want to learn Linux, you should install this and start playing. It’s awesome.

Spotting a smile with Windows IoT

48060254721_8f6444a77e_k.jpg

I’ve been working on my demos for the Insider Dev tour. One of the examples shows how to use Azure Cognitive Services to analyse a picture, find faces and see how happy they are. I’d like to use this in my demo, but I want to use the camera rather than a fixed image.

Anyhoo, I’ve got it working. The Raspberry Pi snaps a picture, sends it to the cloud and then gets back the location and happiness of anyone in it. I’m looking forward to showing it off next week.

I don’t intend to point the camera at the audience though……

ESP32 Bluetooth BLE to Windows 10 Universal Apps

BLE Windows 10.png

So I’ve got this lovely little M5Stack device with an ESP32 processor on it and it is supposed to support Bluetooth BLE. So I thought I’d see if it did. So fired up the example Bluetooth BLE program in the Arduino SDK and then I fired up the Bluetooth sample from the Windows-Universal-Samples and tried to get them to connect.

And they just did. Astonishing. In no time at all I was sending messages from the PC to the M5Stack, and with a bit of fiddling I managed to get data values going the other way as well. I find this amazing and wonderful. Previous attempts to get Bluetooth working like this have always been fairly horrid and fraught. With this I just hit the pair button inside the app on Windows 10, accept a security prompt and then I’m sending packets of data backwards and forwards. I’m definitely going to build something based on this,

Windows 10 Magic Disk Space

magic space.PNG

Windows 10 is magical. Or something. At the beginning of this week I was worried that I was running out of disk space on my main hard disk. Which can be a problem. Things were turning red. Never a good thing in my experience.

This morning I discovered that I suddenly had a lot more space. Around 30 G bytes had appeared from nowhere. Now, I might have done some “sleep deletion” last night, but I don’t think so. Windows 10 must have found the space for me.

Thanks for that.

Windows 10 October Update

Annotation.png

I installed the latest Windows 10 update over Wednesday night on two machines at the same time. I was quite amused to see my lowly Surface Go upgrade in around same time as my proper desktop. The Surface Go is really growing on me.

The installation just worked. On Thursday morning I had the new system running. I’ve not noticed much different to be honest. The biggest change for me so far is that the Snipping Tool is being phased out. This has been a mainstay of my workflow for a very long time. One of the first things I used to do after installing Windows was put a shortcut to the Snipping Tool on the task bar. It was very good at capturing the entire contents of windows. It did have its foibles though. One of the most annoying was that when you drew with a white pen on a white background the pen disappeared. I’ve wondered for a long time why this has not been fixed.

I’m talking about the Snipping Tool in the past tense because I’ve switched to the new replacement, the Snip & Sketch tool. It seems to do all the things that the Snipping Tool does. I even used it to capture the image at the top of this post. It also sets the cursor colour correctly when drawing, which is a step forwards.

I’ve not noticed any huge changes in Windows 10 so far. But I’m looking forward to doing some more exploring.

Windows 10 WiFi Problems Solved

wifiprops.PNG

I'm bringing some old machines back into commission in case I need some spare devices for our "Build a robot in a day" course on Friday. Of course I'm updating them to the latest version of Windows 10, Fall Update Creators edition. My experience has been that, unlike previous versions of Windows on low powered machines, successive versions of Windows 10 have better performance than the previous ones on resource constrained devices.  

Anyhoo, the update on my lovely Packard Bell Butterfly tablet went OK. But afterwards the WiFi didn't work. So, not OK then.

The good news is that I've seen this problem before. And fixed it. This time I'm blogging about it so that I'll remember for the next machine I find that has this problem

  1. Right click Start and open Device Manager
  2. Open the network adapters element and find your WiFi adaptor in the list.
  3.  Right click on the entry in the list and select Properties from the menu that appears..
  4. Select the Power Management tab.
  5. Make sure that the "Allow the Computer to turn off the device to save power" checkbox is clear.

Close the properties dialog and reboot the machine. You should find that WiFi now works. Or at least, I did.

Arduino vs One Drive

Some things you just have to learn the hard way. For a while I've been frustrated by the way that my Arduino projects would build fine for a while, and then fail after I had saved them. 

Eventually I worked out that if you're working on a folder which is being shared by One Drive (or DropBox and probably Google Drive) this causes the Adruino SDK to get upset when it tries to build a solution. This must be due to the file sync process causing files to be locked when they shouldn't be.  Move the files to your desktop and the program builds perfectly. 

Of course, the proper way to share a development project between a bunch of machines is to use GitHub, and that's what I'll be doing in the future....

Thank you, Windows 10

I'm rather liking the Windows 10 Creator's Edition Fall Update Feature Release 1709 for x64 based Systems (KB4041994).

It's full of little changes that just make everything that bit better. Like the way that the Onedrive sync status is now showed in a separate column, rather than on top of the file icon so that I couldn't tell what type of document I was looking at. 

On tip though, after the upgrade I was a bit worried that my system disk had suddenly got a lot smaller. I managed to free off 41 GBytes just by deleting previous Windows installations. 

Network your 3D Printer with Windows 10 IoT Core. If only.

12904837613_19fef16c9f_z.jpg

I've installed Windows 10 Creator's Edition Fall Update. It's very nice. It has a lot of extra support for 3D printers. And I got all excited when I found out that there's an application for the Windows 10 IoT Core running on Raspberry Pi that lets you install your printer on the network and then print to it straight from Windows 10.

It doesn't work. At least, not for me. I've spent all afternoon creating SD card images, configuring them and then finding out that I always get assigned the same (wrong) printer device and then the driver fails to load. 

Oh well. 

Loading FreeCad designs into Paint 3D

I've got lots of things I've designed using the lovely FreeCAD program. I wanted to play with them in Paint 3D in Windows 10 Creators Edition. If you want to do this too, this is how:

FreeCad doesn't seem to support a format that Paint 3D understands. You'll need to use a converter program to do this. I've found a free program at NCH Software that seems to do the trick.  First thing you need to do is download and install the program. 

Then, in FreeCad, select all the elements of the model that you want to export in the editor. Then select File>Export from the FreeCad menu to display the Export Dialog:

Select the "Wavefront OBJ" file type as you can see above. Give the file a sensible name, and then click Save.

Now you need to convert the OBJ file into a 3MF file. Open up Spin 3D. Select Add File (the big plus) and add your file. You can add lots of files if you like. 

I've found that models need to be rotated for some reason (perhaps because the coordinate frames of reference are different). Click the Effects button in the bottom left to ask the Spin program to do this for you.

You want to rotate -90 degrees about the X axis. Click the "Apply Offsets to Objects" checkbox and then put -90 in the Rotation X box, as shown above. Then click OK to close the Effects dialog.

Make sure that you've got the output format set to 3md as you can see above, and then click the Convert button on the bottom right hand side of the Spin 3D window. Your design will now be converted into a 3mf file that you can import into Paint 3D. 

I even managed to put the design into the Remix 3D site for people to download and play with. You can find it here.

Windows 10 Creators Edition Clean Install

So yesterday I did a clean install of Windows 10 from a memory key. It was for my HP Sprout, which had got itself into a big of a pickle after I upgraded the hard drive. 

I booted from the memory key and up came the setup program. It had a slight whinge about all the partitions on the disk and so I thought I'd get rid of everything. If you press Shift+F10 at the disk management menu in the Windows 10 installer you get yourself a command prompt. Which you can use to load the Windows Disk Partition Tool, diskpart. So I did.

The Windows disk partition tool is strong magic. Like, make your system not work any more and all your files vanish magic. It lets you specify the fundamental arrangement of the storage areas on your hard disk. The Sprout had all these recovery partitions and weird bits and pieces lying around which I really didn't want. (and of course I'd made a backup). So I used the "clean" command. 

I've not used it before, previously I've removed and merged partitions by hand. But clean makes it much easier. Scarily so. I was expecting some form of confirmation dialog when I issued the command but no, it just went ahead and cleared the drive. Windows 10 then had a shiny empty disk to go to town on, and it did. 

The Windows 10 installation process is now very slick. It's fast too. I had a working operating system around 10 minutes after cleaning the disk. And it rounds off the installation with a chat from Cortana to set the final options for your machine. 

I like the Creators Edition very much. The only downside I've found so far is the fact that the old style command prompt has been replaced with the new fangled PowerShell. The command prompt harks all the way back to MS-DOS, and I really like that. PowerShell is way, way, better, in many ways, but I must admit that for me the command prompt is nicer. However, if you get the PowerShell prompt you just have to type CMD and press return, and your command prompt is back in all it's glory....

Working on it....

Windows 10 is lovely. But there are some things that it does that drive me a bit nuts. Like, when I've downloaded a file, and then want to find it in my downloads folder.

Not a particularly strange request you might think.

But Windows 10 acts as if I've just asked for the cure for cancer and the ten millionth digit of pi. Along with next week's lottery numbers. My powerful machine with it's ultra-fast hard disk (at least that's what the salesman said) grinds to a halt while the operating system "works on" finding the files in a folder.

Why?

mDNS Manager for Windows 10 IoT Universal Apps

You know how it is. You have built a robot army that you're going to use to take over the world, but first you have to get them all under your control. And if you are using tcp/ip (the world domination network of choice) then you have to give them all an ip address and then put those addresses into your world domination program.

mDNS makes this much easier. It's how Apple's Bonjour network discovery works. A device running mDNS is discoverable on a local network. You can find all the hosts and their ip addresses, along with the services they are providing and the ports. Windows 10 provides a Watcher service that you can use to discover all the machines on a local network, but it is a bit of a pain to use.

So I've written a tiny mDNSManager class that you can use to create and manage a watcher object which will start a search for devices, tell you when it finds one and also present a list of all the devices it has found so far. It's very easy to use. 

You can find the source code for both the manager and a simple demonstration application on GitHub here

If you want to just use the manager in your programs you can install it from NuGet:

Install-Package RobMiles.mDNSManager 

It works on any Windows 10 device, including the Raspberry Pi, and it makes it much easier to connect to a large number of devices. There are mDNS samples available in the example applications for the ESP8266 devices in the Arduino IDE.

I'm using this to allow me to create a Universal Application that will control a bunch of HullPixelbot devices without needing to know their ip addresses in advance. 

Using a Raspberry Pi as an Access Point with Windows 10

I've got a few things running for my TechDays sessions next week. They are working fine on my home network. Now, I know that the conference will have WiFi, but in my experience this can be problematic. Sometimes they use browser based authentication steps which are hard to replicate on a device with no screen, keyboard or mouse. 

But I have a plan. I've got a portable access point that I use on occasions just like this. I know exactly which shelf it is stored on, in a nice little case and everything. So I go and grab it. Of course it's not there. It's not anywhere. Blarst.  

However, I do have a Raspberry Pi 3 which I was planning to take along as well. And it turns out that it will work as an access point too. And setting it up is a dead doddle. I started with the howto here. That got me the Windows 10 IoT Core Dashboard which is an awesome little program that will create an SD card to use to boot your Pi and then take you through connecting and configuring it. The great thing for me is that it lets you use a "naked" Pi, with no keyboard, mouse or screen. All the configuration can be done via the browser based control center. 

If you want to turn your Pi into an access point just head for the IoT Onboarding page you can see above, select a suitably obscure SSID and password and then save them. (I'd advise against the defaults). After a reboot you should have an access point which clients can connect to. 

If you want to share the wired network connection from your Pi you have to actually turn this on. The user interface here is a bit rubbish to be honest. There's nothing I could see that indicates if the sharing is on or off, and you have to make sure that you connect the right adaptors at each end. Which is why you might find the screenshot useful. Just select the items that you can see in the "Access point adaptor" and "Shared network adaptor" and then click the "start shared access" button. And then it all just works. Awesome. 

One tiny gotcha. On my Pi the SSID gets a bunch of hex characters added to it.  HullSSID would probably change to XY_HullSSID_ED50. Browse for the WiFi connection with another device before you put the text into a client program.

A touch of trouble

So the Windows 10 upgrade on my Sony Ultrabook worked fine. Rather too well. Some time back I had to disable the touch screen on this device because the hardware has failed somewhere and detects two finger presses all the time. Which made controlling the machine rather tricky. 

Anyhoo, of course the Windows 10 upgrade turned the touch screen back on. Thanks for that. 

However, I've discovered that if I press down lots of points on the screen it kind of overloads and stops recognising things, so I can use the keyboard and mouse. But it did make some interesting gymnastics as I kept as many fingers as I could on the screen while opening Device Manager and disabling the touch screen driver. 

It works fine now. Kudos to Microsoft for a very smooth upgrade on both the ultrabook and my twisty tablet. 

Make the most of the Windows 10 Upgrade

The Windows 10 free upgrade stops being free on Friday 29th July. Which means that, what with my flair for forward planning, I've been digging out old machines and upgrading them this week because it would be daft not to. One of the machines that I found was my Packard Bell twisty tablet of a few years ago; Still works fine, but I'd forgotten the password to log in. The machine was keyed to my Microsoft account and I've changed my password several times since I last used it. And I can't for the life of me remember the old ones.

Idiot me (although actually a knack for forgetting old passwords is a useful thing to acquire as it stops you using the old one by mistake). Anyhoo, I found a YouTube video that showed a nifty way to break back into a Windows 8 system. The video was a good start, but I had a few issues. For a start, when you run the command prompt via your USB booted copy of Windows 8 the system drive you have to tamper with might not be drive C: (in my case it was drive e:).

Another problem is that the hack doesn't seem to let you fix the passwords of accounts linked to Microsoft. But you can create new local accounts, including ones with administrator privileges, which gets you going. The wise amongst you are probably saying "Why didn't you just attach the machine to a network and let the passwords catch up?". Well, two answers. Firstly I think the mechanism has changed since my machine last ran. And secondly the clock was placing the machine somewhere in 2013, which meant that all the secure sockets stuff was broken. And of course to put the clock right I had to log in.....

The machine is presently at 92% of the upgrade process. If you've got machines that you want to keep useful I'd advise having a quick check around the house to see if you can get them going and update them. I'm probably going to pass my machines on once upgraded, but they'll be a lot more useful if they are running Windows 10. 

Raspberry Pi 3 - Most Interesting

The first Raspberry Pi was a nice device. At the time it was ground breaking. The Raspberry Pi 3 looks at least as ground breaking. It's faster, of course, but it also has WiFi and Bluetooth built into it, which makes it a ready to roll, fully connected Internet of Things device. Previously you'd have to use a physical  network cable and then directly connect your Pi to the device you wanted to talk to. Now you can do it all without wires.  

You can get the Windows 10 Insider Preview that works on the Pi 3 from here

I've ordered mine. 

Bluetooth Manager for Windows 10 Universal Apps now on Nuget

BluetoothManager.PNG

I've been playing with nuget

It's awesome. 

It is fantastically easy to package up an assembly and make it available for just anyone to use in their applications. It is beautifully integrated into Visual Studio and I reckon it is actually easier to download a package from the other side of the world and make it part of your solution than it is to add one that you have written yourself on your own machine. 

To practice I've packaged up my Bluetooth Manager library. This is a little wrapper class that makes it really easy to use Bluetooth on Windows 10 applications. I've not tried it on Windows 10 on Raspberry Pi (but I've tried it on lots of other systems and it works fine). You can find out a bit more about it here.  I use it so that I can print message on my little home made Bluetooth printer, but you can use it anywhere you want to talk over a Bluetooth serial connection. 

Oh, and in case you are wondering why it is version 1.0.1 and not version 1.0.0 I found an interesting quirk in nuget. If your library class doesn't have a public constructor the package will fail to work because Visual Studio will complain that the class is "Inaccessible due to its protection level.". That's what happens when you try to use version 1.0.0