dotNoted

Icon

Observations of .Net development in the wild

VSTO for Mere Mortals Quote

My quote got on a book I reveiewed for Addison Wesley: VSTO for Mere Mortals.

I actually meant it too – it’s a good book. Great for the Word and Excel macro-heads who want to dive into more power – power that the CLR and .Net languages give.

I used to disdain departmental power users who took up the code shovel and started digging… but now I’m rather encouraged by it. I think these kind of inroads could indicate paths of least resistance as an organization evolves. Not, probably, what corporate IT wants to embrace. I think the CLR, with Code Access Security, type safety, hostable runtime, adaptable client-side / server-side story, peerless toolset, access to legacy code assets has the lead here.

Filed under: Uncategorized

NYTimes: “Child’s Play donates video games to children suffering from severe illnesses with the help of gamers.”

I _knew_ video games promoted social deviance!

And <gasp> it’s the evil penny-arcaders behind it!

http://www.nytimes.com/2006/12/27/us/27charity.html?_r=1&th&emc=th&oref=slogin (registration needed)

Filed under: Uncategorized

Thanks for the help!

Trying to find out why an exception is being raised in kernel32.dll… I have to pore through some disassembly code (hint: ignore most of it). The Visual Studio’s Registers window (command: Debug.Registers) is helpful here, to see where we are going to jump to. I was curious about the Effective Address which pops up in the window and needed to refresh my memory on how x86 Assembly represents that… On MSDN:

Effective Address

This group of registers is used for instructions that use the Effective Address mode. If you don’t know what that means, don’t worry about it, or pick up a book on assembly language programming.

Bravo. Very helpful. A book, indeed. Or maybe I shall just not worry while my program throws critical exceptions…

Filed under: Uncategorized

Pseudo-class definitions with C++/CLI macros

.Net generics are great. Of course. Typing them is a pain. Even in C# where the Intellisense is very good, it is tedious to make the type names so long, especially when doing a lot of data type composition, like this (or worse):

Dictionary<int, Dictionary<String, KeyValuePair<MethodInfo, MyCustomMethodAttribute>>>

Grok that. Easy? Now feast your eyes on this:

Dictionary<int, Dictionary<String^, KeyValuePair<MethodInfo^, MyCustomMethodAttribute^>>^>^

In C++/CLI, you need the hats (managed pointers) to refer to reference handles (as opposed to value types like KeyValuePair, which don’t use the hat). It’s easy to get confused (does the hat disappear between the 2nd or 3rd to last right angle bracket?) when coding fast and furious.

In C#, you can subclass a generic type like this:

public class MethodTable : Dictionary<int, Dictionary<String, KeyValuePair<MethodInfo, MyCustomMethodAttribute>>> {}

So, now you can use this class in place of the unwieldy generic type. In C++, you can also do this:

#define MethodTable Dictionary<int, Dictionary<String^, KeyValuePair<MethodInfo^, MyCustomMethodAttribute^>>^>^

This doesn’t define a new type, just gives you some compile time syntax sugar. I prefer the latter, since C++/CLI already creates so many types for IJW, I don’t like to add more.

I can see how C++ macros are easily abused to create whole sub-languages in a program. I’m already going down that path.

Filed under: Uncategorized

Clobbering the %PATH% var with EnvironmentVariableTarget

If you use Environment.GetEnvironmentVariable("Path") to get the Path and later set it via Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine), you will kill your path, since the former retrieves it from the process’s environment block, which includes both Machine and User environments (and more sometimes). I did this block-headed thing, and set my path a couple of times, and it grew to be too long and got truncated. Ouch. Developer tools stop working quickly if that happens.

Thankfully, the machine environment on a Windows NT kernel based OS is controlled by a key in the System key of the HKLM hive: HKEY_LOCAL_MACHINESystemCurrentControlSetControlSession ManagerEnvironment. This means that on a successful boot, the control set is copied over to a second key called ControlSet002. This is how "Last Known Good Configuration" recovery is accomplished – Windows just uses this backup key if you hit F8 and "Last Known Good" at boot. This means my old path should be in HKEY_LOCAL_MACHINESystemControlSet002ControlSession ManagerEnvironment. Bingo, it was. What a relief.

So, don’t forget to call your Environment.GetEnvironmentVariable and Environment.SetEnvironmentVariable methods with matching EnvironmentVariableTarget values, unless you have a carefully considered reason.

Filed under: Uncategorized

MSysInternals keeps the BSOD going

That MS acquired Sysinternals is old news – but what pleases me is that they are keeping the BSOD screen saver around – they are definitely loosening up as a company.

http://www.microsoft.com/technet/sysinternals/Miscellaneous/BlueScreen.mspx

Filed under: Uncategorized

Aaron Marten’s WebLog : Open the Floodgates!

My, how times change….

On the licensing side, we’re also making a change that should have a huge impact on the developer tools community. We have removed the licensing restriction that requires you to target a Microsoft platform. Yes, you read that correctly. Feel free to re-read it again if the shock hasn’t set in yet. You can now legally create a Visual Studio package for tools to target the JRE, Linux, Apache, or whatever your platform of choice may be!

Aaron Marten’s WebLog : Open the Floodgates!

Filed under: Uncategorized

gcnew them arrays!

C++ / CLI managed array initialization:
 
 
It works!

Filed under: Uncategorized

Back at it…

Man, I have no life outside of work, it seems sometimes.

I’ve aborted work at Benton County to take up a much more interesting position at Intel, Corp. were I’m working on a system to help visualize data quality. Two new areas of focus for me to get this work done are computer graphics (mostly using GDI+ [i.e. System.Drawing.Drawing2D], although I’m playing with DX9 in my spare time) and rules engines. The latter finally brings together my long-held interest in intellegent agents and inference systems and my more recent interest in code-generation. The former has greatly expanded my understanding of linear algebra and numerical analysis. Finally, I can use the math above algebra in my everyday life!

Of course, the ramp at Intel was steep, and cranking it out was a full-duty cycle. Any time off had to be devoted to family. Whatever, you think. And that’s it. Ok.

So, let’s get into some good code…

-r

Filed under: Uncategorized