Sunday, December 26, 2004

Merry Christmas!

Happy holidays to everyone!

Try not to eat too much (more than twice your bodyweight is bad!) and make sure the holiday vibe continues into the new year.

All the best, to you and yours,
Matt

Monday, December 20, 2004

Powderfinger in Quicktime News

It's always great seeing local talent being recognised on a global scale, so I was wrapped to see the Brisbane lads from Powderfinger mentioned in the latest Quicktime News!



Congrats fellas, now let's hope bands like Augie March, The Avalanches, George, Jet, John Butler Trio, Pete Murray, The Sleepy Jackson, The Waifs and The Wicked Beat Sounds System (among many others!) all get the recognition they deserve too. We've got a fantastic music scene here in Australia people - get into it!

Thursday, December 16, 2004

Why I like Firefox

Cameron Reilly mentioned that he's happy using Maxthon. I'm absolutely loving Firefox lately - it's one of the few applications that I truly enjoy using. But it got me thinking...why do I like it?

Apart the obvious security benefits, here's some of the features I have grown to love:
  • Tabs, and having them behave exactly as I want (implemented with the following mixture of extensions: MiniT, Tabbrowser Preferences, SessionSaver, UndoCloseTab and DuplicateTab).

  • Find-as-you-type. Such a simple, useful feature!

  • Pop-up blocker.

  • Searchable history and bookmarks.

  • A great search toolbar (with many - thousands? - of different search engines).

  • Keyword search. Allows you to easily define (no url entry required!) keywords that you can type into the url bar - eg typing "imdb Terminator" brings up a search from IMDB for Terminator.

  • AdBlock. Fantastic extension. I hate being distracted with ads and this allows me to completely block them. Incidently, I don't feel too morally guilty because I've never clicked on an ad (except Google's, which I find useful and do NOT block).

  • Flashblock. To further block flickering guff you need this extension. Replaces Macromedia flash content with a "play" button that you have to click before it invokes the flash. Glorious. Makes you realise how many sites use flash, and how many annoying, flickering graphical displays you have somehow managed to get used to.

  • Bookmarks Synchronizer. I have two PC's (home and work) that I regularly use and this extension allows me to have the same bookmarks on both of them, transparently storing them at an ftp location.

  • BugMeNot. An extension that streamlines using the website BugMeNot to get me in to any site that requires a login. Especially useful for reading news sites (*cough* theAge *cough*). Slight guilt trip when using it. But I get over it pretty quick.

  • Web Developer extension. Lots of features to help develop web pages. Change the CSS, discard images, find broken links, validate any page by clicking - and so many more.

  • Bloglines Toolkit. Places the bloglines logo in the status bar - there's a little red indicator when I have feeds to read in bloglines, clicking on the logo takes me to my feeds. Simple, elegant.
Almost all of those features I use every day, they're not just gimmicky cool toys.

As you can see most of the killer features for me are implemented as extensions (and there's hundreds of them available!). Yeah, it's definitely the ability to so dramatically customise Firefox that I love the most. Combining the best-of-class built-in features of Firefox with really cool, useful extensions really makes it a pleasure to use. I won't use IE, or Maxthon, again. Unless Microsoft really picks up their game.

Anyways Cam, stick with Maxthon if you like...it's a decent app. But not good enough for me because Firefox is wicked-cool!

PS if anyone wants links to any of those extensions (I'm being lazy tonight) drop me a message.
PPS If you aren't already subscribed, Cam's blog and the G'day World podcast that he does with Mick Stanic are well worth a visit...

Wednesday, December 15, 2004

MSN Toolbar - OK, but Copernic rocks!

I was trying to avoid mentioning - like everyone else - that Microsoft have just released the new version of the MSN Toolbar, currently in beta form. The big deal with this release is that they've integrated desktop search, allowing you to search all of your files on your local PC by performing a simple keyword search. Many people are comparing it, often favourably, to Google's recent offering, Google Desktop Search (GDS).

Why didn't I want to say anything? Because every man and his dog is talking about it (links courtesy of Robert Scoble). But everyone seems to be comparing it to GDS. Or they just really like it because it's from Microsoft (how the hell did Paul Thurrot achieve any credibility with the drivel on his site?). No one seems to be talking about other alternatives, in particular my favourite desktop search app, Copernic. As far as I can tell MSN Toolbar desktop search is in NO WAY superior to Copernic. And Copernic has at least the following advantages:
  • Much better UI
  • Indexes many more file types (take a look at 'em all!)
  • Has a quick preview panel
  • Has been on the market - well out of beta testing - for aaaages
  • Works well with Firefox (indexes bookmarks and history)
Can't see Microsoft providing that last dot point in a hurry... ;)

I don't understand why Copernic doesn't get more coverage, is it just because it's not from Google or Microsoft?

Anyways, if you're a Firefox user (come on, don't tell me you still use IE?!) and have Copernic , there's no reason to install MSN Toolbar, in fact it'd be a massive backward step! Even if you are an IE user don't bother with MSN Toolbar, use Copernic instead - unless you're just using it for pop-up blocking and auto form filling.

Not that MSN Toolbar isn't a bad app - it's not. It worked relatively effectively and reliably in my testing. It's just that, well, it's not as good as its competitors. And certainly not worthy of the fuss being made in the blogosphere at the moment!


[No, I don't have any affiliation with Copernic, I just appreciate well written software!]

Monday, December 06, 2004

The Spolsky NetSeminar

Anyone who's involved with software development or management should read Joel Spolsky's blog. Actually, if you're in this field it's likely that's redundant advice - you already do. Spolsky is an ex-Microsoftie who seems to have an abundance of solid common sense and I'm always excited to read his entries as they come out. So I was pretty keen to listen to a NetSeminar that he was involved with. Pity it meant getting up at 6 am, damn awkward time zone differences!

Anyway, I got up and sat my bleary eyes in front of the PC and tuned in. So how was it? OK, but not worth losing sleep over. I enjoyed when Spolsky spoke - I'm currently doing a lot of GUI development and he was talkin' my lingo - but there was a lot of coverage of the sponsor's (Electric Cloud) product which was particularly uninteresting to me. For two reasons - it was a completely different topic (distributed provessing to improve build times) to that which Joel was talking and thus the seminar felt very disjointed. Secondly, our company doesn't use makefiles and can't use Electric Clouds (apparently very effective) system[1].

So, a little disappointing.

Hopefully Joel will participate in more seminars in the future and will be able to cover more material...



[1] Incidently, we have trialled Incredibuild and have found it very effective, we were about this close to purchasing...if you're using C++ under Visual Studio and your build times are getting outta control give it a shot.

Podcasts & G'day World

It started with the Daily Source Code. Then the Dawn and Drew Show. DotNetRocks! was next followed by the odd IT Conversations. I'm gettin' addicted! I did poo-poo podcasts in the beginning - I couldn't see how they could possibly be effective. I mean I read about 400[1] times faster than anyone can speak. But then I found the perfect place to listen to them. A place where it is nearly impossible to read and my valuable time was being wasted. You see, I do a fair bit of driving. And here's a tip kiddies, it's the best place to listen to podcasts.

Go ahead and subscribe to those above podcasts, they're great! But, given that I have a nerdy background and I'm a proud Australian, I feel that I have to give a special plug to G'Day World. Created by Mick Stanic (I've read SplaTT's blog for awhile now) and Cameron Riley, this podcast is created by a couple of Aussie geeks and contains our unique sense of humour and slightly outta kilter perspective. The total number of shows is only at two at the moment but the guys are showing a lot of promise. Good luck and keep it up fellas.


[1] actual number may be exaggerated for the benefit of the story.

EPIC

It's been out for a while but if you haven't watched the flash presentation titled EPIC and you have a spare eight minutes you should take a look.

It chronicles how Google purchases TIVO, teams up with Amazon (to form Googlezon), crushes Microsoft and finally takes on the New York Times in a monstrous media clash in the year 2014. Some clever thinking with great narration and sublime :) execution.

Thursday, December 02, 2004

MSN Spaces

What kind of blogger would I be if I didn't cover the recent announcement that MSN Spaces has just gone live?

Dave Winer covered it very early, Scoble wrote why he wasn't going to (immediately) switch to it, Channel 9 posted two (1, 2) vids interviewing the MSN team, Chris Anderson created the first MSN Space that I viewed, William Luu was the first Aussie blogger I read that covered it (though Splatt has too, and I'm sure many others will follow!), Chris Pirillo also talked about the event, Jeremy Wright had a few things to say and even Steve Ballmer agrees that "Blogging is huge" (nice that you're on top of things Steve).

In short, every man and his dog is posting about this new enterprise from the software behometh.

And it's a big event. Although Microsoft have been ahead of the curve in encouraging its employers to blog it's taken them a l-o-n-g time to deliver blogging software. And while MSN Spaces doesn't look to be revolutionary, it's certainly a decent one-dot-oh effort. Typically, MS has integrated a number of complementary features into the offerring. Photos can be uploaded and displayed, you can put music lists online (and import lists from Media Player and purchase from MSN music by clicking on the generated links), and you can post interesting links. You can even customise the look of the site somewhat - though you don't have a great deal of control.

As I said, nothing revolutionary. There's certainly more powerful and flexible software around. What is really cool is that now the masses will have easy access to blogging. That can only be a good thing.

Naturally, I've created a 'space'...but I won't be moving in a hurry. The only change I'm considering is to host my blog on my own machine...

Anyway, gotta get some sleep so I can get up ridiculously early (6 am! Waaaay too early for normal people!) for Spolsky's NetSeminar.

Sunday, November 21, 2004

Boost 1.32 out

For you C++ heads out there, the Boost team has just released a new vesion of their amazing collection of libraries. If you code in C++ these libraries should be part of your development environment, it's as simple as that.

It's been almost 10 months since the last release and the Boost gang have used that time to create a whole slew of new libraries (Serialization, Assignment, Program Options, Multi-index Container, String Algorithm - just to name a few) and they've significantly updated many of the existing libraries (Graph, Python, MPL, Signals). Not to mention a huge number of defect fixes and documentation improvements.

'Nuff said, update your revision tool to include the new version of Boost! :)

As a long-time lurker to the boost mailing list, I'm well aware of the effort that is put into these libraries - and the uncompromising quality applied in the review process is phenomenal. HUGE thanks to the Boost guys from a very grateful C++ developer!

If you're a C++ developer who doesn't use, or see the need for, Boost libraries, please get in contact with me. I'll do my best to change your mind.

Thursday, November 18, 2004

World Wind - Endless Possibilities!

I assume that, by now, everyone has at least heard of NASA's World Wind application.

For those that haven't yet come across this fantastic piece of open source software, it's basically an interactive 3D view of Earth that you can spin around, and zoom in and out of. The wicked-cool thing is that as you zoom, it downloads satellite data to augment the 3D Earth.

[Oh yeah, this baby requires a fat internet connection - the fatter the better! My 512K ADSL connection struggles...thankfully they have caches of data that you can download to reduce the data you have to pull in from the 'net.]

You can also choose to download weather and historical - even animated! - data and overlay that too. Location names that increase in detail as you zoom in, are also present.

As I said, wicked-cool.

But what I find most intriguing is the possibilities that this software presents. One obvious area I'd love to see explored is extending this program for educational use. After using it for an hour or so I absorbed much more about U.S. geography than I had in years. "Oh, there's the Statue of Liberty! That's where Alcatraz is! Check it out! The Hollywood sign!". Kids would be totally blown away. And, with some guidance, they could really learn what's typically considered a 'boring' subject - geography.

Maybe we could add a 'narrating tour guide'. It would list things like:
  • Visit the sites of the seven wonders of the world
  • Learn where all the important political (or museum, or trade centres or...) strutures are located
  • Drop by the top ten tourist locations in Europe

You could press a button and zoom! Off you go, learning while watching the Earth spin in front of you while the tour guide informs you what you're looking at.

Less ambitiously, a list of significant landmarks could be created and some easy way to search and jump to them provided. Neat.

[Incidently check out the hotspot finder that has screen grabs of locations found in World Wind.]

And what about adding some form of charting overlay functionality? Wouldn't it be cool to see a bar graph extending out of the Earth for major locations - and the length of that bar represented population. Or number of homeless per thousand. Or average wage. Life expectancy. Perhaps pie graphs could hover over each state in a country breaking down how that state voted in an election. Imagine being able to somehow hook World Wind to Excel so you could modify those graphs dynamically!

Maybe instead of graphs you could colour the towns/states/countries. So a red country could represent high unemployment and green low. What a great way to visualise geographic data!

What about reducing the World Wind app into a component that could easily be plugged into, and controlled from, other applications? Imagine your favourite instant messenger embedding such a component to show you where the person(s) you're communicating with are located. And of course, your friend's local time and weather could also be displayed so you know if you've woken them up in the middle of a stormy night.

How about performing a trace route and plotting the lines as your packet travels from location to location?

Imagine a souped-up telephone directory - you perform a search for someone and bam, the embedded World Wind rotates and zooms in to show their house. (Actually that's kinda spooky)

What about integrating it with airplane flights? You could type in a flight number and see the start and end locations. If you added some way to represent time then you could even see where the flight is expected to be at any specifed time during it's flight (and hey! You could even 'look' underneath the airplane's location to see what's below.).

Take it one step further - why not plan holidays with World Wind aided software? All of your flights could be chosen with it (imagine the lines drawing over the Earth as you 'simulate' your flights from country to country) and you could use the software to look around your destinations, picking the interesting places to walk to from the detailed satellite images.

And if you could hook google into the system then wouldn't it be useful to search for stuff in a location-aware manner? "Where are the restaurants around this place?" Thirty four dots appear over the satellite images. Click on a dot and you're taken to the restaurant website.

[I wonder if google have thought about this already and that's the reason for their recent acquisition of Keyhole (a commercial competitor to World Wind)?]

I can't stop thinking of ideas.

GPS offers more possibilities. What about integrating it with a taxi service so they can track their vehicles? Many taxis have GPS transponders on the car - if they were to constantly trasmit the GPS information from the taxis to a base station then each taxi could be plotted in World Wind! And each taxi could have an embedded World Wind in the car so that when a new fare arrives on their list they can see where they wish to be picked up from!

Given that many newer cameras are coming out with the ability to embed photos with positional data (from an inbuilt GPS transceiver), what if you could upload your embedded photos to a huge online database? Then connect World Wind to the database. You could then view all the photos that were taken around any area that you zoom in on!

We could replay significant moments in history. All we'd have to do is provide a way to navigate through time, add some historical data and voila! Man, it'd be amazing to progress through our known history - watching as Christ was born, the Romans building their empire, World Wars... All of that would need to be computer generated, of course (I'm not aware of any satellite's flying over Christ's head!), augmenting the satellite data. Could we make both geography and history fun?!

Of course ultimately our ideas would grow to loftier aspirations. Celestia and Stellarium are two programs that are similar in nature to World Wind - they allow you to zoom in and move around a virtual landscape. Only in these programs that landscape is the entire universe, not just Earth. You can fly around the universe watching the planets in motion, and (natural) satellites in orbit. Stars, planets, satellites and whole galaxies are accurately modelled. These programs don't have the same level of detail (no satellite data!) that World Wind has though so what would be waaay cool is if we could mix the two types of programs. Use Celestia/Stellarium to fly through the universe then, when the Earth is zoomed upon, switch to World Wind technology.

Is there any underwater data/images? Could we add that to World Wind?

Anyway, the more I think about it the more applications I can envisage. And given that I'm a software developer and all the code is just there then it's pretty exciting.

What do you think? Do you have a whacky idea related to World Wind?

Now if you'll excuse me I've got to try and turn my mind off and get some sleep...


Saturday, November 13, 2004

End of Holidays

Well, here I am nearly at the end of a two week break from work. My girlfriend Melissa and I spent a fantastically relaxing holiday on Hamilton Island just off the coast of sunny Queensland. Oh yeah, uber nice. :) The weather was perfect (high 20s, low 30s every day) and everywhere you looked appeared to be straight off a tropical postcard photo. Damn I hate the post-holiday blues. ;)

I can highly recommend going there - here's some highlights for anyone else who is thinking of going:

  • We took a day trip on the Banjo Patterson (a sixty foot yacht) to Whitehaven and Corkie's - a terrific experience. Whitehaven beach is breathtaking - make sure you get there (though I'd suggest avoiding the Fantasea catamaran, it's just too mass-market for me).
  • The buggy's are terrific to drive around. :)
  • Go with the Safari Tours boys to Coral Cove - a magnificent, tiny, quiet beach. The hosts are great fun!
  • Spend time around the pool sipping cocktails - and make sure you order one from the in-pool bar. :) Our favourite was "Mud Baby". Mmmm. :) Remember to bring some good books to read.
  • Take out a catamaran for an hour or two. But remember to apply sunscreen!
  • I ran out of time but in hindsight I would have loved to have gone scuba diving with the H20 team. They can give scuba training if need be or alternative just go snorkelling on the reef. Only heard good reports about the reef trips from people I spoke to.
  • Enjoy eating out - Romano's was a highlight (the Gnocchi Gorgonzola was fantastic) as was the Rib Eye Fillet at Spinnakers. The Outrigger is lovely too, especially for quieter more intimate dining.
  • For a cheap eat grab a hot dog for lunch from the Bougainvillea bar (near the pool in front of the Reef View hotel).
  • Wake up early (4:30!) one morning and watch the sunrise from the "sunset" lookout. You'll have to walk though as you aren't allowed to drive the buggy at that time. Be amazed at the wildlife that you'll see (kangaroos, peacocks, cockatoos etc).
  • Go to the same place at sunset - remember to buy a cocktail. :)
  • Be wary of the Irukandji jellyfish that start populating the Whitsundays from mid-November!
  • Check out the Wire Flyer for some flying fox/hanggliding action.
  • Take advantage of the photographers that roam around. The deal is that they take a handful of photos of you (and partner, family, whatever) and put them up on a big board in the photo shop. The next day you can see the photos and just buy the one(s) you want.

It's a great place with a very relaxing vibe...I wouldn't hesitate going back! :)

When I get my photos developed (yep, I'm an old school 35mm photographer - only because I can't afford the $2K for the digital SLR that I want!) I'll scan them in and post them.

Now I've got to come to terms with going back to work... :( What's a partial template specialization again?? ;)

