Week 29

Even better than the real thing

“All things are subject to interpretation. Whichever interpretation prevails at a given time is a function of power and not truth.”

Friedrich Nietzsche

In this blog post entitled “videos of the future”, Benedict Evans posits that after an era in which the smartphone camera has relentlessly digitized the world, Augmented Reality propositions like Pokémon Go represent the return of the physical albeit in virtual form:

“On one hand cameras digitise everything, and on the other AR puts things back into the world.”

The observation only serves to underline a disquiet about the direction in which ever more high fidelity technology is taking us. The sense of foreboding is something captured very well by Will Self in a disturbed Guardian post inspired by something as quotidian as the pixelated dissembling of a digital video as a result of interference as visible in the video above.  The experience seems to give Self a momentary glimpse into our version of the Matrix, namely the liminal domain in which the Internet and digital technology exists. The opening of this particular door of perception provides him with an unwelcome vision through the portal of a hidden reality that seems a harbinger of unimaginable ill:

“Who can even guess at the ultra-definition of holocausts that may be precipitated by the very latest technologies?  After all, when the image of a human and a human herself have become effectively indistinguishable, the only surcease from the toil of existence will come when she’s been switched off.”

As UHD gives way to display technologies that appear to be arcing far beyond human capability, what are we to make of the well-worn trope that perception is reality?  If the simulation of reality on a display can be ‘even better than the real thing’ maybe the same thing applies to reality – in other words, if we really are living in a lower resolution simulation, how would we know?  The discussion brings to mind the Vedic notion of Maya, the idea that our world is the shadow one of Poe:

Is all that we see or seem
But a dream within a dream?

Perhaps you think this is fanciful but consider for a moment the possibilities redolent in this Motherboard post which sounds a warning that your display monitor itself could be subverted to show you :

We can now hack the monitor and you shouldn’t have blind trust in those pixels coming out of your monitor. …  We now live in a world where you can’t trust your monitor

Most of us tend to give digital technology the benefit of any moral doubt probably because we feel comfortable with it or we cannot conceive of things being any other way.  It behoves us to at least consider the alternative may be the case.  To reflect upon the profound realisation that perception is reality and is a function of power not of some platonic ideal of objective truth.   Walking about remains one of the best ways to perceive reality unmediated by camera tricks.  Until we take a picture to try and convey something incredible like the detail in this algal bloom I photographed at the weekend now packaged in prettified form.  It looks hyperreal but no Prisma effects were involved here:


Machine Learning

Adrian Rosebrock’s latest pyimagesearch post includes an excellent walkthrough of image convolution and how to use to use it to build the famous LeNet convolutional neural network.  Rosebrock uses Keras and the post provides a link to his example implementation.  I thought it would be useful to pull it all together into a single ‘batteries included’ file for ease of reference and have made it available for download in my Bitbucket here.  I managed to successfully run it on both an Ubuntu instance in VirtualBox as well as an AWS t2.medium instance.  The main complexity in doing so was in building one of its main dependencies, OpenCV (open source computer vision library), from scratch.  OpenCV is used to access the source data images which are the well-known 28×28 pixel handwritten digits from the MNIST data set.  I included full instructions on how I got OpenCV set up for both environments I tried in the source comments.  The core of the code that outlines the recipe is presented below.  The real challenge is in understanding the Keras implementation which I hope to return to over the coming weeks:

import numpy as np

