1. Home
  2. Computing & Technology
  3. C / C++ / C#
David Bolton
David's C / C++ / C# Blog

By David Bolton, About.com Guide to C / C++ / C#

Getting better Pay in IT

Thursday December 10, 2009

In my 28 year career, 6 of the companies I have worked for have gone bust. No I'm not really a jinx, it's just that the IT industry has changed a lot during that time. That means new companies come along and old ones fold in a Darwinian survival of the fittest battle. Names like Digital who grew massively in the 70s but failed to adapt to the PC and were bought by Compaq who were then bought by Hewlett Packard, now known as HP.

Until I reached the age of 40, the longest I stayed in a job was 3 years. In the last ten years I worked at three companies, one of them for 7 years. Unfortunately it's the way of the world that changing jobs is the best way to get bigger pay than promotion within a job. I was never driven by money and so chose to stay in programming jobs rather than move up into management apart from a couple of Team Leader/Senior developer roles that were still mostly development.

Two of the firms had career paths for techy people such as developers but most companies were small and didn't. Big company culture is different to small and you usually have less freedom and responsibility than in a small company but are more likely to get benefits such as training courses, health care etc. I'm not sure there's any more safety in a big firm as the bank holding company I work for had four rounds of redundancy last year but I'm still there...

Scaling Up to Large Number of Users

Tuesday December 8, 2009

I've always (well for fifteen years) been a traditional RDBMS person. Even the largest website I worked on (a property website) had only had at most a few thousand users and SQL Server 6.5 coped admirably with that.

However many websites with millions of users take a different approach, the so called NoSQL Approach which promotes non-relational databases that don't need a fixed schema and usually avoid join operations. Basically these are based on big fast lookup tables with no relational joins. Facebook with Cassandra, Amazon with Dynamo & Google with BigTable are all big site examples of this.

Given that I'm unlikely to run a website which such large numbers, I can live within my comfort zone of relational DBs. However if you are tempted to dip a toe, Redis is an interesting databse server written in Ansi C for Posix systems. It serves up data structures at a very rapid 110,000 SETs/second, 81,000 GETs/second on a normal Linux box but has a quite rich command set (see ) that distinguishes it from being a simple key/value server.

There are bindings for C and the C# version was developed by Miguel De Icaza of Mono fame. If you use PHP as many do (including myself), you'll also find bindings. Of course if you're like me and comfy with a relational DB but want fast performance cheap then you might want rethinkdb, a drop in MySQL storage engine for SSD devices.

How Long is a Piece of String?

Monday December 7, 2009
C strings are easy to use but they are also easy to misuse with Buffer overflows a consequence of not doing full boundary checking. Companies like Microsoft having been disallowing the use of functions like strcpy as part of their SDL (Security Development Lifecycle) for the past five years. I can't stress the importance of this, just take a look at this page to see what can happen.

But applications need string handling and there are a huge variety of replacement string libraries. James Antill is the author of one such library vstr and has compiled a comprehensive list of other libraries that he has compared it against. Whichever library you use, just ask yourself if a user of your applications could be compromised through insecure calls.

More Thinking Outside the Box

Sunday December 6, 2009
Game AI has come a long way from the 80s and computing power has increased several thousand fold. The AI I wrote in assembly language for a simple Empire game was reasonably sophisticated but hardly compares with say AI for a team of soldiers in a 3D shoot-em-up these days. However even learning techniques can sometimes end up with rubbish behavior as witnessed by this video.

Part of the joy of game playing is gaming the AI. In anything but the simplest games, humans always have an advantage over an algorithm; they are just too devious, sneaky and prepared to try different approaches. So a newer approach is to do what animators do. Look at a human's behavior and do the same. Animators capture motion with special camera and tracking devices attached to clothing. Researchers Jeff Orkin and Deb Roy are trying to model a waiter's interaction in a restaurant with a simple game that feeds them data. You can participate and help them.

Challenge 30 First result

Pedro Graca has set a very fast time of just over 10 ms, so that's the time to beat.