Thursday, November 11, 2004

Firefox 1.0 has been released!

If you're still using Internet Explorer (ick!), do yourself a favour and download and install a copy of Firefox. (Or better yet, use one of the mirrors)

Firefox is so warm and fuzzy it'll make your days oh-so-much better. :)

It's finally reached version 1.0 after a two year development period and is now ready to take on the world (well, IE). Good luck Firefox!

Big thanks and respect to Ben Goodger and the team.

Saturday, October 16, 2004

Information Overload

Blogs are great. It's incredible how easy it can be to be well-informed!

But today I'm not here to extol the virtues of blogs. Instead, lately, I've often found that I am almost becoming inundated with stuff to digest - and if I unplug for a few days I find I have thousands of entries patiently awaiting my eyes' attention.

I also find that it can affect my work. Often while I'm waiting for a build (typically a handful of minutes) I'll bring my Bloglines [1] account to the foreground and have a read. If I'm not dilligent I find that it's easy to get distracted by all the interesting things going on in the world. Twenty minutes later I remember that I was waiting for a build. Damn my curious nature! I don't let it happen often but I'm considering banning myself from reading during work...

How people like Scoble, with his 1000-odd feeds (as compared to my paltry 60!) manage is beyond me...I don't get enough sleep as it is! How do you do it Robert?