# 1. Grab the MNIST dataset (if this is your first time
# running this script, the download may take a minute 
# -- the 55MB MNIST dataset will be downloaded)
print("-- 1. Downloading MNIST dataset... --")
dataset = datasets.fetch_mldata("MNIST Original")
# 2. Reshape the MNIST dataset from a flat list of 
# 784-dim vectors, to 28 x 28 pixel images, then 
# scale the data to the range [0, 1.0]
# and construct the training and testing splits
print("-- 2. Reshaping MNIST data to (1,784) vectors --")
data = dataset.data.reshape((dataset.data.shape[0],28,28))
data = data[:, np.newaxis, :, :]
# 3. Transform the training and testing labels into 
# vectors in the range [0, classes] -- this generates 
# a vector for each label, where the index of the label 
# is set to `1` and all other entries to `0`; 
# in the case of MNIST, there are 10 class labels
print("-- 3. Transforming training and testing labels --")
trainLabels = np_utils.to_categorical(trainLabels, 10)
testLabels = np_utils.to_categorical(testLabels, 10)
# 4. Initialize the optimizer and model
print("-- 4. Compiling model... --")
opt = SGD(lr=0.01)
# 5. Only train and evaluate the model if we 
# *are not* loading a pre-existing model
if training:
  print("-- 5.1 Training model... --")
  # show the accuracy on the testing set
  print("-- 5.2 Evaluating model... --")
  print("Accuracy: {:.2f}%".format(accuracy * 100))
  print("-- 5. Loading model... --")

If like me you’re interested in finding out more about Keras, this list of resources is worth bookmarking.  One of the links it points to is an explanation of how to use Keras as a simplified interface to the somewhat more esoteric TensorFlow.

From China, 1000 synchronised dancing robots that appear to be connected via drone WiFi.  Welcome to the future:

Amazon Web Services

Chalice is a lightweight Python web framework that appears to offer an easy way to transition to serverless from a Flask-based setup running in Amazon today.  Seems well worth keeping an eye on if you are running a web service on AWS virtual machines today:

“You can think of it as Flask/Bottle for serverless APIs. Its goal is to make writing and deploying these types of applications as simple as possible specifically for Python developers.”

Frequent password changes considered harmful is a view that Amazon CTO Werner Vogels appears to subscribe to but isn’t entirely preached within AWS it seems:


Nevertheless, Amazon are still absolutely crushing all comers Infrastructure as a Service (IaaS) space as evidenced by the latest Gartner magic quadrant data:

Microsoft, in short, is a credible competitor to AWS. Google isn’t yet in the same class, but it at least attains “Visionary” status with Gartner. Everyone else, however, is a rounding error.


Mobile and Devices

The Verge interviewed Kim Gae-youn, head of smartphone planning at Samsung who offered some interesting insights into how the Korean OEM plans its smartphone propositions and its perspective on the role of software and services:

How important is software to Samsung overall?

It’s very, very, very, very, very, very, very important.

That’s a lot of verys. Well, how important can it be, should I say, when the core operating system is not developed by Samsung? To a large extent the power lies with Google. So what can Samsung offer?

Samsung Pay. And Knox security. Those are our strong services. Even though the OS is Android, we can differentiate our product with services and at the app level. Recently last year we changed our organization — there used to be one development organization, but now we have two. One team is for hardware and one is for software, so we think software is equal to hardware. It’s very important.

The Guardian on how it is possible to track smartphone users from the telltale trace of their battery statistics which can be openly picked up by apps.

Most Americans think that self-augmentation technology will further exacerbate inequality as it serves to further divide the 1% from the rest of us.  Tony Stark has a lot to answer for:

More than 70% said inequality would increase as benefits from enhancement would go to the wealthy first, and humans with “enhancements” would feel superior to those without them.


A post reporting a key Google milestone in quantum computing reads like something out of science fiction:

Google’s engineers just achieved a milestone in quantum computing: they’ve produced the first completely scalable quantum simulation of a hydrogen molecule. … To run the simulation, the engineers used a supercooled quantum computing circuit called a variational quantum eigensolver (VQE) – essentially a highly advanced modelling system that attempts to mimic our brain’s own neural networks on a quantum level.

Quora asked what would happen if I went 10000 years into the future.  This haunting response offers a well-worn dystopian eschatology you are likely already quite familiar with and alluded to a couple of weeks ago in this blog.  Still, it’s very well told and provides a more hopeful denouement than the unremitting bleakness of the Planet of the Apes:

You step out of your time machine and recognize nothing. Where are all the buildings of your home city? It’s all forest, swamps, hills and plains now. Exploring a bit in your solar powered 6 wheeler, you find some broken marble columns that you vaguely remember as being on the front of the university’s main library. They are now on top of a huge pile of weedy, overgrown rubble.


