By ian | Published:
March 5, 2010
Yes I know, shocking isn’t it? Too busy doing work that pays the bills to blog about random things I find interesting or amusing.
So what’s been keeping me away from WordPress?
- Spending too much time in WinDbg tracking down .NET and COM memory issues.
- Wanting to have a good look at Visual Studio 2010 and .NET 4.0 (though not as much as I’d like, yet)
- Playing lots of Bayonetta
, and some Heavy Rain
.
- Doing lots of internal demos of the WPF\F# GUI-building toolset we’ve been working on. Should be interesting, specially now Luca’s coming on board.
- Experimenting with iPad development
Hopefully I’ll get the chance to write something about all of this soon.
By ian | Published:
January 31, 2010
On Windows, if you regularly change screen resolution or size, perhaps by accessing a machine remotely, you might find some of your application windows are no longer visible; they’re positioned outside of the visible display area. If you can’t see the window, it can be a little difficult to use the application. How can you get that window back?
Read More »
By ian | Published:
January 26, 2010


Pegs vs Triads
I’ve had two very different iPhone gaming experiences over the last few weeks:
Peggle and
Grand Theft Auto: Chinatown Wars. It’s safe to say I got completely addicted to Peggle, but when it arrived I couldn’t resist the temptation of having the GTA universe in my pocket too. After shelling out the almighty sum of £5.99 on the sandbox triad-’em-up, I discovered that there were many aspects of playing/using Peggle that make it a better fit on the iPhone than GTA. Let’s break down how these very different experiences manage the transition to a hand-held, “casual” gaming platform. What exactly does “usability” mean in this context?
Read More »
By ian | Published:
January 21, 2010
There are all sorts of nasty things to be aware of if you’re mixing reference-counted COM objects with garbage-collected .NET. For instance, if you’re implementing COM objects in C++ then you’re free to allocate them anywhere you like; on the heap or perhaps on the stack if you know they’re only used in some specific scope.
But what happens if during the lifetime of that stack based COM object, it gets used from .NET? A runtime callable wrapper (RCW) will be created around the object. And this RCW expects to be able to keep the underlying object alive by incrementing its reference count. Of course, the stack-based object will soon go out of scope, and regardless of its reference count the object will be destroyed and the pointer that the RCW contains will no longer be valid. It points into the stack, so when the RCW gets cleaned-up, the CLR will call via this pointer into memory that contains garbage and you’ll get something nasty like an access violation or illegal instruction exception.
Read More »
Posted in .NET, COM, Debugging, Software Development, WinDbg | Tagged .NET, c++, COM, Debugging, mscorwks, win32, WinDbg |
By ian | Published:
December 14, 2009
In the world of WPF with its powerful templating support, you’re much less likely to need to build a custom control from scratch than you are with legacy Windows GUI frameworks. For the vast majority of scenarios it’s possible to take an existing control and modify its appearance and behaviour to get what you need. However it is still possible and sometimes necessary to build something in code. The other day I was looking at creating one – using F# of course – and realised that a skeleton control serves as a good example of the kind of cross-paradigm features the language offers. They’re the kind of things that make it possible to use functional F# with inherently imperative .NET languages and frameworks like WPF.
Read More »
By ian | Published:
December 3, 2009
Novice Windows programmers can often think that DllMain is a good place to get that one-time set-up and tear-down work done. It seems to offer an ideal opportunity to know when your DLL has just been loaded, and when it’s about to be unloaded. What better place to add all that expensive, complicated initialisation…? STOP! WAIT! Before you add anything in DllMain, make sure you understand what state the process will be in when it gets called. Once you know that, you may well change your mind…
Read More »
By ian | Published:
November 24, 2009
For a while now I’ve been planning to write a blog post about pricing financial instruments using Monte Carlo techniques in F#. As part of this I needed to generate normally distributed random numbers, and while putting together the code to do it I realised it was interesting enough to warrant its own post.
I’m making use of a few F#/.NET idioms to make the process easier. For instance, sequences (.NET’s IEnumerable) are used as the source of uniformly distributed random numbers. Also, to verify that the resulting numbers are actually normally distributed, we can easily use existing WPF/silverlight controls to visualise the values direct from within Visual Studio, in a manner similar to this previous post – but without having to write the plotting code ourselves.
Read More »
By ian | Published:
November 11, 2009
The joy of programming
is hard for anyone to precisely define. At least, it’s hard for programmers to define, and seeing as nobody else understands what the hell it is anyway, that’s pretty much the same thing. However a few people on the interweb have tried quite hard to describe just what the feeling of developing software is by comparing it to things in “the real world”.
A quick google reveals some of the funny, interesting and downright weird things that people have compared programming to. Let’s take a closer look at some of them…
Read More »
By ian | Published:
November 2, 2009
I’ve just noticed a nice little feature in Visual Studio 2010 Beta 2: pinned DataTips. Values displayed in the debugger as you hover over a variable can now be pinned in place and remain aligned with the source. They can even have annotations added… Tasty!
By ian | Published:
October 23, 2009
The other day someone pointed me to the new MSDN article on C++ lambdas in Visual Studio 2010. Interesting. C++0x has been a long time coming, but in my opinion anything that makes C++ usable at a higher level of abstraction is a good thing. There’s nothing wrong with a little abstraction, as long as you can get to the fundamentals if you need to. Otherwise you wouldn’t be using C++, would you?
But one of the things I couldn’t get over from that article is the verbosity. I’ve just got too used to the succintness of F#. I know this is only example code, so it’s intended to demonstrate usage, but the whole point of lambdas is to reduce boilerplate and make the intent of your code more obvious. So, let’s compare the C++0x implementation with the F# version.
Read More »