In two weeks I'm going on holidays (Hamilton Island in the Whitsundays - can't wait!) for seven nights. I'm almost scared to imagine how much reading I'll be doing the first day I log on!

Anyway, I'd be curious to know how everyone else manages their feeds. Don't be shy. :)



[1] Like many others, I've found Bloglines a terrific service - my blogroll is publically available, feel free to take a squiz or recommend blogs that you think I may be interested in.

Friday, October 08, 2004

The Danger of Software Patents

We just had Richard Stallman in town giving a talk about the Danger Of Software Patents. It's not often that we get such illuminaries all the way down here in Melbourne, so I went along and was hugely impressed by his talk. His arguments were compelling and his delivery passionate - I couldn't help but agree with every point he made.

His major points, as I saw them were:
  • Software ideas patents make development hard, particularly for small development groups
  • They help big mega corporations, often at the expense of the small development group
  • They hinder progress (exactly opposite to their intention)
  • Patent lawyers are the only ones who really make money from the system
He's working hard to abolish patent laws in as many countries as he can. He figures that his country is too difficult to change but if other countries don't have the laws then the US will be at a disadvantage and will be forced to change.

I was converted. Power to the man. My little role in the issue now includes informing as many people as I know about the destructive potential that software ideas patents have. Particularly to developers who typically just don't know.

