Entries mainly about programming, but not nececssarily specific to WWII Online

I did a thing



Why not take a shot at doing it in pure C?

Cold hard cache.

Time to crawl the interwebs. I’m looking for something relatively small and lightweight, a binary blob cache that I can drop into place, import a module in python and have relatively easy access to.

The keys are likely to be large, the blobs may be several MB. I don’t care a great-deal about persistence.

What I’m looking to achieve is something like ‘distcc’ for asset conversion. The backend doesn’t need to know that, it’s just going to get semi-opaque key values that ultimately serve to compartmentalize hash spaces.

CPPCon 2017

I love and hate conventions, so I don’t go to them all that often.

Although I’ve watched CPPCon videos, I hadn’t considered something you attended until this year; I wasn’t really convinced it would be worth going.

The agenda for the first few days proposed some very interesting stuff, and I decided to dip my toe.

Alexa addendum

The other day I gave Amazon a hard time for the difficulty of extending Alexa for your own in-house needs. Well, “skills” are actually more accessible than I thought and there are some tutorials – setup … something … in “under an hour“,  or write a controller with “python with flask-ask“.

That brings it a lot closer to being in the hands of the lay-maker, but the setup on Amazon’s side leaves things in a state that will probably result in much sloppiness. I’m also not clear, yet, whether you are limited to “tell” and “ask” directives or if you can create first-class Alexa commands with it.

Going to get a hub and some lights today, get that working, and then some time this week I’ll see if I can implement “Alexa, open Notepad”.

Challenge to Assistant developers

Apple, Google, Microsoft and Amazon are all competing in the digital assistant field. There are pros and cons to each. Yesterday I received an Amazon Echo Dot (2nd gen) and I’ve been dabbling with it. So far Alexa reminds me more of the command-driven voice apps I tinkered with on the CBM Amiga decades ago than she does of Hal, but there is promising progress.

You’ve heard me rant about Cortana, I don’t have a Siri to tinker with and while I’ve had a highly positive experience with Google’s voice recog, for some reason I just haven’t used it in anger – I’ll try and remedy that in the next week or so.

But having the discrete device like this finally gave form to the notion that’s been percolating in the back of my head this last year or so of watching the assistants emerge: Makers.

One of these assistants needs to cross the bridge for home enthusiasts that empowers them to interact with their devices and applications in their terms.

I should be able to rustle up a few dozen lines of code and create my own little agent that transforms into a feature of my assistant exclusive to me and my ecosystem. Once I can do that, someone will build tools to make it easier and more accessible for idea people who aren’t interested in learning to program.

The problem is that to thrive, it’s going to have to be open. Hold your horses there, I’m not anti-proprietary, I’m just stating this simple fact. Apple and Siri aren’t contenders because the winner is going to be enabling a farmer who got his kids to write a raspberry-pi controller to check on his irrigation system from 10 miles away.

I don’t see Alexa being the winner, because her value in is selling Amazon Prime and Amazon Prime Music subscriptions. I suspect anything beyond that is gravy of the cold, lumpy kind from an Amazon perspective, but I’m happy to be proven wrong.

That leaves Google and Cortana.

Google sells advertising, but they have a history of open APIs. Bringing makers into the fold and enabling personalization has all kinds of value potential to Google, starting with bringing you into the android fold, disinsentivizing you from using Apple or Amazon, etc.

Microsoft is built on the success of open architecture and they’re making a large push to support IoT stuff, so this would be a return to roots for Microsoft that could really make WinIoT attractive, so long as they can manage to focus on the role of a driver and not try to restrict it to “must run on Windows”.

There is one more potential contender, though: Facebook.

Mark has shown an interest in exactly this kind of field with Jarvis. They’ve invested a lot in AI, they like releasing the stuff they build into the community. Their mission statement is “to make the world more open and connected”. This notion fits in with the ideas behind Facebook’s

