New blog about XNA programming

by eliasen 30. oktober 2009 18:44

Hi all

Just a quick note to let you all know that my friend and colleague Jakob Lund Krarup has started a new blog about writing games using Microsofts XNA framework.

So if this interests you, do follow it :-)

 

Edit (2009-11-04): The link to the blog is http://www.xnafan.net – which I seem to have missed just before…

 

--
eliasen

Tags:

Testing a map when using the “Fixed” property on an element in your schema

by eliasen 25. oktober 2009 20:33

Hi all

Today I tried playing with the “Fixed” property that can be set on an element or an attribute in your schema. According to the documentation, this is then a value that MUST be present in the element.

image

So the mapper is actually quite down with this – you cannot map anything to the field that has a value in the “Fixed” property. And when expecting the XSLT that is generated by the mapper you will find, that the mapper simply inserts the correct and hard coded value into the field.

image

Great.

Now, I created some links in the map just to test it, and chose that the mapper should validate the input for my map, but not the output, since I hadn’t bothered dragging all the necessary links.

To my surprise I got this error:

   1:  Output validation error: The value of the 'MiddleNames' element does not equal its fixed value.

An error validating the output of the map… but this surely must be a mistake, because I turned validation of the output from the map off and besides; the value in “MiddleNames” cannot be wrong, because the mapper has put it there it self, taken from the schema. Very weird indeed.

Only after quite a search, did I discover that the error was in validation of the INPUT to the map and not the output. I had used the same schema as both input and output, and my input instance did not have the correct value since it was an old test instance.

But really… Microsoft… that error message could be better! :-)

Hope this helps someone.

--
eliasen

Tags:

Keyboard Shortcut to insert a cross reference in Word 2007

by eliasen 25. oktober 2009 14:34

Hi all

As many have noticed, I am co-authoring a book and right now I am writing all my stuff in Word 2007.

As you might have guessed, I have lots of sections, subsections, figures, tables and other numbered items in my text, and naturally, they are there because I need to reference them in my text.

In order to insert a cross reference from some text to a given numbered item, I found two options:

  1. Go to the “References” tab and click on “Cross-reference” in the “Captions” section.
  2. Go to the “Insert” tab and click on “Cross-reference” in the “Links” section.

Both will give me this window:

image

This is all very fine, but I need a quicker access point, since it appears that I most often need both clicks to get to the dialog box, since I am usually not on either the “Insert” or the “References” tab.

So I discovered the “Quick Access Toolbar” by chance. This happened when I accidentally right-clicked on the “Cross-reference” in stead of clicking on it. Here I could add the functionality to the “Quick Access Toolbar” and also choose to show the “Quick Access Toolbar”, as seen here:

image

The arrow points to the “Quick Access Toolbar” and the red square is around the “Cross-reference” functionality. So now I always only need one click, which made me happy… for a while :-)

Because once I could do it with just one click, I started wondering about a keyboard shortcut for it. I couldn’t find one, and I searched and searched… and finally just after posting my question to a newsgroup, I found how to do it:

Go to “Word Options”, which is a button at the lower right when clicking on the Start button at the upper left of Word:

image

This will open up the Word Options. Go to “Customize” and click on “Customize…” as seen in the image below:

image

After this you get a screen where you can change short cuts, as seen here:

image

Choose “Insert Tab” and then “InsertCrossReference” and click in the “Press new shortcut key:” box. Now enter the shortcut you want (I entered Alt+Ctrl+Shift+C). Word will tell you if the shortcut you have chosen is all ready assigned to another function (Mine is “Unassigned” as you can see) and then you can click on “Assign” to complete the task.

So now, every time I need to insert a cross reference, I just pres Ctrl+Alt+Shift+C and the dialog box comes up.

All that is left now is to get the “Only Label and number” as the default value for the drop down that decides what to insert instead of “Entire Caption”, but a Word MVP wrote in a post I found that this was not possible. Bummer. Keeping my fingers crossed for Office 2010! :-)

I hope this helps someone.

--
eliasen

Tags:

Error using unit test of schemas

by eliasen 24. oktober 2009 19:51

Hi all

If you are also receiving this error when unit testing your schemas:

TOMTreeGenerator.GetElementAbsoluteType: Object reference not set to an instance of an object.

then I can inform you that the reason is, that the built-in unit test framework does not support schemas that include or import other schemas.

