Andy Vanek's Blog



  1. Creating Constructors for WCF Generated Code

    In working with WCF on my current project I’ve noticed that the auto-generated code contained in Reference.cs does not do anything for constructors of server-side data types. All the generated code provides in the client-side WCF layer is a default empty constructor. After doing some research into this topic I realized that server-side DataContract classes only get their members marked with the DataMember attribute included into the auto-generated code. Since constructors cannot be marked with the DataMember attribute, they will not be included in the auto-generated code upon downloading...

  2. Telerik’s JustMock “IgnoreArguments” Equivalent

    I’ve had the opportunity this past week to use Telerik’s unit test mocking framework, JustMock . In particular, I wanted to see how it stacked up to RhinoMocks , the mocking framework already used by many of my company’s projects. Even though JustMock is in beta, I was very impressed with its functionality and ease of use compared with RhinoMocks. The two have similar syntax, with JustMock requiring less code in some cases (for instance, JustMock does not use a MockRepository-like object that RhinoMocks uses). One of the first roadblocks I ran into in converting a RhinoMocks-based...

  3. Training Tuesdays: Intro to MVVM Talk

    NimblePros has started a new program called Training Tuesdays where a speaker will discuss a topic related to our profession. Last week I had the pleasure of presenting a topic that is near and dear to me, the Model View ViewModel (MVVM) design pattern. In the discussion I provided an introduction to MVVM and provided a quick Silverlight demo which showcases MVVM vs. non-MVVM approaches to program architecture. Thankfully we have been recording these talk sessions and you can find my video The CandleStick Podcast RSS Feed , which is located on the NimblePros' What We Say page. If you want to just...

  4. Using Attached Properties to Bind LayoutMode Declaratively in a RadChart

    In working with Telerik’s RadChart component for Silverlight, I have come across the scenario where my number of data points will vary based on user input. For example, the user can input a range of dates and each date within that range will correspond to a value on the X-Axis. In most cases the RadChart handles this data well when I have the AxisLayoutMode set to Normal (you can read about the LayoutModes here ). However, I find that the LayoutMode.Normal setting doesn’t really suit my preferences when there is only a single data point to display. Consider the chart below: As you can...

  5. Sitefinity 4.0 Web Analytics CTP is finally here!

    As some of you may already know, Sitefinity 4.0 CTP (Community Technology Preview) has been released . For those of you who are not familiar with Sitefinity, it is a Content Management System that is produced by Telerik , one of the leading third-party .NET vendors. There are many exciting features that are coming to Sitefinity 4.0, one of them being Sitefinity Web Analytics. I have been part of the external team working on Sitefinity Web Analytics as a developer at NimblePros , mentioned by Gabe Sumner in his blog post . The eventual goal of Sitefinity Web Analytics is to combine the power of...

  6. Bind Visibility to ObservableCollection Count in Silverlight

    Today I was working on a Silverlight application and I came across the following issue: I had a StackPanel with an ItemsControl that was bound to an ObservableCollection that may or may not end up being populated. I wanted to tie the Visibility property of the StackPanel to whether or not the ObservableCollection had any items in it (i.e. collection is empty, panel is not visible and vice versa). Since I was using the Model-View-ViewModel (MVVM) design pattern, I needed to figure out how to do this via binding in the View. After some searching around online I found that this is possible thanks...

  7. Using MVVM with Telerik RadChart

    One of the patterns I’ve been working with lately is the Model-View-ViewModel (MVVM) design pattern. I have been using this pattern in conjunction with Silverlight, where the View is usually a UserControl and the Model and ViewModel are independent classes. It is similar to MVC in that its overarching goal is to eliminate any business and data logic from the View. In Silverlight this is achieved primarily by using the binding capabilities available in the declarative XAML code to bind data contextually to a separate class. In using bindings it is possible to minimize the code in the XAML...

  8. Using let keyword in LINQ

    One of the projects I am currently working on deals with parsing data from an XML document into a statistic object that holds a name, a value and the percentage of that value compared to all the data. For example, say we have two items in our data: Foo with a value of 15 and Bar with a value of 5. After we parse the data into the statistic object, Foo would have a percentage of .75 (15 / (15 + 5)) and Bar would have a percentage of .25 (5 / (15 + 5)). I had decided the best route for getting this data would be through LINQ since we can easily work with each data item and select on a new Statistic...

  9. Access a virtual hard disk in Windows 7

    One of the tasks I was faced with at work this week was to update a couple of the machines with a commercial version of Windows 7 Ultimate. These machines were running the RC1 version of Windows 7 and therefore were going to be essentially useless the following week. Naturally, we wanted to create a backup of the current configuration just in case we needed to retrieve a file. Window’s built in Backup and Restore Center was more than up to the task and I successfully created an image of the operating system hard disk for each computer (more specifically, a .vhd – Virtual Hard Disk)...

  10. Get Some REST with C#

    A project I am currently working on involves the usage of Silverlight and ASP.NET. The UI components of the application are contained in the Silverlight while all the data processing is done outside of the Silverlight. One of the key components to this setup is that the Silverlight project needs some way to communicate to the non-Silverlight projects in order to get data to display in the UI. I know some of you are probably thinking “why not use WCF ?” right now, and I will agree that using WCF is an approach to consider. However, I wanted to demonstrate how one can set up their own...