Generalizing Code Creation or "Helping Give Birth to Skynet"

Back in 2001 or so when the .NET Framework was introduced one of the features that struck me as a real innovation was the CodeDOM.


There's a good bit to it but the basic idea is that the .NET framework has support for dynamically generating source code then compiling it.  The CodeDOM or Code Document Object Model is a language independent model of source code.  A graph, that general purpose workhorse data structure for CS people, is used to represent source code in a language independent manner.  The "protocol" or "rules" for the graph are the Code DOM.


I'm running across a case where it seems like it might be useful - there's a COM enumeration that I want to use but the type library importer hasn't marked it with the FlagsAttribute.  Since I don't want to have to keep updating I'm thinking I'll just reflect over it, construct a managed equivalent and then use the managed equivalent.  In a pre-build event for this project.  Make sense right? 


Here's the rub: If procedural programs can produce general intelligence then, IMHO, something like the CodeDOM (and its attendant support) will be a critical step on the journey to real AI.  John Searle seemed pretty convinced that rules and words (what I'm loosely referring to as "procedural programs") are never sufficient to produce intelligence.  Perhaps he's right.  Until that's resolved, I'll work on shaking this feeling of contributing, ever so infinitesimally, to the Birth of Skynet.




Making a background transparent in Visual Studio 2005

Every developer gets to the point in a client-side project where you need to work with graphics.  My favorite tools are, in order of increasing power, the Visual Studio 2005 Image Editor, Microsoft Paint and Adobe Photoshop 3 (mega Kudos to Franklin Thompson, an amazing digital photographer and Web Guru, for giving me a Windows version of Adobe Creative Suite 3 - he's Mac only).


If I can get something done w/o having to switch windows or start up another app then I'm all for it.  In that vein, I wanted to make a minor modification to an icon.  I didn't have access to the original icon and had the darndest time getting the background to be transparent whenever I copied it into the Image Editor (32x32 256 colors image type).  Turns out you can have every pixel of a certain color considered transparent by:

  1. Making sure "Opaque Background" is unchecked (choose a selection tool then uncheck Image -> Draw Opaque).
  2. Switch to the eye dropper tool and right click a pixel that matches the color you want to become transparent.
  3. Switch to the selection tool then select the entire image.
  4. Paste the selection into a new image.  You can also paste it into the same image after deleting it then recreating it (with Draw Opaque unchecked).