FunnelWeb Review

In my Blog Refresh post I talked about moving back to BlogEngine.Net on Arvixe. I used BlogEngine.net for a while but wanted to update to a new version. I had experienced some issues previously with BlogEngine.net upgrades, but always managed to get through it. This time, however, I could not get around my problem (sadly I don’t recall what the problem was since it was years ago). It’s in my nature to tinker with things, and knowing I was stuck with my existing older version wasn’t appealing....

April 12, 2013 · Joshua Marble

WPF Binding Boolean to an Enum Value

Imagine the situation where you have three radio buttons in a Window. You want the selection of those radio buttons to be bound to a single enum value where the enum contains values for each of the radio button options. Radio Button: None Radio Button: Blacklist Radio Button: Whitelist public enum FilterType { None, Whitelist, Blacklist } When the bound value changes, the radio button selections should match it. When a radio button selection is changed, the bound value should match the selection....

April 9, 2013 · Joshua Marble

Arvixe Review

In my previous post I mentioned that Arvixe was a good and cheap web host. They provide a good set of features for a low price for Windows hosting. I used Arvixe for almost two years to host the BlogEngine.net and FunnelWeb platforms for this site. This review is from the perspective of a low traffic website for low cost. Pros Windows hosting on the cheap Free SQL Server databases Good support response times Free domain name registration for a single domain $10 domain registration with free privacy guard Starts at $5/mo Cons Barely adequate control panel software Limited registrar access to your domains Terms of service for your free domain Update: They have access to your password (no hashing, see update section below) The main benefit that Arvixe provides is good features for cheap....

April 8, 2013 · Joshua Marble

Blog Refresh

I know I haven’t updated CODEcisions much lately. I need to make note of some new topics to cover because I’m always learning new things, I just need to write them down. I’m going to try to do better at this going forward, starting with a series of posts of how I changed domain registrars, web hosts, and blog platforms. First let me give you some background. I started out my blog as a personal blog on WordPress....

April 7, 2013 · Joshua Marble

Stacking Multiple IValueConverters

Problem I have had situations before where I needed to convert a binding value in multiple ways, but there was no way to apply multiple converters to the binding. One example of this is wanting to bind the visibility of a control to the inverse of a boolean binding value. Without multiple converters there are only two options. Less Than Ideal Solutions You can bind to a dummy property that is just the inverse of the real property....

October 24, 2012 · Joshua Marble

Use A Custom IValueConverter To Bind A WPF TextBox To An Integer

In a WPF application, I had a TextBox bound to an integer property of a class. The TextBox only allows numeric input. The binding worked as expected except when the text was cleared. I found that when I cleared the text on my WPF TextBox, the binding would fail because it could not convert an empty string to an integer. This caused the previous value of the integer to remain set....

May 23, 2012 · Joshua Marble

The Flaw of LINQ's Single Extension

The purpose of the Single extension methods is to thrown an exception if more than one item matches the query (or, in the parameterless implementation, more than one item exists in the enumerable). It seems obvious then that the method should stop enumerating once finding the second match, throwing the appropriate exception. And indeed this is how the parameterless implementation behaves. The code in this first example calls Enumerator.MoveNext() twice. Once for the matching result, and once to find that a second result exists, throwing the exception....

March 6, 2012 · Joshua Marble

Converting Hash Byte Array To String Output

Years ago, when I was learning how to use C# to calculate hash values, I learned that to properly output the byte array of a hash (or any other byte array) you had to iterate each byte and call byte.ToString(“X2”) method for the proper formatting, adding each byte string to a StringBuilder. StringBuilder hash = new StringBuilder(); foreach (byte b in hashBytes) hash.Append(b.ToString("X2")); Output: DC724AF18FBDD4E59189F5FE768A5F8311527050 Not long ago I was doing something similar and realized that you could use Linq’s Aggregate operator for the same thing in a more concise syntax....

October 18, 2011 · Joshua Marble

Error Calling XmlWriter WriteValue With Guid Parameter

Calling XmlWriter.WriteValue() passing a Guid as the parameter throws an exception. StringWriter stringWriter = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(stringWriter); writer.WriteValue(Guid.NewGuid()); The exception thrown is: InvalidCastException: Xml type 'List of xdt:untypedAtomic' does not support a conversion from Clr type 'Guid' to Clr type 'String'. I don’t see any way around this except by casting the Guid to a string before passing to WriteValue(). Since this overload accepts an object type, even an extension method taking a Guid doesn’t help because the instance method is the one preferred by the compiler....

September 22, 2011 · Joshua Marble

WPF ListBox Binding to CompositeCollection

I was using ListBox to display data bound to a collection, but I also wanted to be able to have an Add New item at the bottom of the list that the user could click to add a new item to the end of the list. Coming from a simplified Windows Forms binding background, my first thought was to just modify the source collection to include my placeholder item. This worked fine functionally, but it caused the collection to not be accurate and caused extra work for me to add and remove the placeholder at certain times....

September 1, 2011 · Joshua Marble