Page: 0 ... 5 ... 10 ... 15 ... 20 25 26 27 28 29 30 31 32 33 ... 35 ... 40 ... 45 ... 50 ... 55 ... 60 ... 65 ... 70 ... 75 ... 80
Last one out turn off the lights.
Date: 8/7/2008
In my travels I've had reason to play with custom memory managers for tracking leaks. My particular flavour outputs a text file on exit with each leak and the stack frame of the allocator, including file and line numbers. Very useful.

Initially I ran the dump code using an atexit handler. This seemed to work well, but then I noticed that some global objects were being destroyed after the dump handler was called AND to top it off the handler would not finish. The process would exit WHILE the dump was mid stream. So you get some of the blocks but not all.

So I've been playing with other methods of calling the dump code in the right place. The best so far that I've come up with is this:
#include <process.h>
#include "MemTrack.h"

int main()
    char *buffer = new char[256]; // leak something

    // normal main code..

    #ifdef TRACK_MEMORY
    return 0;
Or something like that. The call to _cexit calls all the global destructors so that their memory is freed before you dump your blocks to disk. Then the ExitProcess is the neatest way to end the process right now without any more cleanup code being called. I played with _exit, but it didn't really exit right now... it wanted to call all the global destructors again. Not cool.

Anyway there you have it, an insight into calling code after all the global objects have been cleaned up.
(0) Comments | Add Comment

Electric Vehicle Technology
Date: 3/7/2008
Just thought I'd mention some technology developed in Australia that could put a serious dent in the argument that electric cars, motorbikes and bicycles aren't good enough yet.

Redox Gel Batteries

Farnow Pty Ltd, see this PDF for some more info, but it's basically a higher density gel battery that can be made cheaply, has a fast recharge time and can deep cycle.

Gemini Electric Motor

Gemini motors are using both ends of the magnets for better power output and efficiency.

Put both of these technologies together and you might get a vehicle that can compete with the gas guzzlers.

Except the technology is protected by the patent system. Which means that we won't see anything happen for another 15 years when the patents run out. In the meantime the human race is running headlong into extinction. All because a few companies need to make a buck. Or not.

Patents are overwhelmingly evil, there is no good side to them. Just stifled innovation to the detriment of human kind.

Previously. Previously.
(1) Comment | Add Comment

The "No files were found to look in." saga continues...
Date: 25/6/2008
Visual Studio 2002, 2003 and 2005 all have a delightful little bug where sometimes the keyboard state can get messed up so that find in files stops working with the error message:

No files were found to look in.
Find was stopped in progress.

Which I've blogged about before. The commonly held solution is to press Ctrl+Scroll Lock and everything is dandy again.

Well until yesterday that is. Where upon that error message appears in my Find Results pane. I dutifully look up the key press on my own blog (who remembers these things?) and press the key combo. And...? Nothing. Still the same error. Huh?

So back to dearly beloved Google, and I'm searching around. And ran into an alternate solution.

Yes, a different key combo.

For the same problem.


I present to you: Alt+Pause/Break.

Yes... believe it. If the first combo doesn't work, try the 2nd. I suspect by now there are "n" different combos that might need to be invoked to pacify the raging Visual Studio, and that getting you hooked on Ctrl+Scroll Lock is just a gateway drug to a whole swath of arcane key combos that you have to know. I expect that this would make a good interview question.

(4) Comments | Add Comment

Debugging Linux GUI apps.
Date: 23/6/2008
When you are running X windows apps in gdb and they grab the mouse and then crash or hit a breakpoint your console is locked out, you can't do anything except quit the app from a text terminal (i.e. Ctrl+Alt+F1).

However there is a better way. Add these lines to your X11 config:
Section "ServerFlags"
    Option "AllowDeactivateGrabs" "true"

And restart X, now you should be able to use Ctrl+Alt+NumPad / to "ungrab" the mouse at any point and debug the issue in gdb.


But it begs the question, why is it not on by default?
(2) Comments | Add Comment

Longest Back Order Ever
Date: 5/6/2008
Some 8 months after I ordered a BYOC EQ pedal it arrived today, just as the Aussie BYOC distributor is calling it quits.

I didn't intend for it to arrive the same week as the Microprocessor, I'll be getting pretty good at wielding a soldering iron yeah?

On top of that I finally picked up D.M. Cornish's Lamplighter last week, written by a friend of mine who now lives in SA.

How am I ever going to get time to code?
(1) Comment | Add Comment

Scripting Engine v2
Date: 4/6/2008
Basically in the background over the last few months I've been working on a complete rewrite of the Scribe/i.Mage/i.Hex scripting engine to a bytecode/VM model. Currently the engine is going into i.Mage first as a non-default option (i.e. it'll use the v1 engine by default) until I shake out all the bugs.

The main reason for doing it is a lot more speed. The initial version 1 engine was a dumb interpreter and hideously slow. I'm not sure how much faster it'll be until I get a few more things working but I'm expecting a 10x at least increase in speed. The 2 engines run the same code in the same environment, but the error checking is a lot better in the new engine. At the moment it's a switch branching design (i.e. dumbest) but it'll do for the moment. I can refine the internals later if need be.

This will be shipping in the next release of i.Mage, and most likely be the default and only engine in Scribe v2.
(1) Comment | Add Comment