Posts from 2006
-
:
Programming by contract in C++
There’s the first part of what I expect to be a very nice article about programming by contract in C++ over at The C++ Source: The Nuclear Reactor and the Deep Space Probe. Updated 3rd Jan 2006 - the article now appears to be called … -
:
C++ Tips: 1 - Avoid unnecessary optionality
One of my main aims when writing code in C++ is to have the code clearly communicate its purpose. I find it useful to be able to look at a single line in isolation and have a pretty good idea of what its effects are on the code that it … -
:
C++ Tips: 2 - Avoid designing undefined behaviour
When designing code it’s often easy to include undefined behaviour. The need for code that exhibits this kind of behaviour is, however, generally pretty rare and there are often ways around allowing undefined behaviour. In general … -
:
C++ Tips: 3 - Strive to be const correct
Another extremely powerful tool that you can use to ensure that your C++ code communicates as clearly as possible is const. By correctly using const all the time when designing your abstractions you can divide an object’s interface … -
:
LEGO Mindstorms NXT
LEGO has announced a new version of their Mindstorms autonomous robot building system. I did a fair amount of playing around with the original Mindstorms kit way back when and created a system that allowed you to control your robots over a … -
:
iTech Bluetooth Virtual Keyboard
VirtualKeyboard.jpg I recently purchased an iTech Bluetooth Virtual Keyboard for use with Michelle’s PDA. It’s basically a little box that’s about the size of two packets of chewing gum with a red window in the top. It … -
:
C++ Tips: 4 - Learn to work in terms of abstractions, no matter how small
In the fight to make C++ code easier to reason about and understand, never underestimate the value of a name. Giving something a decent name is the first step in thinking about the concept at a slightly more abstract level. Abstraction is … -
:
Grumpy old men
Am I a curmudgeon of technology? You betcha - Ted Neward over at “The Blog Ride” explains why he’s cynical about new technology and suggests that we’d do well to have a little more cynicism. I agree with him, I tend … -
:
Implicit Interfaces
ImplicitInterfaceImplementation - from Martin Fowler is an interesting piece where Martin suggests that it would be useful to be able to provide alternative implementations of a class’s implicit interface. That is, given a class that … -
:
Something all C++ programmers should know when using managed C++
Beware! The rules for when a destructor is called for a managed C++ class in Visual C++ are different than for “normal” C++ class. Jochen Kalmbach recently posed a simple question about a managed C++ class; “Will the … -
:
Now I'm confused (C++/CLI destructors)
So here I am, writing a piece about how the C++/CLI destructor and finalizer stuff could have been a bit neater and I put together some sample code to demonstrate my point and it doesn’t do what the docs I mentioned yesterday suggest … -
:
Detecting the Excel Function Wizard
I’m currently working on some C++ Excel addins for an investment bank. I originally wrote the addins for them back in 2001 and they’ve evolved slowly ever since. Right now we’re adding some new functionality and, whilst … -
:
Beware the momentum of prototype code
A while back Chris Baus wrote a little rant about prototypes. I started to write a piece that defended prototypes when correctly used and ran out of steam; or, more to the point, couldn’t really say very much except they’re OK … -
:
Excel addins sharing data
Or, marvelling at my own, past, cleverness. I’ve been doing a lot of work on these Excel addins for my current client and, as I get back into the whole C++ XLL stuff, I start to realise just how cool my child of 2001 really is. The … -
:
Online autism 'test'
I scored a 28, which is “above average”, so considerably nearer to Asperger’s than it is considered to be “normal”. Which, to be honest, seems about right to me. If nothing else, it might make you think… … -
:
Shaping the future of the XLL interface in Excel 12
If you’re into writing C/C++ XLL addins for Excel and you’d like to help make sure that the new features in the new XLL interface provide all the functionality that you’d like, then it might be an idea for you to get in … -
:
So that's what it's called
Jeremy D. Miller points out that my ‘second’ style of coding (see here) is called writing a “spike” in XP terms. -
:
A collection of links
Once again I’ve been too busy to comment on the following blog postings in a timely manner so here’s a collection of stuff that’s been sitting in my “good stuff” list for a while now. Josh Carter over at … -
:
Purecall
I’ve been plugging away at my multi-process Win32 debugger code this week and one of my test harnesses had started to suffer from intermittent “R6025 - pure virtual function call” errors. These tend to crop up if you call … -
:
First tracks
Last week I managed to get my GPS code to download the GPS “track” from my device and create an html file that uses the Google Maps API to display it as an overlay. I spent some time trying to get the map to display correctly … -
:
When your mocks are executable
The size of the “units” that I test with my unit tests varies quite considerably. Usually I tend to work at the single class level; the test will provide mocks for the services that the class requires and the tests will ensure … -
:
The best toys always come with an SDK, 2
I finally got around to upgrading my mobile phone from an aging Sony Ericsson T68i to a more current (though still hardly bleeding edge) Motorola Razr V3. I’m not interested in the downloadable java games but the fact that you can get … -
:
Charles Petzold on why he loves books
Charles Petzold confesses his love for books. I must admit this bit really hit home for me: “I love how my books remind me of passages in my life. I love the shelves of authors I’ve been obsessed with, and the books that knocked … -
:
Always Produce
Paul Graham writes about “How to do what you love”… It’s quite a good piece but the best bit is hidden down near the end. He suggests that a good way to “stay honest with yourself” about dreams to do … -
:
Look back and shudder
I’m currently investigating a memory leak in a complicated piece of multi-threaded code. Unfortunately the code doesn’t have any unit tests and the leak only shows up reliably in the release build. Worse, I wrote the code and … -
:
Leak plugged
Well, the leak in my legacy code wasn’t too hard to find. There was one potential leak and one screamingly obvious leak. I’ll post the fixed code tomorrow. -
:
More on the socket server leaks
It seems that the leak that I found isn’t likely to be the one that my new user of the code is having problems with. They’ve built the code with Visual Studio 2005, made a few (correct) changes to the code to get it to build … -
:
Back from Megève
I’ve been skiing for the last couple of weeks and now I’m back in London; normal service will resume soon. -
:
Sounds like a real nice way to work
Noel Llopis, over at Games From Within, has written a nice piece about a typical workday at his work place, High Moon Studios. It certainly sounds like a nice way of working. Unfortunately I haven’t been involved in quite that agile a … -
:
Good stuff
Once again I have a list of items flagged for comment in Bloglines but at least this time I have an excuse: “We were on a break!”. First is a link from Brad Wilson to where Bruce Eckel writes about how the “Hyper … -
:
New kind of spam?
Recently I’ve been getting lots of emails from people who seem to think that my company, JetByte Limited, is currently recruiting. We’re not now and are unlikely to be in the near future, but that doesn’t mean people … -
:
More on the socket server VS2005 'leaks'
A while ago I reported that I’d been seeing very strange memory usage patterns in the debug build of the simple echo server when built with Visual Studio 2005 using the standard version of STL that ships with it. The thing that … -
:
VS2005 STL strstream and stringstream leaks
Well, it turns out that my initial gut instinct about the leaks that I found in my socket servers when built with VS 2005 was correct. It was an STL thing. The following code reproduces the problem. #include <strstream> #include … -
:
Latest release of socket server code
The latest release of the free version of my asynchronous, windows, IOCP based, socket server framework can now be obtained from here at ServerFramework.com. The latest release is really just a bug fix and compiler compatability release. … -
:
Table for one
Sorry about the lack of technical postings for a while, this last month or so has been rather hard for me. On 13th February I became suspicious that something wasn’t quite right with Michelle, my partner for the last 17 or so years. … -
:
Ah, so that's what it's like to make the front page of digg!
Typical. My usual subject matter isn’t interesting enough to get onto digg.com, etc. but a throw-away post about using Ethereal to catch my partner cheating gets on the front page… Ah well, such is life :) I’ll just try … -
:
It must be a slow news day when...
My relationship break-up posting gets linked to from CNN.com… And, of course, they put their own spin on it… However, as I mentioned in a reply to one of the comments on the original posting… “Actually, I wrote a … -
:
Ok, now I'm confused
I’ve been looking at my web server log analysis and I have three peaks in my graphs for the last few days. The first big peak, 6,000 hits per hour, was on 28th March when my relationship break-up post was on the front page of digg. … -
:
Deadlock detection tool updates
When I came back from skiing in Colorado I had a bug report from a client and it took me a fair while to isolate the problem for them. The report suggested that a server that I’d built for them a while back was deadlocking in certain … -
:
Comments disabled for a while
My hosting provider has changed something in their perl instalation which means that MT-Blacklist (the thing that protects this blog from comment and trackback spam) is broken and not doing its job properly. I’ve located a fix but … -
:
Comments and trackbacks are now back
I’ve fixed the MT-Blacklist problem and so comments and trackbacks are now working again. -
:
What this blog is ACTUALLY about
Given all the publicity that this blog has received recently over my relationship break-up I thought it might be a good idea to give any new visitors a jumping off point into some of the more popular technical pieces. Believe it or not, … -
:
TickShifter v0.1
Well, I figure that I’ve written about these debug tools that I’ve been working on for long enough. The time has come to make one available for other people to use and abuse. Given that I hope to sell some of these tools … -
:
TickShifter v0.2
As I mentioned a while back, I’ve been working on adding rudimentary GUIs to my debugging and testing tools. In fact, both the deadlock detection tool and the time shifting tool are both functional enough for real world use but the … -
:
Tools, debug thyselves
One of the first things that I tried to do with the latest release of my TickShifter tool was to run it on itself. Of course, that didn’t work. There are several reasons why the tool might have had problems running on itself but I … -
:
I love it when a plan comes together
Discovering and then fixing the problem that prevented my tools from running on themselves planted a seed of an idea in my mind. My APIHook library and any code that used it died horribly under leak testing tools such as Purify and … -
:
Hijacking a thread in another process
My API hooking currently relies on creating a block of memory in the target process to hold the string that you need to pass to LoadLibraryW() and then calling CreateRemoteThread() and passing the address of LoadLibraryW() as the thread … -
:
IDisagree
Jeremy D. Miller talks about how he dislikes the “I” prefix on interface names and how he’d prefer to ditch it in the same way he’s ditched most other hungarian notation. I’m all for ditching hungarian but I … -
:
The thread hijack exercise was a waste of time
A few weeks ago I wrote about hijacking threads. The principle was good, the code worked but the reason I needed it was flawed so the exercise was a failure. I assumed that it was likely to be a failure when I set out though, so it’s … -
:
Mock32, parameterize from below
It’s funny how potential product ideas beget other potential product ideas and the thing that you eventually end up with as a product for sale is often far from the original product idea and the code that you started to write… … -
:
Argentina and beyond...
Normal service will resume at some point, but right now I have some skiing to do… I’m off to Argentina at the end of July for 2 months ski instructor training, then, when I get back I’m going to head off to Tignes to do … -
:
CLR thread pool woes
Joe Duffy has written an interesting piece over on “Generalities & Details: Adventures in the High-tech Underbelly” about problems with the CLR thread pool. Joe’s a program manager on the CLR team at Microsoft, so he … -
:
Deadlock detection tool design change for Vista?
It seems that Vista contains lots of interesting new Win32 API calls and some of these provide built in support for deadlock detection… I guess my deadlock detection tool can operate differently on Vista then… -
:
No, this recent activity doesn't mean that normal service is about to resume
I just realised that I hadn’t posted to here in two months. As I said a while back, my head is not really in the right space for me to be as effective, or interested, in my technical stuff at present. I’m finding it very hard to … -
:
Nerd in a cave
This is something that anyone living with a geek really needs to understand. I find it interesting that Rands has his set patterns of behaviour for getting into The Zone in the mornings. I’m very much a creature of habit and I … -
:
Something that has helped
It’s been a difficult few months for me recently. One of the things that has helped a lot was something that, thankfully, I discovered relatively quickly and have since refined somewhat. The refined version sounds very simple; … -
:
The most important C++ stuff, ever...
I’m still skiing in Argentina, the training is going well and within 3 weeks I’ll know if I make the grade and qualify as a BASI Ski Instructor… Because of all the skiing and partying and work out here I haven’t … -
:
I passed!
Well, today I discovered that I had passed the BASI Ski Instructor course that I’ve been taking in Argentina, so I’m now a Ski Instructor… We fly back from Bariloche to Buenos Aires on Friday and then onwards to the UK on … -
:
Socket Server code - addressing bug fix
There’s a bug in one of the constructors for CSocket::InternetAddress which means that changing the example servers to use a specific network adapter’s address, rather than INADDR_ANY will generate an exception from the call to … -
:
Why do developers still use VC6?
Tim Anderson asks why there are so many developers still using VC6… Well, as I said before, if you produce C++ software in source code form and any of your clients require that you support VC6 then it’s often easier to maintain … -
:
Socket Server Code - async connect failure handling change
I’ve just made a small change to The Server Framework. The change is in how the AsyncConnect() function reports connection errors and the potential problem can occur if there’s a race condition between a call to Close() on a … -
:
Question from a reader
I’ve just had an question from a reader via email: “I’m developing my huge server (I dont have much experience with programming servers) and as far as I know your source is the best available out there.. I would like fit … -
:
Meanwhile...
Meanwhile, I’ll continue doing slalom training in Tignes in the French alps… Beware, those poles are addictive! -
:
Update
I’m back in the UK briefly on 28th and 29th December and then I’m off to Davos for new year… I’m back in the UK in early Feb and then ski guiding for the Ski Club of Great Britain in Jackson Hole for 3 weeks from … -
:
Comments should now be operational again...
I’ve adjusted how I deal with comment spam and the comment system should now be active again…