Browse by Tags
All Tags »
Code (
RSS)
Right, so in Part 1 we looked at the requirements for a Discovery Service and in Part 2 we looked at how we'd host the WCF service. Now it's time to look at the UDP itself. First off though, if you look in Part 2 , at the declaration I've got for DiscoveryServer , you'll see I'm inheriting from a DiscoveryBase . This base class will handle most of the UDP stuff, since both DiscoveryClient and DiscoveryServer need a very similar set of operations. Let's look at the most important...
Right, so in Part 1 we looked at an overview of how this discovery system should work. Now let's start looking at specifics. Before we start diving into the UDP stuff, let's look at the information that the server will publish and how this will be accomplished. If you recall, the mechanism I suggested was that the server host a normal WCF service that held the information about the services, and that the UDP would be used to provide access to this service. So let's start with the WCF...
Metadata Exchange mechanisms such as WSDL are all very well and good, but they fulfil one part of the automatic discovery experience. If you look at WCF a service consists of three parts: Contract Address Binding So, Metadata Exchange helps you figure out the Contract if you're given the Address and sometimes the Binding. All very well and good for assisting us developers get running in using a service. However, how about a scenario where you already know the Contract but you need to figure out...
What's something everybody wants for their application, but very few people have the time to deliver? Performance. Let's face it, in most software projects, performance requirements are relegated to the very end of the project, when every knows they won't have the time to address them. In one sense this is a good thing, as one of my biggest bugbears is premature optimisation. Premature optimization is the root of all evil. - Hoare's Dictum, Sir Tony Hoare When should I optimise? Now...
There seems to be some confusion in the sadeveloper forums about the Dispose pattern, so I thought I look at it in a bit of detail. Deterministic Finalization Deterministic Finalization is something that C++, Pascal and similar languages have. What this means is that when you decide that you're finished with something it is cleaned up immediately. The delete keyword in C++ is used for this purpose, it will call any destructors of the object, and then release the memory that the object uses. In...
I saw this absolutely hilarious comp.compression thread on reddit . Trust me, even if you don't know anything about compression, it's well worth a read. This bright spark called Ashley Labowitz starts off by expounding on his fractal compression system that he's working on. He starts off by stating that the comp.compression FAQ is incorrect, which doesn't earn him many friends. He keeps going on about his system that he claims can compress any file. Unfortunately for him this is provably...
Normal Richards has a brilliant idea for making exception handlers a little neater. His example is for Java, but the syntax would work fine for C#. Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
Quite a long article where I discuss the creation of a generic Range class, and go into the decisions and thinking about many of the design aspects. Touches on lambdas, iterators, generics, and the usual rambling grab-bag of stuff I go on about when I get excited.
I've just recently got my paws on the Orcas beta, and am wading through many blogs, trying new stuff out. I have come across a very cool blog called Yet Another Language Geek by a guy called Wes Dyer. If you haven't subscribed, trust me, do so now, but I'd strongly suggest reading some of his earlier posts first. Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
Introduction In my blog post about marshalling calls , I discussed the basic pattern I use to create an asynchronous component. Well, in this article I’ll discuss a specific example. I was inspired by a post to a forum where someone was asking about the simplest of all possible things: searching the file system. He mentioned that he’d be searching the C:\ drive and all subdirectories, and I pointed out that such a search could take a while. I suggested that in such a situation he run the search in...
In the MSDN Forums not too long ago I had an argument with someone who felt that it was silly not to allow static methods on an interface. So, you could create the following interface: interface IFoo { static void DoThis(); } Any class implementing IFoo would then have to implement the DoThis static function: class MyClass1 : IFoo { static void DoThis() { Console .WriteLine( "MyClass1" ); } } Quite a neat idea, just taking the concept of interfaces and applying them to static members, right? Not...
This one is a common request on the forums, and it has a simple, if somewhat inelegant response: try { using ( FileStream stream = File .OpenRead(path)) { // Do stuff } } catch ( IOException exception) { // Handle locked file } There is no File .IsLocked ( string ) method, which would appear to make our code much more elegant: if (! File .IsLocked(path)) { using ( FileStream stream = File .OpenRead(path)) { // Do stuff } } However, there is a bug in this idea. What if another process opened the file...
With the whole BeginInvoke, EndInvoke thing for delegates, I had always thought that you should call EndInvoke, but you didn't have to. Turns out I was wrong. IanG discusses this here . Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
The Windows Forms UI is not thread-safe, and most calls to WinForms components must be made from the thread that created them. Basically, every WinForms application has a UI thread and zero or more background threads. Control access must be via the UI thread. All well and good, but how do you accomplish this when dealing with background threads? As I see it, there's two main approaches. Caller-driven marshalling In this model, the code that is calling the component is responsible for any marshalling...
What is infinity? It's commonly represented as the lemniscate (∞), that funny sideways 8 that conjures to mind a Mobius strip. If you wanted to get hard core about it you could start talking about Cantor sets, aleph zero, aleph one and suchlike. You also get all sorts of cool paradoxes with inifinities, such as Hilberts Grand Hotel . Anyway, to get back on track, that funky little symbol allows us to imagine a major misconception, that infinity is a thing , it's not, it's a process...
More Posts
Next page »