To partially overcome this, take a look at the seventh issue of the BizTalk Hotrod at http://biztalkhotrod.com/default.aspx, where it is explained how to write a small helper class that will allow you to do unit testing on schemas that include and/or import other schemas.

Unfortunately this does not cover native file formats, but one can hope that Microsoft will improve the unit testing features in future versions of BizTalk.

Tags:

delebarn.dk

by eliasen 18. oktober 2009 17:46

Hi all

My apologies for writing something that is only relevant for the Danish audience.

Anyway, my friend and former colleague Jesper Petersen and his wife, Helle Petersen have started a new web site at http://www.delebarn.dk. The web site is a tool for parents that are divorced and need a some way of communicating about their children. There are lots of features that a free and you can buy a VIP membership quite cheap.

The site is only in Danish.

So if you are divorced and need some way of handling information about your children, like; How did it go at the doctor? When is football practice? And lots, lots and lots other stuff, then take a look at http://www.delebarn.dk.

Thanks

--
eliasen

Tags:

can only call or exec a service

by eliasen 17. oktober 2009 20:59

Hi all

The other day I ran into a strange error when compiling my BizTalk solution. It was a simple solution, which I was fairly sure there was nothing wrong with. I had two projects. In the first I had a public orchestration and in the second I had a schema and an orchestration that calls the orchestration in the first project.

So the project structure looks like this:

project_structure

So not something that would normally go wrong. Anyway, the “customer.biztalk.sendmail” project compiles just fine. But when I compile the “eliasen.customer.test” project it fails with these three errors:

  1. identifier 'biztalk' does not exist in 'eliasen.customer'; are you missing an assembly reference?
  2. cannot find symbol 'customer.biztalk.sendmail.Send_Receipt'
  3. 'biztalk.sendmail.Send_Receipt': can only call or exec a service

This was weird. Apparently the called orchestration (customer.biztalk.sendmail.Send_Receipt) could not be found. Now since there has been a lot of issues with the copy local functionality being broken, that was my first thought. But since my solution had never been deployed and using Reflector on the customer.biztalk.sendmail assembly that was copied to the bin folder of the eliasen.customer.test project had all the right classes, I skipped that idea.

Then, just to be sure, I checked that “biztalk”, “customer” and “sendmail” aren’t reserved words in XLANG/s here: http://msdn.microsoft.com/en-us/library/aa547020(BTS.10).aspx – they weren’t.

Then I googled the “can only call or exec a service” error and found a couple of hits, but none that I could directly relate to my issue.

Then, as if struck by divine intervention, I thought of changing the namespace of the orchestration that was being called. Maybe in hindsight it makes sense, since one of the errors is telling me that it is looking for “biztalk” in the “eliasen.customer” namespace, which really doesn’t make sense at all.

Anyway, I opened up the properties of the called orchestration and changed the namespace:

new_namespace

and then it compiled… after re-choosing the called orchestration in my “Call Orchestration” shape. This, of course, is not acceptable – I want to be able to have any namespace I want. It seems that somehow the compiler matches the “customer” in “customer.biztalk.sendmail” to the “customer” in “eliasen.customer.test” with each other.

I have tried looking deeper into this, but I can’t seem to find the exact reason it is failing, so I will probably just report it to Microsoft and then let them deal with it :-)

Hope this helps someone…

--
eliasen

Tags:

Demotion does not work for attributes… or does it?

by eliasen 16. oktober 2009 11:52

Hi all

Today I discovered something I was not expecting while documenting something else, which I have just described here.

I had a solution that involved this input schema:

inputschema

and this output schema:

outputschema

Field1 from the input schema and Field3 form the output schema are promoted to the same property and Field2 form the input schema and Field4 from the output schema are also promoted to the same property. Note, that Field4 is an attribute, whereas Field1, Field2 and Field3 are elements.

I then have a map that does not map anything from the input to the output. It just creates empty elements/attributes in the output schema.

I added a receive port and receive location to read in the input and used the XMLReceive pipeline, because I needed the messagetype and I needed the property promotion. I added my map to the receive port. I then created a send port that basically just took everything that came in on the receive port and sent it out to a file. The send port uses the XMLTransmit pipeline.

The output from this was, as I expected. Given this input:

inputinstance

I got this output:

outputinstance

What happens is, that demotion is not supported for attributes, which really seems like a silly restriction, but that is just how it is.

