Geeks With Blogs
Brian Schroer Don't Call Me Mort! July 2010 Entries
INotifyPropertyChanged with less code using generics & reflection
Technorati Tags: .NET,INotifyPropertyChanged... In my last post, I talked about using a Visual Studio code snippet for properties in classes implementing INotifyPropertyChanged: The code snippet lets me create the properties faster, but it's still a lot of repetitive "setter" code for each. What if I moved the "has the value changed?" and backing field update logic out of the property setters and replace my NotifyPropertyChanged method with this CheckForPropertyChange method?: protected bool CheckForPropertyChange<T... ......

Posted On Tuesday, July 27, 2010 8:44 AM

INotifyPropertyChanged with less typing using a Code Snippet
Technorati Tags: .NET,INotifyPropertyChanged... Kevin Grossnicklaus gave a nice presentation on M-V-VM User Interface Patterns in Silverlight and WPF at last night's St. Louis .NET User Group meeting. A key part of MVVM is implementation of the INotifyPropertyChanged interface to let views know that bound properties have changed. Here's a simplified version of a model class from the MSDN INotifyPropertyChanged documentation: public class DemoCustomer : INotifyPropertyChanged { private Guid _id ......

Posted On Tuesday, July 27, 2010 7:48 AM

mvcConf recap: (M)egacool (V)irtual (C)onference
Technorati Tags: ASP.NET MVC,mvcconf I took the day off work today to "attend" mvcConf: the Virtual ASP.NET MVC Conference, and had a great time. Thanks to all of the presenters and organizers of the conference. It was a huge success, and I'm sure that like me, most of the attendees hope there will be another soon. It was amazing how smoothly everything went. There were only one session cancellation and very few technical difficulties (I experienced none, but people in the chat rooms reported a few ......

Posted On Thursday, July 22, 2010 10:13 PM

Digital Lens: See how your app or site looks to the visually impaired
Technorati Tags: Digital Lens,accessibility Oded Elyada, a developer in the Microsoft's Israel Innovation Labs has created "Digital Lens", "a tool that helps designers, developers and testers check if their application or website is accessible to visually impaired users." It's a downloadable tool for Windows 7 that adds a tray icon with a menu of the most common vision impairments that can be simulated: If you select one, it filters your Windows display so you'll see what people with those impairments ......

Posted On Friday, July 16, 2010 10:41 PM

Reflector: Disassembling an entire assembly
Technorati Tags: .net,reflector This is mainly for future self… I don't need to do it often, and always waste time looking around for an add-in before I find the simple answer. Just right-click the assembly, then click "Export…": You'll be prompted for the folder to save to: ......

Posted On Friday, July 16, 2010 7:16 PM

jQuery UI autocomplete / IE6 fix with bgiframe plug-in
Technorati Tags: jQuery,JavaScript I'm using the jQuery UI Autocomplete plug-in on my current intranet project, and am impressed with how powerful and easy to use it is. It works great on my development PC with Internet Explorer 8, and I was very pleased with myself. …until I tested on one of our "thin client" machines, and my beautiful autocomplete dropdown looked like Swiss cheese: The browser on the thin-client is, you guessed it - everybody's favorite browser - IE6. IE6 has z-index issues that ......

Posted On Monday, July 12, 2010 9:21 PM

"semicolonoscopy", "olfactory method" and other software sniglets
It's been a while since "sniglets" were popular, but here are my ten candidates for terms that should be in the software development lexicon: ohnosecond: the time elapsed between the pressing of the Enter key and the realization that you've just done something catastrophic (e.g. "delete * from customers") beforon - (be-FORE-on): The moron who worked on the software project before you. e.g. "What beforon wrote this 32767 line method?" swinefluent interface: a hamhanded attempt at a fluent interface.Where(the.API.Is(... ......

Posted On Monday, July 12, 2010 8:35 PM

Questions about geekswithblogs.net
First off, thanks to Jeff & John for creating geekswithblogs.net, and to whomever else I might not know about who maintains it, and to all of the other bloggers for everything I've learned from them the past several years. I've been blogging like a madman lately to earn a geekswithblogs.net T-shirt (Oh please, please let it have a picture of a CareBear!), and have three questions for my fellow geeks: 1) Is there a way to configure your blog to get email notification when someone comments on a ......

Posted On Saturday, July 10, 2010 11:52 AM

Two online events: "mvcConf" and the "jQuery Online Conference"
Technorati Tags: jQuery,ASP.NET,ASP.NET MVC,conferences I was excited yesterday to learn of two upcoming virtual online conferences about topics in which I'm very interested. The first one I heard about was mvcConf, the Virtual ASP.NET MVC Conference - Thursday, July 22. From the website: mvcConf is a virtual conference focused on one thing. Writing awesome applications on top of the ASP.Net MVC framework. The event will be free to attend, and your brain will explode from taking in so much hard core ......

Posted On Friday, July 9, 2010 6:07 AM

New Sandcastle Builds
Technorati Tags: Sandcastle,.NET Photo credit: cynwulf I'm of the opinion that in-line comments are often a "code smell", but if you're developing a framework or class library that you want others to use, .NET XML comments on public classes and members used to generate documentation can be very useful. The tool for building that documentation is Sandcastle. According to its CodePlex site, "Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies ......

Posted On Thursday, July 8, 2010 10:56 PM

Implementing a custom ASP.NET MVC authorization filter
Technorati Tags: .NET,ASP.NET,ASP.NET MVC I'm rewriting a "classic ASP" (that term always makes me laugh - Just 'cause it's old don't make it "classic") application in ASP.NET MVC 2. There's an existing user authorization table in the database, so I want to keep using that for authorization determination. I created a custom class inheriting from FilterAttribute and implementing IAuthorizationFilter: 1: public class DuffAuthorizeAttribute : FilterAttribute, IAuthorizationFilter 2: { 3: public DuffAuthorizeAttribute(params ......

Posted On Thursday, July 8, 2010 9:54 PM

Are you a "Hanselfan"? Help Hanselman fight diabetes
Technorati Tags: Scott Hanselman,diabetes Scott Hanselman is on a mission to raise $50,000 dollars for the ADA Diabetes Walk 2010. $30,000 has been raised so far. He needs our help to raise the remaining $20,000. Are you a "Hanselfan"? If you: have been entertained and educated by the Hanselminutes podcast have a well-thumbed copy of "Professional ASP.NET" on your desk (heck, you could use the dang thing for a desk, it's so huge) ==> or have read one of Scott's other books have learned about a ......

Posted On Thursday, July 8, 2010 8:24 PM

What's a nice class like TextFieldParser doing in a namespace like Microsoft.VisualBasic?
Technorati Tags: .NET I see a lot of discussions on Stack Overflow about how to process CSV (comma-separated values) or other delimited files. The answerers usually suggest solutions involving regular expressions, but there's a simple solution built into the .NET framework: Microsoft.VisualBasic.FileI... I don't know why it's hidden in the Microsoft.VisualBasic namespace hierarchy - there's nothing VB-specific about it. It's easy to use: 1: using (var myCsvFile = new TextFieldParser(myFilePath) ......

Posted On Wednesday, July 7, 2010 8:07 PM

Extending MvcContrib grid with custom DataAnnotationsModelMetadataProvider
Technorati Tags: .NET,ASP.NET,ASP.NET MVC,MvcContrib,localization In a prior post, I blogged about creating a custom class inheriting from System.Web.Mvc.DataAnnotati... to provide localized display names for my models. I was disappointed to find that the MvcContrib grid doesn't use the metadata provider for column names - it just splits "Pascal-case" property names into words (e.g. "FromDate" to "From Date") if a name hasn't been explicitly assigned. public string DisplayName ......

Posted On Tuesday, July 6, 2010 9:44 PM

Convention-based Registration Extension for the Microsoft Unity IOC Container
Technorati Tags: .NET,ASP.NET,ASP.NET MVC,Microsoft Unity In my current ASP.NET MVC project, I'm focused on testability and programming to interfaces rather than concrete implementations, so I have a ton of interfaces. I'm using the Microsoft Unity IOC Container, so my dependency injection initialization code looked like this: 1: using System; 2: using System.Collections.Generic; 3: using System.Reflection; 4: using Duff.Localization; 5: using Duff.Database; 6: using Microsoft.Practices.Unity; 7: ......

Posted On Sunday, July 4, 2010 10:59 PM

How much faster are static vs. instance methods?
Technorati Tags: .NET If you use Resharper, you've probably seen it recommend that you make private methods static if they don't use any instance data or methods. FxCop also has a rule (CA1822) about this: "Methods which do not access instance data or call instance methods can be marked as static. After doing so, the compiler will emit non-virtual call sites to these members which will prevent a check at runtime for each call that insures the current object pointer is non-null. This can result in ......

Posted On Saturday, July 3, 2010 5:44 PM

Quality Equality with JavaScript: "===" > "=="
Technorati Tags: JavaScript Did you know that there are two equality operators in JavaScript? The one that's used most often is the double equal sign ("==") operator. The "==" operator does type coercion. The following example returns true, even though we're comparing a string and a number: if ('5' == 5) That's not too bad, but you probably wouldn't expect the following examples to return true: if (0 == '') if (0 == false) if (false == undefined) if ("\r\n" == 0) They all do though, thanks to JavaScript's ......

Posted On Saturday, July 3, 2010 7:11 AM

Copyright © Brian Schroer | Powered by: GeeksWithBlogs.net