The humble GUID/UUID…

Guids come up periodically. They’re the one obvious choice when a truly unique identifier is needed but you can’t have some application specific central registry (akin to Dicom-3 identifiers).

They look like somewhat random strings of hex digits with dash separators but there is additional structure in there.

The originated with OSF-DCE (the one unix distributed computing environment). Microsoft borrowed parts of OSF-DCE when building COM and DCOM. Guids came along for the ride in this and became part of the windows infrastructure.

In a recent discussion, a piece of code that loaded up ‘fake’ Guids as small integers with zero fill came up. I refreshed my memory (they’re now defined in RFC4122) and came to the conclusion that these aren’t well formed UUIDs at all. There are a couple of short bit fields within the body of a GUID that define the version and type of the GUID. These can’t be zero unless all bits are zero (the null GUID).

 

Starting to look at NUnit

I want to implement some unit tests for the servicemanager service. Not particularly necessary for something this small, but I want to get a look at NUnit and this little service exists in part as an excuse to try some new technologies out on a small scale.

I’ve been using the Microsoft test facilities at work lately and have not been overly impressed. I’m hoping that NUnit will serve better and it runs under the professional rather than enterprise version of the tools.

I’m a bit torn on the dependency injection front. I have components that use system facilites (SCM, registry and such)…in fact most of what this little service does leans that way. Adding in half-baked mock-ups of SCM and registry classes for injection purposes doesn’t make me happy but building limited capability wrappers that expose only what I need now so that I can intercept things doesn’t make much sense either.

I’m still finding my happy place on the DI/Unit test front it seems.

Full unit test of happy and unhappy path with robust, broad based DI looks to me to add two to three times the amount of work that was required to implement the baseline component. Low fidelity mocks leave the code with half-baked unit tests as mock failures either hide deficiencies or generate their own set of phantom errors. Still hunting a state of grace on this front.

Adding support assembly to ServiceManagerService

I’m pulling much of the existing guts of the service manager service out into a separate assembly. I’m expecting this to make for a cleaner design and make testing of the various components easier.

Currently building out the configuration retrieval component. Not expecting this to be a thing of beauty at this point, but should be serviceable and make it easier to build the active part of the service code to always respond to the current state of things.

Once this is done I’ll have to build out a service access and state management component to effect the requested changes.

The real challenge will follow as I need to add a Wix installer to create an MSI to get this onto other systems.

Web UI will likely wait for a later time. It needs to be self-hosted but I’m still not sure what the right toolkit is. I also should figure out how to secure it as this will have full access to some very sensitive items.

Sandbox work and GitHub

Added a menu page under ‘The Sandbox’ menu that points to my github page and provides a quick list of projects that I’m hosting there (just one as yet).

I’ve got a number of other toy projects to play with as time permits. Lots to do and interesting possibilities touching a broad range of technologies. At the moment, work is far more software management than software implementation so I’m looking to keep the fire burning here in the sandbox…

I’ll be updating that set of notes to reflect activity on github as things progress. Hopefully by this time next year there will be a good sized list of interesting projects up there.

Signed up for a few Udemy courses during their $10.00 sale

I signed up for several Udemy courses while they were offering them for around $10.00.

The first pair was a pure impulse buy. I have been poking at OpenGL and related 3D rendering technologies for some time. Written a bit of code in that area a long time ago. When I saw the match pair of Blender and Unreal Engine courses I decided to dive in.

I’ve also grabbed some coursework in the web UI and full stack side. Probably totals to more than I have time to complete reasonably, but at $10.00 a course I’m willing to take that chance.

Currently I’m spreading a pretty wide net. The web side is probably where I have the greatest need for outside guidance as things move incredibly fast and there are many options to choose from. Figuring out what makes sense and isn’t already obsolete is challenging from the outside looking in.

We’ll see how things go…just getting started…

And…just added one more…and Android programming course. That completes the list of pieces (mostly) that will make my photography management tool for vacation work…adding more content to an already full slate but…

Getting the code sandbox rolling…

I’ve finally gotten around to dedicating some time to home front sandbox coding.

I’ve had a github account for some time (with nothing in it until recently) at https://github.com/ninecrows.

This weekend I started finally using it. I’ve wrapped together a little windows service coded in C# that can monitor (or selectively stop) selected services on a given system at C9ServiceManager.

I’ll likely keep moving forward and putting more toy projects up here as things move forward. I’ve got plenty of things, large and small, that I want to play with and I’m going to be making time to mess with them.

I expect that by the end of the weekend I’ll have this little tool doing its base job of logging service state changes and selectively stopping or starting services.

There is quite a bit more I want to do with this one so stay tuned:

  • Persistence for previous state…probably JSON serialization stored under a registry key.
  • RESTful interface for external access and control. Likely to use OWIN and NancyFX though .NET Core might get the  call (reading Microservices for .NET core).
  • Simple, probably single page, Web UI to allow human interaction without excess pain. Likely through the same infrastructure as the RESTful interface. May very well use Angular2 to support the client side part. Things to play with here that are worth learning about.

