Category Archives: Web

ht_chromecast_nt_130724_16x9_992

Google Chromecast in a South African context

I had my Google Chromecast delivered from a local supplier last night, and thought that I would write a quick post on my experiences so far.

Seeing as though I have already had a large number of requests as to where I got it, I will answer that question first. I bought it from Takealot.com on the following URL http://www.takealot.com/tv-audio-video/google-chromecast-hdmi-streaming-media-player,29924636

Right, so the first thing that you need to do is plug the chromecast into a free HDMI port on your TV. Great. Easy enough. The box comes with an external power adapter as well as a USB adapter to power the device, but the external power plug is a US plug. Oops. Useless. USB power it is then! I would have liked to use the external power, simply for the fact that the TV does not have to be on for me to queue up online videos to the device, but alas, unless you are willing to screw around with clumsy power adapters and transformers, forget about it. The USB cable plugged into one of the TV USB slots and powered up the device without issue.

You are presented with a beautiful wallpaper and a device name, with the instruction to go and finish setup by connecting to your new Chromecast with an Android device or a laptop.

I tried to complete setup immediately with my Samsung Galaxy S4, having to download the Chromecast app from the Play store beforehand, which failed. I then tried to set up using my laptop computer, and was told by Google that I was using an unsupported OS (Linux), but I could try anyway. That failed too. Hum…

I then had a bit of an idea, and checked that uPnP was enabled on my (admittedly very old) wifi router, and enabled that. It would have been nice if that little caveat was covered in the intro screen, but it wasn’t. I use MAC address filtering to limit wifi access at home to specific devices, and one thing that I really did appreciate is that the Chromecast device displayed its MAC address on the setup page by default.

The setup, once started, becomes somewhat fiddly. My S4 has decided that a wifi connection is unworthy if it cannot reach the internet, and this was a big problem in completing the setup. I resorted to my laptop again, and managed to get through the steps after having to (confusingly) change wifi networks mid way to properly configure the device.

The device will not connect properly to anything but a 2.4GHz wifi network, so keep that in mind too.

I did have to do each of the steps a couple of times in order for the device to recognise my network and install itself properly, but once that was done, it was pretty plain sailing thereafter.

I immediately was able to stream a YouTube video to the TV in full HD without a glitch. The coolest part was that in the Chrome browser, I installed the Chromecast extension and was able to share not only a specific browser tab to the TV, but also my entire screen. There was some noticeable lag (about 500ms) when playing Kerbal Space Program via the network, but for a very graphics intensive app, and on a not-so-great wifi router, it was rather impressive (and still completely playable).

The apps that Google use to sell you the Chromecast (Netflix, Hulu etc.) are great, but not available in South Africa. Sure, I know that you can get a Netflix account (illegally) by spoofing a DNS service to make it look like you are in the US or UK, but the Chromecast has a trick up its sleeve. Google DNS services are hard coded into the device, so, even with a service like that, you would still need some trickery to get it right.

On the other hand, however, DStv BoxOffice works beautifully via a Chrome browser window, and you are able to enjoy the entire Online catalogue at R30 a movie, even if you are not a subscriber! To me, that is well worth the purchase price, as you are not entitled to pay a subscription, and you can rent when you want to. It is way cheaper for a family to grab a BoxOffice movie in this manner than it is to go to the cinema!

Overall, I think that the device is well worth getting (if you don’t already have an XBMC device or similar), although the price could come down a little in my opinion. There is a LOT of potential here, and I do think that we are only seeing the beginnings of something here for TV viewing.

The ultimate best awesome crazy cool killer feature of this device, though completely undocumented, is for people that do a lot of presentations. If you are a regular speaker, you will know that fiddling with projectors and screens on your laptop can quickly become a nightmare. I would suggest getting one of these things to pop into your laptop bag, and carry around with you. When you need to give a talk, simply plug it in and cast your presentation, saving a lot of time and stress!

I don’t normally do reviews like this, so I don’t really know how to end it off, but, yeah, get one of these things, they are OK tending towards good. In the future, depending on the climate, they may be awesome.

 

