Category Archives: Thoughts

General thoughts, usually on some technical or engineering development related topic. A place for me to chat about things I think might be of interest.

More Functional Programming and some MERN

Functional and Haskell

I’ve been reading through the Haskell book I bought (the C# functional programming book isn’t here yet). So far, Haskell functional programming still looks like a gimmick more than a set of useful tools. I’ll keep reading through to the end and likely play with the language a little before I’m done.

I’m looking forward to the C# functional programming book as I’m hoping it will provide a more practical view of what functional methods bring to the table. Working in a hybrid environment should allow the best of both worlds to shine and allow any awkward spots on one side of the other to be worked around.

MERN and Bootstrap and Things…

I’ve also been rummaging through a book on using node with react rather than angular 2/4. Seems like an interesting option as react sounds less proscriptive than angular. As with angular 2 the react tool still needs a CSS library and also similarly this book suggests bootstrap.

I need to sit down and code up a simple sample program that self-hosts a web server (probably OWIN based) and presents a web UI and perhaps a handful of RESTful web methods as a trial. Not sure whether I’ll go with react or angular 2 for this. Stay tuned…

Oh…also picked up ‘Learning Bootstrap 4, Second Edition‘ to read a bit more about bootstrap along the way. The Amazon web UI framework was bootstrap derived I believe so I expect this to  be somewhat familiar…

I am looking at self-hosting partly because node doesn’t play as nicely with windows as it does with linux and I’m mostly windows based. It is also rather nice to have a one-stop simple web UI hosting option that can get access to native code as needed. The NSSM package seems as if it provides a reasonable way to host something like node as a boot time startup service…I’ll probably play with that at some point.

Interesting…there is a package manager for windows called ‘Chocolatey‘ that seems to be an option for deploying NSSM… 

Hmm…and Kestrel in .NET Core

Ok..and Kestrel seems to be the .NET Core alternative to the OWIN stuff under .NET classic.

Yet another option…in my case the OWIN side is likely more interesting as I’m almost certainly going to be doing things that need interop or similar windows-centric functionality. Interesting as a Linux facing option though. May also be lower overhead in cases where a particular micro-service doesn’t need access to native capabilities.

I am also expecting to need some sort of SSL certificate to enable TLS on these links (don’t need the full commercial cert probably as these are likely going to be expose by IP address and not on the open web). I need to understand what is needed to deploy TLS, ideally with cert verification on both ends using certs I’ve created myself and that don’t correspond to a particular URL.

In this case I’m looking to ensure no MITM attacks and to encrypt the traffic but not to ensure much more than that. I don’t want further authentication to leak and I want to protect the connection (for example for a web UI on a small ‘appliance’ that may at times be exposed to an open internet connection).

Mostly saving these to read/watch in more detail later. Options on top of options here…

C#: Self Hosting Web UI or WPF?

I continue to bounce back and forth between self-hosted web UI and WPF UI for implementing simple user interactions.

WPF is likely to be easier to build the right sort of thing with but is a bit less flexible and more ‘backward looking’. Web interfaces require a self-hosting solution if they’re going to be stand-alone and cross more lines of language and environment.

On balance the web UI path is better as a learning experience and aside from a few corner-cases (OpenGL say) likely to  result in a better user experience in the long run.

I’m still looking for the right self-hosting solution and UI framework solution. I’m going to have to settle on one shortly so that I can being experimenting in the ninecrows sandbox and getting a feel for the technology.

Current links of interest on the self-hosting front:

There also seem to be some hard choices between versions of the framework…classic and core in particular.

More to learn as things move forward. I expect I’ll wind up doing things with both/all before I’m done as they have different strengths. The sorts of things a WPF/WinForms/MFC UI can do in terms of digging into the system and being screen real-estate aware along make them of great interest.

C++/CLI

Recently bought a couple of used books on C++/CLI to read. This looks like the most seamless and high performance approach to .NET/Native interop.

and

Both a little old (though there isn’t much newer really). I’m a bit concerned that Microsoft might move away from supporting this language as it must  be a bit involved to keep up as new releases happen. I’m going to look at adding some interop samples using this technology to my github in the near future.

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.

Repairs moving forward bit by bit…

I received the battery and fan that I ordered. Battery looks good (though  I haven’t yet installed it in the laptop).

The 200mm Fan that Thermaltake suport suggested to replace my broken case fan turns out to be too small. Looks like 220mm perhaps…kind of irritating that the company I bought the case from pointed me at the wrong size replacement fan.

Here’s a ‘fan on fan’ picture…the 200mm fan clearly won’t fit this case.

and here’s the case
I’ve now ordered a 220mm fan from Amazon…we’ll see if that one fits.

A little itchy at the moment as I took the free shipping option from NewEgg for my replacement video card and it doesn’t arrive till next Tuesday. Currently running an old GeForce 770 card in the system. Works but is not particularly inspiring.

It is clear that my old GeForce 970 was dying before it fully failed though. Lightroom had been acting up for some time…I had just put it down to software issues, but the 770 card is much more responsive than the 970 was. Clearly something was up before the end…

Hardware Replace-o-Rama Time

Last weekend the GeForce 970 card in my main desktop failed (had been acting a bit flaky for some time…I had assumed driver problems) and the big side fan on the case ended its life. My Canon S100 belt camera (so much more portable than the 5D) stopped working. My laptop battery also reached zero minutes life.

Working through the replacements now 🙁

Laptop worked out to be straightforward as Amazon had severl options. None had flawless reviews, but at $30.00 I’m giving the most promising option a try.

Video card hurts a bit, but the end result is an upgrade to a GeForce 1080 and no more flakiness (and perhaps getting myself moving on some OpenGL sandbox coding that I’ve been putting off. Ordered from NewEgg so slightly slower delivery than Amazon Prime. Currently running on a 770 card that normally lives in my ‘test target’ machine.

Camera replacement is a bit more of a conundrum.  The Canon S100 was getting a bit long in the tooth but largely met my needs. I have a waterproof case for it as well and that will be missed. I’m looking for a slightly higher end model that might work as an SLR stand-in on my belt on occasion. I’d also like to find something that I can get a waterproof housing for.

The Canon G9 X Mark II looks interesting. Small, light and pretty recent vintage. No waterproof case available and it looks like the low end of the ‘G’ series.

The Canon G7 X Mark II is the next step up. A little bulkier and perhaps less well suited to hanging from my belt next to my phone. It does appear to have a Canon branded waterproof case though as might be expected, pretty pricey.

Leaning towards the G7X as it seems to have the features I really want and is recent enough that I don’t think I’ll wind up feeling that my camera is obsolete as soon as I get it. Still chewing on this for the moment though as I don’t have a vacation in the near future and can wait a bit to make the final decision.

 

 

JSON options in C#…too many options

I’m getting back to sandbox projects on the home front (plenty that got shelved when things got busy) and have been looking at JSON handling in C#.

So far a quick scan of what is out there leaves me with the impression that there are many choices and no clearly dominant one.

So far the open source http://www.newtonsoft.com/json seems to be the best choice. I think I’m going that way for the time being and will look into other options down the road.

Thinking that MongoDB may be a good back end for the data storage I need for the current work at hand. JSON-centric as well so likely a good overall match.