Emerging languages “still overshadowed by Java and Python in coding interviews“:

Screen Shot 2016-08-01 at 10.54.27 AM

The chaos monkey has made way for the chaos queen at Google in the form of Kripa Krishnan head of Google DiRT (Disaster Recovery Team):

a group of 10 Google engineers go around purposely breaking things at the company, under the most dire circumstances they can imagine, just to see what happens.

The ease with which software can be broken by the likes of DiRT ought to inculcate any programmer with a sense of humility.  This post on “why lack of confidence can make you a better programmer” underlines that point of view.  If only certain politicians realised they might come across better by expressing greater doubt and humility:

I finally became a better programmer when I learned to doubt myself, to doubt the software that I wrote.

Nice write up of the art and practice of the Pull Request which is at the core of the Github open source contribution model.


Perhaps Donald Trump represents the world’s first quantum politician capable of providing a simultaneous superposition of alternative realities in real time.  He’s surrounded by such probabilistic uncertainty that it is no wonder his adherents are apparently unable to detect his “missteps”.  His many paths through reality offer attractions right across the political spectrum from the religiously minded through to those drawn by standard fascist rhetoric:

With fascism, as with Trump’s rhetoric, for “us” to belong, that means someone else — a minority group, dissenters, people who hold differing religious beliefs — can’t. Both fascism and Trump hold that something, or someone, has made the nation “ungreat.” For Trump, this “other” has been cast, both implicitly and explicitly, as Muslims and Mexicans; for his supporters, it has often been minorities in general. Those elements must be removed, stripped away, for “greatness” to return. And no matter how many times Trump lies about, well, pretty much everything, that message doesn’t change. And that message is the most dangerous of all.

Alternatively perhaps the wilful obstinacy and fascinating inability to back down is simply a reflection of the mind of a 6-year old:

Donald and Hobbes is scarily accurate

Or perhaps representative of the ultimate troll.  There’s only one way to deal with their sort and maybe a period of silence about The Donald may be in order now.  If sufficient numbers are likewise turned off by his antics, he may find his bubble has burst well before November:

shutting up about Trump and all other professionaltrollshitters (a potty-mouthed portmanteau is the best I can do for now) might be a better tactic. Bullshit is a kind of conjurer’s incantation. Breaking its spell is a matter not so much of truth – however much we might like to believe it – as of disenchantment. … Like trolling, attention is its lifeblood: without a consenting audience, each withers. And the less time we waste on headlines and hand waving, the more we can focus on what’s actually going on.

Society and Culture

The art of communication as practiced by the Chinese government distinctly resembles the confusion and misdirection of Russian concept of Maskirovka with animal references thrown in.  One assumes some of this is irreverent but, as ever, there is a point being made here that the likes of Donald Trump probably already know.   There is nothing to gained by wading into the opinion swamp:

Poor communicators often waste time fielding criticism or otherwise hearing people out. The lesson of the Communist Party is that people respond, above all, to strength.  For your company or non-profit organization, it is more effective to decide what you want to do and declare that a decision has been made.

Prim, the creator of the utterly absorbing Primitive Technology site, is entirely silent in his videos.  They showcase his various attempts to build basic technology without recourse to anything resembling modernity.  The video below of how he constructed a forge hot enough to melt iron using a combination of clay, wood and bark  offers a good insight into the approach.   There’s a curious analogy with agile and iterative development here albeit in an entirely different context:

Primitive technology is a hobby where you make things in the wild completely from scratch using no modern tools or materials. This is the strict rule. If you want a fire- use fire sticks, an axe- pick up a stone and shape it, a hut- build one from trees, mud, rocks etc. The challenge is seeing how far you can go without modern technology. If this hobby interests you then this blog might be what you are looking for.

It’ll probably go down well with the Preppers.  There are 3.7 million of them in the US apparently waiting to rise from the imminent (because it always is) collapse of global society following a global scale nuclear/chemical/EMP attack.   Undeterred by the non-arrival of various predicted Doomsday scenarios such as 2012, this is a constituency inclined to vote Trump in the hope he can bring it all on sooner no doubt.