Tim Keller

Web, IT, Telecoms, Development, Networks, Photography, Life.

Archive for the ‘Programming’ Category

School kids – want to learn computer programming?

without comments

Calling budding programmers, developers and geeks!

Are you interested in learning computer programming? Want to find out what it is all about, without devoting too much time? Do you have a child or learner that might be interested? The University of Cape Town is holding a free course to give young learners an introduction to computer programming. They will teach the basic skills needed to start creating your very own fun and useful computer programs.

The course will be run from Friday 26 to Sunday 28 February 2010. It is targeted at learners in grades 7–10 with little or no knowledge of programming, but learners of other grades are also welcome. The course will teach Python: a real-world programming language used by many large companies such as Google, Yahoo and Industrial Light & Magic that is also easy to pick up.

The only prerequisite for the course is a fair level of computer literacy: using a web browser and text editor. The course will start from the very basics of what computer programming is about and end off with an introduction to programming concepts: flow control, lists and functions.

You can apply online at http://algorithm.cs.uct.ac.za/apply. Dead- line for applications is 21 February.

Written by Tim Keller

January 22nd, 2010 at 4:51 pm

An Oxymoron’s Guide to PHP on Windows

without comments

I had the privilege of speaking at SA Developer Cape Town last night. Twenty-something local geeks turned up to hear about how well the Open Source PHP language runs on Windows IIS, using FastCGI.

For the longest time, the utterance of “PHP” and “Windows” within the same sentence meant the speaker was either temporarily insane, or horribly misguided.

In ‘An Oxymoron’s Guide to PHP on Windows’ you’ll discover just how much the situation has changed in the past 12 months. Thanks to Windows Server, IIS7 and FastCGI, running PHP on Windows finally makes a great deal of sense. It performs admirably and facilitates integration with familiar Microsoft technologies like ASP.net and Silverlight.

Written by Tim Keller

November 26th, 2009 at 11:40 am

Google Go

without comments

Go Logo

Google is touting its new Go language as a modern systems programming language which is expressive, concurrent, garbage-collected. Go takes the development speed of working in a dynamic language like Python, and combines it with the performance and safety of a compiled language like C or C++.

In its Go FAQ, Google explains the main motivations behind the project:

No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously. There are several trends:

  • Computers are enormously quicker but software development is not faster.
  • Dependency management is a big part of software development today but the “header files” of languages in the C tradition are antithetical to clean dependency analysis—and fast compilation.
  • There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.
  • Some fundamental concepts such as garbage collection and parallel computation are not well supported by popular systems languages.
  • The emergence of multicore computers has generated worry and confusion.

Bold words from Google, especially considering the number of new languages which have come and gone over the years. Surely its too risky to put the corporate name behind the project? Not once you hear who’s on the team.

The project is being staffed by some serious Computer Science heavyweights: Robert Griesemer, Rob Pike (Unix Team, Plan 9 OS, UTF-8, Inferno), Ken Thompson (inventor of B – forerunner of C, UTF-8, shepherd Unix and Plan 9), Ian Taylor, Russ Cox, Jini Kim and Adam Langley.

Coming from a C/C++ background during my university days, my first Go experience felt quite nostalgic. I grabbed the source via Mercurial, compiled it in the Terminal, and configured some shell environment variables. What I was left with was a native Go compiler for my x64 architecture (6g) and a Go linker (6l). These are the recommended compilation tools until the GCC-based (gccgo) version catches up.

Installation on Snow Leopard

Before you follow these steps, you should have XTools installed. You should also be running Snow Leopard as your OS. These instructions should also work for 10.5 Leopard, but you may have to use GOARCH=386.

Environment

Go needs a couple of shell/environment parameters to be set prior to installation.

Add the following lines to your ~/.bashrc file:

export GOROOT=\$HOME/Go
export GOOS=darwin
export GOARCH=amd64
export GOBIN=\$HOME/bin

Now use the source command to apply those changes:

source ~/.bashrc

Next we need to add the bin directory for Go, and map it on the system path:

