Bits and Pieces

Bits and Pieces

Tools and Code by Avner Shahar-Kashtan

Home Archive Categories Tags Blog Tools & Projects About Me RSS
  • WCF Serialization part 1: Interfaces, Base classes and the NetDataContractFormatSerializer

    2006-07-31 Avner Shahar-Kashtan Miscellaneous Debris
    One of WCF's goals is interoperability with standard protocol stacks, like WSE or other WS-* implementations. This led, I am told, to the design of WCF's default object serializer - the DataContractFormatSerializer. This handy …
  • WCF and Non-polymorphic bindings

    2006-07-31 Avner Shahar-Kashtan Miscellaneous Debris
    I've been using WCF for the past few months and on the whole, I think the programming model works. I'm getting to really like the extensibility model and the whole deal seems to click rather well. One place where I feel it's a …
  • UI Usability - case studies and recommendations?

    2006-07-18 Avner Shahar-Kashtan Miscellaneous Debris
    Doing work on our WinForm application, we find ourselves having to make choices - too many choices - about the UI. We don't have access to professional UI engineers, unfortunately, and we make uneducated guesses on too many issues - …
  • A silly little C# language feature request: .! operator

    2006-07-13 Avner Shahar-Kashtan Miscellaneous Debris
    When we step back for a moment from our SOAs and Factories and Polymorphism, we have to admit that at the root of much of our code lie a hell of a lot of simple if/else statements. Like it or not, they're what makes our program logic …
  • File Properties in Word 2007

    2006-07-12 Avner Shahar-Kashtan Miscellaneous Debris
    A client asked me the other day what happened to File->Properties in Word 2007. They simply couldn't find it. In the Beta1 TR, I remember it was confusingly located on the Status Bar (!) – right-click, pick View and View Properties. …
  • A Better Obfuscation, or How To Write Code That Will Make Someone Kill You

    2006-07-11 Avner Shahar-Kashtan Miscellaneous Debris
    The following code is perfectly valid C#, and compiles without errors: int _;_ = 5; If we take it a bit further, we can do something like this: int _, __, ___, ____; _ = 5; __ = 10; ___ = 15; ____ = 20; _ = __ - _ * ____ / ___; Now I feel …
  • Ping Notifier!

    2006-07-03 Avner Shahar-Kashtan Miscellaneous Debris
    How many times have you connected to a server via Remote Desktop to install some components?How many have you rebooted a remote server and sat around waiting for it to go up?How many times have you opened a command prompt and ran ping -t …
  • Visual Studio obstructing DebugView

    2006-06-20 Avner Shahar-Kashtan Miscellaneous Debris
    I've mentioned it before, but SysInternal's DebugView is a great utility. It allows you to get the Debug.WriteLine() strings from your application even when you're not attached with a debugger, as long as it was compiled in Debug mode. Very …
  • Some thoughts on uninstalling Sharepoint '12' Beta 1

    2006-06-19 Avner Shahar-Kashtan Miscellaneous Debris
    I'm uninstalling an old beta of the Sharepoint servers from a VPC I have on my computer to make room for the newer Beta 2 servers, and I noticed several things: 1) The installation originally required a then-current build of Windows …
  • My Singleton is disappearing!

    2006-06-19 Avner Shahar-Kashtan Miscellaneous Debris
    WCF's Instance Context model allows me to specify my service's instantiation behavior - I can get a new instance for every call, have WCF manage a session for me and keep an instance per session, or just get lazy and have my service …
  • Hiding properties from the Property Grid

    2006-06-12 Avner Shahar-Kashtan Miscellaneous Debris
    Taking a break from the main components, I decided to get around to writing a small configuration editor using .NET 2.0's lovely ability to edit .config files from code. I have a custom Section Handler defined for my data, and decided the …
  • URIs are not local paths.

    2006-06-06 Avner Shahar-Kashtan Miscellaneous Debris
    It's easy to forget that even though a local filesystem path ("C:MyDirMyFile.dll") can be represented as a Uri (file://C:/MyDir/MyFile.dll), these two entities are different, and have different rules for validations. The problem du jour, …
  • ParamArrays and CLS-compliance.

    2006-06-05 Avner Shahar-Kashtan Miscellaneous Debris
    In my previous post, I noted that when I write this code in C#: public void MyMethod (params object[] args) { ... } What I actually get in my IL is this: public void MyMethod ([System.ParamArray]object[] args) { ... } I have this suspicion …
  • Problems with params array?

    2006-06-05 Avner Shahar-Kashtan Miscellaneous Debris
    I noticed today that the ever-popular String.Format() method has several overloads - in addition to the Format(string format, params object[] args) overload I was expecting, it seems there are three special-case overloads for one, two or …
  • Query SUBST information

    2006-06-04 Avner Shahar-Kashtan Miscellaneous Debris
    For various reasons involving out testing framework, I found myself needing to get the full command-line of the current executing assembly. However, our development environment uses the DOS SUBST command to map a virtual drive letter for …
  • From Accessors to Properties

    2006-05-31 Avner Shahar-Kashtan Miscellaneous Debris
    For various debugging processes, I find myself needing to find several bits of runtime information for my properties. This means I want to get the property's PropertyInfo object by Reflection when that property's code is running. The …
  • Serializing Dictionaries

    2006-05-23 Avner Shahar-Kashtan Miscellaneous Debris
    Dictionaries have been an annoyance when serializing for a while now. IDictionary in v1.1 and now IDictionary in v2.0 are both non-serializable, forcing us to find workarounds or use DataTables or any number of unsatisfactory solutions. My …
  • Bad compiler warnings when using anonymous methods for Predicate<T>

    2006-05-22 Avner Shahar-Kashtan Miscellaneous Debris
    I was sitting around munching some code, and needed to filter a list I had: List list = // get list outputList = list.FindAll(delegate(Whatever item){ if (// blah blah) { return true; } else { return false; }}); (Ignore the greyed-out text …
  • Creating nested directories

    2006-05-22 Avner Shahar-Kashtan Miscellaneous Debris
    Just a quick tip to prevent others from feeling as foolish as I do: The static CreateDirectory() method of the System.IO.Directory class will create the entire directory tree passed to it. There's no need to write an EnsurePathExists() …
  • Non-generic default values in C#? Why not?!

    2006-05-21 Avner Shahar-Kashtan Miscellaneous Debris
    A relatively obscure new keyword in C# 2.0 is the default(T) keyword. It's shorthand for checking if the given generic parameter T is a value type or reference type. If it's a reference type, it returns null. Otherwise it returns …
← Newer
5 / 10
Older →

Bits and Pieces — Tools and Code by Avner Shahar-Kashtan