2017-02-28

That starter git project? Don't stop there...

Two-and-a-half months ago, I posted a 10-step git starter. And I felt good, like I had probably made someone's life a little easier.

I also used it within a matter of weeks for the beginning of a "Coding Dojo"-ish project that my sons (one in the industry already, one about to graduate from SFU in Computer Science, one just in his first year) and I are working on together. Early on in that process, I saw a significant problem with the starter. There was also a significant gap in the how-to-use-this example script. Let me fill in that gap first, and then, later I'll show how to fix the problem.

The gap came in two parts as a result of running the example at home, where all the development boxen run Linux (arch, and fedora -- what a lot of typo-squats there are on fedora, though!). The first part of the gap came in the way I used re-directed cat to create the starting versions of all the files -- something that using Cygwin would have fixed easily enough. But the second problem, the real one, came up in the block after the 10 steps.

On Linux, I could use the default "Unix Makefiles" generator without specifying it at all. Under Cygwin, perhaps that would work as well, but for native Windows builds, especially where the system has several versions of Developer Studio installed (as my Windows development boxes at work often have), you'll want to choose a specific version under which to create solution files.

But wait, you say, I thought CMake was a build system!? Well it is, but not quite. Strictly speaking, it's more a meta-build system. You specify what's required to build what you want in CMakeLists.txt files, but then CMake generates build scripts according to the set of compilers you have on the system. It made the most sense for the project CMake was originally written to support, and given the differences in available functionality on the different platforms, with the different tool chains, it's probably the best choice. The compiler vendors know best what their build system wants. CMake knows how to build build scripts for the build systems listed here. I say call it a win and move on.

If you're building on Windows, and you're using Developer Studio 2013, and you've got both CMake and Developer Studio location on the PATH you would follow step 10 with...

----------------------------------------------------------------------------------------
mkdir build
cd build
cmake -G "Visual Studio 12 2013" ..
msbuild starter.sln /p:Configuration=Release
----------------------------------------------------------------------------------------

I'll verify this when I have an in-house Windows development system up and running, but even if I've messed that up, you should be able to open a ".sln" file from within the build sub-directory in Developer Studio and build and debug everything from there. Once a release version has been built, you should be able to run the resulting command line "tool" and starting "test", from within the build directory as

----------------------------------------------------------------------------------------
.\Release\starter.exe
.\test\Release\testStarter.exe
----------------------------------------------------------------------------------------

And you'll be able to run the resulting test with ctest, thus:

----------------------------------------------------------------------------------------
ctest -C Release .
----------------------------------------------------------------------------------------

The problem, which I'll address in another installment lies in where the test directory is in the example vs. where better practice might put it. Don't worry. Git and your favourite text editor will make this easy, too.

2017-02-23

Electoral Reform in BC - Regional Districts and Provincial Electoral Districts, the Lower Mainland

(the elephant in the legislature)

And so we come to the last installment -- and definitely the most complicated at the "electoral district" end of things, referring, as always, to BC's Electoral Map and the Regional District Map.

When mapping ridings to the Fraser Valley Regional District, some of its area is lost to West Vancouver-Sea to Sky (see below) and some to Fraser-Nicola (as described earlier) but it also takes in some of Metro-Vancouver's territory in filling up Abbotsford South and Abbotsford West. I have lived for significant parts of my life on the western parts of those two ridings and the aggregation isn't entirely crazy. Purists will wonder what South Otter has in common with the village of Arnold (extreme ends of Abbotsford South) but these are all rural and semi-rural areas that look to urban Abbotsford as their centre of gravity. This preference exists to some extent, even in the west, where being "in Langley" might be thought to attract attention toward that urban centre. Maple Ridge-Mission, too, takes in part of Metro-Vancouver for the Maple Ridge end of its area, but since I am sketching things, not painting them per-pixel, I will accept the current boundaries as the source for my experiment.

I propose a new "Fraser Valley" seat consolidated from the new Chilliwack-Kent, Chilliwack, Abbotsford-Mission, Maple Ridge-Mission, Abbotsford-South and Abbotsford-West ridings. It would send six members proportionately chosen to the Legislature, representing about 46,300 people per member, slightly over-represented, but not by as much as many of the really rural areas of BC.