Listen up kids, software idea patents are bad, mmmkay?

PhotoPod

The rumour mill is churning over the apparent leaking of information about a new iPod - a wonderful device that has a colour screen, 60 Gig HD, and audio/video out ports. Not only would you be able to store your beloved music on such a device but also your digital photos! Wicked-cool.

It's an obvious extension to the iPod lineup (and something that has been talked about for ages) and I personally am hoping that the news is more than just vapourware. I love my 40Gig Gen III iPod but I would be so tempted to replace it!!

Read about it here and here.

[UPDATE: Of course the iPod Photo has been released and it looks like another winner from Apple.]

Sunday, October 03, 2004

Better tabbed browsing in Firefox

Everyone favourite browser (well, mine anyway), Firefox, has now got even better tab handling. You can now tell Firefox to open new tabs when external applications try to open a new page. Yay! :)

Now there's no need to install extensions to deliver this feature (TabBrowser Preferences, TabBrowser Extensions and Single Window all provided similar features).

It's currently in the daily builds but is looking good for the 1.0 release.

Chu Yeow covers the issue in more detail at redemption in a blog.


PS If you're not using Firefox, why not?! As far as I can see it's better than IE in every way...please comment if you've tried it and 'gone back'!

Wednesday, September 29, 2004

C++ GUI development is immature