mkdir -p $HOME/bin
echo "$HOME/bin" > go
sudo mv go /etc/paths.d/
eval `/usr/libexec/path_helper -s`

Source Code

The Go team are currently using Mercurial to handle the source code. If you don’t already have it installed, you can install it quickly and easily with the following command:

sudo easy_install mercurial

I encountered an issue whereby UTF-8 was not set as my locale language type. While some will not experience this, I had to force this by adding the following lines to your ~/.profile file:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Adjust according to your locale, if neccesary. Big thanks to ricafeal for this.

This will use the Python easy_install tool to install the mercurial package on your system. Once complete, its time to checkout a copy of the Go source code:

hg clone -r release https://go.googlecode.com/hg/ $GOROOT

This will place a full directory of Go source in the directory defined in ~/.bashrc as $GOROOT

Installation

All the Mac OS X particulars are done and you can follow the standard installation procedure. That includes:

cd $GOROOT/src
./all.bash

If you get a message stating…

--- cd ../test
N known bugs; 0 unexpected bugs

… you should be good to go (oh the puns).

Hello World

package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}

To compile:

$ 6g hello.go
$ 6l hello.6

To execute:

$ ./6.out
hello, world

You may also want to check out Jeremy’s great little script which lets you compiler (6g) and ink (6l) in one, well, go.

More Go later this week!

Written by Tim Keller

November 16th, 2009 at 5:17 am

Silicon Cape idea – Develophpers Cape Town

with 2 comments

Luke, Tim and ChristiaanI was privileged to get to spend the day with some of the brightest entrepreneurs and founders in Cape Town at the Silicon Cape launch. It was incredible to see how quickly founders Vinny Lingham (of Yola) and Justin Stanford (of 4Di Capital and FireID) have been able to bring their vision of a Silicon Valley in the Cape to light. The event included big hitters like former Mail & Guardian Online GM Matthew Buckland, South African billionaire Johann Rupert, Western Cape Premier Helen Zille, and Dr Ramphela Mamphela.

The essence of the day can be consumed via various news sources, but ultimately three goals were exposed:

  • To develop a digital innovation hub
  • To give entrepreneurs a kick-start
  • To set up a Cape VC fund for start-ups

The main take-away for me was an issue raised by a delegate during the open-floor panel discussion: we have a drastic skills-shortage in the local tech start-up space. While the Silicon Cape may foster a community of entrepreneurship, we can’t do much without high quality, skilled employees. The majority of our bright minds are picking up corporate bursaries after High School, and moving straight into black suit and tie after 4 years at University. If we’re going to have great startups in the Silicon Cape, we need great programmers, sysadmins and techies who are available for employment.

With that in mind, I’m going to kick off a little group around this. I think it should be called “Develophpers Cape Town” – a community for PHP devs, aspiring and experienced. Let’s see if we can get some discussion going in the comments here. What is needed most: training, social geek-out events, hackathons, etc?

It is clear to me, that the Cape is onto something really exciting and potentially powerful. Let’s be a part of it.

Written by Tim Keller

October 12th, 2009 at 3:35 pm

Posted in Programming, Technology

CSV to HTML

with 3 comments

I produce websites for a lot of school’s in and around Cape Town. It’s something I started doing when I was in High School, and it’s kinda stuck.

Last night I received a Word document with pages of teacher’s names and email addresses for a website. As I looked at it I imagined the huge amount of time I was about to waste either in a WYSIWYG editor or copying and pasting HTML tags.

Then I remembered that I had a B.Sc and more than 2 brain cells. I moved the Word Table to iWork Numbers (Excel would have worked just as well), exported the file as a CSV document, pulled open Textedit and wrote a quick PHP-CLI script to suck in the CSV and output the relevant HTML.

Hope it’s useful to someone else out there!

#!/usr/bin/php
$job: ".htmlspecialchars($name)."
n"; } ?>


Written by Tim Keller

January 19th, 2009 at 8:06 pm

Posted in Programming

Tagged with , , , ,