Before proposing my final new seat, a word about West Vancouver-Sea to Sky. This riding is unique in the whole province. At the south end, it is comprised of the farthest west portions of West Vancouver, up through Howe Sound to Squamish and Whistler, on to Pemberton, Birken, D'Arcy and Mount Currie. In short it is dominated geographically by the Squamish-Lillooet Regional District but in serious danger of being dominated in regard to population by the part of Metro Vancouver that is included at the south end. Recognizing the hazard in doing so, I am going to include this riding in my Metro-Vancouver model if only because population does swamp geography. Yet if I'm wrong about the actual population counts, what little I know, guess or have been able to sniff out about people from Lions Bay to Whistler, is that this area is functioning more and more as a bedroom community and/or playground for Metro-Vancouver-centred folk, so this distortion shouldn't be enough to invalidate the results of my sketch.

My last proposal will be slightly controversial so I will be making a follow-on promise. Finally then...

I propose a new "Metro Vancouver" seat consolidated from the 42 ridings bounded by the Straight of Georgia to the southwest, and on land inclusively by Langley East, Maple Ridge-Pitt Meadows and West Vancovuer-Sea to Sky. This seat would send 42 members proportionately selected based on a single ballot cast in that greater area. Each member would represent about 56,000 people, being under-represented by about 10%.

That will be the biggest part of my experiment but I submit that some sub-divisions may be appropriate. One such scheme might be in three parts:
  • a Vancouver-Sea to Mountains riding composed of Vancouver, Richmond and the North/West Van region, (18 members)
  • a North Fraser-Suburbs riding comprising Burnaby, New Westminster, Tri-Cities and Maple Ridge-Pitt Meadows (10 members) (maybe even leaving Maple Ridge-Pitt Meadows out on its own?)
  • a South Fraser riding containing everything from Delta to Langley (13 members)
In the tradition of Thomas Piketty (who put all the data for "Capital" up on the web for others to examine), after the election is done and I've totted up my results, I will release the spreadsheet that I use for Metro-Vancouver with some sort keys in place to enable others to fiddle around and examine things further but I wouldn't recommend smaller divisions than this trio because it would tend to leave otherwise urban areas out of the anti-fragmentation effect that I look to find in Regionalized Proporitionality.

So, enough of this until May! If anyone from any other province in Canada wants to try to do something like this for their own piece of the Home and Native Land, please let me know on one of the Facebook posts and maybe we can compare notes later.

And I must get back to some matters of more immediate urgency that interrupted the gradual flow of this presentation when I first conceived of it.

Electoral Reform in BC - Regional Districts and Provincial Electoral Districts, Kelowna and Victoria

With reference, again, to BC's Electoral Map and the Regional District Map, this and the next (last) installment are the simplest at the Regional District end of things, more complicated when it comes to the ridings.

The Central Okanagan Regional district is largely "Metro Kelowna" and the immediate countryside. It boasts a population of just under 180,000 and because it only sends 3 members to the legislature, it would be significantly under-represented, except that Paradise Valley, which contains the Coquihalla 97C highway on its way out of the Okanagan, and everything south of it is part of the Penticton riding. So to make the math reflect reality a bit more closely, I'm going to lump Okanagan-Similkameen and Central Okanagan together to counter the resulting distortion. If I had location-by-location census data, I could do it that way but this is for a charcoal sketch, not a pixel-true, crystalline, exact image, so the "lumping" approach should be adequate for the purpose.

Central Okanagan's 180,000 or so plus people plus the 80,700 from Okanagan-Similkameen makes about 260,700
Central Okanagan's three ridings (Kelowna-Lake Country, Kelowna West and Kelowna-Mission) plus Okanagan-Similkameen's two (Penticton and Boundary-Similkameen) make 5
So, at 52,100 or so population per member of the legislature, there's some under-representation here, but not by the greatest disparity (see Metro-Vancouver).