I know there are plenty of C++ GUI libraries out there. Here is an incomplete but significant list:
  1. wxWidgets
  2. Qt
  3. FLTK
  4. gtkmm
  5. FOX
  6. TnFOX
  7. Notus
  8. Ultimate++
  9. Toad
  10. CxxGUI
  11. Inti
  12. VCF
  13. MFC
  14. WTL
  15. Win32
  16. Win32Gui
  17. SmartWIN
  18. WinForms
Whew! That's a fairly long list. But you know what? Although many of them are reasonably good none of them provide me with all of the features I want or need. Here's what I want:
  1. Cross platform
  2. Well documented
  3. Modern (and well designed) interface
  4. Easy to use
  5. Widely used
  6. GUI editor (RAD tool)
  7. Free
None of the aforementioned GUI libraries can satisfy all my needs and that sucks rocks.

Friday, September 17, 2004

Raymond Chen & the visual history of spam and virii

Raymond Chen, one of the key developers at Microsoft (he's been around for aaaages), has one of the better geeky blogs on the net. If you have to develop on the Windows platform on a day to day basis you should check it out.

One of his recent posts dicusses spam - he's tracked every dodgey email and virus that has ended in his inbox and created a graph depicting when it arrived and how big it was.

The way such a mass of data is presented in such a digestable way would make Edward Tufte proud.

The result is fascinating, and there's good news; spam seems to be reducing...

Tuesday, September 14, 2004

The Rasterbator

If you're into printing really big images take a look at The Rasterbator.

You give it an image (up to a meg in size) and it spits back a pdf that contains your image spread over pages and pages using large dots to 'render' your image.

The finished product just looks way cool. :)