Final Challenge 29 Results Published

Saturday December 5, 2009

Congratulations to Michael Chock who just beat Pedro Graca. The differences were milliseconds and I reran them a few times to check.

There were some C and C++ entries and it's interesting to see the use of the hr_time.c/cpp files. I did wonder why people called hr_time.h instead of hr_time.hpp for C++ but that's because I provided the hr_time.h for the C++.

Does it matter if you .h instead of .hpp in C++ applications? Not really unless you are also developing C code and don't want to mix them up. Whereas C++ can compile C code, the opposite isn't true for C++ code. Apart from the possibility of mixing the code up, I suspect it's mainly a matter of personal preference or am I missing something?

MandleBulbs - a Newish Meme

Friday December 4, 2009

While Mandlebrot sets have been around since the mid 80s, it's only the last few months have seen the emergence of MandleBulbs. These are similar to Mandlebrot sets but in three dimensions and the images are just stunning and look like they were formed naturally.

Unfortunately, source code in C, C++ or C# is very thin on the ground, just about non existent, partially because it's new and it also requires a lot of intense processing. The equations are more complicated - see Wikipedia for a discussion

But if anyone has source code, please let me know so I can link to it. I suspect we won't see any for a while because it's so new and more complex because of the 3D rendering involving coloring and shading that it could be commercially exploited. Eventually there is bound to be an open source version.

PS.Marking almost done for Challenge 29 but I'm having compiler errors with one. Final results tomorrow.

Challenge 29 Still being Marked

Thursday December 3, 2009

There are 13 entries including a late one) so I've updated the times but there's still three to do. I should have them all done by tomorrow evening.

If you've started Challenge 30, you may need to download settlers.txt again as I've corrected one of the coordinates!

Programming Challenge 30 Published

Tuesday December 1, 2009

You get to zap the surface of a planet from your orbiting spacecraft but the targeting system is broken and so you must define the targeting locations according to the challenge's rules. With five different sizes of targeting areas possible your program must reach every location as economically as possible while not zapping settlers.

It just needs a file of settler locations (that your zapping must avoid) and that will be uploaded tomorrow. You can start coding without it, or just make your own file up for now. Put in 10 settler locations, consisting of 10 pairs of numbers separated by a comma, each pair on a single line and each value in the range 0-99.

Eg 12,34
45,87
etc etc
Good luck! Challenge 29 will be finished marking in a day or two.

A Reader Writes

Monday November 30, 2009

Today I had an email from, well let's call him Arun as that's his name. He wanted to know about using C for web apps and mentioned Wt that I had written about. It's a fair question- the old saying about there being no stupid questions only stupid answers springs to mind. Wt is actually used with C++ not C but that's not the issue here.

My main philosophy with programming is use the best tool for the job though obviously I am constrained to write about C, C++ and C# here. It may come as a shock but I also do use other technologies and languages. These include sql for databases, Flash, JavaScript, PHP and even Delphi but I mention them only to highlight my point.

I replied to Arun that as a beginner he should really use something like PHP for web apps as it's far easier to start down that path and getting access to a web server to run PHP rather than Wt is also likely to easier. PHP is closer to C than many other languages. If you have access to your own web server and are experienced with C++ then you might consider Wt but otherwise I would still recommend PHP.

Fighting Wars With Plastic Bricks

Sunday November 29, 2009

BrikWars ScreenshotMy parents were convinced I would become an architect when I was younger as I had a Lego set and just made houses with it. It's kind of ironic because I used to play wargames and now Lego + wargames = BrikWars! Clearly it's just an excuse for grown men to play with Lego!

BrikWars is a set of rules for fighting tabletop wargames using Lego and Minifigs. This has been coded in the last year in C# for Windows and you can download the GPL'd open source code built using XNA and fight against the computer or other players. No bricks to tidy up afterwards!

PS Latest entries are now being marked for Programming Challenge 29, still one day to submit late entries!
Read Archives
Explore C / C++ / C#
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

©2009 About.com, a part of The New York Times Company.

All rights reserved.