Wednesday, February 29, 2012

A student asked me if there's a simple way of making a method that takes a variable number of arguments. In Java, using the ... notation, you can do just that! Let's say, for example, you want to create a method that will add up any number of integer numbers. Using the code below, you can do just that. So simple, so easy, so elegant.

public class AddUpMany { 
  public int addThemAll(int... numbers) { 
    int total = 0; 
    for (int temp : numbers) { 
      total += temp; 
    } 
    return total; 
  } 

  public static void main(String args[]) { 
    AddUpMany instance = new AddUpMany(); 
    System.out.println("Adding up 5 and 6 gives you " + instance.addThemAll(5,6));      
    System.out.println("Adding up 5,5 and 2 gives you " + instance.addThemAll(5,5,2));
    System.out.println("Adding up 1,2 and 3 gives you " + instance.addThemAll(1,2,3)); 
  } 
}

Saturday, February 25, 2012

Javascript Lessons

It's so often these days that I get asked questions around Javascript, that I felt I should find a resource for my students. After digging around a bit, I found Code Academy, a brilliant site that offers a free Javascript course.

Why Javascript if this site is about Java? Well, some students have started to write all sorts of interesting applications as projects, especially in the mobile space. With smart-phones all the rage these days, and, admit it, some of these devices are incredible, more and more students are interested in developing for them. By using Java as the back-end, they write server applications with a HTML / Javascript interface.

If you are interesting in learning Javascript for free, I'd recommend you give the Code Academy guys a try, it's a great site, with really easy-to-follow lessons that will get you up to speed in just a couple of hours.

Monday, September 6, 2010

Another one in Stellenbosch - Umonya

It's happening again!

There's ANOTHER free Python course being held by Umonya at the University of Stellenbosch. Students will be given the opportunity to learn the Python programming language, interact with industry players and, most importantly, learn that computers are not all that scary.

Please visit Umonya for more information regarding this fantastic outreach project.

Tuesday, August 31, 2010

Great stuff in Cape Town

The guys at Umonya are doing fantastic things for school kids in South Africa. They offer free Python courses over selected weekends where children with no previous programming experience are taught how to program in Python.

Not only do they show these kids things they might have thought impossible before, but they also make time to have chats with the kids to open their eyes to career possibilities that many of them have never thought off.

The courses are organized by UCT students, but, in my humble opinion, reflect the same level of quality, commitment and dedication one would expect from professional trainers. These guys need your help and support, so if your company (or yourself) can be involved in any way, do step up and help cultivate the next generation of IT professionals for Africa.

Friday, August 20, 2010

Telesure Cesspool

I know this is not blog related, but really, I've had it with these guys.

RANT ON

We had an accident in April 2010, and things are STILL not sorted out by these Telesure, Auto&General, AA Insurance incompetents. Did you know Dial Direct, Budget, Auto & General and First for Woman are ALL just brands of Telesure? And if you go on a site like Hippo, you are actually getting quotes from the same company, just under different brand names.

So here's a little bit of free advice - stay away from Telesure and their brands, it's just the most pathetic service I have ever received. In fact, I'm going to write a nice long article about it and hopefully save someone all the hassle I had to go through. It takes days for them to get back to you, even though they have a so-called service charter that they clearly do not stick to.

Do proper research when you are considering your insurance provider and make sure they are underwritten by a reputable company. I made the mistake of trusting in the AA brand name, AA Insurance is useless, they are simply brokers and did not lift a finger to try to assist us.

RANT OFF

Wednesday, March 10, 2010

Python in Afrika

Ja, ek't ook besluit om meer ernstig te raak oor my Python-vaardighede, so ek het 'n nuwe blog by PythonOutjie opgelaai en gaan my avonture met almal deel :)

Friday, March 5, 2010

Excellent resource for code examples

Looking for Java example code? Why not give Java2S a try? They have thousands of code listings and you will be surprised just how broad the subjects range.

Have fun and remember to keep in touch with your Java basics, that's a lesson we often forget!