Our New Minecraft Server – World Not Found

A new Minecraft World is born! Yes – that’s right…The Southern Kingdoms is taking the back seat and our new server (rented from Multiplay) is up. Been testing it on a quick short subscription for a few days now and it is wonderful – it shall be called World Not Found – an exclusive invite-only server where big things are planned. If you know me in person, or any of the other server members such as jcm, dburger or jellymann, and want participate in epic Minecraft projects then give us a shout IRL. Note that a small contribution to the server rental might be required.

Adding programs to your PATH in Windows

Adding items to your PATH system variable is one of those routine programmer activities – especially in Windows where many program installers don’t usually do this for you. So here is a quick tutorial on adding items to your PATH.

1. What is the PATH Variable?

The PATH variable is a list of directories which is searched through when a command is executed with no explicitly given location. So if you are in a random directory and you type the command “java”, then the operating system will search the current directory for a program of that name. If none is found, it will then search through all the directories in the PATH variable for the program.

2. Where is PATH set?

In Windows, the PATH variable is set in the advanced system settings. These settings can be found by right-clicking on computer, selecting “properties” and then selecting “Advanced system settings”

Step 1

 

Then on the “Advanced” tab, click on the “Environmental Variable” button. A window will pop up and the global system PATH variable will be in the System Variables list.

Step 2

 

Select “Path” from the list and click edit. At THE END of the text given in “Variable Value”, add a directory to include in the path – such as where Java is installed. Do not remove anything else from the path variable unless you know exactly what you are removing from it. Also ensure you add a semi-colon “;” character between the last directory and the one you are adding. Click OK and you are done. If your command terminal was already open, then close it and open it again for the changes to take effect.

Step 3

Another look at Afrihost

Afrihost-logo

So a few months back I posted my rant (click here) about the situation of throttling by Afrihost/Axxess. Now once again just to clarify, I was at the time an Axxess customer but I want to ensure that no one forgets that Axxess is owned by Afrihost and as such also needs to take some responsibility for the actions of any subsidiary companies – but back to topic. I thought I would carry out a another little experiment. I wanted to see how much Afrihost and Axxess actually shared. We know that they share the same custom built MTN network. I was curious about how closely their management of the bandwidth on that network is in sync with one another.

The only way to find out was of course to change service providers from Axxess to Afrihost (I know, I know – but I was curious). It has led to a very interesting discovery. Throttling still occurred yes, and this throttling was indeed still sometimes to the magnitude of over 90%, but, and this is a big but, it occurred far less frequently than when I was with Axxess. In fact it seems to be occurring less and less as time goes on – but more importantly the manner in which the throttling was done was more with what I expected than with Axxess. It was was usually only done within peak business times when one expects heavy congestion and the amount of throttling sometimes would change on a hourly basis. This shows a better approach to the management of the network in my opinion, one where the network is consistently monitored and adjustments made on an hourly basis.

I will however not count my chickens before they hatch and am monitoring the behaviour of my connection closely. Thus far however I applaud Afrihost for the effort on their side for trying to keep everyone happy. Will I retract my previous rant? Not a chance – they still need to make sure that their subsidiaries behave.

C++/CX: Not a simple love or hate

Standards are important. Standards makes it clear what to expect or what is expected of you. If you are still wondering what I am talking about, well then a bit of an explanation follows: I am talking about official standards as published by a Standard Organisation (such as ISO etc…). I want to quickly give my brief opinion C++/CX, a small deviation from the C++ standard, where, in my opinion, it is not quite clear cut whether the decision to deviate from the Standard was a good thing or a bad thing.

C++/CX, according to the Microsoft site (here), is a set of extensions to C++ that are targeted at Windows Store and Windows Runtime development. I came across C++/CX when I was reading some Windows 8 development tutorials and have not yet used it very much. My first thought was “why? oh why do you do this to us?”. Why not just make use of standard C++? First of all the applicability of a Standard in the context of Windows Runtime development isn’t as important since we are confined to that specific context. The applications developed are not aimed at being cross-platform, and developers are not likely to try and use a different compiler (although sometimes that might still be nice).

But there are other reasons that maybe we should stick to the Standard? How about the fact that a C++ developer has to now contend with and learn new language constructs that wouldn’t normally be seen in a C++ program? The other side of this argument is that experienced developers normally have no issue coming to terms with new programming languages (and since C++/CX introduces new syntactical elements is has to be defined as a altogether different language).

Maybe something can be found if the reasons for such a deviation can be inferred. This is trivial – the deviations have introduced new language features obviously intended so that developers do not have to cobble a lot of code together for elements that occur frequently in Windows Runtime programs. I have found some of these features to be interesting and potentially useful (interfaces, accessor methods etc.)