It’s not that it’s currently impossible to do these things, but there’s a huge barrier to entry. For example, the simple task of turning on (or off) my PC? Voice control is largely going to be about inter-action; set the heating in another room, check on the house while you’re away, remind me of something in 30 minutes when I might be in a different room or building or vehicle…

(*Edit: You can actually build your own Alexa skills. But it’s definitely not entry-level stuff)

Pi for kids?

Last year I gave my nephews an arduino starter kit as a present. They’re really bright, so it just made sense to them. Faster than I could demonstrate that wiring up the button and the lights let them create a control they’d already figured it out and wanted to know what else it could do.
I realize now it was handing someone of my generation a battery, some cash, and saying “you can power anything with this”. It fuels the path of creativity without nurturing it.
This year I was going to give them a raspberry-pi starter kit but it’ll just wind up being a way to run games if there’s not something to fuel and guide their imagination a little.
“It can do anything electronic”. “Like what?” “Uh, like, uhm, drive a motor” “Oh, to do what?” “Look, this is why I’m a programmer, just imaginate some stuff, squirt!”
And they’re too young for me to point them at “forums”. So:
I’m hoping some of you might be able to recommend maybe some kits, books, perhaps online courses or guides for a variety of beginner, entry/kid-level projects that include the programming but perhaps focus on the more physical aspect of doing things. They’re *not* gonna want a series of tutorials on how to make different patterns of blinking lights, they’re going to want something that demonstrates practical potentials and – ideally – gives them reason to go to the store with their parents and see the aisle of potential components they might tap into to fire off their little imaginations.

Virtualized desktops vs multi-boot

I’m trying to figure out a good way to compartmentalize/containerize my various Windows desktop usage modes: Development, gaming and general use. This seems like a good way to combat a number of things such as the surface-area of each model (exposure to risk) and things like registry bloat etc.

With fast boot times, multi-boot isn’t a terrible idea. But I kind of have this notion in my head of having a graphical Dom 0 (Win10, Ubuntu, something) where I can see my guests as windows and use them thusly, paste, drag’n’drop between them, etc, but have the option to quickly transition them to full screen at any time.

I found (thanks to Bill Hulley) that KVM can do some of this ( but it sounds brittle/fragile to me, and I’m increasingly wary of this level of hackery for supporting such aggressively-evolving systems as GPUs, stuff gets abandoned, APIs and ABIs change, a maintainer drops out…

Having two user accounts might be an option, but they share the same HKLM and things like MSVC aren’t great at being discrete.

Windows Containers sound interesting, but I don’t know that there’s a way for the app inside a container to expose a GUI on the host, all the instructions I’ve found so far are for server-based containers. So for now, I’m just gonna continue putting all my eggs into the one basket :)

Would the interviewer be right?

Please avoid stating which problem these are solutions for.

During a recent discussion the following code was suggested

int desc(const Node* node, int d)
  int l = d, r = d;
  if (node->l) l = desc(node->l, d + 1);
  if (node->r) r = desc(node->r, d + 1);  // edit: thanks, Nico
  return max(l, r);
int d2(const Node* root)
  return root ? desc(root, 1) : 0;

One of the folks in the discussion shook his head and said: “If this was an interviewer, they would want you to do it in one function, though”. Then he presented this:

int d1(const Node* root)
  if (root == nullptr) return 0;
  return max(d1(root->l) + 1, d1(root->r) + 1);

Then he made the assertion “this is what an interviewer would be looking for”.

Happy new year









And now for something completely similar.

So I’m back on the job market. Lots of ideas and inspiration from my time at Blizzard, a really great place to work. No, I won’t tell you. I already have a few job apps out, and I’m trying to stick to the US west coast and gaming.

I’ve been in the games industry proper for near 12 years now, and while that’s where I’m going to look first, I’m going to be open to possibilities back in the real world.

Right now I’m toying with the idea of a C++-centric code templator I’m thinking of calling “C[]” (C-squared); something that can handle trivial cases like “take this list of words and generate an enum statement and an array of strings” to the ability to generate multiple complex code modules from shared definitions.