Once that is all in place I’ll most likely move on to another project (and/or spend some time on the Udemy classes I signed up for that parallel some of this effort).

Windows services with single page web apps

I’m getting things going on some sandbox software projects that have been sitting on the shelf for some time. Perhaps a bit spread out but should be interesting.

I want to be able to put together free-standing service applications that expose both RESTful programmatic control and single page interactive GUIs without involving an external web server.

Looking like C# and either OWIN or .NET core as the sweet spot here. Need to choose a javascript library for the client side bits…Angular2 seems interesting but may be more involved for first attempts than I want.

I’ve also signed up for several of the sale Udemy courses…started out with an impulse buy of the Unreal Engine Programming course and an associated Blender course. Added in some Angular, Node and web programming stuff. Probably more in there than I’ll have time to get to,  but at $10 each I can deal.

Definitely need to come up to speed more on the various web programming environments and tools as they’re looking like the right way to do UI at this point. Leaves me with ASP.NET, Node and Apache with PHP, Javascript, C# and Typescript on the plate 🙂 Each of these shows up somewhere in my environments of interest. Should be fun…

Looking at WebGL and Three.js

I’ve been reading my kindle copy of WebGL: Up and Running as a way of starting to play with OpenGL and related technologies.

Adding in three.js (main site here) to the mix seems like a good idea as it provides pretty decent tools for wrapping the details of WebGL. I’m also going to dig through the code a bit to see what the back-end looks like…I’m more than a bit curious about how the tools add in elements along the way (the samples I’ve seen have no explicit canvas so I’m guessing it gets added by three.js.

If I can get some WebGL code up and running, next step will be to build some PHP based RESTful interface code to talk to the front end and see what makes sense (JQuery, Angular) for the rest of the browser side code.

Looking at putting together a simple web based board game as something to play with. Can add sophistication later. Plenty to play with.

Web Implementation Options for SandBox Projects

Looking at some sandbox projects that need web interfaces.

Winding up with a big split here

  • PHP/Apache (LAMP) for real site work.
    Anything that needs to run up here on my hosting will be something LAMP-like. Code needs to be PHP (at least locally) with back end persistence in MySQL.
    Front end should be more flexible. As long as the back ends can provide what the browser side code needs all should be good.
  • IIS/ASP.NET looks like the easiest choice (with .net core MVC as the tool set) for windows integrated work. I have a few things that want to run locally on a system but present a web interface externally. These tools should provide lots of ‘traction’ with close windows integration. Probably an Angular front end and perhaps a full service on the back-end.
  • Node.js shows up in many places. It provides a fast to deploy web server that is flexible and easy to code for. It is on my list in part because it has been showing up in places that are interesting and it part because it promises to support light-weight tasks where IIS would seem like over-kill.

For the front ends there are a huge number of choices out there. Of the ones I’ve seen

  • Angular 2 seems to be pretty capable and well respected. I expect to do at least some work with Angular and if it proves easy to work with I may focus on it.
  • Bootstrap is older (I think) but appears to provide a similar set of tools and infrastructure. If I run into issues with Angular, I may give this a try for something small and see how well it works.

I am also looking at free-standing, light weight web server options that run in C#. This is primarily aimed at RESTful interfaces to back-end code. OWIN and Katana seem to promise something like this while on the C++ side (and I expect C++ will show up now and then) microhttpd looks promising (with GPL restrictions, but these are sandbox projects).

Currently doing quite a bit of reading. Soon I’ve got to kick off from reading and get to some doing. Not sure what I’ll tackle first but I will probably try to list the things I’d like to kick around before I pick one…stay tuned.

 

A Little bit of python…

Someone at work asked about shuffling cards in software (or similar type problems) so I write a small bit of python for them. Python isn’t a language that I’ve had much need for in the past but it was the language they are familiar with:

#! /usr/bin/env python3
import random

# Cards in each suit
cards = ['Ace', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King']

# Suits of cards
suits = ['Clubs', 'Hearts', 'Diamonds', 'Spades']

# Start with an empty deck and fill it with on card of each type in each suit
deck = []
for card in cards:
 for suit in suits:
 deck.append(card + " of " + suit)

# Make sure we got the right number of cards in the deck
decksize = len(deck)
print (str(decksize) + " cards in a deck")

# Shuffle the cards by walking through each location and swapping it with a
# randomly chosen location in the deck.
for item in range(0, decksize):
 dest = random.randint(0, decksize - 1)
 # Swap by saving the contents of the destination spot, copying the source
 # spot there and then placing our saved card in the source location.
 temp = deck[dest]
 deck[dest] = deck[item]
 deck[item] = temp
 
print(deck);

Classic bit of swap based shuffle.

I was a bit surprised to see that python has split into two largely incompatible languages with the transition from 2.x to 3.x being drawn out and there seems to be some question whether there will ever be a full transition.

It does appear that with a bit of care it is possible to have both versions on one system with distinct names. Makes things workable if not exactly pleasant.

Engineering execution and creativity mixed for the best results…