So where does this leave the issue? I think it leaves it in a fairly grey area. Deviations or extensions in this manner add a bit of diversity – as such, some of the features might be considered for the actual standard (just as many of the constructs in Boost have been added into the Standard C++ library). I don’t think we should fault developers for augmenting the tools available so as to have the tools they need. Yes, it can be frustrating sometimes if it is (basically) forced upon us by a big corporate giant. However in this case you have a choice (C#, Javascript, C++). The inclusion of Javascript deserves sidetracking from the main topic, and so I shall finish with it. Javascript’s inclusion tells me that Microsoft seems to be taking note of global trends these days instead of trying to beat the trends into submission and set their own. There are more and more examples of this including but not limited to the inclusion of Node.js into the Azure platform and more recently the integration of git into Visual Studio and Team Foundation. I kind of like the initiative, whether it is an elaborate marketing ploy to lure in new developers or not – time will tell.

Axxess/Afrihost Throttling Connections by 90%???

** Please also see the updated Afrihost ISP Review Here **

<rant>The ISP market in South Africa is understandably a cut-throat business with each ISP trying to outdo the other whilst at the the same time attempting to squeeze as many consumers as possible onto their network.

MWeb rocked the boat a few years ago by introducing the first affordable uncapped ADSL products. ISP after ISP followed suite. I myself have an uncapped account with Axxess (now owned by Afrihost). Why not with MWeb you ask? Well there are certain things in their terms and conditions that certainly do not suit me (I mean really, I am forbidden to FTP something to my home computer???). Anyway, back to the point. I have never had many issues with Axxess/Afrihost – that is until they spontaneously decided to move all their customers from the age-old-proven IS network to some newly “custom-built” network by MTN. Now I understand that such things may incur some teething problems, which they had and have said to be sorted out. Besides the issues I have with my physical ADSL line (which is neither owned nor the responsibility of Axxess/Afrihost) I had a few days of glorious speeds in which I could finally download myself a new game or two on Steam …. or so I thought. Three days and 5.5GB later, I notice that my Steam downloads seem to be a bit slow…but maybe that is just a line issue again I thought.

Days went by and I noticed that browsing was as quick as ever, but Steam downloads were sitting at 15KB/s … I have 1Mbps line which should give me speeds in excess of 100KB/s. Another peculiar fact was that whenever I started the download, the speeds would jump around a bit near 80KB/s and then after a while drop to 15KB/s. At first it seemed a little random, however it would do this consistently whenever I stopped and restarted the download or whenever Steam would give up and suspend the download for a while (due to slow speeds) and resume it. I then decided to do a little experiment. Start the download and time it until the speed drops to a consistent 15KB/s. Imagine the surprise when I discovered time and time again that after almost exactly 1 minute and 30 seconds the speed would drop. It never took longer than that but sometimes did so after a mere minute. The final test was to quickly do the same tests on a prepaid capped (guaranteed unshaped/unthrottled) account. Result? Pure bandwidth joy…return to uncapped…throttled hell.

Now why not complain? Well because I know the response I am going to get: “We reserve the right as according to our Acceptable Use Policy to prioritise/throttle our uncapped users based on network congestion bla bla bla…..” …  please explain this to me: When Axxess/Afrihost were making use of IS backbone, then I could easily transfer 100GB in a month with barely an issue. Now after a mere 30GB  they are throttling like hell on a new network that they boast far outstrips the old one in terms of capacity. If this were true then I would not be receiving only 11% of my theoretical speed on a weekend when business traffic is at an all time low! Come on Axxess/Afrihost … (un)shape up or ship out. I think I shall simply execute my right to move to another ISP … I hear IS has some nice consumer offerings these days….<rant/>

Moved!

Good news! I have moved this blog to a proper web hosting service. For those of you who didn’t know, I had hosted this blog on a small server of mine until now. There was no problem with that except for the reliability of my internet connection. There is bad copper in the ground here, which means when there is a small thunderstorm on the other side of the continent then my ADSL line loses sync. Last night it lost sync 94 times in a two hour period…I am fed up with it…anyways – that is why I have moved this blog to a proper host :)

Configuring Open MPI in Windows

This tutorial covers the setup of Open MPI and the compiling and running of MPI programs in the Microsoft Windows environment.

Open MPI and Windows

Open MPI is an implementation of the MPI standard. It is cross platform and makes use of your installed C++ or Fortran compiler. Getting everything working in a Linux environment is fairly easy provided gcc is installed. However when it comes to Windows there seems to be fairly few resources available on the internet that details the procedures to get everything up and running. After some playing around I eventual got everything working nicely.

My environment:

  • Windows 7 Ultimate x64
  • Open MPI 1.6.1 x64
  • Microsoft Visual Studio 2012 Professional x86 (only needed for cl.exe)

This tutorial does not make direct use of Visual Studio. Any version of Visual Studio should do, all we really need is the Microsoft C++ compiler and related tools that Open MPI uses.

 

Step 1: Installation

Download and install the latest version of Open MPI. Note that I downloaded the 64 bit version. I also changed the installation path to “Program Files” instead of the default “Program Files (x86)”. The Open MPI website states that this a temporary issue with their installer that should be fixed in time. If the installer asks to setup PATH variables then do so for all users. If the installer reports a failure when trying to do so, then don’t worry, we can do it manually as well.

 

