Mr. .NET

Thoughts from a Product Manager…Geek…Gamer

Archive for the ‘.NET 2.0’ Category

Data Dynamics Analysis released!

without comments

Luc announced it yesterday, and it was so hectic around the office and at home that I forgot to do the same.

Yesterday, Data Dynamics released Data Dynamics Analysis!  This product has been a blast to demo at shows, even if I’m not as slick at using it as Luc is.  Just like many applications have a use for reports of some sort, there are uses for Data Dynamics Analysis in many applications.  Any time you need to look at historic data you can use Analysis to help you pinpoint the answers to many questions in your data.

Whether you point it directly at your data or you feed it queries Analysis can handle them.  Built off of the same data manager used in Data Dynamics Reports, it’s ready to start handling data from the moment you drop it on the form and tell it what data to use.

Written by James

May 20, 2008 at 1:56 pm

A new build of Data Dynamics Reports released

without comments

On Friday we released another beta build of Data Dynamics Reports, this build fixes a few issues including several customer report issues and a regression introduced in a previous release.

I keep saying it, but this is likely to be the last beta release before we put out another production build; coming after the new year.

Written by James

December 23, 2007 at 4:34 pm

New release of Data Dynamics Reports

without comments

We’re fast approaching the first point release of Data Dynamics Reports and I decided it was time to put a beta out there.

New in this release is support for hiding the main menu and toolbars of the end user designer control as well as the ability to fire those commands on the designer.

I’m looking for feedback specifically on that functionality.

A hidden feature is that we’ve made some changes to support medium trust environments, like those found on many ASP.NET hosts.  I didn’t announce it in the release notes because there are still some issues with the way it works.

Due to the limitations imposed by medium trust certain features are not supported without minor security changes.  For example; in order to generate a PDF the report engine needs access to the font files.  By default medium trust won’t give us access to the fonts directory nor to the API call we need to make in order to find it.  The compromise is to fall back to the fonts defined in the PDF spec.

Fear not, we also ship additional trust policy files that hosts can install for you in order to enable the specific trust settings we need.

Written by James

November 18, 2007 at 7:16 pm

Null Coalescing operator

with one comment

While reading my feeds today I came across a post by Scott Guthrie showing how to use the null coalescing operator with LINQ. What really caught my eye was a feature I had never heard of before; the null coalescing operator. A quick look at Scott’s links and I see it was introduce in C# 2.0 and has been blogged about a few times.

Basically put:

object assignable = testedObject ?? ifNullValue;

is the same as

object temp = (testedObject);

if( temp == null )  {
    temp = (ifNullValue);
}

assignable = temp;

Where assignable is an assignable statement, and testedObject and ifNullValue are statements that evaluate to an object.

Its been a while since I learned something new in C#, so this was a fun excursion.

Written by James

September 20, 2007 at 11:25 pm

Posted in .NET 2.0

System.Drawing classes not supported outside of Windows Forms

with 3 comments

A while back a note was added to the documentation of the System.Drawing namespace stating:

“Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.”

Today the Windows Forms Documentations Updates blog clarifies what this means.

“We don’t mean they won’t work in an ASP.NET application or that we are trying to cover up some known bug that occurs when you use them in a service. The bottom line is that if you call Microsoft Product Support Services regarding a problem you have using a System.Drawing.* class in a service, they will not offer free support.”

I won’t offer my opinion on this as I can see several things going on here. But I do hope they change their tune and support the scenario again.  An ASP.NET control that generates HTML for a barcode is a hack, the only way to do a barcode correctly is to create an image, something that will also now require the use of another library to create the image in order to be 100% supported now.

I will, however, put forth some speculation, just something that came to mind while I was writing this post.  When GDI+ was announced there was also mention that in the future it could be updated to use hardware acceleration.  I dug up this link from Google that talks about that very thing: http://www.microsoft.com/whdc/archive/GDInext.mspx Now, if GDI+ (i.e. System.Drawing.*) were to become accelerated then there is the very real possibility that it would be impossible for the System.Drawing stuff to work outside of a Windows Forms environment.

There are some things that counter this idea.

  • Why put the note up there now?  Currently all of the GDI+ features appear to be implemented in software rather than hardware.  So if there was a change to be made the System.Drawing team could make sure it still uses the software implementation rather than the hardware one if running outside of a windows application.
  • Why accelerate GDI+ now when WPF just came out?  That would surely send a mixed signal to some people.

A question that falls in with this is that Windows Vista makes use of available DirectX acceleration for its window drawing.  Could this mean that Windows Vista’s GDI+ implementation is already hardware accelerated and the note is added so that things don’t go downhill when run on Windows Longhorn server?

Speculation is fun!

Written by James

May 14, 2007 at 1:34 am

Posted in .NET 2.0, Rants

Its been a while

without comments

