hash_bucket()

Archive for April 2007

is the name of my good friend Ander’s project that he is running out of Copenhagen, Denmark (and sometimes Tokyo, Japan as well). The project revolves around design in various fields such as web, print, fashion and so on. You should definitely check out his site at

http://www.venomyum.com/

I’m sure you’ll like what you see! Also don’t miss the fashion collections over at http://www.1206.dk/collections/goodlock/ which showcase some of Ander’s incredible talent!

MIX 2007

Posted on: April 20, 2007

Maybe most of you already know, but I’ll be visiting the Mix07 Conference in Las Vegas, USA (April 30th to May 2nd). Mix is a conference that aims to bring together web developers, designers and IT decision makers for a 72h discussion on the future of the web.

mix
While MIX is organized by Microsoft Corp. they are really trying hard to get a good mixture of people that live both in the MS-world and those that do not.

At last years conference I was really surprised at how many non-MS speakers there were, and that those speakers also seemed to be comfortable enough to actually deliver a very sober and unbiased view of MS and their technologies. Many of the new technologies and platforms that Microsoft is unleashing unto the world lately offer knew paradigms for software development and deployment. Thus critique, as well as unbiased appreciation is very important I think.

Last year was a lot of fun and I am looking forward to this years event as well.

This post is going to explain, in simple terms, how to build an XBAP that needs to access data (in this case XML) over a network. It is also going to talk about how to communicate with a Web Service from within an XBAP. All this while avoiding the WebPermission exception AND the Environment exception. :) And no, we won’t be going full-trust.

As always, some things are simplified for the sake of clarity, if you feel there is something you’d like me to explain in more detail, please drop a comment.

Let’s get to it. First a list of truths (as of 2007/04/12):

  • An XBAP cannot communicate with a WCF Web Service*
  • An XBAP cannot access local resources on the users machine**
  • An XBAP cannot access arbitrary online resources***
  • An XBAP is very sensitive about its Site Of Origin
  • * – As of now, however, rumors say that with the release of .NET 3.5, this might be made possible, within certain security limitations.
  • ** – Unless the application is installed and running with modified security settings. By default an XBAP lives in the security sandbox of the Internet Zone.
  • *** – For example, you can set an Image control to Source an image from an off-site url, but you cannot (by default) access an XML stream from an arbitrary URL, via for example an XmlDocument.Load().

So with that out of the way, how do you go about connecting your XBAP to a webservice? Well it turns out that you can actually communicate to non-WCF webservices, and in the world of .NET that means ASP.NET (asmx) services.

This fact has lead some to suggest the technique of Bridging, but what does that mean? Well, say that you have a set of nice WCF services, or for that matter services that do not reside on the same physical machine / domain as your XBAP. In that case, what you do is you build an ASP.NET service that exposes methods to go get the data from these other services and pass it back down to you, thus acting as a bridge between your XBAP and the rest of the world.

How is this possible if an XBAP cannot access arbitrary online resources? Well it turns out that an XBAP can actually communicate with one and only one point outside its protective little bubble, without security getting in your way so to speak :), and that is that magical place called the Site of Origin. The following illustrations should clarify somewhat:

Xbap data flow

This needs to be explicitly enabled in the security settings for you project.

(In VS2005, right click your project in the Solution Explorer and select Properties, click the Security tab, the Advanced button and then make sure the “Grant the application access to its site of origin.” check-box is checked. Also why you are there, it helps to fill out the “Debug this application as yada yada” textbox with a domain/machine name that makes sense to you. I will explain why later.)

Now that you have that out of the way, two things become possible. First of all you can access webservices hosted on the same site, and even better you can now reference resource-uris that reside on this domain.

So say for example that you have an XML file sitting on the same webserver as the one hosting the XBAP, and you’ve granted the application access to its site of origin. This means you can do the following inside your XBAP:

using System.XML;
	XmlDocument D = new XmlDocument();
	D.Load("http://yoursiteoforigin/filename.xml");
	//Do something with your XML...

Not too bad :). Be warned however that the domain/machine name part of the site of origin must be the same as the one you set in the security settings. This can lead to some confusion during debug when for example you might have set the site of origin to ‘http://machinename’ but in your project you might refer to the ‘http://localhost’. This will not work!

This also means that in some scenarios you can switch out your bridging ASP.NET webservice for a Windows Service that serves up XML data to the webserver that you application can download, thus avoiding the need to open up and secure a web service.

This whole site of origin thing is very important for another reason as well. Say that you are developing and testing an ASP.NET web service on the same machine, and that you deploy it on your local IIS (I’m talking about IIS6 by the way). If you then go ahead and reference that service in your XBAP project, you need to take note so that the url by which you refer to it is the exact same as your site of origin.

Don’t let the machinename/localhost similarity fool you, the Url’s that get added to you Service.wsdl file need to be exactly the same as the ones you specified as the Site of Origin.

