Welcome to

Magenic Technologies Community Blog

Sign in | Join | Help

I've moved my blog from this location to geekswithblogs.net. Although using the Magenic blog server is convenient and served well for me, I wanted more going forward.

 

Code Camp 10 in Boston is around 4 weeks away and there's still room if you want to attend or if you want to speak.
Check out Chris Bowen's blog for complete details or just head over to the web site to register. I have several sessions already planned.

See you there!

I like reading the Microsoft Forums, I even really like responding on the Forums, however the forums are not very convenient form of communication for me. It requires an internet connection, and the expirience varies based on what browser you happen to be using, and I switch fairly regularly between Internet Explorer and FireFox. And navigating around is rather painful.

I like rich client applications for things that I do frequently, like reading blogs. I have SharpReader set up to gather all the blog posts and cache them for me so I can read them at my leisure, which is generally once or twice a day. I'd hate to have to click throgh to each blog to find out what's new.

So I was very please to find this project on CodePlex which gives me a similar deal but for the microsoft forums. It currently only works for the Web Forums and not the NNTP newsgroups but looking at the source, it might be possible to write an adapter for the NNTP newsgroups as well. At any rate I am going to keep an eye on this project.

I was luck enough to be presented with the opportunity to attend Tech-Ed again this year. This was my third Tech-Ed ( 1997, 2006 ). I spent a lot of time on the Expo floor talking with various product groups and meeting old friends.

This year was the first year that MS split the conference into Tech-Ed Developers and Tech-Ed IT. I can't say I though it was a success. About half the sessions I attended weren't worth it and the other half were a no brainer ( Rocky Lotkha, Ted Neward  ). There were some times that I though the presenter was there more for themselves than the attendies ( Jeffery Palermo ). 

The conference center was huge compared to the number of people attending ( roughly 4800 ), and the layout was a little off. The partners seemed like they were stuck in a corner and the distance from the breakout rooms to the dining area was the full length of the center, a good 5-10 minute walk. I did however have a good time at some of the evening events including the attendies party @ Universal.

I met Bill Chiles, Jimmy Schementi and Curt Hagenlocher from the IronPython/IronRuby team at the Dymanic Languages booth. It was nice to put some faces to names that I have been seeing on the IronPython mailing list for a while. I was also able to resolve some issues I was having after talking to them so, thanks guys! I did however seem to miss Jon Lam no matter how much I hung out down there.

Some of my favorite sessions were actually during the lunch break, which meant wolfing down whatever was in those steaming catering dishes ( I think that was chicken ) and rusing to a breakout room. Eric Gunnerson from Microsoft gave two presentations on HealthVault which was a very interesting SaS initiative they have going. Andy Dunn also gave a presentation on XNA and Game Studio, which actually drew an audience of roughly 200 including myself and fellow Magenic Consultant Chris Williams.

Look for a few more posts on some neat things from Tech-Ed.

A few days ago I did a short presentation on XNA Development for a group of technologests at an event called Tech Tuesday, It's held every month and this month Microsoft was sponsoring the event and invited me to talk about XNA. It was a great event, I got to meet a lot of new people and ran into a few familiar ones. You can read about the event ( and I got a mention as well ) here: http://danbricklin.com/log/2008_03_06.htm#ttuemay13

An interesting note, during the event I was talking to two individuals who were asking about accessing the libraries on the Zune through XNA. My immediate response was that you couldn't do that, but it turns out I was wrong. Nick Gavelyn blogged about his new game where he is able to get access to the Album Art. So I stand corrected, you can access the pictures stored on the Zune, and I hope that this proves to be true for the XBOX as well.

The ZMan just posted about the availability of the first CTP for XNA 3.0. \o/ We can now start writing Games for the Zune! I'm downloading it now but be sure to check back later as I fill in some details.

See the Zman's post for more details : http://www.thezbuffer.com/articles/535.aspx

 

I will be speaking at the first ever Magenic Technology Summit that is being held on Friday June 20 in Chicago.

 

This is a full day of Magenic-provided training, available by invitation only to customers and potential customers of Magenic. We have lined up an impressive array of speakers and topics in two tracks, .NET development and Microsoft servers. There are even two keynotes:

