Thursday, November 8, 2012

On NaNoWriMo: Part V

For the third year running, I am taking part in National Novel Writing Month. The object of NaNoWriMo is to write an entire 50 000 word novel in just 30 days. Of course, I'm cheating a little this year by attempting to finish the novel I started last year.

In 2011, I only managed 22 186 words, but I grew rather attached to my characters in the process. I promised at the time that I would eventually finish the novel, and that's what I'm doing now. I'm keeping the content separate though, so the word counts don't interfere with each other.

Here's a bit of a synopsis. If you like the story to be completely new the first time you read it (like I usually do) then you can skip it.

"In Part I, we met Amser - the girl from so far away, the seasons are wrong - with her little box of powders and fuming chemicals. We also met Llyr, formerly Pedran, formerly Elhaearn, the son of Cledwyn Roch, former self-appointed lord of the city of Pyr, notorious pirate and marauder, insidious conman, and once proud owner of a sizeable private army that could successfully invade and occupy most of the country, should he have wished. We also met the Types, or at least two of them. Amser claimed to have built their bodies, mixed their blood and poured the life into them, but naturally, Llyr finds that difficult to believe. He would have paid it a lot more attention if they weren't on the run from the Company, who wanted Llyr dead, supposedly because a handful of corrupt politicians wanted him out the way, but there seems to be something even more sinister behind it.

"Was that all in Part I? Most of it was, at least. Part II carries on from there, and will hopefully start providing answers. Will we learn why Amser left the Village, what happened to Briallen after the siege? Who is directing the Company, and why? Where is Llyr, and why was he so carefully tracking the Types so far from home, even though he was fully aware of the army of more than a thousand men hot on his heels? And most importantly, who were the Ancients, and why did they disappear?

"Will Part II answer these questions? I sure hope so."