CORS in Python Bottle Framework

I was hacking up a quick mobile web app and needed to do an AJAX (jQuery based) POST and PUT to a simple Python Bottle REST server. Turn out that the AJAX POST was sending HTTP OPTIONS before the POST and the server was rejecting it with a 405. This, I find out, was due to a Cross Origin scripting issue and needed a solution.

Easiest way that I could come up with to fix the CORS (Cross Origin Resource Sharing) problem, was to write a simple bottle.py decorator that would enable me to do cross origin posts easily.

Firstly, the JQuery AJAX looked something like this on the client side:

$.ajax({
                            url: "http://host:port/save",
                            type: "POST",
                            data: JSON.stringify( { "mydata" : "Some stuff" } ),
                            contentType: "application/json",
                            success: function(data){
                                $("#result").html('got datal: ' + data);
                            },
                            error:function(error){
                                $("#result").html('There was an error while submitting: ' + error.message);
                            }
                    });

and the Python code looks like this:

# the decorator
def enable_cors(fn):
    def _enable_cors(*args, **kwargs):
        # set CORS headers
        response.headers['Access-Control-Allow-Origin'] = '*'
        response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS'
        response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'

        if bottle.request.method != 'OPTIONS':
            # actual request; reply with the actual response
            return fn(*args, **kwargs)

    return _enable_cors

You can then add the decorator to whatever of your @route methods that you need to enable CORS for with the simple @enable_cors annotation

@route('/save/', method=['OPTIONS', 'POST'])
@enable_cors
def save():
    # Rest of your code here...

Note that in the method I have set a list of the allowed methods, which include HTTP OPTIONS…

That is it! Javascript folks will tell you to rather do a $.post query, but I do prefer this method (I am more of a server side type of dude…)

There are, other ways to achieve this, but in my opinion, this is simplest and most elegant.

YouTube has not won anything

Reposted from old site – original date: Monday 6 May 2013

This is a response to Eric Schmidt’s claim that YouTube has won the battle against TV before it started.

See article at http://www.thedenverchannel.com/news/u-s-world/youtube-has-already-won-battle-with-television-executive-claims

Firstly, what battle? Secondly, YouTube has won nothing, especially in Africa. Where it counts by the way. Why does that count? I’ll give you a billion reasons.
Let us disambiguate some of the statements.

  1. YouTube cannot even be compared to linear TV, so that whole argument is marketing troll, or stupidity. We’ll call it trolling for now.
  2. What I [b]think[/b] Schmidt was thinking when he uttered this nonsense, is that the new way of doing TV is Video On Demand (VOD)
  3. YouTube as a service provider, with paid for VOD, [b]could[/b] be a player, sometime in the near future.
  4. YouTube has a very long way to go before they are a serious contender in the space.
  5. Anyone paying USD for TV services in Africa is going to have a bad time.

Let me explain a bit more. People are used to using YouTube for 10 minute clips. There will have to be a major mindset change in user interaction to change that behaviour.
Most folks view YouTube clips on PC or small screen devices and have pretty much no idea how to consume YouTube video in any other way. People in Africa, still are familiar with opening browser tabs, loading 3 videos overnight (buffering) and then playing them hours or even a day later. This may not be the case everywhere, of course, but I have seen this recently in my travels. People that consume YouTube occasionally via HTPC systems like XBMC are few and far between, certainly not the majority, and certainly want to see that in 1080i/p at least resolution, requiring a faster than 4Mb/s ADSL line (very expensve).

As an ADSL subscriber with a 4Mb/s line, I can tell you that (with discounts), it is more expensive than a Premium DStv package (includes Transactional VOD service).

On the other hand, we have TV. Let’s forget linear TV, because that is last season, for sure. People want the VOD style, “I want to watch this now”. What needs to happen is that we focus on getting cheaper devices into every home and make VOD services available to more people. This is currently happening (check DStv’s website for new packages) and with my own daily work, there are many more very good things in the pipeline…