Our first keynote speaker is Jay Schmelzer, who is the Group Program Manager for RAD tools. This basically means he runs the teams for all the Visual Studio designers and related RAD tools. He’s an excellent good speaker and should provide some great insight into the present and future of RAD development tools from Microsoft.

Our second keynote speaker is Rockford Lhotka, Magenic’s Technology Evangelist and the creator of the very popular CSLA .NET development framework.

But more importantly, two tracks of in-depth technical content straight from the experts at Magenic. Topics covering the present and future of .NET development and key Microsoft server products. An event like this doesn’t come along every day, and shouldn’t be missed! More details about the event itself are available on the Magenic Website.

 

If you are a Magenic customer and would like to attend, contact your Magenic Account Eexecutive immediately!

 

As you can tell from the last couple of posts, I'm looking at IronPython. Not for Python, I can barely spell Python let along develop in it, but that is changing slowly. My interest in IronPython is actually the Microsoft.Scripting assembly, better known as the Dynamic Language Runtime (DLR). I'm doing some research for a talk I'm doing at Code Camp 9 on extending your applications using the DLR.

Anyway, back on topic, I've found that the IronPython sources are a great source of new ideas and great examples of pattern usage. In particular there was something that struck me, because it rang a bell from way back in my college days. When I first started to be instructed in programming there was a practice that was ingrained into you from day one. Check your arguments before you act on them to make sure they are valid. Now throughout my career, that practice has slowly gone away, I blame VB. It's funny that this comes up now as I have recently been thinking how to get myself back into this practice.

So, here is what I saw in Methods in the DLR code:

/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentNullException"></exception>
public ScriptEngine/*!*/ GetEngineByFileExtension(string/*!*/ extension) {
    Contract.RequiresNotNull(extension, "extension");

    ScriptEngine engine;
    if (!TryGetEngineByFileExtension(extension, out engine)) {
        throw new ArgumentException(Resources.UnknownLanguageId); // TODO: wrong resource
    }

    return engine;
}

Notice the first line of code in the method; Contract.RequiresNotNull. Simply Brilliant! I love this idea, so much so that I'm starting to use it in my own code. Here's what it is. Contract is a static class with a handfull of methods that allow you to use rich semantics to describe what is requred for this method to complete successfully. Here's a list of the methods in Contract.

void Requires(bool precondition)
void Requires(bool precondition, string paramName)
void Requires(bool precondition, string paramName, string message)
void RequiresNotNull(object value, string paramName)
void RequiresNotEmpty(string str, string paramName)
void RequiresNotEmpty<T>(ICollection<T> collection, string paramName)
void RequiresArrayIndex<T>(IList<T> array, int index, string indexName)
void RequiresArrayInsertIndex<T>(IList<T> array, int index, string indexName)
void RequiresArrayRange<T>(IList<T> array, int offset, int count, string offsetName, string countName)
void RequiresArrayRange(string str, int offset, int count, string offsetName, string countName)
void RequiresNotNullItems<T>(IList<T> array, string arrayName)

These methods use a combination of Exceptions and another static class called Assert to alert you to problems in your arguments. Assert is a nice clean wrapper around Debug.Assert to make things easier for you.

The DLR and IronPython are under the Ms-Public licence so make sure you read it carefully before you use that code in your applications. Other wise you are free to implement the same ideas in your own code, so go forth and start checking your parameters again!

I know I will.

Here's something I came across in the IronPython sources that I really hadn't noticed in the .Net Framework before.

[assembly: InternalsVisibleTo("IronPython.Modules")]

This is from the MSDN documention on the Attribute:

.NET Framework Class Library

InternalsVisibleToAttribute Class

Specifies that types that are ordinarily visible only within the current assembly are visible to another assembly.

Namespace: System.Runtime.CompilerServices
Assembly:  mscorlib (in mscorlib.dll)

This seems like it would be a great way to expose your classes to unit testing without having to ship your tests. It also makes it easy for you to split large collections of classes that need internal access to each other into multiple assemblies to update them independently. Even though as I write that it makes me think that if you have that situation, you need to refactor and break those internal dependecies. :)

I was at my local IGDA users group meeting last night and announced the Boston XNA Developers group. After the presentation, I was talking to some folks interested in the XNA group. One of them asked me this question; "How do I draw a line in XNA?". I was a bit baffled at first, thinking, why would you want to do that? But then it struck me that it really wasn't an easy thing to do. In DirectX there was an API to draw primitives like lines and circles. That doesn't exist in XNA. "Why?", you might ask. The answer is fairly simple. XNA does not provide for a Fixed Function Pipeline, you must have an effect in place ( Vertex and Pixel Shader ) in order to draw.