You can follow my progress on the official NaNoWriMo sitehere (notice that I'm always behind?). I update my wordcount there religiously as a form of procrastination, so you can rest assured that it's accurate to within about 10 minutes.

In the mean time you can read the prologue, or a collection of all (at least, most) of the fiction works I've posted on this blog.

Here's my daily progress for a revised goal of 27 817 words (the number needed to take the novel past 50000). Already looking better than last year, isn't it?

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Thursday, October 25, 2012

On Grandparents

Earlier this week, my grandfather passed away. Looking at the way I've turned out, it's amazing how I landed up as the culmination of the collective influences of all four of my grandparents. Naturally, my parents did play a significant role, but a lot of what they passed on to me came from their parents. There is no doubt that I'm extremely grateful that I had the grandparents I did.
  • Douglas (1918-1988): My father and aunt often told me the story about how he was once asked "What do you want to do when you finish school?" He smiled, because by then, he already had a Master's degree in analytical chemistry. Although the only memory I have of him is one of sitting on the floor next to him in his armchair, he still played a fairly significant role in my life. Apart from the fact that I look remarkably similar to him when he was my age, the chemistry and electric kits that I grew up messing around with (which played a big role in how I turned out) came from him.
  • Barbara (1923-1997): We did not have many TV channels when I was younger, and if it weren't for my grandmother carefully recording shows like TMNT, Dinosaucers, Saber Rider, and most importantly, Wallace and Grommit, I would have missed out on the shows that more or less defined my early childhood imagination. I have no idea how she knew what to tape, but she somehow managed to get the right shows every time.
  • Ethne (1932-1999): There's no doubt that my the large majority of my tastes came from my grandmother - from food, to art, to furniture, to music. There are so many piano pieces that make me feel nostalgic because I can remember hearing my grandmother playing them, or even because they have something in common with something she used to play. Even though it's not a piece she played, I cannot listen to Chopin's Prelude in E-minor without thinking of her and crying.
  • Alan (1928-2012): I remember when he taught me and my brother how coordinates worked (I must have been about 11 or 12 at the time). We sat with graph paper and carefully worked out the coordinates of vertices so that we could get the computer to plot a Tyrannosaurus. At the time, I thought it was a game, not realising that I'd be using the same concepts at university more than a decade later. It never ceased to amaze me how he could remember maths he'd studied at university 60 years earlier, when I could barely remember stuff I learned in the last couple weeks. My fascination with engineering and large machinery definitely comes from him. One morning in 1995, we followed one of the last steam pulled journeys of the Blue Train. There is still a framed picture from a calender of that very train on my wall. On one occassion, I got to drive a steam engine by myself (under supervision, of course), taking it up to 70km/h, which is an experience no 9-year-old could ever forget.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Thursday, October 18, 2012

On the construction of a Boeing 747 in Minecraft - Part II

So, I did mention when this blog was still young that I very rarely finish things. But I did promise in my introductory post for my Minecraft Boeing 747 project that I would make the effort to finish it. And now I have. At least, I have finished the exterior.

I started building it around the end of March on the EnderSouls Minecraft server, so it's taken about 6 and a half months to get this far (admittedly with several breaks, at least one of which lasted several months). It's twice the size of the real thing, and mostly to scale, with a little bit of artistic license here and there (mainly around the windows and the writing on the side).

All of the building and material gathering was done in survival mode, although I did cheat a little by paying other players to gather a lot of the snow for me (the build took a staggering 160 stacks of snow blocks - which means over 40 000 snowballs needed to be harvested).

Anyway here are some screen shots.

Because I had a few people asking me how I did it, I guess I'll give a rough breakdown of my approach to the build. I started by getting a few reference photos, together with what engineers call a "3 view" - which is just a scale drawing of the top, front and side views of the aircraft. You'll also need to know a couple of dimensions of the real aircraft, and the obvious place to get those is Wikipedia. It's important to note that no matter how good you think the photos are, you must be careful taking direct measurements off them, because perspective distorts distances. Stick to the drawings for measurements, and use the photos more for minor adjustments to get appearances right.

You'll almost certainly need to resize the 3 view. It's best to get a lower resolution image and enlarge it, because thicker blurry lines make it easier to fit a blocky curve. You need it pretty big, and you're not concerned about how it looks. The exact size you want is a easy to calculate, but you could find it with trial and error approach. Take the length of the aircraft in pixels in the image, and divide by the real length to get a distance of pixels per metre. I find that you need a minimum of 7 pixels per metre to get a decent representation, so find the factor you need to scale your image by to get 7 (or more) pixels per metre, and scale the image. In my case, I went from a roughly 700x400 image to a 2100x1200 image.

I used Gimp to do most of the measuring, but pretty much any photo editing software that can show a grid over your image and allows resizing and repositioning of the grid will do. Set the grid size to the number of pixels in a metre (in my case, 7). You can then use your discretion to judge the edges of curves. Start by building a frame, and then fill it in later. I found it easiest to mark the blocks roughly in bright colours using the pencil tool. Here's the 3 view I used once I was done with it.

Click for full size image

The wings and horizontal tail proved the most difficult to design. After a couple of attempts at doing it by eye from the photos and 3 view, I gave up. Instead, I wrote a very simple script in Python that calculates the positions of the blocks based on a minimal number of parameters (I've made this Minecraft wing design script available for download). One of the files output by the script gives a layer-by-layer breakdown of the wing, which is perfect for building in survival mode. You can easily calculate the angles by reading your coordinates in Gimp, and then using trigonometry to get the angles. If you do this, atan2 is your friend.

These techniques will work reasonably well for any build. If you want to try something like this yourself, all you need is time, patience, and an eye for detail. Good luck.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, October 15, 2012

On Stupid Outdated Laws in South Africa

November is just around the corner, and that means NaNoWriMo. That is National Novel Writing Month, for those too lazy to follow a link. I'm well on track and fully intend on finishing the novel I started for last year's NaNoWriMo, and I've started making plans for self-publishing, distributing, and of course, making some money.

I'm a big fan of the creative commons license, so naturally I'll be releasing the completed novel under a CC license and distributing the e-book for free. I don't really care whether the book makes money or not (I just want people to read it), but I have no problem if some people enjoy it and feel like donating a little.

Many bloggers, artists, authors and even musicians do this. Kevin McLeod of Incompetech, for example, creates music and releases it for free under a CC license. All he asks for in return is that people share his music, tell the world about him, and if they like, they can donate a little money.

That's exactly the model I would love to use. There is however one small complication. I live in South Africa, and for some reason or other South African law apparently makes it illegal for anyone to receive a donation unless they are a registered Nonprofit Organisation, which I am most certainly not. As far as I can tell, South Africa is the only country that has a law like this.

While I understand the purpose of that sort of law, and I can conceive the role in fighting fraud and corruption it might play, I think that it may be time for the South African government to review it. There needs to be a better way that I can make money from my book than forcing people to pay for it if they don't want to. I'm not a lawyer, so I'm not even going to make suggestions about how the law should be changed, but I'm sure that looking at how other countries handle this sort of thing would be the first step.

It's disappointing that a small legal complication stands in the way of the free culture movement in this country.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

On Psychoactive Drugs (Sort Of)

When I was 19, I made a concious decision not to drink alcohol. I don't know why I chose to be like that, but I think it had something to do with the fact that my brain is hard enough to control at the best of times, and I don't like losing control of it, even slightly. I feel the same way about all psychoactive drugs, including caffeine. I even feel that way about painkillers, which I take only when absolutely necessary - which is about once or twice a year, if that.

One morning about a month ago, I was fairly short on sleep, so I decided to try a cup of coffee to wake up. It worked, and I felt incredibly alert for the next few hours. However, by lunch time, the effect had worn off, and I was rendered useless for the rest of the day. The next day, I didn't get quite enough sleep either, and so I did the same thing. I kept it up for about two weeks, after which I introduced a second cup a day in order to try to keep my brain functioning for longer. In order to avoid developing a dependence on caffeine, I made sure to have at least three consecutive caffeine-free days a week.

I've definitely felt more alert and productive on those days that I've drunk my coffee, but looking back on how much I've achieved on those days, I don't think I've achieved any more than usual. If anything, I've been procrastinating even more than I usually do (and that's saying something), and I've felt particularly existential and irritable over the past month, which tends to be even more counter-productive. Not to mention that I've had a couple of the worst headaches I've had in years over the past month (not counting those from when my titanium bolt was screwed in), and I blame it all on caffeine.

I think I'm going to put a stop to this. No more psychoactive drugs for me.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Friday, September 28, 2012

On SylverMyst Technologies

It was almost 2 years ago that I added the little footnote at the bottom of my blog: "A Sylvermyst Technologies production." Around the time I began this blog, I got tired of forms that asked for an organisation (they're rare, but they exist_, so I just created one.

I can't even remember what the forms were for. I guess I was supposed to put the name of my university, but I really couldn't see why they'd need that. I actually started with the clich├ęd "[surname] Technologies", but a very quick Google search ended that idea very quickly. I changed it a bit, and "SilverMist Technologies" was born.

Long-time readers of my blog will remember that in early 2011, I moved my blog over to it's cutrrent domain - - and learned a very important lesson: All of the best domain names are already taken. I decided to buy one before it was too late. There's nothing worse than someone who buys a domain name and then just sits on it without putting anything up, so I used my limited knowledge of html and threw together and a very simple webpage with a link to this blog, and a nice (in my opinion) logo in GIMP.

As I mentioned in my previous post, I started making plans to release some of my better software (I had to sift through the 50 or so half finished programs I still had for ones that I'd actually managed to finished). Overall, I put together 7 of them which I felt could have some use or entertainment value. The number of finished programs plummeted to zero around the time I my university workload really picked up, and has never recovered. Incidentally, that's around the same time I started this blog.

I had to go digging in a cupboard for a long lost copy of Delphi 7. Funnily enough, I stopped developing in Delphi four years ago, around the time I formatted the computer and found that the disc had mysteriously disappeared. Unfortunately, I still couldn't find the disc. All I really needed to do was add a license bit into the about box of each programs and re-build them, so I made another plan (*wink wink*). Funnily enough, I couldn't get Delphi working on my Windows 7 partition without doing a bit of fiddling, but it worked perfectly under Wine on my Linux partition. Oh, how times have changed.

Incidentally, thanks to an ancient backup disc my brother had made, I also found the little artificial life program that I mentioned in a post when this blog was only a week old. Thanks to a major bug in Turbo Pascal, it doesn't run on anything with a processor faster than 200MHz. On my computer at the time (a 300MHz Celeron), I found that a pretty decent workaround was to make sure the processor was kept busy enough that it seemed slower. The easiest way of doing that was to play some music in the background (which is something I always do while programming anyway). When I tried it on a computer with a couple GHz, that no longer worked so well. I was a little worried that I'd never get it working on my current computer with it's four cores providing eight processing threads, but somehow DosBox doesn't suffer from the problem at all.

Anyway, the need to build a new website from scratch motivated me to learn a little PHP, and so I've pieced together a very small, simple website. Go have a look at everything I've done at, and check out a couple of the programs I've written at Let me know what you think, and of any improvements I could make.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Friday, September 7, 2012

On Open Source and the Way People See the World

I'm not going to lie. The thing that got me into open source software was the price.

And let's face it - that's a pretty big reason why many people go the FOSS (Free and Open Source Software) route. They download the software, and never contribute, and never donate. I have seen more than one programmer get so frustrated with their users' attitudes that they just abandon the project. Partly, they're right. It's true that too many users like that would be bad for the open source community. But in a lot of ways, they're wrong.

Fortunately, many programmers don't see the community like that. Many of them see the community as a group of excited and enthusiastic hobbyists who love the idea that you don't need a huge corporate budget to come up with quality software. You just need a small group of people who are willing to contribute consistently, who are passionate about problem solving.

I've been programming as a hobby for about 12 years now, mainly because I've always found it kind of fun. I had the privilege of lecturing a programming course to a class of just under 200 second year university students earlier this year, and it opened my eyes considerably - both to the way I view programming, and to the way most other people view it.

What I learned about the students was both pretty disappointing and pretty encouraging, but I'll get to that in a moment. First, I'll share what I learned about the way I view programming. Not surprisingly, I see it more or less the the same way a stamp collector views collecting stamps, or a musician views playing music. It passes the time, and I simply enjoy time passed programming more than I would have enjoyed that time if I had passed it by doing something else. Problem solving comes naturally to me, and overcoming a challenge gives me a unique feeling of accomplishment that you can't get any other way.

When I was in third year student, we had to plot several charts and graphs for our Aircraft Design course. Naturally, being engineering students, most of us were pretty comfortable with a computer, and the majority of the class would plot the graphs in MS Excel, rather than draw them by hand. Our lecturer warned us that one particular graph we needed to be able to plot was incredible difficult to plot on a computer, pointing out that even companies like Lockheed were still plotting them by hand as late as the mid eighties (computers were better at plotting back then than you might think). Naturally, I took it as a challenge. I rearranged all of the equations, looking back at their derivations, and in a single sitting, I wrote a roughly 250 line Matlab script that calculated all of the curves and plotted the graph, complete with labels. The following day, I set about making the script customisable - adding options to turn features on or off. On the third day, I made the whole thing more user friendly - adding separate files for options and parameters, and added plenty of comments explaining how the code worked. Feeling proud of myself, I printed a few charts for half a dozen or so aircraft, and took a selection to show my lecturer. He was impressed, and showed the rest of the class. I was pretty embarrassed about it, and just sat there in the corner, blushing quietly.

Much later in the year, a week or two before our massive design projects were due, someone in my class wanted to know if he could buy my program. Before then, I'd never even considered the possibility that I'd ever sell a piece of software. I thought very carefully about it, and that evening, I hid an obscure line in the code that would print my name in the bottom right corner of the chart, and handed him the entire source code. Later that week, someone else asked me about it, and I emailed them the source code as well. I thought nothing more of it. A year later, another class mate approached me. He had my program, and wanted to know if it was OK to use it to plot charts for his final year project. I said yes, as long as he gave me credit. I thought that would be the end of it.

I have been approached every year since. This year, a student who was almost certainly still in high school by the time I had a bachelor's degree asked me if they could get a copy of the program. It made me realise something fairly important about FOSS. People don't program because they want to make a useful piece of software. They program because they enjoy it, and its the pride that stems from that enjoyment that ensures a high standard of work. And that is exactly what is written in the GNU manifesto.

(On a side note: You probably were not aware that I recently started making plans to release some of the software I've programmed during my life (including the S.E.P chart script (because its just a script, not a program, whatever students want to call it) mentioned in this post). It's not available yet (I need to make some minor changes to the source code before I release it under CPAL or GPL... whichever I decide to use), but you can still see descriptions for some of them.)

That brings me to the way my students see programming. An encouragingly large number (at least 10% of the class) seemed passionate about programming. One student, in fact, told me I'd inspired him to change career paths from Nuclear Engineering to becoming a programmer. That's probably the most flattering thing I've ever heard, even though I think it's most likely the thrill of solving a difficult problem that got him, and not my lecturing. Whatever it was, hopefully I managed to convince him not to change career paths.

The attitudes of the rest of the class scared me a little, and I think its partly because that seems to be the way the rest of the world views programming. Its much the same as what Benjamin Zander says about listening to classical music. It's something most people would enjoy doing if they just sat down and gave it a chance. But they immediately assume that they won't enjoy it. Most worrying, however, is that many of them get too caught up in trying to actually learn certain programs. Not just algorithms, mind you. It's actually quite helpful to have a repository of algorithms to draw from, but there are some things which are merely programming exercises that hardly anyone would ever need to know outside of a classroom. Things like a function to invert a matrix (in practice, the smart thing to do would be to download a matrix math library, with only one exception - that is, if the matrix math library is what you are trying to program). It seems that the students dislike problem solving to such an extent that they will take any measures possible to actually avoid it altogether.

To me, a generic problem solving ability is the most important skill anyone can ever have. Life is just a series of problems, and the better you are at solving those problems, the better you will do at life. If solving challenging problems brings you enjoyment, then you are automatically set to enjoy life. It really is that simple. I think I'm going to have to emphasise that to the next class I teach.

(Another side note: I was going to write a bit about my gradual shift towards using only FOSS, but I got a bit sidetracked. That will have to come in another post.)

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, August 20, 2012

On South African (and Possibly Other) Drivers

I don't know what it is, but people in general do not know how to drive. An alarming majority of drivers on the road act either impulsively and irrationally, or nervously and hesitantly. Both of these mindsets are incredibly dangerous and, let's face it, stupid.

While the vast majority of my driving is around the Gauteng region, I've noticed no real difference in driver attitudes on trips to Durban or Cape Town in the last couple of years. It seems to be at least a national problem. It may even be that globally, attitudes are changing, but I don't have any experience driving in other countries, so I can't comment on that. This post is a pretty long rant, but I really hope you will take the time to read it, since these points apply to almost everyone (even me, in some cases).

    Nervous Drivers.

Nervous or hesitant driving is indeed dangerous in many situations, and these drivers are a big problem on the road. Almost everyone knows how to solve this problem though, and I bet you're muttering some form of the solution to yourself right now:

"Those drivers should just learn to be more confident on the road."

That is indeed the solution, in essence. Just like the solution to world hunger is that the starving should eat more food. Apart from making a major logical fallacy by simply posing the solution as a state in which the problem is absent, it subtly passes the blame onto those nervous drivers, completely ignoring the reasons for their nervousness. Lets face it. The reason most of those nervous drivers are so hesitant is because so many other drivers are impulsive and unpredictable. If everyone drove in a consistent and predictable manner, there would be an incredible reduction in the number of nervous drivers on the road. Which brings me to the next problem.

    Impulsive Drivers.

First, let me define what I mean by impulsive driving. An impulsive driver is a driver who takes an action without having considered the entire state of his current situation. In other words, it is a driver who acts on a decision without considering all of the available information. It's not necessarily a driver who breaks the rules of the road (I'll get to that in a moment), but rather driver who changes into the left lane when they need to turn right at the next intersection, for example. Or a driver who doesn't stop at a yield when there is a car approaching. Or even a driver who keeps the same following distance regardless of weather conditions.

I don't think its a case of drivers consciously ignoring facts (that would be stupid). I think its simply a case of drivers not knowing what to look for, and not knowing where to look. Its a classic case of the Dunning-Kruger effect. They are incompetent drivers, but will never seek to be better drivers because they are not aware of their incompetence. The one point which many drivers have very little practical understanding of is stopping distances.

    On Stopping Distances.

Most people have no clue when it comes to stopping distances. Braking as hard as possible without locking the brakes, driving at a speed of 60 km/h, a typical stopping distance is 50m or so. At 80 km/h, it's 70m. At 120 km/h, it's 120m. Great. Numbers. Distances. It's hard to know what they mean in real life. Time is something most of us understand a little better, so let's consider stopping times instead.

I hope you have a stop watch nearby. At 60 km/h, it takes around 5 seconds to stop the car (including a reaction time). But really, how long is 5 seconds? Hold your breath, tense up your right foot (as if you're pushing the brake pedal), and start the stop watch. When it hits 5 seconds, you can relax and breathe again. That wasn't bad. Now try 9 seconds (which corresponds to stopping from 120 km/h. You got it? That is about the shortest possible time in which an average car can come to a stop in dry conditions. If you're ever slightly slow on the brakes, if you push slightly softer, or if the wheels skid for even an instant, it's going to take longer.

Now consider a wet road. In wet conditions, a general rule of thumb is that the stopping distance doubles (but reaction time obviously stays the same), so the time increases to about 16 seconds. Try holding your breath and tensing your foot again, waiting for 16 seconds this time. 16 seconds is a pretty long time, when you're actually thinking about it. Now try the same thing again, but this time, imagine yourself on the freeway, just after an afternoon thunderstorm, doing 120km/h, slamming on brakes as a pedestrian steps into the road a couple hundred metres ahead of you...

    On Intelligent Lane Selection.

This one is so obvious to those who can do it, but seemingly unreachable for those who can't. In general, you should get into the lane that is going to take you where you want to go. It's stupid to move over into the right lane when you're going to be turning left in a hundred metres. If you need to turn left, then you should move into the left lane before the turn. If the traffic in that lane is slow, then so be it. Drive slowly for a bit. Your priority should be to follow the general flow of traffic. To go against the flow is both futile and dangerous.

However, it's not necessary to get into the right hand lane if you're only going to be turning right several kilometres down the road. You should always be considering how you will be getting into the correct lane, but as a general rule of thumb, you only really need to start moving over to that lane when the turn approaches. In urban driving, this means getting into that lane a block or two before the turn, and on freeways, it means starting to move over to that lane when you start passing signs for the off-ramp you want.

When you're not planning on turning off the freeway any time soon, there's a general guideline to which most drivers seem oblivious.

    Keep Left, Pass Right.

There are even signs at regular intervals along the freeway to remind drivers, but the vast majority (at least 80%, by my estimate) stick in the lane they are in if the road ahead is clear. The mentality of South African drivers seems pretty clear, and I can see those slow drivers mumbling under their breathes:

"If you want to drive fast, go around."

This attitude is absolutely correct. If the vehicle behind you wants to go faster than you, they should indeed overtake you. In fact, they should overtake you on the right. And if you want to do a speed that is slower than the speed limit (even if it's for a brief uphill stretch), then you should move over to the left so that there are lanes on the right for faster vehicles to overtake. I acknowledge that many drivers do move over when a vehicle approaches from behind, but these vehicles should move over to the left if it is safe to do so, even when there happen to be no vehicles behind them at the time.

Of course, this doesn't mean that the right hand lane is free to fly along at any speed. Which brings me to my next point.

    Speed Limits.

Typically, speed limits on a road are set based on empirical data for similar roads. The actual limit is usually chosen from 60, 80, 100 or 120 km/h (it's a small set to make them easy to remember), and is the highest speed that gives an acceptably low accident rate on similar roads. When finding a similar road, typical factors that are considered are the surface type and quality, frequency and severity of bends, density of both vehicle and pedestrian traffic, and the number and type of intersections, amongst other things.

There are many arguments that speed limits are incorrect or outdated, and that modern cars have safety features, and all that. But there are a few things these arguments neglect. While accidents can happen at any speed, the severity of accidents goes up with speed. Also, while cars have safety features added all the time, pedestrians do not. Nor do fences, lamp posts, or buildings. Most importantly, nor do driver's brains. A driver in a modern car is no less likely to make a fatal mistake than a driver 50 years ago. In fact, based on the observations outlined in this post, drivers are more likely than ever to do something stupid.

But that aside, driving faster than the speed limit is illegal, just like it is illegal to steal, murder or rape. I know many people who drive way above the speed limit. Many of them do it because they know they won't get caught.

Lets face it, committing a crime for the thrill because you know you can get away from it is socially disturbing behaviour. To me, it's not to far removed from a person who breaks into a hospital and rapes patients while they're in a coma.

People who break the speed limit fall into one of two categories.
  1. Those who are oblivious to the rules.
  2. Those who know the rules, but deliberately ignore them.
Both sorts of behaviour worry me, and in most other aspects of life, they would be considered socially unacceptable, and possibly even sociopathic. And this brings me to yet another point.

    Lack of Regard for Rules in General.

Stop streets mean stop. No one knows how traffic circles work. Going straight from turning lanes, and turning from straight lanes is dangerous (and turning left from the right only lane in front of traffic going straight is just plain stupid). Solid line means no overtaking. Amber light means stop. Red light means don't go. Many traffic lights even need a sign saying "wait for green". How retarded do drivers need to be that they need to be reminded about the most fundamental principle behind traffic lights?

The extent to which people ignore rules on the road is absolutely terrifying. Many people will start thinking I'm talking about the minibus taxis here, but I'm not. I'm talking about you. I'm even talking about me.


I see aggression on the road all the time. A lot of the time, it's not even warranted. I'll give you the best example, and the one you're probably familiar with. Imagine yourself driving along, and a taxi is stopped in front of you to drop off passengers. You have to wait behind it. You get frustrated. When you finally manage to pass the taxi, you hoot and wave the driver your middle finger. Why? The taxi is carrying out a necessary function in society. Stopping to let off or pick up passengers is not against the rules of the road. Sure, hoot away if the taxi actually breaks the rules of the road, but don't just hoot because you're impatient and can't wait two seconds.

Also, if someone does hoot at you, consider why they are hooting. Many drivers are sent into an immediate rage at the sound of a hooter, or the sight of a middle finger. If you're on the receiving end of this, consider that you must have done something to trigger the incident. It may be that you did nothing wrong, but the other person made a mistake that they are unaware of. It's possible, but you should also consider the possibility that you made a mistake that you're not aware of.

Whatever happens, don't get angry, because that just limits your ability to think logically and act rationally. Just relax. Go with the flow.

    Never Obstruct the General Flow Of Traffic.

This is far easier to do than it seems. Don't come to a stop when waiting to merge with high speed traffic, such as on a high way on-ramp. The correct way to do it (and the way that virtually prevents traffic jams) is to match speeds with the traffic by the time you need to merge. Similarly, if you are on the freeway, and there are cars entering from the on-ramp, leave enough space between yourself and the car in front for the cars entering to do so without slowing down the rest of the traffic. The same principle applies when the road narrows.

Another one is to not cross the intersection unless you can clear it. People ignoring this rule is the number one cause of urban gridlock worldwide. It's just frustrating, and it shows that the driver blocking the intersection wasn't driving with a full awareness of what was going on in the road around them. Which brings me to my final point.

    Be Aware of Everything Around You.

This is too vast to cover completely, but I just have a couple of examples which will hopefully demonstrate my point.

You see how little people pay attention best when approaching a jam up on a two lane road due to an obstruction in one of the lanes. Both lanes get backed up, and since the cars in the clear lane usually are kind enough to each let a single car from the other lane in at the obstruction, you land up with both lanes moving at roughly the same average speeds. Every now and then, you'll get a car that's a bit slow to pull off, or car that doesn't let the car from the other lane in, or lets two or three cars through. These create waves which flow upstream. Often they are damped out, but sometimes they travel all the way up the jam, and make it seem as if vehicles in one of the lanes is moving quicker than vehicles in the other at any one point. You get these waves in both lanes, and they vary in frequency and magnitude. The net result is that to any driver far enough upstream of the jam, one lane will appear to be moving faster than the other. Many drivers will try to stay in the faster of the two lanes, and constantly change lanes to make sure that happens. If they were to look at more than just the cars immediately around them, but look at the entire traffic jam, they'd realise that their efforts are futile. If all cars wait patiently, and each vehicle from the unobstructed lane lets a single vehicle from the obstructed lane through before going, the maximum waiting time for any driver in the jam is minimised.

The other one is when people act based on the actions of the vehicle immediately in front of them, not looking at what's going on ahead of that vehicle. Consider the case of a very slow moving (or stationary) vehicle in the left lane, followed by cars A, B and C, all of which want to pass. The right lane is full of steadily flowing traffic. When a gap in the right lane approaches, C almost inevitably takes it. B takes the next gap, and A has to wait for the gap after that. Occasionally, C will move into the right lane, but then slow down and let A and B in, which is very nice and all, but this obstructs the general flow of traffic in the right lane, going against my previous point. In an ideal world (which is sadly very far away), B and C would leave the gap for A to take, since A has been waiting longest for the gap.

Even if A is the only car stuck behind the slow moving vehicle, he will usually follow immediately behind it, leaving only enough space to pull out. Ideally, A should leave enough space between himself and the vehicle in front that he can accelerate to match the speed of the traffic in the right lane if a large enough gap comes along. Sadly, I hardly ever see this happen.

I know I am not the best driver out there. But acknowledging that is one step further than most South African drives have taken, and knowing that fact automatically makes me a better driver than many. Most of the points I've made above have equivalents in other aspects of life. Know your faults. Don't be ashamed when you make mistakes. Be aware of the actions of others, and the effects of your actions on their emotions. Basically, don't be an asshole.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, July 30, 2012

On Minecraft Enchantment Levels and Bookshelves Part III: The Changes in 1.3

The much anticipated 1.3 update for Minecraft is coming out soon, and along with a whole host of new additions to the game, it also brings an overhaul to the enchanting system. This, of course, completely changes the optimum enchanting level-bookshelf relations that I derived for the previous enchanting system, just like the 1.1 update broke the one before that.

I've been digging in the source for the 12w26a snapshot in order to find out what the changes are. To my knowledge, the calculations have not changed since the rebalancing introduced in the 12w22a snapshot released at the end of May. Comparing these to the snippets of source code I had saved from 1.1, I have worked out how the new enchanting levels are calculated.

But, before I get into that, let me once again reiterate why you'd want to understand the enchanting level-bookshelf relation. There are simulators which can calculate the probability of getting a certain enchantment at a certain level (there is an excellent calculator here). This means that if you are looking for a specific enchantment or combination of enchantments, there is an optimum level that would maximise you chances of getting the combination of enchantments that you want. Of course, you can keep rolling new levels to find the level you want, but it is quicker to set the number of bookshelves so that the level you want is most likely to show up, especially if you tend to enchant at the same level every time.

Lets start by looking at the relevant changes as stated in the version history on the wiki:
  • "The maximum enchantment level has been lowered from 50 to 30. As a result enchantment tables now require only 15 bookcases around them to allow maximum level enchantments."
  • "With a full enchantment table set with bookshelves, at the bottom of the 3 enchantments, it always shows you the highest number possible"

First, before we get into source code, let's try some in-game testing. The first point is definitely true. Level 30 is indeed the maximum level, and there is no difference in the distribution of levels with more than 15 bookshelves. Now testing the second point. With no bookshelves, it seems we are offered random levels in the bottom slot between 1 and 8. The first obvious difference is that maximum with no bookshelves has been upped from 5. Also it seems you are not always shown the highest number possible. In fact, with 5 bookshelves, you are offered levels between 10 and 15 in the bottom slot, and although 10 bookshelves usually offers level 20, it occasionally offers as high as level 23 in the bottom slot (as in the screenshot below). With 15 bookshelves, however, you always seem to be offered level 30 in the bottom slot. The second point, it seems, is indeed only true for a "full enchantment table set".

Figure 1: Screenshot showing enchantment level 23 being offered with 10 bookshelves (which happens about 1.13% of the time)

So, what's actually happening in the source code? There are actually only 4 small changes in functionality between 1.1 and 12w26a. The relevant snippets of code (edited slightly to make them more readable) are:

- In version 1.1:
    if (nBookShelves > 30) { nBookShelves = 30; }
    int level = random.nextInt(5) + 1 + (nBookShelves / 2) +
                random.nextInt(nBookShelves + 1);
    if (slotNum == 0) { return (level/2) + 1; }
    if (slotNum == 1) { return (level*2)/3 + 1; }
    else { return level; }

- and in snapshotn 12w26a:
    if (nBookShelves > 15) { nBookShelves = 15; }
    int level = random.nextInt(8) + 1 + (nBookShelves /2) +
                random.nextInt(nBookShelves + 1);
    if (slotNum == 0) { return max(level/3, 1); }
    if (slotNum == 1) { return (level*2)/3 + 1; }
    else { return max(level, nBookShelves*2); }

The changes are:
  1. The number of bookshelves is capped at 15, rather than 30.
  2. The random modifier for the level is between 1 and 8, rather than 1 and 5.
  3. The top slot shows one third of the calculated level, rather than one half.
  4. The level offered in the bottom slot now has a lower bound equal to twice the number of bookshelves.

It is a fairly simple matter to use this to validate the upper and lower bounds for the enchantment levels that we find in-game. The table below shows what these upper and lower bounds are for each number of bookshelves.

Shelves Top Middle Bottom

For the previous system, I plotted the distributions of levels offered in the bottom slot, but the bottom slot is now heavily skewed toward offering a level equal to twice the number of bookshelves. For instance, with 14 bookshelves, you will be offered a level 28 enchantment 99.2% of the time, with a level 29 enchantment only showing up an average of once every 120 tries. This makes odd levelled enchantments exceptionally difficult to obtain (although none is rarer than the level 50 enchantment was in the 1.1. enchanting system). It also makes a distribution graph look pretty stupid. Even so, I plotted it. Don't ask me why.

Figure 2: Distribution of enchantment levels appearing in the bottom slot

The optimum number of bookshelves to use to obtain a specific enchantment level is easy to calculate and is shown in the table below, together with the probability that that enchantment will be offered at that level.

Level Shelves Probability
1 0 71.3%
2 1 55.6%
3 2 40.6%
4 2 34.4%
5 2 34.4%
6 3 50.8%
7 3 31.6%
8 4 55.0%
9 4 23.4%
10 5 70.1%
11 10 18.2%
12 6 73.7%
13 12 15.4%
14 7 84.4%
15 14 13.3%
16 8 86.1%
17 15 10.2%
18 9 92.5%
19 15 5.5%
20 10 93.2%
21 10 3.4%
22 11 96.9%
23 11 2.1%
24 12 97.1%
25 12 1.9%
26 13 99.1%
27 13 0.9%
28 14 99.2%
29 14 0.8%
30 15 100.0%

Due to the rarity of high odd numbered levels, it is probably quicker for players to restrict themselves to the even number that gives the best probability for the combination of enchantments they want, rather than use an odd number with a slightly higher probability. As a rule of thumb, for even numbers, take half of the level you want, and use that many bookshelves. It's much easier than it was before.

[Source: minecraft.jar for versions 1.1 and snapshot 12w26a, decompiled with MCP 5.6 and MCP 6.15 respectively.]

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Thursday, July 19, 2012

On Seeing the World in Polarised Light

Polarised light has always fascinated me, but being as stingy as I am, I have always only bought myself cheap sunglasses, so until recently, I have never actually owned a pair of Polaroid sunglasses. Earlier this year, after my previous pair of sunglasses broke in the mid summer sun, I decided to fork out a bit extra and get myself a slightly higher quality pair of sunglasses (although they were about the cheapest in the store when I bought them). I keep noticing things that are absolutely amazing, and I wonder to myself whether people who don't know much about the physics can really appreciate the world around them.

I'm not going to go into the physics here but I will leave links to Wikipedia's basic explanation and more advanced explanation here.

My first encounter with polarised light was when I was about 8 or 9 years old, and a friend at school showed me that if you turned the filter on the calculator screen over, you could invert the colours of the numbers. I played around with a couple of filters (I wasn't ever afraid of digging broken calculators out of bins - which are more common than you'd think) and discovered that holding them parallel to each other did nothing, but if you turned one of them perpendicular, the intersecting area would darken. I also found that if you used two filters on the calculator display, and the back filter was a little bent or trampled (because you can't be worried about quality when you're digging out of bins), there would be rainbow colours across the screen. I had a nice unique calculator display with a black background and rainbows through the numbers. I was a little disappointed when I got to high school and found that the fancier calculators had no removable filter.

Over the years, I have collected a number of filters from various cheap digital toys, 3D glasses (about the only thing they're good for, since I have very poor stereoscopic depth perception), and the like. I keep them in a little transparent plastic box from which I once freed a set of playing cards. I liked the way that the plastic box had little rainbow patterns when viewed between two filters. In physics during my first year at university, I finally learned a bit about how residual stresses in plastics cause them to absorb and admit light of different wavelengths in differing amounts (an effect known as dichroism). That was interesting in itself, but I also learned that sellotape is dichroic. By placing sellotape in layers over a transparent surface, you can create complex patterns of shapes and colours that can only be seen when placed between two polarising filters.

That's all very nice, but it did not prepare me for the experience of seeing the entire world through polarised light. Everything is different. Before I had Polariod sunglasses, I did not really appreciate the way that almost all reflected light is polarised to a degree. In fact, unless the sun is behind you and the surface is reflecting straight at you, the glare from it will be at least partially polarised. That applies to almost every surface. I don't know if I can convey the absolute magnitude of that. Almost every surface.

I don't think I've noticed before how shiny absolutely every surface. Nothing is truly matte, it seems. The interesting part is that normally while wearing polarising sunglasses, the shine off any horizontal surface is greatly reduced (of course, that's the whole point in polarising sunglasses). However, if you tilt your head at 90°, the shine of all vertical surfaces is reduced, and you still get the glare of horizontal surfaces.

I can't remember exactly when I got these sunglasses, but it was around four or five months ago. I still can't get over it. While driving, I continuously tilt my head and watch how the reflections change on the surface of the dashboard, other cars, paving, windows, lakes, and pretty much everything around me. It's also interesting that the displays in my car for the clock, radio, petrol meter and the like all polarise light at 45°. This means that they are dimmed slightly when I'm wearing my sunglasses, unless I tilt my head to the right. If I tilt my head to the left (which is the likely case when I'm leaning over to change the station or volume), the display turns black, and becomes unreadable. I wonder if there's a specific reason for the polarisation angle being the way it is. Anyway, I assume people who see me driving a long just think I'm swaying my head to music or something.

While walking through a nursery over the weekend, I was tilting my head from side to side, looking at the reflections off the plant leaves, when my girlfriend bluntly pointed out that I looked like a retard. I know this, but still. It's just so fascinating.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Tuesday, July 10, 2012

On Everything. It is Just So Damn Amazing.

It's hard not to live life in complete and utter amazement. The shear fact that I am alive in such an incredibly improbable world is unbelievably overwhelming. This is the sort of thing that can only be explained with incredibly long sentences, so I suggest that you brace yourself. Even more improbable is the fact that I happen to be a human, capable not only of thinking these thoughts, glimpsing the tiny clues as to where our universe came from, but sharing them with others who are equally (and in many cases much more) capable of appreciating and expanding them. I could easily have been born a bacteria, running off nothing more than simple chemical impulses, with no concious awareness of my surroundings, no room to make decisions and manipulate my environment to suit me.

Of course, my concious awareness and ability to manipulate my environment may just be due to chemical impulses as well, but is independent chemical impulses separately directing trillions of cells to interact for mutual benefit, driving such a vastly complex mechanism that the illusions of awareness, conciousness and free will inexplicably emerge from the chaotic interaction at a lower level. And when it comes right down to it, all those chemical interactions are just unimaginably small particles floating through emptiness, pushing each other around according to a simple set of quantitative rules.

And we can look at the universe, and realise that things can be counted, and that everything we see follows simple quantitative rules. If you have two apples, and find another apple, then you have three apples. It is unfathomably simple, and never fails. And everything we see can be counted like this. And when we break it down into smaller parts, there are different rules, but they can still be quantified with the same mathematics. We need more advanced tools to deal with the scale of the mathematics, but on a fundamental level, they are all just extensions of the same counting techniques we use to keep track of how many pieces of fruit we have. We can keep going, on and on, and as we get deeper and deeper, our set of rules keeps on going, and all of it can be quantified by logical extensions of this simple system that we came up with to make sure our neighbour wasn't stealing our cattle. And its not like these applying these rules gives just an estimate of our universe. We demand that they work every single time. If they do, we mark them as just maybe. And if they don't, even if it's just once, we mark them as definitely wrong, but even so, we have rules that can quantify exactly how wrong they are, and those same rules can tell us how much confidence we can have in our "maybes" as well.

And in the end, we're left with this massively complex set of simple, elegant, quantifiable rules. But there are so many rules that no one really knows them all, and no one is even capable of understanding a fraction of them, never mind applying them. But in just a few hundred years, the millions of human minds who have considered them have collectively put together a sufficiently powerful rule set that we can now consider the possibility that our entire universe is just a momentary interaction caused by a chance collision of two multi-dimensional curtains flapping in an an extra-universal emptiness. Not only consider, but actually have at least a superficial understanding of the quantifiable rules that are theoretically capable of explaining and predicting absolutely everything that will possibly happen in our universe, in a quantifiable manner.

Of course, while the rules themselves are so ridiculously simple, the shear number of ways in which they can interact makes them so incredibly complex. The overwhelming majority of them are just special cases of interactions between even simpler rules, which themselves arise out of an even simpler set. And at the bottom, there is a tiny set of ridiculously simple, self-containing rules, whose interactions are so complex that the only way of solving them is to watch an entire meta-universe play out.

And then within that meta-universe, out of who-knows-how-many possible universes, there is this one. And in it, out of who-knows-how-many galactic clusters, we have this one, and in it, this galaxy. And out of the hundreds of billions of stars, we have our sun, and it's eight little major planets, as many as a couple hundred dwarf planets, and several hundred thousand minor planets orbiting around it. And out of all those, our planet happens to exist. And over the last four and a half billion years, has warped and cooled, to a relatively stable, water-covered ball. And the water has been kept at one of an endless number of combinations of temperatures and pressures that allow it to stay liquid, but repeatedly heated and cooled just enough to cause the convection currents required to mix chemicals formed in long dead stars in just the right ways that they could bond together and make crude but functional copies of themselves using the fragments of similar chemicals floating around them. Our simple set of rules allow this, but it is so endlessly unlikely that it possibly took half a billion years of the right conditions for it to happen. We don't know how - we weren't there to see, and know one has yet had the half a billion years spare time it would take to run an experiment to see it.

But these crude chemical copy machines gradually began ripping each other up to make more rough copies of themselves, and those that were ineffective at copying were ripped up, unless some series of fortunate mistakes happened to make it beneficial for those chemicals to be copied by those that could copy. Think about how the world would work under just these simple rules. A protective membrane, for example, would make it much harder for a copier to be ripped up, and so mistakes that caused it to copy the membrane along with itself would be a huge advantage. Simple rules, simple copying, with a couple mistakes along the way. But those mistakes lead to the vast complexity from the simple rules. A mistake that prevents a copier from copying will never spread, whereas a mistake that makes a copier more effective at copying will spread rapidly. For example, a mistake that forces a copier to avoid the copiers with membranes and go after the easy free chemicals (which we can arbitrarily call food) will make copying that much easier, and so these copiers will multiply far quicker than the others. But this means that having a membrane will be a huge advantage, saving those with membranes from being eaten, regardless of their own dietary preference. Soon, most copiers will have membranes, which are easier to break in groups, and so mistakes in the copying that lead to the copiers working with those of the same kind will give an advantage. This leads to multicellular organisms, and by the same simple copying rules, with the same sorts of advantageous and disadvantageous mistakes by these little copying machines, you get the trillions of cells that make up my own body, firing off the electrical, chemical and physical impulses that drive my body, and allow me to have thoughts like this. That's evolution. It's completely logical, undeniable on a fundamental level, and absolutely, incredibly amazing.

Sure, it's random chance, but its a selective chance. It seems improbable for all the random coincidences to line up, but its far more likely than you'd think. I once heard an explanation using an analogy of rolling 20 dice and trying to get 20 sixes at once. If you roll all 20 dice once every second, you'd need to keep rolling them each second for an average of a hundred and fifteen million years before getting 20 sixes by pure random chance. It could quite possibly even take far longer than that. But we're not talking pure random chance with evolution. We're talking about selective chance. Imagine you're rolling 20 dice, but with each roll, you're allowed to keep the best roll that that dice has given you. So you roll the 20 dice, and you'd expect around three or so to land on six. So you keep those sixes, and roll the others. There's a 99.9% chance that you'll have the 20 sixes in under sixty throws, and the chances of not having 20 sixes after 100 throws are about one in two million. Throwing some form of selection into the mix makes a phenomenal difference to those random mistakes - the difference between a hundred million years and a couple of minutes...

Did you see what I just did. I pulled out a tiny set of my limited quantifiable rules, and applied them to a simple scenario, and not only predicted the future, but also quantified how likely my predictions are to be correct. I can test these with experiments, and predict in advance how often I'll be right. The very fact that I can do this blows my mind.

But, as amazing as that is, and as astounding as the collective understanding of the universe that science has pulled together over the last few hundred years is, there are still some people - far too many people - who think that a single book can explain it all, and that what the book doesn't say is beyond our understanding.

Screw it. I want to understand. Reality is far too incredible to sit back and be satisfied and just accept things we don't know. All we have is clues, some subtle, some not, that lead us deeper and deeper into a labyrinth of rules. We don't know if we're on a dead end or not. We're feeling around in the dark, not knowing where we are, where we've been, or where we're going. All we know is that we're here, and dammit, I want to know what's at the end.

What I'm trying to say is fuck religion. No one knows the truth. We all need to stop being so gullible, believing in a made-up fairy tales and obvious bullshit. Reality is far too exciting to just ignore.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Tuesday, June 26, 2012

On Dreams: Part II

My memory, especially my short term memory, is pathetic. I read somewhere (I can't remember where) that forcing yourself to remember dreams is a good way to train your short term memory to dig things out of your subconscious. I have no idea whether it's true or not, but it sounded worth a try.

I have never really been able to remember my dreams. If I even recalled having dreamed more than once every two months, it was a lot. To be honest though, I've never really made a concious effort to remember them. So, I have read up on how to train your brain to remember dreams, and it really is as simple as remembering to make the effort every morning before your brain starts writing over those parts of your memory.

The method for doing that seemed to be recommended the most was using a dream journal. I don't like the idea of having to write out by hand in the early hours of the morning (I'm too much of a perfectionist to deal with the sloppy handwriting and constant self-editing when my brain is basically half asleep), so I bought myself a small battery-powered LED reading light, and installed a simple note taking applet in my Kindle (which is always next to my bed anyway).

I've been recording my dreams the moment I wake up for one week now, and have recorded twelve dreams in total already (not counting the one that I was too lazy to write down at 3am on Sunday morning). I have remembered dreaming every time I have woken up in the last week, which is possibly more than I recalled from the rest of the last year combined.

(On a probably unrelated side note, I have gone from drinking coffee maybe once every two to three months to around three or four times a week, starting from just under two weeks ago. Probably unimportant, but changes in environmental conditions are always worth noting.)

I can say that I think I've identified the reason that I remember so few of my dreams. The reason is most likely that they are completely and utterly mundane. For example, I had a dream that I was sitting in the back seat of a car with my brother next to me, staring out the window as the car drove along the same route I drive every day to work. Or sitting impatiently waiting for an invoice for books that I had ordered. Or sitting quietly in a movie with my girlfriend while watching the credits scrolling up the screen forever, thinking nothing but that having such long credits before the movie starts just puts the audience to sleep. They are so utterly mundane that there is no wonder I have so rarely remembered them.

It was all very disappointing, considering what my subconscious mind throws at me while I'm awake.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, June 18, 2012

On Using the Moon to Guess the Time

I decided to try something different for this post. I am not a visual learner. I learn by reading and doing, and that's probably one of the main reasons this blog has so few pictures. This time, however, I decided to make the entire post into a graphic. Enjoy.

Please let me know about any errors or inaccuracies. Since this took more than five times longer to make than most other posts, don't expect many more of them.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Tuesday, June 5, 2012

On the Transit of Venus

I just happen to live on that magic line along which Venus's transit across the sun ends exactly at sunrise. For most of South Africa, it won't be visible at all, except for parts of Limpopo, Mpumalanga and the northern corner of KwaZulu-Natal. Along the Swaziland border, it will be visible for as long as 15 minutes after sunrise. That is, if you can find a high enough spot that the damn horizon isn't in the way.

The reason I bring up the transit is that, like with eclipses, all the news sources talk about methods for viewing solar events. Of course, everyone knows that you should never look at the sun directly unless you want to go blind (even looking for a couple of seconds can cause permanent damage).

The alternatives that are usually mentioned are the trick involving projecting sunlight from a pinhole onto a piece of paper, or wearing welding goggles or specially rated solar glasses (sunglasses do not provide sufficient protection).

The alternative that is very rarely mentioned is that the camera on your cellphone is ideal for viewing solar events. I used the camera on my cheap cellphone to photograph a halo back in November of 2010, and you can see how well that worked. You can take decent pictures of eclipses just by pointing your camera at the sun. It is very important to keep your head in the shadow of some object so that you cannot directly see the sun, and hold your arm out into the sun using the screen to see where your camera is pointing. You will need to look at the screen at an angle to achieve this. Don't point the camera at the sun for too long at a time unless you have a solar filter. And, whatever you do, don't look at the sun directly, and don't look through any eyepiece of a camera at the sun. Keep your head in the shade and watch the sun on your screen.

Unfortunately, this trick won't work so well with the transit of Venus, since Venus will be a tiny spot on the sun, and the glare from the sunlight will pretty much obscure it completely for your cellphone camera. You can reduce the glare considerably, however, by taking the photograph through the wind shield of a car (many of which are treated for glare), and holding a pair of sunglasses over the camera lens. The cheaper and simpler the camera, the better, since it's more likely to automatically adjust the light levels in the picture, rather than requiring you to set it. You certainly won't get professional quality photographs like this, but at least you'll see what's going on.

(On an interesting side note: Nobel prize-winning physicist Richard Feynman watched the first ever detonation of an atomic bomb from 20 miles away with no more eye protection than the wind shield of a truck, because he insisted that you wouldn't see anything through the special goggles they had been given, and the glass of the truck had been treated to block UV rays. He later boasted that he was probably the only one who actually saw the explosion. [Source: Feynman, R.P. Surely You're Joking, Mr. Feynman!: Adventures of a Curious Character, W. W. Norton & Company, 1985.] Note that the wind shield of a truck does not provide sufficient protection for looking directly at the sun.)

(On another side note: It's not at all difficult to get professional quality solar photographs from the camera of an average smartphone. All you need is a tripod and a special solar filter.)

What I am curious to see is whether or not the shadow of Venus will be visible on the surface of the moon (which is just two days past full, and should be fully visible in the western sky during the transit). For reference, if you are interested, Venus will be at the middle of its transit at 03:30 SAST tomorrow morning, and will be in transit for just under three and a half hours on either side of that mark.

[Edit - 6 June 2012, 07:56 SAST: My very first thought as I woke up this morning was that I had been an idiot thinking that the shadow would be visible on the moon. It makes me wonder what my subconscious does while I'm asleep. I didn't even know yet that I was awake when I realised it. My eyes were still shut. I literally was sleeping one second, and the next second I was awake thinking "The shadow won't be visible on the moon and I'm an idiot, and by the way, its morning now."

Of course, most of the sunny side of the moon would have had a full view of the transit just as good as we had on Earth (actually, Venus would appear 0.6% smaller), but the fact is that Venus only blocks out a small fraction of the sun (0.095% of the light from the sun, according to my quick calculations). And that light would be blocked for most lit side of the moon. So, the net result is that there would have been a really, really slight (no where near perceptible) dimming of the entire moon after midnight last night, and that would be all.

Of course, its always interesting to look at the moon through a pair of binoculars, so that realisation did not stop me.

(On a side note: Most people know how to estimate the time from the position of the sun, but very few can tell the time from the position of the moon. Maybe I should do a post about that some time...)]

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Thursday, May 24, 2012

On Towel Day Part III

Oh dear. A post that has been regurgitated a second time... And it's the second one in a row quoting Doublas Adams. But that important time of year has come around again, so in memory of the death of the great Douglas Adams on the 11th of May 2001, and in celebration of the premier of the Star Wars episode IV on the 25th of May 1977, I’d like to remind every geek and nerd out there to remember to be proud and carry their towels with them tomorrow.

For does the Guide itself not say:
      "A towel is about the most massively useful thing an interstellar hitchhiker can have. Partly it has great practical value - you can wrap it around you for warmth as you bound across the cold moons of Jaglan Beta; you can lie on it on the brilliant marble-sanded beaches of Santraginus V, inhaling the heady sea vapours; you can sleep under it beneath the stars which shine so redly on the desert world of Kakrafoon; use it to sail a mini raft down the slow heavy river Moth; wet it for use in hand-to- hand-combat; wrap it round your head to ward off noxious fumes or to avoid the gaze of the Ravenous Bugblatter Beast of Traal (a mindboggingly stupid animal, it assumes that if you can't see it, it can't see you - daft as a bush, but very ravenous); you can wave your towel in emergencies as a distress signal, and of course dry yourself off with it if it still seems to be clean enough.

      "More importantly, a towel has immense psychological value. For some reason, if a strag (strag: non-hitch hiker) discovers that a hitch hiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, face flannel, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet weather gear, space suit etc., etc. Furthermore, the strag will then happily lend the hitch hiker any of these or a dozen other items that the hitch hiker might accidentally have "lost". What the strag will think is that any man who can hitch the length and breadth of the galaxy, rough it, slum it, struggle against terrible odds, win through, and still knows where his towel is is clearly a man to be reckoned with."

Even if you never read the Guide and don’t understand the significance of Towel Day do it for the sake of Geek Pride Day tomorrow. And if you are really so geeky that a towel is not enough for you, then make sure to carry your hard boiled egg and lilac with you for the Glorious Revolution of the 25th of May, as a tribute to Terry Pratchett, and to help raise awareness for Alzheimer's research.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, May 21, 2012

On Religious Beliefs, and My Own Lack Thereof

(On a side note: This is a particularly difficult post, but I think I am now mature enough to be open and honest about this. I can't say the same for those around me (because, while I consider myself to be a reasonable judge of character most of the time, this is the one field in which, due to its very nature, people tend to be completely irrational. Please don't be irrational if you read this. Think calm thoughts.)

    I am an atheist.

This does not mean that I believe that there is no god. It means that I do not believe that any god exists. These are two fundamentally different ideas, and I think the difference between them are a primary source of confusion for many theists and a fair number of agnostics too.

I realised that it is important for me to talk about my religious beliefs after stumbling across a certain Wikipedia article (Importance of religion by country), and in particular, the fact that only 65% of the USA perceives religion to be important as opposed to an alarming 84.5% of South Africans. The poll opened my eyes, and I have suddenly noticed the incredible number of devout religious followers in my life every day.

Atheism tends to be tricky to explain to someone who completely and absolutely believes a certain set of religious teachings. The problem seems to be with understanding how atheism goes beyond the whole idea of belief. While all religions tend to emphasise the concept of faith and belief, even putting it forward as the defining characteristic that will earn the most divine rewards ("He who believes in me has everlasting life" - John 6:47), atheism simply rejects that belief. It's difficult for a believer to understand that. So let me put forward another one of my religious views to help clarify.

    I am also an agnostic.

When I was less informed on the matter, I was very much against being labelled an atheist. I grew up under the impression that atheism was an arrogant assertion of the non-existence of any deity that had no room for error. While I was (and still am) almost certain that no god in the conventional sense actually exists (partially on the grounds that there simply is no evidence that a god exists, nor any need for one to exist), I have never been able to discount the remote possibility that I could be wrong. I am pretty arrogant, but even I do not have the extreme arrogance to claim that I have all the answers to the universe.

I cannot claim that there is no god. I do not believe that there is no god. I do not believe anything regarding the existence of god. It really is as simple as "I do not believe in god". Gradually, as I came to understand more about atheism, I realised that being able to say that one statement truthfully is all that it takes to be an atheist. Now, I am proud to label myself an atheist.

    I am also a pantheist.

Or more specifically, a naturalistic pantheist in a sense. Being an atheist does not mean that I do not have a sense of awe and wonder at the natural world. The natural world is amazing, and those that know me will know that I am fascinated by almost everything. I have a very high respect for almost all natural phenomena, and life (not only human life) is one of the things that I hold in very high regard.

    I am also an antitheist.

I have never really been open about my views before, but I increasingly feel the urge when I am around religious people to point out how absurd and arrogant their beliefs are. I know that the only reason I have never done so in the past is because I lack the confidence in my ability to put forward a convincing argument to convert them to atheism faster than the argument would alienate them.

Although I certainly dislike awkward situations, I've come to the point where I'm starting to feel that it is my moral obligation to stop people from throwing their lives away on a fictional concept, and start living their lives with wonder, realising that they actually don't know anything.

Opposition to religion tends to cause people to take offence, but it shouldn't. The words of Douglas Adams (possible one of the biggest influences on all of my writing) from his speech at Digital Biota 2 in September 1998 probably highlights this best: "The invention of the scientific method and science is the most powerful intellectual idea, the most powerful framework for thinking and investigating and understanding and challenging the world around us that there is, and that it rests on the premise that any idea is there to be attacked and if it withstands the attack then it lives to fight another day and if it doesn't withstand the attack then down it goes. Religion doesn't seem to work like that... Yet when you look at it rationally there is no reason why those ideas shouldn't be as open to debate as any other, except that we have agreed somehow between us that they shouldn't be."

So, from this moment forth, I am going to strive to attack religion with sensible and rational arguments. My aim is not to alienate people, but to inform them of the absurdity of absolute belief. Even if I cannot turn everyone I know into atheists, just having them accept an open-minded and agnostic viewpoint would be enough. I don't intend to be mean and I certainly don't mean offence, but it is inevitable that some will take things offensive. All I am asking is for everyone to just admit that they just don't know.

(On another side note: Even though I was never confirmed, I used to consider myself a Christian until only a year or two ago. And it wasn't like I was young and impressionable when I first started really calling myself a Christian. I was in my very late teens when I first started seeking religion, and spent almost two years calling myself a Buddhist before I began calling myself Christian. Gradually, I came to realise that I didn't really believe, nor did I need to believe. It is not at all difficult to drop belief in the Bible, and dropping belief in God is only a small step away from that. I suggest that absolutely any doubt in the existence of God is a sign that there is an agnostic hiding somewhere in your subconscious. Embrace it. The world is far more complex and amazing than any book could have you believe. Life is so much better than you think. You are free. You are one of billions in a species that is one of billions on a planet that is one of billions in a galaxy that is one of billions in the universe. And is the universe one of billions in something else? Quite possibly, but that's the awesome thing. No one really knows! Isn't that completely amazing in itself? Not knowing but striving to find out, I can assure you, is far more exciting than pretending that you know but can never understand.)

(On a final side note: Religion was one of the absolute no-go topics when I started this blog (I still thought of myself as a Christian back then). I guess that I have changed a lot.)

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Wednesday, May 9, 2012

On the Sizes of Things in the Sky, Part II

On the 6th of May 2012, many people noticed and reported on the so-called "abnormal" size and brightness of the moon. It just goes to show how little people notice if its not pointed out. I wrote last month about the sizes of things in the sky, in which I explained why the moon varies in size, anywhere from 9.3% smaller than to 4.8% larger than the sun.

The moon has an elliptical orbit, which means that it can be considerably closer at one point of the orbit than at another point. Over 40 000 km closer, in fact (which is actually less than 6% closer than it's average distance). This point in the moon's orbit is called the perigee.

(On a side note: The perigee has an interesting property - the rate at which the moon is getting closer or further from the Earth is slowest at this point. That means that the perigee is a gradual thing, and the moon stays close to this distance for a couple of months at a time.)

A supermoon is arbitrarily defined to occur when the moon is within 90% of its perigee during a full or new moon. Astrologers refer to the event as a supermoon, and like to believe that it has some special significance on natural disasters and the like. Astronomers, on the other hand, use the term perigee-syzygy, and point out that apart from causing perigean spring tides, there's hardly any evidence suggesting that it has any significance whatsoever.

Just in case the media frenzy seems to have made the supermoon of earlier this month appear to be an incredibly rare occurrence, I've taken the effort to look up all the dates of supermoons in the 21st century (i.e. I clicked the second link in the Google results for "super moon dates"). The dates, from the very astrologer who coined the term, for the last and next five years are as follows.

Table 1: Supermoon dates for full moons from 2009 to 2015.

11 January 2009
31 December 2009
30 January 2010
28 February 2010
18 February 2011
19 March 2011
18 April 2011
6 April 2012
6 May 2012
4 June 2012
25 May 2013
23 June 2013
22 July 2013
12 July 2014
10 August 2014
9 September 2014
29 August 2015
28 September 2015
27 October 2015

There is another type of supermoon - the so-called extreme supermoon, which occurs when the moon is closer than its average closest approach. The table below lists the dates on which this occurs for the first half of the 21st century. You cannot help but notice that 2012 is suspiciously absent from the list.

Table 2: "Extreme supermoon" dates for full moons from 2001 to 2050.

12 December 2008
30 January 2010
16 March 2011
14 November 2016
2 January 2018
25 November 2034
13 January 2036

Although, the actual event of an "extreme" supermoon is not that different from a normal full moon, as demonstrated in the picture below. Note that the March 2011 supermoon was supposedly the biggest since 1993.

The "supermoon" of 19 March 2011 (right), compared to a "typical" full moon of 20 December 2010 (left).
Image by Marco Langbroek, 2011 under a Creative Commons Attribution-Share Alike 3.0 Unported license.

Fascinating. It seems that the whole supermoon frenzy is simply just another case of a journalist getting hold of a piece of information and getting extremely excited about it without bothering to do any research on the topic first.

(On a side note: If you do want to read further on supermoons, please bear in mind that logic is to astrology as the finer points of Russian literature are to the bacteria on a decomposing dead penguin in the Antarctic.)

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Tuesday, May 8, 2012

On an Interesting Pronunciation Point

In general, South Africans tend to take their pronuncialtion from the English, but every now and then a word sneaks in with the American pronunciation. A very good example that not many people seem to know about is the word "mall". The majority of South Africans tend to pronounce it the same as the word "maul", which is indeed a homophone, at least to the Americans. Pronounced the English way, "mall" should almost (but not quite) rhyme with "shall". In non-rhotic accents (that is, accents which tend to drop the letter 'r' if it's followed by a consonant), it it even almost rhymes with gnarl.

The reason, as far as I can tell, is that the Australians got the wrong pronunciation from the Americans, and then South Africans gradually copied it from there. Why the Americans can't pronounce half the words in the English language correctly, no one knows (if I were talking aloud now, this would be followed by a loud clearing of the throat and something like "laziness" mumbled under my breath).

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Thursday, May 3, 2012

On Better Dates for South African Public Holidays

Public holidays that fall on a Tuesday or Thursday (like earlier this week) tend to trigger that thought of "Hey, it's one day short of a long weekend, so why don't I just take an extra day off?". This leads to a drop in productivity for that week. Wednesday holidays tend to spark similar reasoning for some people.If you exclude the two Easter holidays, the two Christmas holidays and New Year's Day, you are left with seven public holidays. Each of these seven holidays will fall on a different day of the week, so that each day from Monday to Sunday has a corresponding public holiday. This year, it just so happens that these roles are filled by Heritage Day, Workers' Day, Human Rights Day, Women's Day, Freedom Day, Youth Day, and the Day of Reconciliation respectively, but this varies from year to year.

In theory, this even distribution should mean that there will be the same number of those "extra days off" every year (exactly two). Likewise, there will be exactly one public holiday missed each year due to it falling on a Saturday (at least for those of us in Monday to Friday jobs). So, from year to year, the overall number of unproductive days should be identical. However, there is little consistency in the distribution of these. Also, an additional "extra day off" comes in if either Human Rights Day or Freedom Day falls on a Wednesday in the same week as one of the Easter public holidays (as happened in 2011).

So, to deal with all of this, I propose that those seven public holidays be assigned dates that move from year to year. This is not dissimilar to the way that federal holidays are observed in the United States.

I have done all of the necessary calculations to minimise the distance that each holiday moves in the years 2000 to 2100, inclusive. The table below gives my proposed public holiday dates, as well as the average deviation from the current date for that holiday throughout the 21st century. Where there was no difference between having the holiday on a Monday or Friday, I favoured a Friday holiday, but a Monday holiday would be equally valid (although I suspect that a week with a Friday holiday would be more productive than a week with a Monday holiday). Holidays for which this was the case are marked with an asterisk.

Table 1: Proposed New Public Holiday Dates.
Public Holiday Current Date Proposed Date Deviation
Human Rights Day 21 March 3rd Monday of March 3.03 days
Freedom Day 27 April Last Friday of April 1.71 days
Workers' Day 1 May 1st Monday of May 3.97 days
Youth Day 16 June 3rd Friday* of June 2.29 days
Women's Day 9 August 2nd Friday* of August 2.28 days
Heritage Day 24 September Last Friday of September 2.97 days
Day of Reconciliation 16 December 3rd Monday of December 2.28 days

Of course, many people do attach some significance to a particular calender date, but I have discussed why this is completely unfounded in a previous post.

Although having Freedom Day on a Monday produces the same net deviation as a Friday, this introduces a possibility for a clash with Family Day in the distant future (as happened last year, and will happen in 2038). Likewise for holding Human Rights Day on a Friday (which would have caused a clash in 2008, and will cause a clash again in 2160). For all other public holidays, the day may easily be switched from Monday to Friday with no significant effect on the deviation from the current date. In the cases of Workers' Day, Heritage Day and the Day of Reconciliation, the day that came out on top only did so because my sample (of 101 years) happened to cover one or two more of one day than the other.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .