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

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

Go, An Experimental Language from Google

Wednesday November 11, 2009

Anything Google does in code is worthy of attention and a new programming language more so. Both Microsoft and Google have a lot of very bright people but with Google it's more likely to be producing open source as this is. Started in September 2007, Go is an experimental OO Lite (no inheritance) language that tries to break away from Java and C++ . It's best summed up as a concurrent, garbage-collected language with fast compilation.

By experimental I suspect they mean it's here to stay but isn't quite finished yet. With built in features like Garbage Collection and parallel computation without having to write threaded code so it supports multi-core out of the box.

The language is interesting. For example, variable declarations are more like the Pascal model with the type after the variable name. This declares two pointers to an int.

var a, b *int;

This is for Linux/Mac mainly, so possibly it would run under Windows using Cygwin/MingW. Gccgo has a C++ front-end with a recursive descent parser coupled to the standard GCC back end. Gc is written in C using yacc/bison for the parser. No header files but instead, just put a load of files in a directory and they can compile together and make cross file calls without needing declarations.

There's a fair deal of documentation and instructions on how to install and run it. It's early days so it lacks tools like an IDE and debugger but no doubt those are in the works. For some "strange" reason they think ogle would be a good name for the debugger as in "go ogle". It must be an anagram...!

An Augmented Reality Toolkit

Tuesday November 10, 2009

Augmented Reality (AR) is a new buzzword at the moment with several iPhone apps available. It's a simple idea, determine what a camera is looking at and add additional information onto the display. So you point your iPhone 3GS (The latest one with a compass) and it uses GPS and direction information to suss where you are at what you are looking at. It then adds information (e.g. StarBucks) over the live camera image on the screen. It's great for guide books!

But there are other uses of AR and for computer users with a camera there's the GPLed multiplatform library (Windows, Linux, Mac OS X, SGI) ARToolkit with a C API. This was originally developed by Dr. Hirokazu Kato, and is now supported by the Human Interface Technology Laboratory (HIT Lab) at the University of Washington, HIT Lab NZ at the University of Canterbury, New Zealand, and ARToolworks, Inc, Seattle.

It picks up images from a camera and tracks markers (square areas) where it superimposes images. The projects page lets you see what people have done with the toolkit.

Challenge 29 Revisited

Sunday November 8, 2009