So to answer the question. First, go ahead and create a new Windows XNA Game, I'll wait here.

Done? Great. Now, lets set up some fields we'll need in the Game1 class. Put the following code right after the declaration of the SpritBatch.

        VertexPositionNormalTexture[] line;  // Our start and end points.
        Matrix world, projection, view;      // Transformation Matrices
        BasicEffect basicEffect;             // Standard Effect to draw with
        VertexDeclaration vertexDeclaration; // Our format for the line.

Now in the Initialize() method lets call some helper methods to setup for drawing.

      InitializeTransforms();
      InitializeBasicEffect();

In IntializeTransforms we will set up the world, projection and view matrices so that our line is drawn in the viewport correctly. Then in InitializeBasicEffect() we use those transforms to properly render our graphics. Here is the code for those two methods.

        /// <summary>
        /// IntializeTranforms is used to set up the matrix transformations required
        /// to draw the Display the scene.
        /// </summary>
        private void InitializeTransforms()
        {
            world = Matrix.CreateTranslation( new Vector3( -1.5f, -0.5f, 0.0f ) );
 
            view = Matrix.CreateLookAt(
                                        new Vector3( 0.0f, 0.0f, 7.0f ),
                                        new Vector3( 0.0f, 0.0f, 0.0f ),
                                        Vector3.Up
                                      );
 
            projection = Matrix.CreatePerspectiveFieldOfView(
                                                              MathHelper.ToRadians( 45 ),
                                                              (float)graphics.GraphicsDevice.Viewport.Width /
                                                              (float)graphics.GraphicsDevice.Viewport.Height,
                                                              1.0f, 100.0f
                                                            );
        }
 
        /// <summary>
        /// Setup up the required effect so we can see our scene
        /// </summary>
        private void InitializeBasicEffect()
        {
            // Not part of the Effect per se, but is required for drawing
            vertexDeclaration = new VertexDeclaration(
                                                        graphics.GraphicsDevice,
                                                        VertexPositionNormalTexture.VertexElements
                                                     );
 
            basicEffect = new BasicEffect( graphics.GraphicsDevice, null );
            basicEffect.DiffuseColor = new Vector3( 1.0f, 1.0f, 1.0f );
 
            basicEffect.World = world;
            basicEffect.View = view;
            basicEffect.Projection = projection;
 
        }

Now that we have the requirements set up, lets add the code to draw our line. What we need to do in the Draw Method is tell the GraphicsDevice to use our Vertex Format and using the basicEffect, call DrawLine(), which we will implement in a second.  Add the following code to the Draw method.

            graphics.GraphicsDevice.VertexDeclaration = vertexDeclaration;
 
            // The effect is a compiled effect created and compiled elsewhere
            // in the application.
            basicEffect.Begin();
 
            foreach ( EffectPass pass in basicEffect.CurrentTechnique.Passes )
            {
                pass.Begin();
 
                DrawLine();
 
                pass.End();
            }
            basicEffect.End();

Let's add in a stub for DrawLine() so that the code will compile.

        private void DrawLine()
        {
        }

Alright, at this point we have the skeleton code needed to draw anything we want. Since what we want to draw is a line, we need to initialize our line. Our line is made up of a Position, Normal and Texture Coordinate. Set the line field to a new instance of VertexPositionNormalTexture array with 2 elements. The first element represents the start point and the second element is the end point. Each element of the array will be set to a new instance of VertexPositionNormalTexture. The constructor for VertexNormalTexture takes three arguments, a Vector3 for position, a Vector3 for normal direction and a Vector2 for texture coordinates. The normal and texture coordinates will be set to Vector3.Forward and Vector2.One which has the vertex facing the camera and the coordinate to 1.

            line = new VertexPositionNormalTexture[ 2 ];
 
            line[ 0 ] = new VertexPositionNormalTexture( new Vector3( 0, 0, 0 ),
                                                         Vector3.Forward,
                                                         Vector2.One
                                                       );
 
           line[ 1 ] = new VertexPositionNormalTexture( new Vector3( 0, 1, 0 ),
                                                        Vector3.Forward,
                                                        Vector2.One
                                                      );

Now we need to draw the two points we just defined. In our DrawLine method we'll call GraphicsDevice.DrawUserIndexedPrimitives(). We'll use PrimitiveType.LineList to tell XNA how to draw our vertices. The second argument is our array of vertices. The third and fourth parameters are the starting vertex and the number of vertices, respectively. The next three arguments are the index array, start index and count of indicies.

            graphics.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(
                        PrimitiveType.LineList,
                        line,
                        0,  // vertex buffer offset to add to each element of the index buffer
                        2,  // number of vertices in pointList
                        new short[2] { 0, 1 },  // the index buffer
                        0,  // first index element to read
                        1   // number of primitives to draw
                    );

Run the application, and you'll have a line!

There are a couple of things I've found that just don't work when Importing and Exporting sites. The newest on is with workflows. If you have an approval workflow on a list, and you restore it to a new location, it's possible that the task notification emails will no longer be sent. One fix so far is to toggle the Send Email switch on the Tasks list off then back on again to get the emails to start sending.

A couple of very cool things were announced this week by Microsoft that pertain to XNA:

Xbox LIVE Community Games announced

Xbox LIVE Community Games is a newly announced offering which pioneers upon the industry leading Xbox LIVE service to provide gamers an opportunity to share, peer review, download and play games created by the community, for the community. Starting with the beta launch of the service later this spring, members with an XNA Creators Club subscription will be able to submit their own game creations for self-publishing through to Xbox LIVE Marketplace via the http://creators.xna.com website.

Zune game development support announced for XNA Game Studio 3.0

Today the XNA Community Games Platform team announced the first feature of the coming XNA Game Studio 3.0, the ability to build games for the Zune platform. XNA Game Studio 3.0 allows all game developers to create unique and imaginative games for the entire family of Zune media devices. A preview release of XNA Game Studio 3.0 will be available in the Spring 2008 timeframe, with a final release scheduled for the holiday 2008 season.

 

I'd like to announce the formation of a new XNA developer users group in the Boston area. The official name of the group is Boston XNA Developers Group. There is a web site up for it, which will be updated with meeting dates and times as well as anything else of interest.

The first meeting will be held on Wednesday, February 27th from 6:00pm-8:00pm. The location of the meeting will be at the Microsoft Offices on Jones Road in Waltham, MA.

The topic for the inaugural meeting has not been decided yet, but when it is I'll update you here and on  the site.

I look forward to seeing you there.

I was looking at doing some Smartphone development so I downloaded the Mobile 6 SDK and started plugging away. I have some code that uses the Singleton<> implementation I blogged about before. Everything compiles fine, but when I try to run the application, it fails with a runtime exception :

System.NotSupportedException was unhandled
at System.RuntimeType.InvokeMember()
at System.Type.InvokeMember()
at SingletonFactory..cctor()
at Axiom.Core.Singleton`1.get_Instance()
at Axiom.Core.Root..ctor()
at DeviceApplication1.Program._configure()
at DeviceApplication1.Program.Run()
at DeviceApplication1.Program.Main()

The exception is thrown on this line :

internal static T instance = (T)typeof( T ).InvokeMember( typeof( T ).Name, BindingFlags.CreateInstance | BindingFlags.Instance | BindingFlags.NonPublic, null, null, null );

Now I'm not sure which part of this is unsupported, but if I figure it out, I'll update this post.

Oh, one interesting aspect of developing with the Mobile 6 SDK and using the Emulators is that you should go into the project properties and uncheck the option to deploy the latest .Net Runtime. Took me a while to figure this out, but until I did my device kept on running out of space to deploy the application.

I have been working with SharePoint 2007 (MOSS) for quite some time now. Lately, most of the work has been around branding. Some things to note when you are creating your features and solutions to deploy your new branding files:

  1. The name of the feature XML file in your feature folder must be Feature.xml (case sensitive) in the Solution Manifest.
  2. If you are deploying themes using a FeatureEventHandler, make sure you update the version of the assembly otherwise the new assembly will not get deployed correctly.
  3. You Theme INF file must not be named theme.inf. If it is, you will get the dreaded 'There is already a theme named '...' on the server.' error.

More to come, stay tuned.

More Posts Next page »