When, however, I implemented my solution using an orchestration, it worked! The value of Field2 in the input was demoted into the value of Field4 in the output.

My orchestration is very simple:

orchestration

Basically, I receive the input, transform it using the same map as was on the receive port, copy over all the properties:

   1: OutputMessage(*) = InputMessage(*);
   2: OutputMessage(DemotionTest.Property1) = InputMessage(DemotionTest.Property1);
   3: OutputMessage(DemotionTest.Property2) = InputMessage(DemotionTest.Property2);

The reason that I copy over Property1 and Property2 manually is, that they are marked as MessageDataContextProperty in the property schema, and therefore, they are not automatically copied over using the OutputMessage(*) = InputMessage(*) statement.

After doing this, I just send out the message. The result is this:

outputinstance2

Now, this confused me… and what confused me more is, that I can actually do it with the passthrough pipeline on the send port. This means, that the demotion is happening as the orchestration publishes the message into the MessageBox for sending out the message.

So the upside to this is, that demotion for attributes DOES work – but only when the demotion occurs inside an orchestration upon sending out the message.

The downside is, that the product team have managed to do things differently depending on where in the process it happens, which really sounds like bad design. Hopefully they will fix this at some point in time.

Hope this helps someone

--
eliasen

Tags:

Copying context between messages in an orchestration – how does M2(*) = M1(*) work?

by eliasen 16. oktober 2009 11:38

Hi all

It is pretty common that developers want to assign one message to another inside and orchestration. And as we all know, this must happen inside a “Construct Message” shape.

Inside the “Construct Message” shape, you can have several shapes, but they must all be either a “Transform” shape or a “Message Assignment” shape. The “Transform” shape is used to execute a map, that will generate the message(s) that is/are to be constructed. The “Message Assignment” shape on the other hand uses the expression editor to let you specify how to assign a value to the message(s) that is/are to be constructed.

Often, there is a need to basically copy a message and then change just a couple of values in the copied message. This can’t be done by changing the values of the existing message, as messages in an orchestration are immutable.

Creating the copy is pretty simple; You just assign one message to another like this:

   1: OutputMessage = InputMessage;

Now, what many people realize after doing this and something does not work, like routing, correlation or other is, that this assignment only copies the content of InputMessage to OutputMessage. The context is not copied at all. So what you can do is to add another line of code to your “Message Assignment” shape like this:

   1: OutputMessage = InputMessage;
   2: OutputMessage(*) = InputMessage(*);

This will copy the context of a message from one message to another… but not the entire context, as it turns out.

I was trying out a demo for property demotion, and for this I let my orchestration receive an input message, transform it to an output message and send this out.

So what I did was that I created two schemas:

inputschema and outputschema

I let Field1 and Field3 be promoted into the same promoted property from a custom property schema, and I let Field2 and Field 4 be promoted into another property in a custom property schema.

and a map that does not map anything – it just created empty fields for Field3 and Field4.

In my “Construct Message” shape, I then added a “Transform” shape to do the transformation and a “Message Assignment” shape that would copy the properties. I then wanted to make sure the output of the send port had the demoted values inside it.

What I expected to happen was this:

  1. The XMLReceive pipeline would receive the input, promote the two properties and publish the message to the MessageBox.
  2. The Orchestration would pick it up, perform the transformation, copy the context and send the message out.
  3. The XMLTransmit pipeline would demote the two values from context (that I had copied from the input message) into Field3 and Field4

This didn’t happen, though. No values were demoted at all. Now, not demoting into Field4 was expected, since demotion doesn’t work for attributes (or does it? See my blog post coming up in a very short time :-) ), but I really expected something to turn up in Field3.

It turns out, that this statement from my code:

   1: OutputMessage(*) = InputMessage(*);

does not copy ALL the context, but only the promoted properties that are marked as MessageContextPropertyBase. The ones that are marked as MessageDataPropertyBase (which is the default) do not get copied over. Now, this actually makes sense, all though it baffled me at first, since properties marked as MessageDataPropertyBase are based on values inside the message, so they cannot just be copied to another message type, since BizTalk cannot guarantee that this property exists on this message type and that the element that points to the promoted property actually exists in the message. Well, I guess BizTalk COULD guarantee that, but Microsoft have chosen not to implement that.

Also, distinguished fields, which are also in the context of the message are not copied over – again, this makes sense, since these are tightly bound to the schema they come from (This doesn’t stop the mapping engine of copying them over in maps on receive ports, though, which is really silly – see here).

