« March 2008 | April 2008 Archives | May 2008 »

Practical Testing: 16 - Fixing a timeout bug

| 5 Comments
Back in 2004, I wrote a series of articles called "Practical Testing" where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to show how writing your tests before your code changes how you design your code. Then, in 2005, I adjusted the code to be more scalable and I showed how the tests that had originally been written helped when code needed to be changed for performance purposes. Finally I uploaded a test utility program that I'd been working on, TickShifter, that…

It seems I'm not the only one...

| 0 Comments
It seems I'm not the only one to make mistakes with GetTickCount() based timer code, see: System.Threading.Timer fires immediately when specifying a large value for due time.…

Practical Testing: 17 - A whole new approach

| 0 Comments
The comments to my last practical testing entry got me thinking. The commenter who had located the bug in part 15, which was fixed in part 16, suggested a new approach to the problem and I've been investigating it. The suggestion is, essentially, to use a timer with a longer range before roll-over rather than GetTickCount() with its 49.7 day roll-over. In Vista and later we could just use GetTickCount64() but on earlier platforms that's not available to us. My commenter's solution was to build a GetTickCount64() on top of GetTickCount() and use that. Given that adjusting the code for…
There's an interesting article over on the Dr. Dobbs Code Talk blog; PQR - A Simple Design Pattern for Multicore Enterprise Applications. It documents a design that I'm pretty familiar with and one which has worked pretty well for me in the past (this project was built in this way, for example). My variation on this idea is that it all tends to be in one process. Work items are passed from one 'processor' to another via queues and each processor can run multiple threads to process multiple work items in parallel. In simple systems you end up with a…

What would I do??

| 0 Comments
There's an entry over on the Dr. Dobbs blog about testing and how you make sure that your tests are testing the right thing; effectively, who tests the test. There's a question at the end "What do you do?" and I think my rather pithy, I've had some wine, answer is, "I think harder". The poster laments the fact that if you're doing TDD then the test fails first and then you write the code and then it works and therefore you know the test is testing the correct thing but if you have existing code then, well, it doesn't…

Comments, captcha and blacklist...

| 0 Comments
I've turned the blacklist back on. I turned it off yesterday and have had a couple of spam comments get through. The blacklist itself doesn't always catch the spam comments but it does give me a one click method of removing them. With it turned off I lose the easy removal. If your comment is refused you should get a message telling you why; the reason is logged, but, unfortunately the full comment txt isn't. The best approach if you have a legitimate comment that you cant post is to either email me, or leave a simple comment that explains…

Spam problems

| 3 Comments
This morning a spammer somewhere seems to have used my main email address as the return address on a whole bunch of random spam that has been sent out from all over the place. As such I have around 3000 undeliverable mail responses flowing into my in box. No doubt this will now have knock on effects with ISPs who use DNSLB type systems as my domain is being used by spammers again. What's the best way of dealing with this kind of problem?…

Spam gone...

| 2 Comments
The endless torrent of bounce messages began again yesterday evening. Once again it was arount one email every 2 minutes or so. I turned on my laptop this morning expecting a few thousand emails to download and only a third of them to be correctly classified as spam by Outlook... There were a few, but, probably, under 10. There was no other spam either... Two legitimate email messages... It was, well, rather strange. Of course this didn't seem right. I sent myself a test email and that worked. I checked the webmail interface and the mailbox was really empty. I…

Socket connection termination

| 4 Comments
I've been putting together a sample server for a client that shows how to cleanly terminate a socket connection. This should have been a simple thing to do, but in doing so I've discovered some gnarlyness within The Server Framework and the result has been some new TODO items for the 5.3 release... When you have an active TCP/IP connection that you wish to terminate cleanly you need to initiate a TCP/IP protocol level shutdown sequence by calling shutdown(). This sends the appropriate packets between the two TCP/IP stacks (server and client) and terminates the connection. Once this is done you can…
« March 2008 | April 2008 Archives | May 2008 »

About this Archive

This page is an archive of entries from April 2008 listed from newest to oldest.

March 2008 is the previous archive.

May 2008 is the next archive.

I usually write about C++ development on Windows platforms, but I often ramble on about other less technical stuff...

Find recent content on the main index or look in the archives to find all content.

I have other blogs...

Subscribe to feed The Server Framework - high performance server development
Subscribe to feed Lock Explorer - deadlock detection and multi-threaded performance tools
Subscribe to feed l'Hexapod - embedded electronics and robotics
Subscribe to feed MegèveSki - skiing