I don't believe that Regionalized Proportionality should come into play where there is a collection of fewer than four seats. I don't have extensive research to back that up but call it a hunch. As I've been drawing this project to one conclusion, I've conceived of a follow-up that shouldn't be too hard to execute after the provincial election that's happening this spring. Ignoring for the moment the importance of local personalities in the urban areas and the clamor that may or may not erupt about strategic votes (voting for your least unfavourite candidate to prevent a REALLY bad option from winning), I'm going to consolidate several sets of ridings' electoral result to demonstrate, again just as a rough sketch, of how Regionalized Proportionality would have changed the outcome of this spring's election, just as an example.

And this is the place where I'll do the first consolidation. Although it breaches one of my principles (following Regional District Lines), it will honour the similar character of the whole Okanagan district with, I hope, not too sprawling a definition. I propose an "Okanagan" seat comprised of the new Penticton, Kelowna-Lake Country, Kelowna-Mission and Kelowna West ridings. It would send four members proportionally selected to the legislature in Victoria. I think I will also do a comparison that adds Vernon-Monashee to the mix, but I suspect that this will be an agglomeration too far.

My second consolidation almost perfectly follows the Capital Regional District as a single riding, except where some parts of Saanich North and the Islands may be in the Cowichan Valley Regional District. Here I propose a "Victoria" seat comprising the new Langford-Juan de Fuca, Esquimalt-Metchosin, Victoria-Beacon Hill, Victoria-Swan Lake, Oak Bay-Gordon Head, Saanich South and Saanich North and the Islands. It would send seven members to the Legislature, representing 51,400 people per member, so under-represented by about 2% (see the first post in this series for that calculation -- including my follow-on comment).

Electoral Reform in BC - Regional Districts and Provincial Electoral Districts, Kamloops the not-quite-urban

​(Again, I'm referring all through here to the Electoral Map and the Regional District Map but I don't think this installment will be confusing enough for the colorization that was required last time.)

After the last installment, I took some time to sift through what was left (the most urban parts of BC) and other than the "problem" of what to do with Whistler, and what to do about the places under consideration here, my confidence that Regionalized Proportionality would serve BC well has been unequivocally strengthened. Bear in mind that while we've dealt with the greatest part of the land area of BC, we have still only talked about 26 seats in the projected 87 seat legislature to be elected this spring. Rural BC has good reason to feel a little swamped by the urban parts in size. Hopefully their moderate over-representation softens the blow somewhat.

Outside of the long-time urban areas of Vancouver (in its largest senses) and Victoria, Kamloops and Kelowna are the other two more urban parts of BC and they represent, in my mind, the boundary between where Regionalized Proportionality would leave existing ridings as they were or consolidate them into proportional blocks. Let's take them on one at a time.

Urban Kamloops lies entirely within the Thompson-Nicola regional district. Electorally the district is split into three ridings with a large but sparsely populated additions from two other regional districts:

  • Squamish-Lillooet: north portions in the Fraser watershed, but not via Harrison Lake
  • Fraser Valley: upstream of the Harrison River around the Fraser watershed
  • And from Okanagan-Similkameen, the part of Manning Park that isn't in the Fraser watershed (and hence in the Fraser Valley regional district).
This last point reflects the difference between highway logistics (split the park on or around the summit; deal with the west slope from Hope, deal with the east from Princeton) and political concerns (people who live in Manning Park probably have more in common with each other than not, electorally speaking).

The three ridings each have their own character.

Kamloops-North Thompson follow the same pattern as the ridings around Prince George very closely: take part of the urban area (north side of Kamloops) and include its closest hinterland (the communities between there and not quite up to Valemount, following the Thompson watershed boundary, actually).

Fraser Nicola approaches "metro Kamloops" from the south but from the detail that I see, probably doesn't quite get there, so it probably represents the most south-westerly mainland riding in BC comparable with the rural ridings farther north and east. The largest community it includes would be Merritt, at about 7,100 people. The rest are names familiar from road trips in my childhood: Hope, Yale, Spuzzum, Boston Bar, Lytton, Spences Bridge, Ashcroft, Cache Creek and Clinton to name off the points within the riding that we would drive through when I was a child. Where were we going? Oh, just from the Fraser Valley and one set of relatives, to Williams Lake where my Dad's youngest sister and her family were for many years. Little places, many of those, that have lost all of their Alberta-bound through-traffic since the Coquihalla Highway opened 30 years ago.