Ok, I’ll stop here for now. More on the deployment of ASP.NET services and XBAPs in another post.

Teaching

Posted on: April 11, 2007

Today I held a 3 hour introduction to building user experiences (that’s UI’s for those who don’t like Buzz words :) using the Microsoft Expression suite of applications.

Focusing mainly on Expression Blend and how to integrate it into the workflow, I took the class from understanding the relationship between code-behind files and XAML, walked through data-binding, control templates & styles, animations and events, and finally built a small RSS reader.

I also gave a short introduction to the .NET framework and how its various parts come together to form the basis of the Expression/Visual Studio workflow.

The whole presentation was in Japanese and I suspect I did some interesting mistakes in both grammar and vocabulary. Sometimes translating technical terms from English to Japanese can be really tricky. A few times I managed to mix the word for Relationship with the one for Jump-Suite, causing some very confused looks :). 

Dating

Posted on: April 11, 2007

Last weekend me and S went to Oodaiba for a good old fashioned date. It’s been a while since we went out dating like that. Not that we don’t go on dates, but since we have a car we often drive to different locations. The problem with that however is that you are always sort of pressed by the omnipresent parking-ghost that haunts Tokyo.

Last Sunday however we went by train and took a slow and cosy stroll down the beach-area, stopping for lunch at a cafe and doing some shopping in some of the stores around the Decks are. The sun was shining for the most part and it was a beautiful spring day.

After this we took a boat tour from Oodaiba to Hamamatsuchou, something that I have been wanting to do for a long time. We got to go under the Rainbow Bridge, and we also got a magnificent view of Tokyo from the water.

One of our friends who runs a french restaurant in Ebisu also celebrated the 10 year anniversary of his business, so we decided to drop in, say hello and have a glass of champagne befor ending the day in a small thai restaurant with a cold beer.

It was a great day and just the perfect relaxation from all the work lately, and walking around with S like this made me feel even more how much I love and treasure her by my side.

as the old statement reads in Murder on the Mississippi (c64 Adventure game released in 1986).

Yesterday I was feeling a little bit odd and my head just wouldn’t focus on my tasks at hand. I though maybe I was just tired, but when I got back home S suggested I check my temperature, and it turns out I had a high fever. So today I am staying home taking it easy and trying not to get to caught up in work ;).

Now what better way to distract oneself than through some computer gaming I thought to myself, and starting searching the web for some free downloads. While doing this I drifted in to the realm of abandon ware (essentially games that are so old that no one cares anymore if you copy them around).

I have always been a fan of adventure games, and by that I mean real adventure games that feature a box of verbs at the bottom of the screen and where it is virtually impossible to get killed. Ever since I first started using computers I have always been hooked on these games with their wonderful ability to engulf the player in virtual settings. I guess to me in many senses it is much like reading a good novel, though a bit more interactive, challenging and frustrating from time to time.

Anyways, many times since the demise of the Amiga platform I have cursed the modern game development companies and Mr. Carmack (even though yes, I know he does a lot of good things in the open source sense…) for the death of this game genre. Mostly because I believe I have played through most of the major adventure games ever put out there, and while they are great the first time, the very game-play model doesn’t lend it self to replays (except for Cruise for a Corpse which might just be the best game ever produced…). So the lack of new titles puts me in the rust so to speak.

Still, there is one game that I never managed to get my hands on back in the days when you could spend afternoon by afternoon just playing; “The Lost Files of Sherlock Holmes: The Case of the Serrated Scalpel”.

Released in 1992 by Electronic Arts (Developed by Mythos Inc.), I think one of the reasons I never got to play it was because this was just about the time when Commodore was about to go down, and those were tumultuous times for most of us… (naturally I didn’t own a PC at the time…) I remember though, reading in DMZ (Besvarjaren Besvarar) about the various problems and riddles in the game, and thinking to myself “I have GOT to get this game…”. Never happened…

Until today! I downloaded DosBox and the abondonware PC image of the game, set it all up and dove in.

So here I am, sun flowing in through the living room window, drinking cider and eating potato chips while playing the one game I have been yearning for for almost 15 years… and I almost feel like I am 14 again ;)

The world would be a better place if there were more adventure games out there… Just imagine what they could look like with todays graphics…

“Come, Watson, come! The game is afoot!”


.

This blog has no clear focus. It has a focus though, it's just not very clear at the moment...

Dev Env.

Visual Studio 2008 Prof / NUnit / Gallio / csUnit / STools (ExactMagic) / doxygen / dxCore / TypeMock / TestDriven.net / SequenceViz / CLRProfiler / Snoop / Reflector / Mole / FxCop / Subversion / TortoiseSVN / SlikSVN / CruiseControl.net / msbuild / nant

Blog Stats

  • 81,261 hits