It’s been a while since I’ve written code all through the night. I think the last time I managed to do it I was tweaking the database generator that creates one of the sample databases for Data Dynamics Reports.

I also discovered why its sometimes a bad idea to do so. I have a 40+ line block of code with a grand total of 1 comment and I can’t tell what was going through my mind when I wrote it.

I’ll rewrite that code later…Now it is time to get some sleep, I have no idea what time I’m waking up but I hope its dark outside when I do. And just to be safe I’m setting my alarm clock.

Update: What a difference a few hours of sleep makes. I woke up about 5 hours later and just got back to the code. Now the logic is cleaned up, the block I referenced earlier is down to 37 lines of code, with 7 comments including 2 TODO items. The code that calls that block is cleaned up as well and everything reads well. Normally I stop my all-night sessions around mid morning, but I kept this one going about 8 hours too long.

Written by James

October 29, 2006 at 4:35 pm

Posted in .NET 2.0

C++/CLI In Action unedited chapter available

without comments

An unedited version of the first chapter of Nish’s book C++/CLI In Action has been released. I reviewed the book a few months ago and I can say that it’ll help anyone familiar with C++ looking for how to use .NET or WinFX* functionality in their apps.

It should also be somewhat useful for C#ers who want more control/freedom dip into a language that requires more from the dev while still allowing access to the framework they already know.

*I can’t bring myself to call it .NET 3.0

Written by James

September 22, 2006 at 11:07 am

Posted in .NET 2.0, Technology

Getting around the visual studio project directory structure

with one comment

Cheez commented that he was having an issue where he had to remember to set all of his resources to copy the content or he would get File Not Found Exceptions at run time.

Once the project gets beyond a certain size this may not be desirable; especially once his project gets underway copying that content will use up a lot of disk space and possibly slow down his build to just to copy the data.

About the Resources; that is Visual C# Express’ fault. The IDE can’t make any assumptions about what you want because it leaves all of the building up to MSBuild — remember those awful makefiles from the CS classes at MTU? think the same thing but extensible for building anything. And I think they make more sense than makefile ever did.

There is one way to get around it; which is how the starter kit does it. Prepend all of your filenames with @”..\..\” to get out of the bin\Debug or bin\Release directory and to where your project is located.

Something that is interesting is that if you go into your project’s bin\debug directory you will see two executables there app.exe and app.vshost.exe. When you run your app from Visual Studio you are actually running app.vshost.exe.* You can use this knowledge to your advantage and choose at runtime what you need to prepend to the filename.

public static class FileHelper {
  private static object locker = new object();
  private static string filePrefix = null;
  public static string FilePrefix {
    get {
      if( filePrefix == null ) {
        lock( locker ) {
          if( filePrefix == null ) {
            string app = System.Environment.GetCommandLineArgs()[0];
            if( app.ToLower().EndsWith(".vshost.exe") )
              filePrefix = @"..\..\";
            else
              filePrefix = "";
          }
        }
      }
      return filePrefix;
    }
  }
}

Now when you need a filename you do: FileHelper.FilePrefix + "myfilename.ext";

Ideally you should put the filenames into a readonly static variable as well, that way if you need/want to change the filename you only have to update one location. For example:

public static class MediaFiles {
  public readonly static string TitleScreenImage =
    FileHelper.FilePrefix + @"Images\TitleScreen.tga";
}

*There are caveats to this technique.

  1. You can tell Visual Studio not to use the VSHost option, in which case you need to look at the directory structure or something else. Maybe System.Diagnostics.Debugger.IsAttached, but it is possible to have the debugger attached when not running in Visual Studio as well.
  2. System.Environment.GetCommandLineArgs() doesn’t exist on the Compact Framework which the 360 version of your XNA code will run on. I would assume by the time you get to doing 360 builds of your game I can convince you to go with a customized build process so this would be a non-issue :-)

Edit: Of course you can just change the output path of the binary as well, but at one point in time that caused severe problems for me so I stopped doing it.

Written by James

August 31, 2006 at 1:31 am

Posted in .NET 2.0

When Sleep can be bad

without comments

Thread.Sleep(0); that is.

Joe Duffy explains why Thread.Sleep(1) is better than Thread.Sleep(0).

Thanks to Jason for the heads up.

Written by James

August 29, 2006 at 12:40 pm

Posted in .NET 1.x, .NET 2.0

XNA Studio Express

without comments

As a gamer I’ve always longed to be a game developer — it’s what got me into programming in High School — but I never did much outside of minor Quake 3 mods that my university roommate and I made and a few small projects using the Allegro library.

Now I eagerly wait to see just what is going to be included in the XNA Studio Express on August 30th and later what it really would take to port such a game from Windows over to the 360. Having the option to run code on my 360 (for $99/yr) might just be enough to get me into creating a small project.

Written by James

August 25, 2006 at 1:54 am

Posted in .NET 2.0, Technology