Monday, August 31, 2015

Takealot - South Africa's best online shop with the WORST searching in the history of searching

South Africa is slowly but surely getting on the online shopping bandwagon, and we have a few big online retailers, but the one I'm going to be talking about in this blog post is Takealot. They used to be called take2, but there was some issue with the name so they changed it.

They've also absorbed Kalahari a few months ago, so I think it's safe to say they're the biggest online shop in SA.

We buy from them often. Especially because they deliver for free if you order over a certain amount, and they have those damn daily deals which are hard to resist.

But, and it saddens me a great deal to say this - their searching SUCKS. Finding an item on Takealot is akin to finding that proverbial needle in the haystack. It's much more difficult than it's supposed to be. So many times I've searched for something on Takealot, then I'm bombarded with irrelevant results. And complaining about this on their social media doesn't do anything.

Now, I'm a web programmer - and by far I'm not the best there is, but I'm pretty good - and I think I know exactly what it is they're doing wrong with their search algorithm (can you even call something as broken as their search function an "algorithm"?).

The other day, for example, I see they've started stocking musical instruments and equipment, like guitars and amps. I'm a big Marshall fan, I still have my Valvestate 65W from my 18th birthday back in 2000. So, I search for "marshall amp" (  I do NOT want to see SHOES in the search results. Nike cross trainers with the word "amp" in the name, but guess what, the word "marshall" is nowhere to be found on the page for those shoes.

What this tells me is that their main search algorithm (there I go calling it that again) is they made the mistake of using the keyword OR instead of AND. So, searching for "marshall amp" goes and queries their database with "give me every item that features one of these words". Instead, it should be "give me every item that features all these words".

Let's use another example - "bluray writer" ( - this gives me huge amounts of bluray MOVIES. DVD Writers, yes. Oxford Dictionaries, yes. Countless other books, yes. Even changing to the right department doesn't give satisfactory results. Maybe they wrote "bluray" instead like "blu-ray" - so I search for "blu-ray writer" ( - this gives you, as you can see, anything but blu-ray writers. Blu-ray players, yes. Countless other things, that DON'T include the word "writer", yes. The thing I'm looking for? Sadly, no.

Takealot - for the love of all that is good and the internet - surely fixing this should be a minor task? But if not, investing the time to fix it will make searching so much better for EVERYONE (and with that, I mean MORE MONEY FOR YOU BECAUSE PEOPLE WILL ACTUALLY FIND WHAT THEY'RE LOOKING FOR ON YOUR SITE!). I am quite technical, and I struggle my ass off to find products on your site. For people not as technically inclined - I don't even want to know the hassle they have to go through to find something.

Anyway, rant over. Your service is good, and your prices as well. Just fix the searching.

Friday, August 7, 2015

Unity Tutorial - how to make a Dictionary show up in the editor

I discovered how awesome Dictionaries are this week (yes I haven't been coding in Unity C# that long ok hehe). It's basically a key-value pair fancy array thing :)

Here's how you'd use it:

Dictionary<string, string> nameOfMyDictionary = new Dictionary<string, string> ();

(Remember to include the System.Collections.Generic; namespace at the top of your file, otherwise this won't work...)

Then, you can add stuff to it with code using the Add() function, etc. Similar to Lists.

Anyway, I discovered that they don't show up the Editor like normal arrays do. And that made me a little sad. So, here's a small workaround I discovered. I'm sure it's not the best way to do it, but it works for me.

Firstly, create a struct containing the key-value pair variables, and remember to add System.Serializable to allow them to show up in the editor:

public struct NameOfStruct
public string  string1UniqueKey;
public string string1Value;

Next, declare an Array of your new Struct, like so:

public NameOfStruct[] myDictionaryStruct;

This makes the array show up in the Unity Editor, where you can edit it:

So, fill in a few values:

We're almost done. Now we simply need to assign these values to our Dictionary. We do that in the Start() function with a simple for loop:

void Start () 
for (int i = 0; i < myDictionaryStruct.Length; i++)
nameOfMyDictionary.Add (myDictionaryStruct[i].string1UniqueKey, myDictionaryStruct[i].string1Value);

It works great, now you can use the dictionary as you normally would. For example, let's say I want to get the value of Alpha, I would simply type in:


That would then be equal to "One" - pretty cool hey?

Here's a screenshot of my code:

(click to make it bigger)

Hope this little trick helps you in some way!