A Web of Memories

The near ubiquitous web, even in it’s basic form, provides a vast interconnected mesh of facts, thoughts and ideas such that there is almost never a question where the answer is not at our finger tips, but can our education system, and the world, keep up with such a radical new way of thinking and learning?

With the ever increasing ubiquity of the internet, carried wherever you might want it on your laptop, tablet or smart phone means that you now have constant access to a stream of information about almost anything. Who’s that actor? What’s that song? What is the speed of light? When was Mozart born? Two or three taps on your device of choice and you have the answer, anywhere, any time.

If you can have the answer to anything at your fingertips, instantly, where is the value of memorising untold quantities of facts, figures, formula and processes? More and more the human condition is being stored in a digital enclave, thoughts and feelings, facts and figures, all safely stored for later retrieval away from our fragile collection of flesh and bone.

Those in accademia have long accepted that learning to do things repeatably and accurately by rote has become less and less valuable, this is highlighted no better than manufacturing. Once the great engine of the British industrial age, manufacturing has withered away as such tasks have been moved to areas with suplus labour, and hence lower wages, such as China. Even the precision or artistry of an engineer or craftsman has been largely replaced by mechanised alternatives who work tirelessly without mistakes. So what of our studies?

One might argue that even at the university level much of what is required is nothing more than creative plagiarism and rote regurgitation. Take Brunel University’s CS3010 where the students are tasked with filling a wiki with social web concepts. Here much of the work required is simply ripping off the appropriate articles from Wikipedia and not getting caught. A task that could no doubt be accomplished algorithmically with a little thought, replacing the students with nothing more than a small shell script.

And here in lies the answer. It is the creation of such an algorithm, such a script, which requires thought, understanding and presence of mind. It could be argued that universities already assess understanding of concepts and ability to apply concepts in their testing, but ever so frequently this is entirely dependant on rote learning of an underlying thought. For example, imagine a question like so: “Apply a WBS to the following case study.” Here we are undeniably testing the ability to apply concepts, but without the rote learning of how to do such a process, or even what WBS is, you have little hope of attaining any grade.

The fragile existence of human beings lends itself to offloading as much as possible into this backing store, a cloud brain, that can be accessed at will without burdening our main cognitive processing abilities, but at what point do we stop such progression and how do we determine fact from fiction and who has what abilities as we move on from the Information Age, where information is currency, to an era where information is ubiquitous and truly free?

In honour of the Dancing Kame

With world IPv6 day growing ever closer I have made a small change to my logo. For those of you viewing the site over v4 connection you’ll see the new low-res imagery, but if you’re using a v6 connection (and your operating system is correctly prioritising it), then you’ll see the slick glossy one you’d normally see.

I’ll keep this logo until at least the end of the month and for those of you on v6 connections who want to see what the v4 variation looks like you can check it out here.

World IPv6 day, are you ready?

World IPv6 day is coming, if you’ve not already experimented with IPv6 now is the time to try it out.World IPv6 Day Logo

So, global networking is on the cusp of a big change. IPv4 addresses are already getting quite scarce and ISPs are being allocated v6 addresses with every request — whether they want them or not — in an attempt to increase adoption of the new standard. At some point soon new users will be unable to get a v4 address and that means they won’t be able to connect to your site or service. With less than one month remaining until World IPv6 Day, a global test if IPv6 infrastructure and the effect on end users, it’s time to try out v6 connectivity for yourself.

Many large organisations including Google, Facebook, Yahoo and Microsoft will be taking part and enabling IPv6 DNS records on their websites, which means that, should you have IPv6 connectivity, you’ll be connecting via the new-fangled protocol. But what about users who don’t have IPv6 connectivity? Well, for the most part they’ll happily continue to connect via IPv4. There may be a few instances where a bad configuration, such as the computer thinking it has IPv6 connectivity when it does not, that could result in slow or no access to the sites, but finding out who is affected is part of this global networking experiment. Fortunately ARIN has a comprehensive wiki covering many of these potential issues.

If you want to test your IPv6 connectivity there are a number of sites which will break this down for you such as ipv6-test.com and for the more technically inclined test-ipv6.com or simply visit one of the IPv6 demonstration pages set up by Google or Facebook. Note that the latter two will only work if you already have an IPv6 connection.

Should you not have IPv6 connectivity already, and most users don’t, it’s easy to get setup with providers such as Hurricane Electric who provide a free tunnel service. Once set-up your IPv6 traffic goes through the tunnel to one of Hurricane Electric’s many points of presence and out onto the wider v6 Internet. I’ve been using this service to provide IPv6 connectivity to my home network since February and am extremely pleased with both the stability and speed. In addition Hurricane Electric provides DNS services which have been invaluable to getting me fully IPv6 ready.

Hurricane Electrics service also includes some fantastic training material with their v6 certification and has an enthusiastic forum where your questions can be answered by knowledgable users and involved staff, and keeping up with IPv6 news is equally easy with their regular web casts.

With the availability of fast, free connectivity there really is no excuse not to give IPv6 a go, both at home and crucially in your organisation.

This Code is Such a Brainf*ck — No, Really!

While languages such as Brainf*ck and the more kid-friendly Ook! (in name only) are generally left to the realm of toys and bragging rights, their real beauty is having an extremely simple turing complete interactive environment in which to learn underlying computer science concepts.

Engineers like to do things differently, and nothing demonstrates this more than the plethora of esoteric programming languages available. Usually relegated to research projects of debatable value, toys and bragging rights the ability to strip back to the bare metal of the computer hardware, of even an emulation thereof, can be of huge educational value for the legion of high level software developers who have no understanding on exactly a pixel is actually rendered on a screen.

For example, a code sample in the unfortunately named Brainf*ck.

++++++++++        // Set first cell (counter) to 10
[
        >         // Move to next cell (output)
        +         // Increase value of current cell
        .         // Display value of current cell
        <         // Move to previous cell (counter)
        -         // Decrease value of current cell
]

The above commented code simply displays the value 1 to 10 on the output. A few things to note:

  1. Memory cells can be used for any purpose, their use as described in the above comments, is to aid in understanding only.
  2. Code blocks (defined by ‘[' and ']‘) continue to execute while the current memory cell is greater than zero.
  3. Brainf*ck compilers/interpreters typically display output as ASCII symbols, so running this program will not display actual characters.
  4. Seven of the eight available operations, with the exception of read value to current cell indicated by a comma (‘,’), are represented in the example program.
  5. Layout, whitespace and unknown characters are (or at least should be) ignored.

The program can be executed with an online interpreter. To see the output rendered in a human readable form you will need to use debug-mode as the ASCII symbols for number 1 to 10 are control characters and do not normally display anything on screen.

Using only eight instructions with an implicit operand makes this an excellent model for understanding memory allocation and for thinking about how these operations can be completed at the basic level. The use of ASCII output highlights the relation between the decimal value of a memory cell and it’s on screen representation. Parallels can also be drawn with assembly language programming. The highly reduced instruction set, again, coupled with implicit operands and pointer, provides a deeper insight to how a modern microprocessor might carry out instructions and introduces the thought processes required to understand memory addressing and operations.

While such and intricate understanding of the underlying implementation details of computer hardware is arguably not essential, and as such only peripherally taught in many modern degree level computer science course, esoteric programming languages such as Brainf*ck can help developers understand these underlying concepts of the digital computer by giving them an interactive path for investigation and have the potential to bring about a more enlightened, openminded and flexible developer workforce if their educational value is properly exploited — despite some rather institution unfriendly names.

Going Loopy with Loops

Reinventing the wheel can often give a deeper understanding of the problem and highlight some of the esoteric features of your chosen programming language — however, remember to go back to using the standard method and style in your production code!

I like loops, they are predictable, reliable and relatively easy to understand. For many common algorithms there are much more efficient ways of computing the solution, however loops often provide an easy to understand approach to getting to the right answer — eventually.

Recently, when demonstrating looping constructs to a beginner I provided the following three examples which spit out 1 to 10 on the terminal.

// Traditional
for(int i = 1; i <= 10; i++) {
    System.out.println(i);
}

// Unorthodox
int i = 0;
while(i < 10) {
    System.out.println(i+1);
    i = i + 1;
}

// Too smart for own good
for(int i = 0; i < 10; System.out.println(++i));

Each sample was slightly more complex, conceptually, than the next. The final sample demonstrating how the for could be abused to show the desired output on only one correctly formatted line. In it we use my favourite pre-increment operator to push the the 0 up to 1 before we output the number to the display. Of course we could have used 1 and 11 as our bound with the post-increment operator, but any sane programmer would agree that numbering should start at zero.

Extending the code abuse further, while browsing over at Stack Overflow I discovered that while is largely redundant, if you are happy to abuse for some more. Turns out that for, as typically defined, assumes the test condition to be true when omitted and all three sections of the for statement are in fact optional. As one of the moderators put it:

This answer pretty much proves the awesomeness of the “No question is too simple” policy. :) — Bill the Lizard

Likewise, while browsing an interesting article on The Daily WTF which highlights a simple method for square root calculation my muse overcame me. The article makes it quite clear that such iterative approximations are not highly regarded (unless you are John Carmack), however, it reminded me of a simple pi calculator that I wrote using JavaScript a number years ago when similarly inspired.

Armed with new knowledge about the abuse of for and an entirely redundant algorithm to code I set about developing a square root function.

double sqrt(double n) {
    for(double r = 1; r != n; n = r == (r = 0.5 * (r + (n < 0 ? -n : n) / r)) ? r : n);
    return n;
}

There are so many things wrong with this I’m not sure where to start. How about the blatant abuse of the parameter n as both the input and output, simply to avoid declaring another variable? This requires the break condition to determine whether the usually untouched n contains the currently calculated value of the result.

The final chunk of code actually does the calculation of the square root while deterministically assigning the value to n to terminate the loop and return the result. The calculation itself is relatively simple: is the average of our calculated root, r, and n / r equal to the previous value of r? If not, further refine r in the same way.

r == ( 0.5 * ( r + n / r ) )

The calculation, as implemented in my sqrt() function, is complicated somewhat by the embedded assignment of the new value to r, the poor-mans error handling of negative numbers (who wants to deal with imaginary numbers anyway?) and the inline if used to assign the final value to n.

Of course, we could always use the built in Java Math.sqrt() method which efficiently passes the calculation off to the hardware, but where’s the fun in that!?