On holiday in Dubai and saw this:
Pretty cool...
Some time ago I started wondering about mocking and IOC in Silverlight 2. There is quite obviously a gap here that someone needs to plug, as soon as you start writing tests (thank you Jamie Cansdale!) you're going to need mocks of some sort and as soon as you have a Silverlight project of any real size, IOC becomes necessary.
Mark Monster blogged about what it would take to port Castle DynamicProxy and consequently Moq to Silverlight and so until someone comes along with a better or official solution I decided to take up the challenge. There was a fair amount of work, although in terms of actual code changes that were needed due to API changes in the Silverlight CLR there was really very little, the brunt of the work as Mark pointed out was around the lack of Remoting and also the lack of non-generic collections in Silverlight. I will just note though Mark, your list of code changes required to get these projects to compile is a MASSIVE underestimate, because the compiler shows as many errors as it can, but only when you fix these does it throw another few hundred at you! More...
Update - 9/6/2008 : Updated for Silverlight 2 Beta 2!
One of the problems I've run across while playing around with the Beta is the lack of support for any easy way to navigate around you application by moving between Xaml pages. The problem really stems from this little piece of generated code in your App.xaml.cs file.
private void Application_Startup(
object sender,
StartupEventArgs e)
{
// Load the main control
this.RootVisual = new Page();
}
Looking at the docs for the RootVisual property of Application class, we're told that RootVisual can only be set once. My limited testing shows that this isn't actually true, and that it's possible to set LayoutRoot as many times as you'd like but only in the Application_Startup handler, which is obviously of very little use! More...
Update - 9/6/2008 : Updated for Silverlight 2 Beta 2, new Silverlight.js included!
Silverlight 2 is here and with it's arrival there are going to be a whole load of Blogengine.NET using developers wanting to embed their sample Silverlight apps in their blog posts.
Presented here is a Blogengine.NET extension which makes all the necessary arrangements to embed your content. It works, like most others, by using a token that you type into your posts and in the most basic form looks like this:
[ silverlight:source=/ClientBin/MySilverlightApp.xap ] (without the spaces!) More...
Update - 9/6/2008 : Rebuilt the solution for Silverlight 2 Beta 2
I don't think I'm alone in saying that I've been waiting to get my hands on the Silverlight 2.0 bits for quite a while now. First impressions: it delivers!
I've been reading through the docs and playing around with the bits and my mind has been buzzing with loads of little samples and things to try, many of which will make it to these pages over the coming months I'm sure. I was actually reading though the API docs on MSDN before MIX08 even started and when I saw System.Text.RegularExpressions it just popped into my head I could make my first little baby steps with a Silverlight regex evaluator.
If you have read through all of Mr Guthrie's tutorials, which I highly recommend you do, then most of the code is very simple so I will only highlight a few interesting pieces, although as always the code will be available for download. The application cycles through all available matches for the suplied regular expression highlighting each in turn as you press the button. If no match is found or the last match has been reached a modal "MessageBox" type control is displayed. More...
Background
In writing a pretty boring LOB app for my day job, I had the need to associate and store arbitrary files with records. I didn't want to just store the file in the actual database, so given that the application already sends audio and image data to an Ftp server on the network I figured I would store the files there also and just hold the file name in the database. 'm not storing the path, just the name and extension of the file and then the file is on the Ftp. Works very well and any client in the building can store pdf/doc/xls/etc files and anyone else can see and save them. The problem I had was that I wanted to make a nice UI for the workflow and display the correct icon for each file. There is a handy static method for extracting icons from files, Icon.ExtractAssociatedIcon(filePath), which works great when you actually have the path to a file you want to find the icon for. Unfortunately there is no way built into the framework to get the default icon for a given file extension. More...
Having just read a pretty interesting post by some guy who gets quite emotional about "else" blocks, the way to spot that this is an emotional reaction is the use of "Never-ever-under-any-circumstances-for-any-reason-what-so-ever", I have to admit I really liked the post. It was fascinating for me to see and have explained some other developer’s little mental twitch reflex when he sees "else" used in (what he considers to be) an inappropriate way.
The truth is I liked it because secretly I have one of my own. Actually I think its way worse than his. Why oh why did Microsoft see fit to include compiler keywords for primitive types? What purpose does it serve?
We have "string" for String, "byte" for Byte, "int" for Int32... Why? Seriously, why? "float" and "double", what's that all about, what we're talking about is single and double precision floating point numbers, if you're at least going to have compiler keywords for these they should be "single" and "double". If you're going to do this kind of thing, we already have "smalint", "int" and "bigint" from Sql Server, why not stick to that instead of "short", "int" and "long"? Has the whole world gone to madness? More...
There are several implementations out there already for doing this, but for one reason or another they all did something I didn't like. Some use the registry, some can't pass parameters, some use P/Invoke, some use remoting and others use the VB libraries. Not quite high treason but even so, an all C# and very light implementation has got to be worth the effort. More...
Before I start, I'll give fair warning, this fits squarely into the category of post where the topic is going to be of very little interest to most readers, however it just might make one person out there a very very happy developer and save them some pain.
I'm nearing the end of my adventures (I sure as hell hope there are no more problems, put it that way) writing a Winsock LSP and I have to say, it's been a gloriously excrusiating experience.
One of the problems I had when tinkering with this was with the new Windows Integrity Control stuff in Vista, in particular, how it all applies to IE7 Protected Mode. I'm sure it's all far more secure and that's a great thing, but it does put some obstacles in the road of people writing code which runs in the IE process, such as BHO's and toolbars... and also Winsock LSPs. More...
In addition to the post made here a few days ago, registrations were opened today for the UK launch event of all three products, and just like our friends over in the USA we also get a free copy of everything just for turning up!
You can register on the (cheesily named) Heroes Happen Here UK website, go get it while you can. See you there! More...