Sunday, August 10

So now what?

From MSDN:
Command-line compilation can be used to build applications with more complexity, although the compiler does not support WPF applications that include Extensible Application Markup Language (XAML) source code. Furthermore, command-line compilation does not support the full range of build requirements of typical WPF applications, including configuration management and ClickOnce manifest generation. To support these and other more complex build requirements, WPF integrates with and extends MSBuild.

You can't use the command line to compile XAML applications. Why?

Tuesday, July 29

NAnt and .NET 3.5

From an old entry by Jeffrey Palermo:

Unfortunately, we don't have a .Net 3.5-compatible NAnt distribution
yet, but it's trivial to get the latest version (.85) working with
.Net 3.5 and a Visual Studio 2008 solution.  Open up you nant.exe
config file, and add the following framework node just below your net-2.0 node.  Not much of a change, and it's working well for me.

<framework name="net-3.5"
    description="Microsoft .NET Framework 3.5"
    sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}"
    frameworkdirectory="${path::combine(installRoot, 'v3.5')}"
    frameworkassemblydirectory="${path::combine(installRoot, 'v2.0.50727')}"

        <!-- include .NET specific assemblies -->
    <include name="tasks/net/*.dll" />
    <!-- include .NET 2.0 specific assemblies -->
    <include name="tasks/net/2.0/**/*.dll" />
    <!-- include Microsoft.NET specific task assembly -->
    <include name="NAnt.MSNetTasks.dll" />
    <!-- include Microsoft.NET specific test assembly -->
    <include name="NAnt.MSNet.Tests.dll" />

        <readregistry property="installRoot"
            hive="LocalMachine" />

    <readregistry property="sdkInstallRoot"
            failonerror="false" />

        <task name="csc">
            <attribute name="exename">csc</attribute>
      <attribute name="supportsnowarnlist">true</attribute>
      <attribute name="supportswarnaserrorlist">true</attribute>
      <attribute name="supportskeycontainer">true</attribute>
      <attribute name="supportskeyfile">true</attribute>
      <attribute name="supportsplatform">true</attribute>
      <attribute name="supportslangversion">true</attribute>

      <task name="vbc">
      <attribute name="exename">vbc</attribute>
      <attribute name="supportsdocgeneration">true</attribute>
      <attribute name="supportsnostdlib">true</attribute>
      <attribute name="supportsnowarnlist">true</attribute>
      <attribute name="supportskeycontainer">true</attribute>
      <attribute name="supportskeyfile">true</attribute>
      <attribute name="supportsplatform">true</attribute>
      <attribute name="supportswarnaserrorlist">true</attribute>

      <task name="jsc">
      <attribute name="exename">jsc</attribute>
      <attribute name="supportsplatform">true</attribute>

      <task name="vjc">
      <attribute name="exename">vjc</attribute>
      <attribute name="supportsnowarnlist">true</attribute>
      <attribute name="supportskeycontainer">true</attribute>
      <attribute name="supportskeyfile">true</attribute>

      <task name="resgen">
      <attribute name="exename">resgen</attribute>
      <attribute name="supportsassemblyreferences">true</attribute>
      <attribute name="supportsexternalfilereferences">true</attribute>

      <task name="al">
      <attribute name="exename">al</attribute>

      <task name="delay-sign">
      <attribute name="exename">sn</attribute>

      <task name="license">
      <attribute name="exename">lc</attribute>
      <attribute name="supportsassemblyreferences">true</attribute>

      <task name="ilasm">
      <attribute name="exename">ilasm</attribute>

      <task name="ildasm">
      <attribute name="exename">ildasm</attribute>

Next, change the following in your NAnt build:

<property name="nant.settings.currentframework" value="net-3.5" />

Monday, July 28

Automated Unmaintainable Code

Still working on Nant, just not making a lot of progress.
A long time ago, I came across a humorous article on how to write
unmaintainable code. One of the points was to use the C continuation
operator to break up #defines so that a global search could not find
them. I use the global search quite a bit, so this one stuck in
my head as particularly bad. The other day, I was looking at some
open-source code. It was not indented, so I did a Ctrl-Shift-F in
Eclipse to reformat it. I ran the program, and received an exception.
So I copied the message and did a search to see what was causing
said exception. The search turned up no hits. I kept cutting
down on the words, and eventually, after about half of it was gone,
I found it. The reformat had broken up the string into several short
strings concatenated together. Somehow I find this offensive. It's
a good thing I don't use the Ctrl-Shift-F very often.

Tuesday, July 15

Supremacy: First Look

Lots and lots of code, no surprise there. XAML, which I have had zero
experience using. Well, that's what I wanted. The organization looks fine.
One major obstacle: I only have Visual Studio 2008 Express, which does not
support sub projects. Ok, have to resort to an old method: take it all
apart, and see if I can put it together to make it work.
Maybe I can install NAnt and build it that way?

Friday, July 11

Star Trek: Supremacy

One of the best ways I have for learning is to follow in the footsteps of others. There is plenty of Open Source Software to learn from, but not a whole lot I find of interest. Thanks again to Jeff Atwood; I've found an interesting project to look at. Star Trek: Supremacy is the successor to Birth of the Federation; a game I played a lot after it came out years ago. The developer took it open source, so I am going to take a look.

I downloaded and installed the game, and after some false starts with the version of .NET, I got it running. It looks pretty much the same as the original. I can't get too far with it because I can't seem to build anything. Anyway, I want to get the code. I install TortoiseCVN and the SVNBridge CodePlex wants, and for the next hour, download 100Mb of code and resources.

Wednesday, July 9

Been Hacked

A few years ago, I did some work on a web site for a local Sci-Fi convention. The original developer passed away suddenly (RIP Ray G.) So I took over the job, and rebuilt everything from scratch in PHP. It turned out pretty good, but I did make a bad mistake. In order to make the main page menu be modified from a program, I had it read the links from a database. That was ok; the mistake was that I used fully qualified URLs. It was about a month before someone discovered and hacked it. Fortunately, I'm firmly in the Ratbert Engineering category. From Scott Adam's Dilbert, Ratbert gives the old adage of the Optimist seeing the glass half full, the Pessimist half empty. The Engineer has another half glass as an emergency backup. So restoring was a minutes' effort. It took another half hour to look over the logs to see how it was hacked, and another hour to fix the hole.

Tuesday, July 8

Too Much

In my years of programming, I've noticed that programmers have one basic trait in common: ego. We like to think we are perfect. I am acutely embarrassed by any mistake I make, whether anyone else notices or not. Yet when I look over a small portion of the programming stuff on the Web, I am overwhelmed. Languages: Java, C#, PHP, Perl, Python, Ruby, SQL, and on and on. Methodologies: Design patterns, SCRUM, Agile, TDD, etc. Frameworks such as Spring, ORMs such as Hibernate, Databases, Unit testing. Take any one of these, and I have just scratched the surface. I don't even know what I don't know. But I'm disinclined to admit that. I think it's been tattooed into my brain that if I admit to that, some people panic. This comes from years of being the sole developer on a project. It was in C, and although others were hired to work on it, they either didn't get it, or moved on as soon as they did.

I should be insulted. I've read through most of TheDailyWTF, and none of it looks to be mine. Certainly I've done SOMETHING that merits an article or two, or three... Alex probably just can't believe it. Either that or every stupid thing I've done has been done already.

Monday, July 7

Initial Addition

Jeff Atwood of Coding Horror wrote “Don’t go Dark” I thought this was a pretty good idea, so here I am. My purpose is to record my thoughts, mistakes, and ideas. Maybe I’ll get a project or two in here.