If YouTube think that this is an easy task, they have a lot of surprises coming.

Using a framework to reduce technical debt

Reposted from old site – original date: Saturday 15 October 2011

Ward Cunningham coined the phrase technical debt, and it seems to be one of those magical phrases that truly encompasses a number of software development issues that companies face every day.

Take a small software startup as an example.

The Minimum Viable Product (MVP) is the piece of software that the business is based upon. This will form the basis of most of the future operations of the company and will normally make or break the company in terms of additional funding or future business prospects. Writing a complete MVP from scratch is normally not a good way to proceed. Very little of any new startups business is all new, but rather a new idea or model based on existing ideas. This is the key piece of information and should be the focus of the startup.

Technical debt is introduced when architectural decisions are not taken wisely from the beginning of the project and large amounts of refactoring, or indeed, rewrites of the software are needed.

This is somewhat avoidable in the short and medium terms, giving the technical team more time to get out a MVP and start with business processes, as well as buy more time for innovation in the niche space in which they are attempting to carve or operate in.

How can this technical debt be avoided? Quite easily in fact. Use a framework. Take Chisimba for example (or any other big framework that you may be familiar with) and see what I mean. If I know that I can install Chisimba and it will take care of things like my collaboration environment, a wiki, a company blog and numerous othehr bits and pieces needed to get going, I can start work almost immediately on the things that I am passionate about (my niche). This also brings in another very important point about minimising technical debt – focus. The more diluted your focus is, the chances of failure increases exponentially. Focus all of your products based on a single framework and give your development team time to become expert at that framework. In the long run, technical decisions like “what framework/code base to use to start” are done for you and your team is allowed to get on with it from the start. This allows for an increasingly rapid (and more agile) response to the evolving business environment. This is especially important in software development environments, as the landscape is extremely fickle, changes very rapidly, and often, by the time that you have a MVP out, someone else has done it already, thereby losing all competitive advantage that you may have gained previously. By utilising a framework that you are expert at, you can rapidly prototype, make quick changes and have an MVP out the door for market testing/suitability in days instead of weeks or months.This also gives you the advantage of being able to retract a product from the market and essentially start over numerous times, as not much time (and therefore money) has been spent on any single project.

In the short term, you will feel pain. You need to be aware of this. A framework is not everything to everyone and it will take time initially for your dev team to get up to speed, but in the long term, you will easily be able to leverage that expertise for additional productivity. The mere fact that devs will be under less pressure to write additional base code for every other project will also make your dev team happier. I don’t think I know any developer that actually likes doing donkey work (same old base code to get an app together) and your technical architect can then focus on radical improvements to existing base architecture (innovation) as well as making things faster, more efficient, more friendly and generally increasing the competitive gap that you have over any competitors (present and future).

I guess the ramblings above boil down to one core aspect – focus. Have it. Use it. Profit!

The first iteration of a location database is now available for use

Reposted from old site – original date: Friday 2 September 2011

All data is Creative Commons BY licensed, which means that you can use it for ANY purpose whatsoever (including commercial use). That being said, if you think that your app using the database may create a lot of traffic, please notify me so that I can make adequate provisions.

The API will return JSON for use in mobile, web or even desktop applications. In the very near future, the semantically linked data will also be returned in JSON-LD.

The API has a number of endpoints, with more becoming available soon. For the time being, it is a read only API, but that will change over the coming weeks (as I get time to implement more). The basic usage is something like:

1. getbylatlon – Gets a point(s) and nearby points by passing a longitude and latitude pair (WGS84) to the function. You may also specify a radius in metres (m) to get points in a sphere around that point too. Example:

http://geo.chisimba.com/index.php?module=geo&action=getbylonlat&lon=18.56&lat=-33.59&radius=100

This will get the points around the point specified within a radius of 100m and return them as a JSON string.

2. getbyplacename – The get by place name function takes a single urlencoded string as a place name and an optional radius to search around as well. If the place name is not found at all, an empty JSON string will be returned. Example:

