Tuesday, September 30, 2008

Java Puzzle In C++

The java.about.com website has a puzzle where you need to decode a string, so I wrote the decoder program in C++.

Monday, September 29, 2008

iPhone 3G Now In South Africa

Vodacom released the long awaiting iPhone 3G in South Africa.

For more information and deals, visit http://www.vodacom.co.za

Weekly Code: C++ Include Guards 29/09/2008

Include guards prevents you from including an header file multiple times, it's done by using compiler precessors:

#ifndef FileUtils_H
#define FileUtils_H
#include "FileUtils.h"

You can also put a #pragma once at the top of the file:

#pragma once

#include "FileUtils.h"

There is also a generator for include guards available.

Thursday, September 25, 2008

Regular Expression Search

Manipulating some data today to write Java code from the data, I found that Eclipse and EditPlus
both have support for regular expressions in the Search Find/Replace dialog! I wrote a simple "[0-9]" regular expression to remove all numbers from my data (leaving only plain text) WoW! Thats cool! :-)

Google's 10 Birthday

Yes the big girl is turning 10!


Tuesday, September 23, 2008

beanstalkapp.com - Free Sub-Version

If your looking for a free/paid for online sub-version (SVN) provider then I suggest using beanstalkapp.com which offers a free sub-version account with 20 MB space and other plans that you can upgrade too.

Monday, September 22, 2008

Light Bot - Save/Load

My wife Jolene De Villiers found a version of Light Bot here that allow you to save/load a game so you can continue from where you last ended. :)

Sunday, September 21, 2008

Weekly Code: Predicates In C++/CLI (21/09/2008)

In C++/CLI every .Net generic List collection (List class) which is in the System.Collections.Generic namespace have methods like FindAll that takes in a Predicate as a parameter.

A Predicate is a delegate that to a method that return true if a match is find in the collection base on a condition in the delegate method. It make it easy to find a element match in a collection without writting a complicated for each loop for example.

C# make this easy by using anonymous methods in C# 2.0 and lamda expressions in C# 3.0 but C++ language doesn't have this feature (C++/CLI is base on C++ that doesn't have anonymous methods/lamda expressions)

In this example I demostrate using predicates in C++/CLI with Visual C++.Net 2008 to find items in a collection.

If your interested in C++/CLI then I suggest reading C++/CLI In Action.

Weekly Code List

Saturday, September 20, 2008

TIOBE Software - Java TOP 1!

On the TIOBE Software list for the popularity of programming languages for September 2008 Java is TOP 1 on the list. :-)

Go Go Java!!

Light Bot - Game For Programmers :)

I started to play Light Bot a game where the idea is to program a little robot to move/jump around blocks and light up all the blue blocks. You program the rebot using block (unfortunatly no coding :-( where you've 2 functions that you can execute.

Friday, September 19, 2008

Java URL vs URI

Goodday :)

You can get URL and a URI but remember that both of them work differently.

The URL encode the string where the URI is the actual resource.

I had a problem in a Java unit test (using jUnit) for PDFTable where my unit test failed since it was unable to load the fonts. The reason for this is that it was using the URL so trying to find the font files under an encoding path.

So the actual code fix is:

URI url = getClass().getClassLoader().getResource(fontResourceDir).toURI();
String path = url.getPath();

The toURI() method represents this abstract pathname.

PDFTable Open Source Project

Our employer allow Evan Summers and myself to release the Java code we wrote to generate PDF statements and invoices as a opensource project - PDFTable which is under the Apache License, Version 2.0

Im planning to make some modifications to it soon.



Welcome to my blog. I'm Lennie De Villiers, I'm a software developer for Soliditech with 4 years software development experience using programming languages like Java, C#, C++, VB.Net, PHP, ASP.Net. My main focus in this blog is to share my experience.

Happy reading! :-)