Kamloops-South Thompson, though, while taking in the closest hinterlands to metro Kamloops, is not very vast in area, stretching from Savona to Chase and Westwold. Savona to either of Chase or Westwold takes about an hour to drive now, says google maps but travel times would be longer where significant backroads access is required. This is almost an urban/suburban mix, although outside of "metro Kamloops", the thought might be resisted. Would the people of Kamloops want to be lumped together for a regional proportional list? They should have a say but my guess would be that the ridings they have suit the population as it currently stands.

So my scheme probably wouldn't affect these places at all. Kamloops, if it were to become its own riding, even including all of what is now Kamloops-South Thompson would only have two members at current levels -- not enough to be interesting for a proportional ballot. And doing so would leave at least one hinterland -- the North Thompson, without a natural place to collect with to keep it from being too greatly over-represented. As it stands, these three ridings represent a bit more than 128,000 people at 42,800 per riding, bringing the over-all average up slightly to 42,500 per member of the legislative assembly.

Not a bad mix and for the task as it was assigned, I have no words of reproof for Elections BC.

An AI will eat my job?

One more brief interlude before I complete my series on Regionalized Proportionality as it might apply provincially to British Columbia.

This paper, as mentioned in a current slashdot post, and savaged in various ways in the comments would seem to suggest that an AI will eat my job, as a dessert following the assembly line jobs of bygone days (whose former holders are inclined to blame globalization, wrongly) and the main course under current consideration in the transport jobs that google and others are working at destroying even as we speak. Of course, the news reports aggregated with the original paper's link at slashdot, MSPowerUser and New Scientist, while interest- and attention-grabbing aren't really known for sober consideration.

Of course there's the autonomic adrenaline rush when one sees anything that may threaten one's livelihood but some of the trains of thought in slashdot's comments pointed one direction for comfort straightaway. I didn't stick around long enough to see what other comfort might be shed in the cacophony but a few other things quickly came to mind:
  1. As was pointed out by several on slashdot, now you'll just have to find people who can write specifications that the AI can understand and turn into programs. Hmm... That sounds an awful lot like programming, or rather meta-programming, I suppose. Just not the kind of Meta-Programming that Abrahams and Gurtovoy had in mind. The paper itself gives examples of what this meta-code might look like. There's a Domain-specific Language (DSL) there that reminds me, in some ways, of any highly abstracted programming language.
  2. How about user interfaces? My first thought after I turned away from the cacophony was that the space between a computer and human users is going to be harder to specify well, therefore not going to go away very soon, either.
  3. And then there's computer to machine interfaces. You're going to have to get so specific about the specifications at that end, that it's not clear to me this, at least, is ever going to go away, no matter how good the AI becomes.
The examples of what "DeepCoder", the program developed for the paper, can do, may be deep for a computer to have performed, but it's only in the nature of a very primitive moving around of some simple data. I expect the DSL would have to get prohibitively expressive to be particularly useful to the larger problem at hand, so until you develop the AI that can generate a true and clear expression of what it takes to get the problem solved, I see a lot of work that will still require a human for a long time. (I hope the reader can see a DeepJoker pattern in "until you develop...") Time will tell where this will all lead but in its current state it rather reminds me of the distance between how long it takes for Principia Mathematica to prove that one plus one equals two, and how relevant that is for the elementary pupil cutting their baby teeth on the first pages of Arithmetic. In one sense, it was important work for somebody to have done once, and we are grateful for the work Russell and Whitehead put in to achieve it. But in the sense most commonly employed by the vast majority of humanity, it has no relevance whatsoever.