http://geo.chisimba.com/index.php?module=geo&action=getbyplacename&placename=Milnerton&radius=100

where the placename is “Milnerton” and the optional radius parameter is 100m

3. getwikipedia – will get the wikipedia content from a specific latitude and longitude pair. This is dependant on wikipedia location tagging:

http://geo.chisimba.com/index.php?module=geo&action=getwikipedia&lon=18.513600833955&lat=-33.810299107327005

4. getflickr – will return flickr photos from the location:

http://geo.chisimba.com/index.php?module=geo&action=getflickr&lon=18.513600833955&lat=-33.810299107327005

NOTE: Both the flickr and wikipedia functions are a work in progress, so they may spuriously be down over the next few days.

All functions can be called without authentication by using cURL or a similar library. Please remember to cache! Bandwidth is expensive and this is a personal project!

Disruptive Tech

Reposted from old site – original date: Wednesday 15 June 2011

I have been seeing many instances of the term “disruptive tech” being used all over the web recently and would like to make a few comments as to what I understand from this. I asked a few people on twitter as to what they understood by the term (especially some folks that were actually using the term) and the overwhelming answer was “A technology like mobile phones that changes the way we do things”. OK that is fine, but I don’t buy that as a “disruptive” technology. Disruption to me would be something that [b]fundamentally[/b] changed the way that humans do things that allow a certain evolutionary pathway to be opened up. To me, disruptive tech would be something like controlled fire making, the wheel, electricity and building on the communications example above, the telephone itself. Those things changed the way we do things. Mobile phones, to me at least, are “evolutionary tech”. That is, they are technologies that have undergone a natural evolution (mobility) to enable us to do more of the same thing (phone communication) in an easier way.

I am seeing this term also being adopted by marketing people to describe certain web apps. How is a single web app disruptive? The web itself may be disruptive tech, but a single app? Never in my humble opinion! Some semantic web applications (not in the single app sense of the word of course) may become somewhat disruptive, as IPv6 based devices and folksonomy start feeding into a wider network of things, situations, contexts and locations, but until that is commonplace, it is difficult to justify calling just about anything on the web right now “disruptive”.

I can also see the day that someone starts calling themselves a “Disruptive Technologist”. Much the same way that some call themselves “Social Media Gurus”. I do hope that the ghosts of Leonardo Da Vinci, Nikola Tesla and others haunt them!

Double Gauss lens design and the web

Reposted from old site – original date: Thursday 3 February 2011

So while I was starting a piece as a guest blogger on a photography blog, I started thinking about how lens technology is so simple, but yet yields such incredible results. What is the secret there? Well, the secret is simple. Simplicity. OK, yes, we have all heard the old adage of KISS principal (Keep It Simple, Stupid), but this takes that to a whole new level. I am not talking here about user interactions with your software, but rather about the entire ecosystem of your site and design.

Here I would like to introduce you to one of my favourite camera lenses. The Nikon AF Nikkor 50 mm f/1.8D. It is a 50mm fast lens that really performs well in low light conditions. What does this have to do with software design you ask? Well, I am glad you asked! The answer is almost everything! Not the overall finished product, or even what it does, but rather the way that it works.

The best thing about this lens is that it is really cheap, and gives amazingly sharp and clear results, even on lower end cameras. The reason it is cheap is that there is almost nothing to it. It works on a very simple lens design called Double Gauss lenns design. Check out the Wikipedia entry at http://en.wikipedia.org/wiki/Double-Gauss_lens

Now, the way that the lens works is that it has a large focal plane and it does very well at reducing optical aberrations over that focal plane. The reason that it can do that is that there are two sets of optical elements in the lens that work together to achieve the result.

Are you starting to see the analogy yet?

OK, so in the web world, we have a large focal plane. Lots and lots of potential users, all over the place, not with much focus, maybe casual browsers. The first task of the lens and your site is to get those users to engage with your app. That would include stuff like clicking on buy buttons or signing up to use a service or something. Great! We have achieved in our app, what the first set of optical elemnts in the lens does.