Thanks to John Downey, Pedro Graca, Stuart Highman and Kenneth D Weinert for early entries (I've marked the first two and will carry on marking as entries are received). Also, thanks to the commenters regarding the asymmetric distance calculation (not the same distance in each direction!). I found this page on distance calculations

a = pi/2 - lat1
b = pi/2 - lat2
c = sqrt(a^2 + b^2 - 2 * a * b * cos(lon2 - lon1)
d = R * c

Use R= 3956(miles). I know the Earth isn't a sphere- it's an oblate spheroid because the rotation of the Earth makes it bulge slightly at the equator but it's ok for this challenge.

The first times are

  1. Pedro Graca 1.567 seconds
  2. John Downey 1.658 seconds
Both entries are written in C#.

Covering Open Source

Friday November 6, 2009
As you've probably guessed, I'm a keen advocate of open source, albeit an equally keen user of closed source software, especially development tools. Having worked in a software house that sold software to banks, Closed software development is focused on providing something that the customer will buy. If they aren't focused then they're out of business sooner or later, whereas open source has the luxury of not needing to be commercial to survive. My point is that the world is big enough for both.

But it's also obvious that with 70 million + websites/blogs out there, there is almost certainly a lot of useful open source that is never heard about. So if you are working on an open source project (C, C++ and C# only) and would like a mention write to me at cplus.guide@about.com and tell me about your project, team etc.

Challenge 28 Marked

Thursday November 5, 2009

Congrats to Pedro Graca who once again wins though the competition was out of sight this time. His C entry calculated the puzzle answer in about 3 seconds and though it didn't create a valid CSV file, it would be churlish not to cite him as the winner.

I've had the first entry for Challenge 29 from John Downey of Purdue University. Starting from this weekend, I'll try and mark these as they come in but no source code will be published until the challenge ends.

Computer Vision and Face Recognition in C and C++

Tuesday November 3, 2009

Living in the UK which I believe is home to the most CCTV cameras per head of population (about 1 for every 16 people in the UK) means I'm not terribly keen on advancing this type of technology but you can't really halt progress, just try to control it so it doesn't get abused. We must be close the point of having software that can track a person in a crowd moving across a city, if it hasn't already been done.

Face recognition is a hard problem to solve from scratch but it's now a mature enough technology that even cheap compact digital cameras can identify faces. Open Source is making inroads into this as well with two libraries. The LibFace open source library uses the OpenCV library for face recognition and has got a complete collection of functions that are essential for building a face recognition system.

Intel originally produced the OpenCV (Open Source Computer Vision) library, written mostly in C which is about computer vision and has over 400 different functions covering 28 areas of computer vision research, of which one aspect is face recognition. There's even an O'Reilly book about using OpenCV and writing applications in C, C++ and Python. There's also a good guide to getting started with OpenCV from Leeds University. Intel sells a library IPP which is integrated with OpenCV so that if you have IPP, some functions are much faster.

Revisiting Google C++ Standards

Monday November 2, 2009

Google produces a lot of software in C++ so they have prescribed a set of standards for all C++ Google Software. There's a lot of wisdom in there and some interesting stuff. If you're an experienced developer with C++ then you can probably ignore it but if you're starting out it's not a bad set of rules to take on board. Here are a couple of interesting points:

Namespaces

  1. Don't use Using as in using namespace std; This pollutes the namespace.
  2. You can use anonymous namespaces.

Exceptions

Google don't like you to use exception handling. Thankfully there are some "exceptions" to this rule regarding Windows Software and existing code that uses exceptions.

If you have Python on your computer then there is a Google python script that will check your C++ code to see that it conforms with the style guide.

  • Link to Tools and Utilities Library
  • SlickEdit 2009 Review Published

    Sunday November 1, 2009

    Though I spend most of my time in front of an IDE, there was a time years ago when I would have welcomed something like SlickEdit which I have just reviewed. Back then, the the initials PWB might bring back a few memories! It's not true that it was short for Programmer's Waste Bin.

    Since then of course Visual Studio's IDE has become pretty good and there's Eclipse/Netbeans and a whole stack more. So it's a competitive environment to be trying to sell an IDE in. My conclusions are that SlickEdit 2009 is an excellent full featured IDE (with a Macro programming language more powerful than C) that is great for development where you use different programming languages or platforms. But judge for yourself...

    Challenge 29 Published

    Friday October 30, 2009
    This is a nice easy speed challenge. There are 10,000 treasure hunters located across the continental USA and likewise there are 250 treasures. You are given the latitude and longitude of both treasures and hunters and have to figure out which 10 treasures have the lowest average distance of hunters within 100 miles so you can assign them to search for the treasure. The challenge is only concerned with managing the hunters not the actual search.

    If a hunter is more than 100 miles from a treasure don't count that hunter. So if the total distance of all 10 hunters from one treasure is 265 miles then the average distance of hunters from that treasure is 26.5 miles.

    Two Different Implementations of MySQL

    Wednesday October 28, 2009
    Amazon and Calpont use MySQL in two different ways; that's the beauty of Open Source. Amazon has just started offering a new web service Amazon RDS (Relational Data Store) to compliment its Amazon SimpleDB service which is essentially a way of creating fast lookup tables. RDS provides MySQL 5.1. You pay for the size of an instance, storage, data transfer in and out and extra backup over the first 100%. If you prefer other databases, they are available through the Amazon EC2 service.

    Calpont have used MySQL in their InfiniDB Community Edition. This is a free customized version of MySQL that is optimized for analytical use opf the kind used in Data Warehouses. It offers multi-threaded processing with no limits on CPU or core count on a single server, no limits on RAM, CPU, size of database, or concurrent users and is available as free download. Calpont make their money by offering a commercial version of this. Kudos to them for providing a free download without requiring registration.

    Programming Challenge 28 deadline Approaches
    Only a few days to get your puzzle solving code in.

    Read Archives
    Explore C / C++ / C#
    About.com Special Features

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

    Easy ways to connect two computers for networking purposes. More >

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

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

    All rights reserved.