But there's a cavalier attitude in the tone of the coverage of this paper (which is actually quite interesting) which implies that software developers are simple coders who take specifications and crank out code without further thought. If that were always the case, I wouldn't still be keen to continue the craft. The kind of problem being solved by DeepCoder in the paper forms only the smallest piece of the kinds of things I've done in my career. At the very least, there's the problem of making the inputs on a particular occasion that an algorithm was executed endure for the next time (persistence/serialization), and then retrieving them for that next time (deserialization, data validation), sometimes heavily constrained by choices already made by surrounding technology (adaptation). And when people (as mediated through UI devices or signals from other programs) start to affect what the program should do, that introduces another set of problems (interaction, more data validation). Then when you're solving a problem for which there aren't a lot of code snippets out there already, you'll still need to write some of it yourself, like the first code that calculates colours under PDF's Transparency model to mention one instance -- and chances are, the first code won't be good enough for all cases (non-trivial algorithms). I could go on but the themes repeat (as one already has) at the same time as new ones appear. There's a lot of work that still needs to be done before DeepCoder writes any simple app that a human might find useful.

I think I won't starve very soon, whatever my adrenaline thinks.

2017-02-15

A letter in response to a call for petition around Canadian House Motion M-103

For the text of the motion in question (words matter!) click here.

Hello Ron...

I'm still feeling bruised from the electoral reform reversal but while I'll hold that against your leader, I can't really hold it against you, nor will it prevent me speaking up in a slightly more nuanced way than I was urged to do this morning by a friend, with regard to House Motion M-103.

This friend urged signing a petition here:

which when I read it struck me as fear-mongering of a vile sort. Still, there was one point it raised that I think needs to be hammered out before this motion is adopted by the House of Commons.

In any event, I expect the Supreme Court of Canada to rule, ultimately, in favour of free speech over the more egregious possible outcomes of the motion that the petition promoters are predicting, but I still think it is a dangerous motion to allow to pass as is, for the simple reason that "Islamophobia" is not well-defined. The only widely accepted definition of Islamophobia is promulgated by a declaration which appeals and is willing to limit its impact to a body of religious law. That detail should dictate at least a little caution in adopting statements that use the term in a blanket way without further clarification as this motion does.

Those who suggest that it is the camel's nose of injecting further, Shari`a based intrusions on Canadian society are doing so based on ideas of hijra and so forth, whose ultimate success, if indeed it is in play here, I doubt very highly on other grounds. I count these warnings as those of cranks and xenophobes. Yet, as long as "Islamophobia" is well-defined only in a very religious context, and so long as it can potentially be extended to cover sensible criticism of acts past and present done by identifiable members of the larger Islamic community, this motion has the potential of going too far and some measure of the alarm being raised isn't entirely inappropriate -- and this is something that has been said by more than just cranks.

Consider, for a moment what the societal backlash would be (and ought to be! I say it though I myself identify as Christian) if various Christian leaders asked for protections that could be construed as preventing honest criticism of the acts of any groups of Christians? That would clearly be unconstitutional.

​Can I ask and urge that the motion be amended, at the very least to point out that any definition of "Islamophobia" is, a priori, limited by what would be protected under the Charter of Rights and Freedoms? I don't believe that the honourable member who raised the motion could reasonably object to that, and it SHOULD serve to satisfy at least those with reasonable doubts that this isn't what its shrillest critics claim it to be. As for those with unreasonable doubts, what can one say? Only a long record of something other than expectation has the potential (but unfortunately, that's all it has) of convincing these that there's no "there" there; yet working out that long proof is the pith of any national project, including this Canadian experiment.

​Can we agree that such a rider of reference to the Charter​ must be added to make the motion better, a true Canadian response to some deeply fearful circumstances? Clearly, some such response is required: to the mosque shooting in Québec, to the silly braying of our nearest neighbour's new leader, to the up-tick in racist and sexist violence that has occurred even in Canada since his election, is in order. But let's do it thoughtfully, sensibly, in a typically Canadian way, shall we? It may ultimately be possible, otherwise, to draw a bright line between the passing of this motion as is and the [inflaming of even worse kinds of fear and panic, leading to a reversal of any of the good this resolution is rightly intending to accomplish].

Thanks for your time, both of you. Much wisdom to you in being part of our country's governing body.

Sincerely,


Arthur N. Klassen

2017-02-02

Electoral Reform -- Canceled -- Haiku

Like father, like son.
Once again, Canada is
Betrayed by Trudeau.

I'm old enough to remember the betrayal of Canada by the father. I hoped better from his son but was not surprised to hear about yet another undone promise.