The next step is to focus the different types of users together, create community and provide interest to retain them. This is the job of the second phase web design. What is going to hold your users’ attention? What will keep them loyal? What will get them to keep coming back for more?

If you can figure that out, you have a winning combo. You have a Double Gauss Web Application Design. Sounds much better than “Dude, my site rocks” eh?

Anyway, this is a short summary of a piece that I am thinking about for an upcoming conference. I am not sure if I will use it or not, but wanted to keep track of it somewhere (here).

Let me know what you think!

Group buying platform(s)

Reposted from old site – original date: Saturday 22 January 2011

So the new big thing is group buying online. This is not a new idea. Not by a longshot. How does this impact us here in Africa? I am not sure yet, but time, as usual, will tell I suppose.

I would like to say that around 8 years ago, I wrote a group buying system that I canned, simply because of the lack of decent eCommerce in South Africa. The basic idea was to allow people to bid on an item, say sugar, bread or maize meal by pledging to buy a couple bags of it. When enough people had pledged for an item, a palette or a container of the stuff would be bought and the cheaper prices gained from massive bulk buying could be distributed to all. The system was called SwarmBuy. The source code is GPL licensed, but I have no idea where it is right now (hopefully backed up somewhere, but unsure of that too)

I still think that this is a pretty decent idea, and now that mobile payment solutions are in place in a few African countries, it could work. Now that the time is right(er), large internationals like Groupon and Google are also competing in this space, and there is little chance that local consumers will benefit from large scale buying/selling. We must be cogniscent that the profits from these types of schemes [b]leave Africa[/b] which is not a good thing, ever.

What does that say? We in Africa need to think about what we need and when, not always follow the crowd. We can do this stuff easily enough. These kinds of systems are trivial to roll out, but the marketing and consumer education is a perennial issue. How do we start addressing that?

Afrihost and why they rock as an ISP

Reposted from old site – original date: Thursday 28 October 2010

OK, so you really will not see this often (read ever) on this site, but the recent activities at Afrihost http://www.afrihost.com warrant this.

I have been hosting sites with Afrihost for a few years, and decided earlier this year to move my ADSL account over to them as well. This was probably the best move I have ever made. There were a couple of issues in the beginning with respect to SEACOM cable connectivity problems, but Afrihost hacked around that by providing a proxy server onto the SAT3 cable. Other than that, I have nothing but good things to say about them.

1. Bandwidth is cheap. Really cheap. Our bandwidth bill for our home ADSL has shrunk to such a degree that I was able to upgrade our line to a 4mbps line. That is awesome.
2. We use a lot of bandwidth, mainly on the upstream and through their web based “Client Zone” we are able to top up our capped account anytime, from anywhere. With at least one photographer in the house at any one time, we tend to use a few GB a month uploading and this really helps. They do take care of the minority “mainly uploader” group too, which very few ISP’s do in SA.
3. They have a 2 for 1 top up special at certain times. OK, scratch that, most times. We pay very little for a very good return with Afrihost
4. Service is awesome. The head honcho at @Afrihost on twitter tweets and answers queries too (@gianvisser) which I respect.
5. They just ran a 1GB for life free promo. I love that, because no matter what happens now, I will always be online at least!

Just a quick anecdote of a query that did come up.

I was experiencing slightly lower line speeds than I should have and tweeted about it. Afrihost picked up that tweet (without me @messaging them or even following them at the time) and had a technician PHONE me on my mobile phone to sort out the issue. The dude was knowledgeable and had respect for the fact that I knew what I was talking about instead of trying to shove a pre-recorded call centre script down my throat (you know the old “OK click on the Start button”… “I use linux”….”Ja, OK, now click on the start button…” routine) and helped me out in a few minutes. In a country where very few companies really take service seriously, this needs mentioning!

To end, I would like to say a big thank you to Afrihost for caring enough that my ISP is an important relationship to me.

If you do use twitter, please follow:

@gianvisser
@Afrihost

to get a really excellent service and great prices.