Software Development
Just a quick note on something that helped me get my solutions builds to run faster as I develop. First off, I’ll admit that “Faster Builds” is a bit of a stretch. I’m not actually making VS compile faster. Rather, I’m reducing the amount of time I waste waiting for a build to complete. Time Consuming Builds… Some solutions have a ton of stuff going on in their compilation process: Numerous projects (presentation, business, data, etc) Unit tests (maybe one per project) Static code analysis ...
Today, I finally resolved an issue that I thought was related to WPF’s focus implementation. For some reason, I couldn’t get certain elements to get focus when I clicked on them. This was messing up a number of other things, including keyboard interactions and routed commands. I thought that I had some strange scenario that was preventing focus from going to my canvas. Maybe some issue with FocusScopes? Maybe the control wasn’t Focusable? It turns out that I had a number of event handlers set up for clicking, dragging, etc. In these, I was setting e.handled = true. Not...
A lot of the MVVM guidance around commands suggest using a generic ICommand implementation, such as the RelayCommand or GenericCommand implementations. These are great for UI pieces that are bound directly to an underlying ViewModel and I use them frequently. There are still cases where a RoutedUICommand is exactly what one needs. Take, for instance, toolbar buttons or menu items that need to act on pages that are loaded in a WPF frame. In this case, a RoutedUICommand is appropriate since it is decoupled from the page, which may or may not be loaded at the time. ...
I recently started listening to the Herding Code podcast and BoagWorld podcast and have subsequently been exposed to some really interesting “stuff”. I thought I’d put these down, if for no other reason than helping me remember to try them out. JSConf Javascript is getting a lot of attention and investment lately. This is both in the browser and on the server. There are a ton of cool things going on, many of which are discussed at JSConf. One of the trippy things I heard about is a JS library that will rip flash into HTML5...
When working with WPF resources, remember to declare the resources in the correct order. A style or template that is referenced elsewhere must be defined before it can be used. In other words, if Style1 uses BrushA as a StaticResource, then BrushA must be defined before Style1. Otherwise, you’ll get fun errors like: Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.FrameworkTemplate' It may be common knowledge, but it can be a real pain to diagnose. This is especially true if you have a large set of template and styles for...
Laurent Bugnion’s work on MVVM Light introduced me to the ViewModel Locator pattern. The concept and implementation are really slick!
From my perspective, ViewModel Locators do the following:
Provide a simple, declarative way to connect a View to a ViewModel (duh).
Enable design-time support, including the ability to connect an alternate data source behind the VM (cool!).
I want a solution that lets me:
Connect my XAML views to their associated ViewModels
Handle a somewhat complex model with a hierarchy of domain model entities and...
Scenario A user selects a new value from a WPF combo box. You ask if they are sure they want to do this. User says “No”. WPF app is built with MVVM such that the combo box’s SelectedItem is bound to a property on the ViewModel. In the setter, you prompt the user and attempt to cancel the selection by discarding the new selected value. Here’s the UI XAML <Window x:Class="WpfComboBoxCancelSelect.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Cancellable...
In some cases, I need to be able to build a query that has a variable set of OR conditions. This is not simple with the default language constructs and extension methods.
It’s simple to dynamically build an expression that includes AND parameters, because that is what the WHERE() extension method does. Not so easy for OR’ing together a bunch of conditions.
Enter LinqKit.
This is a great library. It provides some easy to use (but powerful) extension methods that let you “Or()” some conditions together. A common case is where you get a list of values that you need to add into...
I’m a little flabbergasted that Entity Framework does not do anything to enforce the MaxLength on string values. It just passes this responsibility down to the database and catches the resulting (unhelpful) exceptions. I suppose that there is a justification for this, but from an notably simplistic perspective… Why should I start a transaction and waste precious DB resources, only to get some generic “String or binary data may be truncated” error message back. It would be trivial for EF to use the metadata to ensure that you cannot push a 10 character string into a field that...
“Whatever doesn’t kill you makes you stronger”
That’s how I feel about Code Analysis. It’s painful, but in the end, it teaches me stuff that I didn’t know or hadn’t thought about.
Richard Broida challenged me to see if I could rework some WIN32 P/Invoke code to get it to pass Code Analysis rules. My initial response was pretty close to whining, but I recovered from my temper tantrum and did some investigation.
Luckily, I didn’t have to look too far… The info on the rule “CA1060:MovePInvokesToNativeMethodsClass” provided some useful guidance and explanation.
So I created a class in my project called...
So, I have a project with Code Analysis turned on and it treats warnings as errors. In this project, I have a class that overrides Equals() so that I can use some of the nice collection based linq expression (like Except()). Well, code analysis doesn’t like it if you override Equals, but forget to override GetHashCode(). Needless to say, I have to override GetHashCode(). But how does one do this? Some searching turned up a bunch of interesting resources showing how to do this. However, there isn’t some cut and paste code that solves the problem. You have...
I had a need to make my WPF app remember it’s size, position and state for the main window. A bit of “Binging” and I eventually heard the sound of found. Turns out there are a couple ideas out there, but the WINDOWPLACEMENT solution from MSDN seemed to fit the bill the best. This solution requires using some WIN32 API calls to get and set the information. The upside is that it seems to leverage the smarts built in to Windows regarding multi-monitor detection. The sample says that if the app was previously displayed on a secondary monitor that...
Maybe I’m late to the party, but I just found the Except() LINQ extension method. I knew I loved .NET! For those of you familiar with set theory, this returns the “difference” between two collections. In my case, I needed to append a set of items to an existing collection, but only if they’re not already in the target collection. This thing was just what I needed. Here’s the definition: //
// Summary:
// Produces the set difference of two sequences by using the default equality
// ...
I’ve been discussing an architectural question with a colleague this week. The scenario includes a WPF application, Domain Driven Design and MVVM. The goal is a relatively “pure” domain model where the classes in the model do not depend on any UI specific or other external assemblies. They are pretty much pure “POCO” objects.
The question is whether it’s reasonable to have the domain model implement INotifyPropertyChanged and INotifyCollectionChanged (via ObservableCollection).
INotifyPropertyChanged is defined in System.dll. It’s part of System.ComponentModel namespace.
INotifyCollectionChanged and ObservableCollection are both in WindowsBase.dll. These are in System.Collections.Specialized and System.Collections.ObjectModel respectively.
My take… go for...
For the past two days, I’ve been trying to get the infrastructure in place for skinning a WPF application. My goal is to support multiple skins and swap them out dynamically while the app is open. I could get the skin to affect the UI if I set it in the main window’s resource dictionary. However there was a quirk… The application uses WPF frames and pages. The skin was not showing up on frame’s pages. It would only show up on the main window. I searched Bing, Google and StackOverflow for answers. No luck. I...
In part 1, I asked the question “Do I expose the model directly, or do I wrap each item in its own view model?” We looked at two plausible options for handling this and saw some code examples of each. In part 2, I asked the question “Do I expose the model’s collections directly, or do I wrap each collection?” We saw the progression of code to implement this "brute-force". Then we quickly ran away screaming. This installment (part 3) asks "How do I cleanly and easily wrap the model’s collections with collections of ViewModels?" We'll take a...
In my previous post, I asked the question “Do I expose the model directly, or do I wrap each item in its own view model?” We looked at two plausible options for handling this and saw some code examples of each.
Now it’s time for a more interesting and challenging scenario: Do I expose the model’s collections directly, or do I wrap each collection? Let me paint this picture a bit so that we can see the scenario and the challenges.
MVVM says that a ViewModel sits between the View (XAML) and the Model. The ViewModel (VM) exposes data from the model...
The WPF community seems pretty happy with the MVVM pattern for WPF development. I can see why. It’s a great fit for WPF and its strong data-binding support. It provides a very nice layer for managing UI state, translating, formatting, and aggregating data.
So let’s say that I adopt MVVM for my project. I think there are some scenarios that still need definition. One of these is “To Wrap or Not to Wrap?” Let me explain…
MVVM says that a ViewModel sits between the View (XAML) and the Model. The ViewModel (VM) exposes data from the model plus additional view-specific details that...
Since WPF likes INotifyPropertyChanged on bound objects, I looked for a snippet to help out.
Matthias Shapiro had a good version for the interface implementation and a property declaration. I made a couple adjustments to the snippets based on personal preference (check if the value has changed before raising the event / remove the region from the property.
Then added some property verification support based on the snippet sample from Philipp Sumi. The property verification uses reflection to check if the property exists. If not, it throws an exception. This function is marked with a Conditional attribute so that it...
I picked up "Head First Web Site Design" to help me with the "design" portion of a new site. The author walks through a number of great topics, including information architecture, color, layout, and CSS. I have heard about using CSS for layout, rather than HTML tables, but had not fully investigated or used the approach. After walking through the book, I understand this approach better and understand the reasoning. It's really cool and quite amazing to see how powerful a CSS based layout can be.
I'm used to the table based layout, but I think a CSS layout approach feels...
Recently used Theme Forest and Graphic River for a new web site. I was very impressed with the number of site templates and graphics available for a really good price. I picked up a site template for $12 and some graphics for $6. The quality of the designs are way better than I can do myself and the prices are very reasonable.
I recently gave a presentation at the Bennett Adelson .NET SIG in Cleveland. We covered the basics of Windows Authorization Manager, what's new, and walked through a non-trivial demo that showed a variety of ways to use the technology.
Slides and demo code are available on the Past Events page of the Bennett Adelson web site. It's the AzMan presentation from Nov 10, 2009.
I'd love to hear any feedback about your experiences with AzMan. Feel free to contact me if you have any trouble with the demos.
Cheers!
I finally spent the 60 seconds it took to find the keyboard shortcut for Smart Tags, like the paste options and auto format tags that show up in office. Ready for it...?
Alt-Shift-F10
This will expand the smart tag so that you can use the keyboard (arrow, enter, esc) to pick the option.
Here's the info from MS on the keyboard shortcuts.
One other tidbit... If you need to bring up the context menu, but your keyboard doesn't have the button for it, you can use Shift-F10.
This morning, I listened to a couple Channel9 podcasts with Pat Helland where he discussed the Many-Core movement.
There has been a lot of talk about parallelism and many-core computing, but Pat helped to put this in context. Pat explained the issues around cpu power consumption, the slowing rate of frequency increases. The fact that chips used to draw around 8 watts but now consume 150 watts helps explain why energy consumption is a hot topic in the data-center world.
Based on this historical context, it makes a lot of sense why we'd move toward a many-core architecture. Instead of one...
In a previous post, I mentioned the T4 text template feature that is built in to Visual Studio. This past week, I used T4 templates on one of my projects and it turned out very well. I created the templates to help automate the creation of the classes in our DAL layer.
The templates provided us with a couple of nice benefits:
Saved time - reduced the time to create the DAL by 50 - 75%.
Consistency - the classes are implemented in a consistent pattern, while...
My last day at InfoCision was Friday. It is strange leaving behind seven years of my life. I gained friendships with some great people. I learned a lot from the people, projects and positions along the way. I sincerely hope to keep these friendships for a long time to come. To my InfoCision colleagues... Thank you! I wish you all the best! Monday marks the start of v.next for my career. I'm starting with Bennett Adelson. I'm super excited about the position! I get to work with really smart people and use some of the latest technologies. I think...
We recently had a need to support a distributed transaction across web service calls. The natural choice is WCF. We managed to get the transaction support working, but ran into another issue along the way. WCF uses a stricter addressing scheme than ASMX. It only supports one “binding” per sheme. So, you can only have one valid HTTP:// address for your service. This is not the case with IIS or ASMX services, where a web site can listen on multiple IPs via multiple DNS names. ASMX services automatically adjust by returning WSDL that is based on the address...
Today I got tired of typing long SQL table names, so I figured I’d try Red-Gates’s SQL Prompt add-in for SQL Management Studio. I installed the trial version and in a matter of minutes got my first experience of “Intellisense” for SQL. One word: Awesome! The tool is really nice. It integrates very well into the environment, provides a ton of useful information, time saving features, and configuration options. The demo version also includes a feature that formats the SQL code. This is pretty nice too. It makes everything the correct case, does...
I watched the PDC day 1 keynote today with my fellow coworkers. Below are my (unrefined) notes from the session.
Ray Ozzie
Why Cloud?
Current solutions focused on internal apps
Future solutions will assume more external facing solutions
Users expect more social networking features embedded in solutions (ranking, reviews, etc)
Operations teams and Dev teams are finding that they must work more closely together
Some companies have spike / valley traffic patterns
Companies need redundancy as apps move to...
EDA is a special interest of mine and one of the first posts on my blog. It seems that it is a great way to stitch together the services that we create inside the enterprise. Otherwise, you end up with the same tightly-coupled spider web that you had before SOA.
Recently, my enterprise architect forwarded a great article on Event Driven Architecture from The Architect Journal. The article does a great job of explaining the idea and explaining how it fits in an SOA ecosystem. Definitely worth a read!
You can imagine my delight to see that Microsoft is releasing EDA capabilities...
Microsoft’s PDC conference started today. They’ve got a ton of great stuff coming out this year!
While I cannot be there this year, I’ll soak up as much as I can…
http://www.MicrosoftPDC.com/
Oleg Sych has a great set of posts that show how to use the T4 Templating feature that is included in Visual Studio 2008. This is a great technology that makes it really easy to create code generation capabilities inside a project. He goes into the details, but it’s really simple to get started. Add a text file with a “.tt” extension. Add your template to the file. Add logic to the template in your language of choice (VB.NET / C#) Save the template...
J.D. Meier has a ton of great information and advice for improving at work and in life. His “Effectiveness Post Roundup” post gives a nice list, linking to lots of great information. He has information on a variety of topics including: Communication Email Leadership Learning Management Productivity Project Management Teamwork...
I think I found something that fixes the problem with XP’s windows explorer search for cases where you are searching for text inside a file. You may have noticed in the past, that it doesn’t return results that you know it should return. The fix that seems to be working so far is referenced as method #2 in the MS Knowledge Base article KB309173. The article includes the following recommendation: Method 2 To configure Windows XP to search all files no matter what...
I've been using Fiddler for a while and covered some of the basics in a previous post. I just learned that with Fiddler, you can put a breakpoint on network traffic! It’s “F5” for network packet capture!
Basically, you launch Fiddler and tell it to stop once it’s received the request (F11 keyboard shortcut). Then you can look at this request and even change it. When you’re ready, you can tell Fiddler to send the request on to it’s ultimate destination.
But it doesn’t stop there…
You can either tell Fiddler to just continue, or you can tell it to stop again once...
I ran across a useful utility that helps both in explaining and diagnosing Kerberos delegation setup. The utility is really nicely done. You just put it on your web server, and then browse to the page. The good stuff is green and the errors are in red. The great thing is that it has in-line explanations of everything and additional steps to help fix the problem! The utility is specifically targeted at showing whether delegation will work and explaining in detail why it might not. It also allows you to “add a backend” server to the...
A nice VB statement is IF(). It’s equivalent to the C# ?? operator. It works like this: Dim i as integer? = Nothing Console.WriteLine(IF(i, –1)) i = 3 Console.WriteLine(IF(i, –1)) The above will output: -1 3 The IF() statement evaluates the nullable variable. If it is not null, then it will return the value of the variable. Otherwise, it returns the value of the second parameter. The equivalent in C# would be: int? i = null; Console.WriteLine(i ?? -1); ...
As I started looking at LINQ, I’m running into some interesting scenarios regarding nullable boolean values. We all know how SQL allows for a BIT to be 3 values: True, False or NULL. We also know that in SQL, handling NULLs in comparisons requires special attention. For the most part NULL does not equal NULL. The use of LINQ brings this concept and scenario up into the .NET programming world. Now I need to be careful about conditionals that include Nullable(Of Boolean). I won’t repeat all the information here, but please read the following articles that explain this...
If you haven’t used Fiddler, you should check it out. It shows you the HTTP traffic that is flowing over the wire. This can be a huge help when diagnosing issues. One small challenge is using Fiddler to view traffic that stays on the local machine. By default, fiddler cannot see data sent to http://localhost/ or http://127.0.0.1/. This is because the OS doesn’t push this data through the normal networking pipeline. One workaround is to use the name of your machine in the URL. So, if you have a machine named “Machine1”, you could use a URL of...
Nice article listing the top 10 LINQ myths… http://www.albahari.com/nutshell/10linqmyths.aspx
I just stumbled on a CodePlex project called Sculpture. It’s a Visual Studio add-in / package that allows users to create services and applications in a model-drive approach. Model Driven Architecture (MDA) has been a hot topic lately. You can see this in Microsoft’s feature set of VS 2010. They’re baking in many features to “design” systems visually and raise the level of abstraction. Sculpture is pretty new (currently in beta), but the way they’ve implemented it is pretty nice. It’s more than just a code-generator. It appears that you can re-generate the model down into your...
Visual Studio Magazine has a nice article that gives a good intro and 360-degree view of MS’s “cloud” data services offerings. These are now available for use via the VS 2008 / .NET 3.5 SP1 release. http://visualstudiomagazine.com/features/article.aspx?editorialsid=2469 There are a lot of individual, but related offerings coming from MS under the “… Data Services” umbrella. In general, they are MS’s cloud computing and REST based technologies. These technologies are common for public services on the web since they are simple to use and based on widely accepted standards. I’m not yet clear on how these will be used...
Great stuff: http://blogs.msdn.com/dsimmons/pages/entity-framework-faq.aspx
I found a pretty nice webcast on LINQ to SQL from Teched. It's a 400 level session that goes into some of the challenges in creating "real world" applications with LINQ to SQL.
http://www.microsoft.com/events/teched2008/webcasts/TLA402/#9
Tony discusses a few different "real world" scenarios:
1. Using LINQ to SQL with a distributed, service-based system.
2. Handling change tracking (what was updated / inserted / deleted) by the client code.
3. Concurrency
4. Injecting business logic
5. Using stored procs
He does a very nice job of showing how things work and covers most of the topics in sufficient details to get the point across. He also...
There's an issue with WCF proxies that is starting to get some (negative) attention. It has to do with the fact that WCF proxies can throw an exception when they are disposed. There are a number of posts on the net about this, so I won't go into details here. Microsoft has an article on this issue: http://msdn.microsoft.com/en-us/library/aa355056(VS.85).aspx Tony Seed has a good article that shows a nice way to fix this, including a code snippet. http://blog.tonysneed.com/?p=86
I just signed up on Twitter. It looks kinda fun. http://twitter.com/nathanaw
John Nastase sent me the following information on ViewState. I found it very helpful in understanding the inner workings. http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx The article is pretty in depth, but it explains things very well. Definitely worth a read. Thanks John!
One of the “Desert Island” picks from a recent “This Week on Channel9” episode mentioned a pretty cool utility that lets you share a keyboard and mouse between two computers without using a KVM switch. It’s a software based solution that you run on the primary and any other computers that you’re sharing. You can share many many computers if you want. In my case, I have a laptop and a desktop. I wanted to have a single keyboard, but not have to worry about a kvm switch. The software is called Synergy. You can get it at...
As part of the load testing for an audio streaming solution, I’ve tested out Web Gardening. My candidate is a beefy quad-core Xenon based server. Background: The audio streaming services run under IIS. Their job is to locate an audio file and deliver it in an acceptable format to the user. Some of our audio is in a compressed wave format, but most is in a proprietary encoding. Our approach is to deliver this as a WMA format to the user, which requires two conversions. One from the proprietary format to PCM Wave format. Then we...
If you've been writing any blogs (or if you'd like to start), I highly recommend Windows Live Writer. I started using it after I got back from vacation. It makes it really easy to create and edit blogs. It has a spell checker, image support, nice formatting, and (best of all) a larger area for writing your post.
I've started using the XML commenting feature in VS 2008. It's great!!!
I knew that it was there, but I never realized that there was Intellisense support for writing the comments. I figured I have to remember a bunch of XML tags and write it all by hand. Not so. It' super easy to write the comments using the XML comments blocks!
To get started just try it. All you have to do is type three apostrophes and VS will inject an XML comment block with a summary, remarks and sections for each of the parameters on the method. Then you just...
I attended the .NET SIG at the Microsoft offices in Independence last night. John Stockton presented Silverlight to the group. He did a very nice job. It was sort of an intro-level discussion of Silverlight with a focus on how Silverlight can consume and connect to various sources of data. Below are my notes from the session Backwards Compatibility Silverlight plugins are backwards compatible. Version 2 will run apps written against Silverlight version 1.1. ...
VS 2008 SP1 has many new features. One of these is ASP.NET Dynamic Data. Scott Hanselman has created a number of really good screencasts that show the basics of Dynamic Data. I watched most of these during lunch today and I am very impressed with the technology. They did some really nice work to make simple apps really easy to build. To quote the site: "ASP.NET Dynamic Data provides a framework that enables you to quickly build a functional data-driven application, based on a LINQ to SQL or Entity Framework data model. It also adds great...
Here’s a good article that introduces the ADO.NET Data Services features that come with VS 2008 SP1. From what I understand, Data Services is an umbrella for a variety technologies. We’re seeing the first part of this now with SP1. The support includes some server side technologies for making REST based calls for CRUD operations on data. It also includes some client libraries that make the programming experience nicer. The client libraries include APIs for .NET, Silverlight, and AJAX. There is also support for making LINQ queries to an ADO.NET data service. The data services framework rides on top...
I’m a pretty huge fan of the Olympics. I don’t watch much TV, but when it’s time for the Olympics the TV is almost always on. This year, I’m really excited what NBC has done with the online coverage. They’re delivering live and on-demand coverage of a lot of the events. This is great because many events are on in the middle of the night. This year, I can watch yesterday’s events on demand at my convenience. For example, they made available the entire 6 hour footage of the men’s bicycling road race. (I haven’t watch all of that...
I stumbled on a really nice tool for VS called RockScroll. It's a replacement scroll bar for .NET code files. It shows a preview of the entire file as the scroll bar. The install is simple and you can easily disable it via the VS Add-ins manager. One of the really cool features is the automatic "Find in page" feature. You just double click a word and it will show you all the places in the file where that word exists. You can quickly find and see all places where it exists via the scroll bar's preview...
I ran some code analysis on my audio streaming solution today and learned something new: There is a recommendation within the code analysis engine that looks for cases where the List(of T) type is exposed as a public property or on a public method of a class. The recommendation is to use something like System.Collections.ObjectModel.Collection(of T) instead. This seemed kind of strange to me, so I looked into it a bit. Here an article from the code analysis team blog that explains the rational: http://blogs.msdn.com/fxcop/archive/2006/04/27/585476.aspx I'm still looking into this a bit. There may be consequences...
I just learned about a search engine called Krugle (http://www.krugle.org). It lets you search billions of lines of code in open source projects around the world. It's really a pretty neat thing that they've done. There are many times that we need to write some complex sort of code that someone else must have had to write too. Why not see if you can re-use it and save yourself the time. The engine is aware of source code structures, so you can select your language and then search for the keyword in certain locations like class names,...
I listened to an Entity Framework podcast from Channel9's "Expert to Expert". Brian Beckman (a mathematician at MS) interviewed Sam Druker (GM of the Data Programmability group) about the design and philosophy of EF. It was a very interesting discussion and helped to position EF in comparison to the other O/R options out there. There were a couple key points that stood out to me: EF is not just an Object / Relational mapper in the classic sense of the word. It's scope is much more than just translating a .NET class into a SQL row. ...
For the most part, VB.NET is not case sensitive. XML is case sensitive. As you work with web services (datatypes, method names, parameters, etc), please be aware that changing the case of a name is a breaking change.
Rather than write this stuff myself, I've included a couple of good articles that get through the concepts quickly and easily. Why should you care about XML Namespaces? XML is everywhere, even if you don't work directly with it. As IMC moves more to web services, our systems are sending more and more XML over the wire. We're also starting to use it in the databases as a flexible data storage mechanism. In all of these cases, we must carefully design the namespaces so that we don't get collisions between two systems or two versions of the same...
For the most part, Microsoft did a very nice job of making TFS 2005 stuff work with TFS 2008 and vice-versa. There's one area that just isn't compatible: Team Build. This is a bit of a sticky issue. Let's take our planned approach here: Upgrade some people to VS 2008. They start writing apps with VS 2008. Let's say that they are even targeting the 2.0 framework. They add their stuff to the nightly build. The build breaks because TFS 2005 cannot build a solution from VS 2008. ...
Last night, I got my first look at the Silverlight 2.0 (beta1) development experience. I downloaded and installed the Silverlight tools for VS 2008 and dove right in. Overall, I'm very impressed with Silverlight. I read through the first bit of the help files to learn the architecture and basic concepts. For the most part everything makes sense. There were a couple of things that caught me off guard. These aren't show stoppers by any means. Just things that I didn't expect: 1) Silverlight 2.0 does not support synchronous calls to web services. You can add a...
Remember the C++ pointer stuff that you learned back in school? Messy stuff! Thank goodness for .NET where we don't have to worry about pointers and references, right? Wrong! It's still important to understand what kind of object you're working with. In some cases, your variable is really a pointer. In other cases, the variable is the data. Can you Handle It? I dare you! First, let's start with a little test... Take a look at the following code snippets and see if you can figure out the answers. The Test Done Already! ...
Caching is a very beneficial practice for improving application performance and efficiency. Conceptually, it is simple. However, there are a number of issues to take into account when caching data. I'd encourage you to read up on caching before you start using it though. As with all things, there are tradeoffs and challenges involved. So, be careful when and how you cache. Below is some info to get you started, but feel free to ask questions if you're doing caching for the first time. Caching is the practice of storing data in a location where it can be reused again...
Here's a little test to explore the way that value types behave differently than reference types when using .NET.
Enjoy!
1) Passing an instance of a Class to a method ByVal.
What's printed out:
a) 5
b) 15
Public Class MyNumberClass
Public Value As Integer
End Class
Module MainModule
Sub Main()
Sample1()
End Sub
Sub Sample1()
Dim oNumber As New MyNumberClass()
oNumber.Value = 5
Sample1_Add(oNumber)
Console.WriteLine(oNumber.Value)
End Sub
Sub Sample1_Add(ByVal num As MyNumberClass)
num.Value = num.Value + 10
End Sub
End Module
2) Passing an instance of a Structure to a method ByVal.
What's printed out:
...
Guidance Packages are awesome, but they do have a way of driving me crazy sometimes. They have a new version of the Guidance Automation Extensions, which is basically the runtime or framework that plugs in to VS. The new version was updated to support VS 2005 and VS 2008. The documentation indicates that the installers for guidance packages are now supposed to prompt you for which version of VS to install into. Not. After searching and reading about 20 different articles, plus using Reflector on the GAX dlls, I finally figured out that you have to...
A couple weeks ago, my team was having issues with a new version of one of our web services. It seemed that it was using up all available TCP ports on the server, thereby causing a Denial of Service. We found the root cause of the issue... A For..Each loop! So, For..Each loops aren't bad. The problem was what we did inside the loop. We were looping over a set of records and then reaching out to another web service. This resulted in thousands of individual web service calls back to the same web farm. The solution:...
I watched a webcast on how to use the WCF/WF integration that comes with .NET 3.5 and VS2008. It looks like they've added some features that make it very easy and very powerful to use WCF with WF workflows. Here are the things that caught my attention: WCF Service Host VS 2008 comes with a built in WCF Service Host. It acts similar to the Cassini web server that VS 2005 uses for asp.net web sites. The cool thing is that you don't need to create a host project to host the WCF service. Just the WCF...
Last night, I finally dove in and read up on LINQ. Amazing stuff! Since I haven't actually written anything with it, everything I know is just theory and second-hand. That said, LINQ looks really cool. It's another example of Microsoft making a complex problem into a simple solution. I love how Microsoft looks at a problem space and says: "I know you say you want ... but here's a solution that addresses your real needs." I read a couple of things last night that helped me a lot. First was a Channel9 video with Anders...
In researching MSE's policy support, I had to do some reading on XAML. It finally makes sense. So here's my 10,000 foot view of XAML: XAML (Extensible Application Markup Language) is an XML grammar for instantiating a tree of objects, setting their properties, and stitching them together. Pretty simple, but pretty powerful idea! I can use XML to declare what objects to create. Then the same XML has the values to stuff into the properties and the logic to hook on object to another object. The XamlReader class in the .NET 3.0 framework reads the XML in and...
At the ArcReady seminar, Chris Madrid discussed the MSE's support for custom policies. This is the extensibility point in MSE for adding your own WCF behaviors into the MSE's runtime. He showed some simple examples like turning off the metadata output of a service. The cool thing is that you can inject any behavior you want into the engine. Some ideas that he mentioned: Publishing info to BizTalk's BAM service so that we can analyze the traffic going in and out of the web services. Logging messages to some sort of...
This morning I went to an ArcReady seminar at the MS campus in Independence. Chris Madris, from MS Consulting Service, spoke on SOA Lifecycle Management. Great Stuff!!! Chris talked about best practices for creating and operating an SOA environment. Then he demo'd the MS Service Engine that MS Consulting Services has created to "Virtualize" services. Layers... Chris presented the idea that there are three layers of services: Process Layer, Service Layer, and Integration Layer. The Infrastructure Layer sits on the bottom and exposes systems to the enterprise. These might be wrappers around legacy...
It looks like MS is working on Enterprise Library version 4.0. From what I can tell, version 4 should be very cool.
Check out the backlog for version 4.
(Yes I did say backlog... They use agile methods in the Patterns and Practices group.)
Yesterday, I created my first UI using the Spring.NET framework. I have to say that I am very impressed!
The features I used were
- Dependency injection
- Model-view-controller support
- Two way databinding
I have a couple pages done and so far they are turning out to be conceptually simple and clean. The framework strikes the right balance between being too intrusive vs not helpful enough. I am able to use the features that I want, without having to "drink all the cool-aid" at once.
The two way databinding is really nice because it decouples the UI stuff, the databinding, and the UI business...
This past weekend was my son's cub scout pinewood derby race. I was point person on the committee that organized the event. My main task happened to be running the score board which was written in Excel.
I found it quite interesting to be in a position where I was very dependent on the computer and the excel based "application" that we used to run the scores. The thing that surprised me was how nervous I was about the score board working right.
The race was a points race with a specially organized set of pairings that rotated the races in such...
Over the past couple days, I've been exploring some of the popular open source application frameworks out there. The ones that caught my attention were Spring.NET, MonoRail, and ASP.NET MVC.
All of these offer a nice way to implement web applications using the Model-View-Controller pattern. This pattern helps to separate the UI into it's logical pieces. Once implemented, it becomes much simpler to make powerful UIs with multiple views into the same information.
For an example of MVC, think of MS Word or MS Outlook. They can show you many different "views" of the same data. All of the views...
Aspect Oriented Programming (AOP) is a term I've stumbled across a couple times before. My 2-second understanding of it was basically that you use attributes in your code to define how the code should behave. These attributes could do things like wrap the method in a transaction or log information about the method call.
So what's the big deal about attributes? We already do that all over the place in .NET as we write web services, etc.
Well, I stumbled on a framework called Spring.NET and read up on it. For some background... Spring.NET is a "spiritual port" of the widely used...
As mentioned in my post on AOP, I've been learning more about Inversion of Control (IoC) and Dependencey Injection (DI). I'll explain my take on these a bit more in this post.
IOC and DI have been gaining ground lately in a number of areas. Microsoft built the widely accepted Enterprise Library and the Composite UI Application block on top of an IoC library that they call Object Builder. They chose this design because it gives them a very powerful way to manage a large number of dependencies in these highly-integrated frameworks.
For example, in Enterprise Library, the Exception block...
Awesome!!!
Microsoft has released a tool that they developed inside their consulting division. They created the tool to help their customers and now they are starting to make it more widely available.
The Microsoft Services Engine is a runtime that helps manage, version and govern a portfolio of SOA services.
The version they released is version 6.2, which indicates that it's already been through the paces of real-world use. It comes with decent documentation, a management UI, a universal service tester, and the runtime that hosts the virtual services.
It's built on WCF and has a deep understanding of how WCF works. This...
Just a quick note here, but MS has released updates to some of their guidance packages. The updates look very compelling.
It also sounds like the guidance package framework (GAX and GAT) are going to become an integrated part of the next verison of Visual Studio. This is also very good news.
Most of these are hosted on CodePlex, with supporting pages on MSDN.
Web Service Software Factory (Modeling Edition)
Very cool! They used the DSL (Domain Specific Language) toolkit to create a visual designer for creating web services. It looks a little like the class designer in VS 2005.
They also stripped out the data access stuff. This...
I've learned about a new design pattern that is conceptually similar to an ESB. It's called an Event Driven Architecture or EDA.
I like this term because it describes the pattern that I've been trying to implement here at IMC via our Service Bus implementations.
I still think that an ESB is useful, but the industry seems to be converging on the concept that an ESB is something sort of like BizTalk with it's transformation and orchestration capabilities.
EDA can be implemented on top of an ESB of this definition, but it does not require that much power to work right.
Microsoft actually...
Thanks for stopping by my blog! Glad you're here!
I hope to share my experiences, lessons, and ideas on the important parts of my life...
Family
Software Development, Architecture and Engineering
Cub Scouts
Cycling