SO, in order to get ALL the context copied form my input schema to the output schema, I needed three lines of code:

   1: OutputMessage(*) = InputMessage(*);
   2: OutputMessage(DemotionTest.Property1) = InputMessage(DemotionTest.Property1);
   3: OutputMessage(DemotionTest.Property2) = InputMessage(DemotionTest.Property2);

or I could mark the properties as MessageContextPropertyBase.

Yes, indeed… So remember this from now on:

  1. Assigning one message to another does NOT copy over the context
  2. Copying over context using M2(*) = M1(*) does NOT copy over custom properties that are marked as the default (MessageDataContextBase)
  3. In order to get the rest of the properties copied over, do it manually or change the type of the properties, if applicable.

I hope this helps someone…

--
eliasen

Tags:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

by eliasen 15. oktober 2009 20:41

Hi all

When developing BizTalk 2009 solutions using Visual Studio .NET 2008 on Windows Server 2008, you run into issues when deploying from within Visual Studio .NET.

Now, first of all, as long as there are issues with BizTalk 2009 on Visual Studio .NET 2008, you should refrain from deploying from within Visual Studio .NET.

Secondly, when deploying on Windows Server 2008, you might run into this series of errors:

First error:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)), followed by

Second error:

at Microsoft.BizTalk.Gac.Fusion.IAssemblyCache.InstallAssembly(AssemblyCacheInstallFlag flags, String manifestFilePath, FusionInstallReference referenceData)
   at Microsoft.BizTalk.Gac.Gac.InstallAssembly(String assemblyPathname, Boolean force)
   at Microsoft.BizTalk.Deployment.BizTalkAssembly.GacInstall(String assemblyLocation)
   at Microsoft.BizTalk.Deployment.BizTalkAssembly.PrivateDeploy(String server, String database, String assemblyPathname, String applicationName)
   at Microsoft.BizTalk.Deployment.BizTalkAssembly.Deploy(Boolean redeploy, String server, String database, String assemblyPathname, String group, String applicationName, ApplicationLog log)

Third error:

Unspecified exception: "
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Fourth error:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Fifth error:

Failed to add resource(s). Change requests failed for some resources. BizTalkAssemblyResourceManager failed to complete end type change request. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

 

Now, usually, I must confess that my developer machines are usually virtual PCs, where I just login as the local administrator. If you do that, everything works fine. But in Windows Server 2008, Microsoft have introduced a new security system, where you need to approve it every time you start up some program that requires administrator rights – even if you are a member of the local administrators group.

So for instance, starting up BizTalk Server Administration console will cause this to appear:

user account control

And you have to click “Continue” to start it up.

The error above is because suddenly, even if you are a member of the local administrators group, you cannot add assemblies to the GAC.

You have three choices to fix it:

  1. Login with your username, but run Visual Studio .NET as an administrator. This is done by right clicking on the short cut for VS.NET and choosing “Run as administrator”.
  2. Login as administrator
  3. Turn off the “User Account Control”. This is done by entering “Control Panel” => “User Accounts”. Click on “Turn User Account Control on or off” – and in here you can turn it off. Now, when logged in as a user that i not the administrator, but who is a member of the local administrators group, you get the rights you usually have.

 

Hope this helps someone

--
eliasen

Tags:

BizTalk courses in Denmark

by eliasen 13. oktober 2009 19:12

Hi all

Just to let all you Danes know, Alan Smith (MVP) will be delivering the famous Quicklearn courses in BizTalk Deep Dive and BizTalk for Administrators in Copenhagen this fall.

You can see more about the courses at

BizTalk 2009 Developer Deep Dive – November 16’th

BizTalk 2009 for Administrators – November 30’th

Both courses are 5 days.

--
eliasen

Tags:

About the author

Jan Eliasen is 37 years old, divorced and has 2 sons, Andreas (July 2004) and Emil (July 2006).

Jan has a masters degree in computer science and is currently employed at Logica Denmark as an IT architect.

Jan is a 6 times Microsoft MVP in BizTalk Server (not currently an MVP) and proud co-author of the BizTalk 2010 Unleashed book.

BizTalk Server 2010 Unleashed


Buy from Amazon

Microsoft MVP


6 times: July 2004, July 2008, July 2009, July 2010, July 2011, and July 2012. Not currently an MVP.

MCTS

Image to show

Month List

Page List