Step 2: Open MPI PATH setup

For me the installer failed to setup any PATH variables, stating that my PATH was too long (not true). In this case we shall set it up manually. Simply add the bin directory of Open MPI to the global PATH variable. Thus in my case I added “C:\Program Files\OpenMPI_v1.6\bin” without the quotes to my PATH.

 

Step 3: cl.exe PATH setup

Open MPI for Windows is pre-configured to use the Microsoft C/C++ Compiler. It thus needs access to cl.exe, which controls the Microsoft Compiler and Linker. It is important here to add the correct directory to your PATH depending on the architecture (32 bit or 64 bit) of the Open MPI that you downloaded or else you will get linker errors. Since I downloaded the x64 version, I added the following directory to my global PATH: “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64″ If you installed the x86 version of Open MPI then you can use the base bin directory (without the amd64 on the end).

 

Step 4: VCVARS

cl.exe won’t work out the box in any command prompt. It is required that the Visual Studio environmental variables are set up. The good news is that Microsoft provides bat files to do this for you. The bad news is that these settings are lost when you restart your computer. Thus here you have a choice, either simply run the bat file before you wish to compile MPI programs (not that much hassle since the bat file is in the same directory as cl.exe and thus in your PATH now), or you can add the file to your task scheduler to run at system startup. The name of the file is either vcvars32.bat or vcvars64.bat for x86 and x64 architectures respectfully. I just simply type vcvars64 into my command prompt before compiling the first time. At this point everything should be setup.

 

Compiling a simple MPI program:

I tested the setup with a simple program that has each process print out a greeting and exit. To compile: “mpic++ main.cpp” If everything is setup correctly then you should see output like this:

Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

main.cpp
Microsoft (R) Incremental Linker Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
"/LIBPATH:C:Program FilesOpenMPI_v1.6/lib"
libmpi_cxx.lib
libmpi.lib
libopen-pal.lib
libopen-rte.lib
advapi32.lib
Ws2_32.lib
shlwapi.lib
main.obj

Then to run the program with 10 processes: “mpirun -np 10 main.exe”

That’s it. Happy distributed programming.

When the internet works!

Short sweet happy story: The internet works when you search for the solution to a problem with your favourite search engine, and the first result is exactly the one that you are looking for.

Furthermore, this first result simply gives you the answer without giving a long sad story first and thus requiring you to read a billion forum posts before actually finding the solution :).

Just in case you were wondering, the problem and solution that inspired this post.

Perlin Noise – The Simplicity, the genius

So after my rant about how the internet lies about what Perlin Noise is and what it isn’t, I decided to implement it myself (well actually my final graphics assignment specification decided for me). After staring at my code for two whole days trying to figure out why I was getting repeating patterns (and no, you may not ask me what the bug was due to shear embarrassment), I achieved the very embodiment of coherent randomness. Now this is still the original implementation with the speed improvement as given by Perlin himself – now to implement it with his improvements.

Original Perlin Noise

Perlin Noise

Perlin Noise: The Internet Lies

Perlin Noise

Perlin Noise

A while back I started experimenting with some procedural techniques, more precisely I wanted to create a procedural terrain using Perlin Noise. I had never implemented Perlin Noise before so Google to the rescue. The first decent article I came across was this tutorial. Without going into too much detail, it explained how I should combine noise functions with different frequencies and amplitudes to produce “Perlin Noise”.

My first attempt failed, producing complete random noise. After confirming that I followed the tutorial accurately I set out to find more tutorials. Everything that I found seemed to be similar: combine noise at different frequencies and amplitudes. In the end I did indeed get some working “Perlin Noise”…or so I thought.

It was about a year later and I am in my Honours Graphics class at University one Friday night when my lecturer begins explaining the process that one follows to implement Perlin Noise. At first I thought I could sit back and relax, then I started to realise that I had no idea what my lecturer was talking about. The process was entirely different to what I had learnt! There was no talk of the octaves, frequencies and amplitudes and the methods of combining the noise like I had learnt – needless to say, I was completely confused. At this point I decided that I would take a detailed look into Ken Perlin’s online notes which is where my lecturer got all of his sources from. After wrapping my mind around the algorithm, I continue with Ken’s notes on different methods of applying the noise. One of the strategies that Ken Perlin mentions he calls Fractal Noise – this being the process of recombining the noise produced by the Perlin Noise function in different frequencies and amplitudes – just like I have read before!!

So!! – what many many people on the internet are calling Perlin Noise – is actually not Perlin Noise at all. It is instead the fractal recombination of noise. Furthurmore the noise function that everyone seems to be using is either some small custom random number function or just the programming language’s built-in random number function – meaning that once again that NONE OF IT can in any way be called Perlin Noise.

It seems that some of these tutorials and explanations have been on the internet so l

ong that it has actually convinced a large amount of the population that this fractal combination of noise is what Perlin Noise is – and thus more and more of these tutorials are appearing.

This blunder, this blatant lie is a dishonour to Ken Perlin and his work. The word needs to spread – so share this with everyone you know!!