Monday, September 13, 2004

Wikalong issues

I've recently had a few problems with the Wikalong[1] extension for Firefox. It seems to have issues with a couple of other extensions, in particular DuplicateTab and UndoCloseTab. Instead of letting those extensions do their funky groove thing and create a duplicate tab, or regenerate a previously closed tab, the newly-created tabs are blank.

Not sure if the issue is with Wikalong or DuplicateTab or UndoCloseTab. But I found disabling Wikalong fixed the issues (and the tab extensions are more important to me at the moment!).


[1] Which is a terrific idea incidently! Kudos to the author.

GMail invites

Like many other bloggers out there, I'm offerring gmail invites to anyone. First in best dressed. If you're interested just email me your email address. I can be found at:

matt_dot_trentini@gmail.com

Just replace "_dot_" with ".". Dontcha just love spam? ;(

Saturday, July 31, 2004

Transform - Algorithm of the month

If you've found yourself iterating over a container so that you can extract something out of each element and place it in another container you are doing it the hard way.

The std::transform() algorithm is your friend. It allows you to modify the elements of a container based on the input of another container.

An example:

// IntWrapper.h
struct IntWrapper
{
    int x;
};

// YourCode.cpp
std::vector <IntWrapper> wrappers;
std::list<int> numbers;

for(std::vector<intwrapper>::const_iterator wrapperIt = wrappers.begin(); wrapperIt != wrappers.end(); ++wrapperIt)
{
    numbers.push_back(wrappers.x);
}

Not an uncommon situation.

A better way to do it:


// IntWrapper.h
struct IntWrapper
{
    int x;
};

// IntWrapperHelpers.h ** Could also put in IntWrapper.h or even make it a member function of IntWrapper **
int extractX(const IntWrapper &wrapper);

// IntWrapperHelpers.cpp
int extractX(const IntWrapper &wrapper)
{
    return wrapper.x;
}

// YourCode.cpp
std::vector <IntWrapper> wrappers;
std::list<int> numbers;

std::transform(wrappers.begin(), wrappers.end(), std::back_inserter(numbers), extractX);

Although it's marginally (one line!) more code I argue that this is a far superior solution.

For starters, if you need to do this operation more than once you can reuse the extractX() function. Secondly, the transform function is self-describing. Just by reading it you can tell that numbers is going to be transformed in some way based on the elements of wrappers. A simple iteration, as in the fist example, requires you to delve into the code to deduce that. Finally, because extractX() is part of IntWrappers interface (Don't believe me? Read Scott Meyers' article How Non-Member Functions Improve Encapsulation) the "extraction knowledge" is encapsulated more cleanly - clients don't need to know how to get x out of an IntWrapper.

Anyway, my guideline is that whenever I'm iterating over a container to fill another container I use transform. I always find that it saves me time in the long run.


P.S. There's another form of transform - it fills an output container based on two input containers. Using it is very similar to the single input container. I'll leave the exploration of that algorithm as an exercise for the reader... :)

Friday, July 30, 2004

Boost Introductory Presentation

The Boost libraries are some of the most powerful and important libraries a C++ developer should have in their arsenal.

In the future I'll be covering some of those libraries in depth. For now, if you're unfamiliar with the libraries take a look at an Introductory Boost Presentation I created awhile ago. I delivered the presentation to some of my colleagues who weren't aware of what Boost offerred and it was received pretty well. Now I'm just trying to get them to use some of the libraries on a day to day basis...

It can be hard changing the way people work!

Boost also maintains a bibliography if you're looking for more articles...

Thursday, July 29, 2004

First post

OK, here it is. I've finally gotten off my butt and created a blog, joining the hordes. And here is the obligatory first post. :)

To give you fair warning this blog will concentrate mostly on issues that affect software developers. C++ is my lingua franca so expect programming related topics to focus on that beast of a language.

I'll be covering things like: sound design principles, tips on using various tools and how to figure out what happened when Things Go Wrong.

It's likely I'll go off on many tangents - don't fight it, just hang on and enjoy the ride. :)