Saturday, 29 January 2011

Happy - Belated - New Year

Sorry, Sorry Sorry, I'm sorry to the masses of phantom no-ones not reading my blog, this is a very belated welcome to the new year.  I have not been blogging, I've not been writing, I've not been on the Internet.  I have however had a jolly good Christmas and been very busy at work.

I'm sorry to say that work took the majority of time, I'll not go into details, but lets just say that a person at work, whom had a couple of months to provide part of a system didn't deliver, and I was roped in with a week to go to get it done (which I did by the way - but I don't think anyone realises that my two day lash job code was over a third of this major project... Aaaaaanyway, enough said about that.

What have I been up to?  Well, on the 26th of this Month, I became an Uncle for the first time.  My little brother's wife gave birth to a beautiful baby girl (Awwwwww).  So, tomorrow I'm going over to meet her.

My dog has also been ill, he had to have an operation to remove a lump from his belly.  All it well however, he's bounced back and the lab work says it was just a fatty lump.  So all good.

I myself have been ill also, I've indeed been to the doctor today and been put on a few strange and strong pills.  I took one and then floated around Morrisons doing the weekly shop, I have no idea what I've bought.

In personal gaming time I've not actually had that much time, I did however receive a 60 day time card for World of Warcraft for Christmas... I didn't get Cataclysm! Just time.  So I have been really really really enjoying myself maxing out all my achievements on my various characters.  I've also created a new alt, whom I'm playing utterly solo (no help from my other characters money pots or skills)... and it's a bit of a new one for me, it's a Dwarf... My first Dwarf... and a Shaman... I've never played Shaman.  And I'm really enjoying that.

I'm happy to see that my predictions of the level to item level gap were correct, as people march about with 110K health, I'm also bemused to see people in "LFG" channels demanding a certain level of item... "Not got six months of raiding done on this three month old expansion?  Well fuck off noob"... It is not a pretty sight.

When the WoW time expires I have a line up of things to do, if you'll remember I bought a new gaming rig (Core i7 - 12Gb of RAM etc etc), well one of my RAID array hard drives gave up the ghost two weeks ago, so I've had the joy of a complete reinstall of my OS.  This means that apart from WoW I have no games on the machine.

So, Civ5 and Dragon Age are going to be my two games for February and March.

I have also spent an inordinate amount of money and purchased Microsoft Visual Studio 2010 Professional.  I'm not going to tell you how much it cost me, because just writing it down will make me feel sick.  But I have sort of fallen in love with it as a development environment.

Its not perfect, there are problems with building (sometimes) and its doing its intellisense with SQL Server... and even with 12GB of RAM and 8 CPU cores it is slow at updating the hints as it goes.  But for visualising your code, organising your development and debugging (watches especially) it is brilliant.

It is the first application I've been using which I know is using the new Direct2D and DirectWrite interfaces (themselves build on top if Direct3D 10.1 and DXGI.  And that elegance and low impact on the system (for what its doing there's very little impact on my system) has inspired me to go back to native programming.

So, I've taken my C# hat and decided to leave it in the office each night, and I come home and put on my C++ hat.  I've been thoroughly enjoying Scott Meyers book "Effective C++".

It is an excellent way to wrap your head back into proper progamming technique after a break into C# or Java.  Indeed the items contained within will often make reference to how "other languages" do things and how to attain the same thing in C++.

The net upshot of this return to my love of hard core programming has been a small C++ (Win32 - not CLR) wrapper system around Direct2D, which can take a handle from a C# form and draw the Direct2D graphics defined by the C# calls within.  Its so nifty I've been given a new project at work to make it a commercial grade project... which is nice.

Indeed right now, while writing this blog I'm researching something which I've never really used in C++, the function pointers.  As Meyers points out, its is a travesty that the C++ Compiler doesn't support proper delegate functions, it is in fact easier to implement proper delegates rather than function pointers... but still delegates are not part of the C++ standards.  Though I am going to be looking at what TR1 and Boost might be offering.

Anyway, for anyone puzzling all the information out there, here's how to call a "void function" which you've pointed at from another function.  The function "A::DoSomethingWithA" takes a void pointer to a function as a parameter and calls that function.   The function is "DoIt" and I just declare a class A and pass "DoIt" as the parameter, so here you go:

class A

A ()

~A ()

// Call a void function pointer... so we run the exteral code given
void DoSomethingWithA ( void(*ExternalFunctionPointer)(void) )

// The function we are going to be passing to be called from inside A
void __cdecl DoIt (void)
printf_s("Hello World");

// The main function, which declares a class A and Does something with a function passed as a pointer
int main(int argc, char* argv[])
A* a = new A();
delete a;


return 0;