Gerhard Potgieter

The Ultimate Kloon

Archive for the ‘Programming’ Category

Delphi Character count

Posted by Gerhard under Programming

During this week I saw a request on my favourite forums MyBroadband about some guy wanting some help in Delphi counting the ocurrance of a certain character in a string. So I quickly put a function together and thought I’d might as well share it with you guys.

function CountChars(const str: string; c: char): integer;
// Returns the number of times a character occurs in a string
var
p: PChar;
begin
Result := 0;
p := PChar(Pointer(str));
while p <> nil do begin
p := StrScan(p, c);
if p <> nil then begin
inc(Result);
inc(p);
end;
end;
end;

To use it simply call as follows: CountChars(thestring,thechar);

Where thestring is the string you want to search in and thechar the character you want to count.

AsecoStats Release v1.0.0

Posted by Gerhard under Gaming, Programming

It is finally here, AsecoStats v1.0.0 for you to use. You will find the download link under the software section. If there is any queries feel free to post them here and I’ll try respond as soon as possible. Alternate you can find me in irc on the #ctwug channel at fire.ctwug.co.za

Software section

Posted by Gerhard under Personal, Programming

Added a software section to the site where I will be adding all my projects when I think it is stable enough for a release.

First project added to the section is my Mikrotik SysLogServer, it enables users to do remote logging to it from Mikrotik devices and then stores the logs inside a MySQL or MSSQL database.

Ill soon be adding the AsecoStats project to the pages aswell, as I got allot of requests for it. Just need to package it nicely and write some how to’s.

Thanks for all the support.

Google Chrome, free open source browserGoogle will today launch it beta version of Google Chrome, a open source browser to go head to head with Firefox and the likes.

So why are they launching Chrome? Because they believe they can add value for users and, at the same time, help drive innovation on the web.

Google’s aim is to provide a fresh new browser built from scratch, in fact the first multi threaded browser. Under the hood, they were able to build the foundation of a browser that runs today’s complex web applications much better. By keeping each tab in an isolated “sandbox”, they were able to prevent one tab from crashing another and provide improved protection from rogue sites. They improved speed and responsiveness across the board. They also built a more powerful JavaScript engine, V8, to power the next generation of web applications that aren’t even possible in today’s browsers.

Apparently this is just the beginning, Google Chrome is far from done, this beta is only being released to Windows clients to start a broader discussion and to get input from the public as soon as possible.

For a comic explaining Google Chrome go here

As soon as the donwload is available I will post a link and info here.

Flat Files? What Flat Files?

Posted by Gerhard under Programming

For all you flat file junkies out there.

Nadeo recently launched TrackMania Nations Forever (TMNF), the successor of their previous free racing game TrackMania Nations (TMN).

Being part of CTWUG we have a few avid gamers on the network and one of the games we played allot was TrackMania Nations (TMN). So with the new TrackMania Nations Forever (TMNF) I thought I would give it a go and set up a server, and as with every game on the network users prefer a stats page aswell. So after searching high and low on the web I couldn’t find a stats solutions for TMNF that produced stats based on real time results, the closest I got was TMOS - TrackMania Offline Server, so the obvious thing to do was write my own solution.

Running a dedicated TMNF server required ASECO, Automatic Server Control, to generate statistics in realtime to a online database or local database. It took me about 2 days of programming to get a stable running bug free site. I called it AsecoStats cause it is based on the Aseco 2.1.4 for TMNF.

The index page displays live server stats like how many players are currently online, current track, list all player names and best times that are currently online aswell as the Author records aswell as the best time for the track.

AsecoStats Index Page

The Players page displays all the current players that ever played on the server aswell as their total wins and total time played on the server.

AsecoStats Players

When you click on the player name you will be transfered to a page detailing all the tracks the player has ever raced aswell as their best time for each track and poll position

AsecoStats Player Statistics

On the Tracks page is a list of all the challenges (tracks) ever played on the server with their author, best time and what player achieved this time.

AsecoStats Tracks Page

When you click on the track name you will be transfered to a page that details all the players that ever played that track aswell as their poll position and their time.

AsecoStats Track Details

This is all I did for now as this is the first beta version (v. 0.9b), and what the users wanted to see for now. The pages is written in php and utilizes Aseco 2.1.4 for TMNF’s mysql database. I haven’t decided on a license for it yet but if interest is big enough I will possibly release this under GNU.

For the next release I’m looking into a point system so users can get a overall server position and not just per track. Please leave your comments as to what you guys think of this and any suggestions is also welcome.

Google Friend ConnectGoogle has joined the revolution to make the web more social by introducing Friend Connect to enable people to interact with their friends.

Friend Connect follows just after announcements last week by social networking sites Facebook and MySpace to open up their data availability to be used on personal websites.

Data Availability and Connect let users move their personal profiles and applications to other websites.

Google says with Friend Connect, any website owner can add a snippet of code to his or her site and get social features up and running right away without any complicated programming. This will run the complete range from invitations to member’s gallery and from message walls to reviews.

As 99% of sites are not currently socially enabled, Friend Connect has a big potential market in front of it and the route to all things profitable in this space will be through tapping into “the deep profit and user data flowing through Friend Connect.” In other words, mining that information through advertising.

Google is being cautious about approving sites to use the new code and is creating a waiting list for requests to use Friend Connect. It says it expects to give the go ahead to a few dozens sites in the next few days.

Meanwhile MySpace and Facebook anticipate rolling out their offerings over the next few weeks.

Facebook chat here!

Posted by Gerhard under Internet, Programming

So I’m not a big Facebook addict like the majority of www users out there, but once in a while I would log on to Facebook to leave a quick PM to friends abroad or see what everybody is up to. Personally I think Facebook is one great piece of development, and has all the features one could think of except one which was a live chat function.

A while back I saw a leaked video of a live chat for Facebook and and first thought it was a hoax or something, but after thinking about it I realized that this was one feature that would make Facebook stand out even more and something that I believe every user would use if not abuse during work hours.

So this morning I logged on to Facebook and saw this bar at the bottom of my browser, and after looking at it realized that Facebook chat finally got implemented. I must say I’m quite chuffed with the addon, looks good doesn’t bother my browsing experience and is easy to use.

Facebook chat screenTo the left is a picture illustrating the the chat program expanded showing your online friends and a open chat windows. Its as simple as clicking the online friends bar en a small window pops ups showing all your online friends. Then you just double click the friend’s name and a chat window opens and then your ready to chat.

After sending a message you can close the chat window and once you receive a new message it will automatically pop up. Without any windows open the chat applications sits at the bottom of your browser just as a small gray bar with 4 icons.

You also have the option to detach the chat application from your current Facebook page and view it in a seperate window if you feel that doing all in one browser window is to much.

So big up to the Facebook Development team for this fine addon, I’m sure you hits will now sky rocket even more. Just a shame now this will encourage more companies to block the Facebook website for their workers as this means productivity will go down the drain even more now. But non the less still a great addon.

Yesterday I finally got my ND: Information Technology from CPUT. Should have gotten it 2 years back but due multiple lost papers and the bad management at CPUT I had to wait. Well now I’m officially qualified and looking forward to continuing my studies from next year. Just a thank to my family for supporting me not just financially but also morally.

Watch out IT industry I’m coming with a big bang.

Subscribe to Gerhard Potgieter