Posts

Showing posts from 2011

Binding ENUM to WPF control - ComboBox

I believe, I explored quite a bit on finding the best approach for my requirement of binding Enum to WPF ComboBox and thought to share the gradual steps here for a one-stop place which hopefully will help similar minded technical enthusiast .. The simplest approach: You want to just bind Enum as it appears (verbatim) to the WPF combo .. Let's define a sample enum as follows: namespace {    public enum TestEnum    {       String1,       String2,       String3,       String4    } } All we now need is a way to leverage Enum - GetValues method to provide a list of values that lets you bind directly to the ComboBox via ItemSource. < ObjectDataProvider x : Key ="dataFromEnum" MethodName ="GetValues" ObjectType ="{ x : Type sys : Enum }" > < ObjectDataProvider.MethodParameters > < x : Type TypeName ="local:TestEnum" /> </ ObjectDataProvider.MethodParameters > </ ObjectDataProvider > Reference URL: ht

LinQ gotcha - DISTINCT with ORDER BY

In T-SQL, the position of an <Operator> has no relevance as long as they belong to the same SQL statement. However, in a LinQ statement, one <Operator> could override ( more acurately, ignore ) another <Operator> ... This is pretty evident when combining DISTINCT and ORDER BY on the same element in a given scenario. Follow Marco Russo's blog here  - with a great example with explanation.

None of us will ever forget

It was a beautiful morning on September 11th 2001 - I was half way my commute to the work when to my dismay what I heard on the radio was a completely incredible! shocking news - a broken perspective of a group of people who took along thousands of human lives in so little time.. and it left a legacy of hardships and remembrance for those who lost their dear ones. Ten years later, the great country has rebuilt the part of the WTC - more so, even much better and much safer than ever before; however one kid touched my heart during the family visitation speech that I heard on the CBC this morning. .. Dad, if you were here today you would've been proud to see my little brother who is now 12 years old .. "I try to teach him all the things my father taught me. How to catch a baseball, how to ride a bike," and to work hard in school, he said. "I wish my dad had been there to teach me how to drive, ask a girl on a date, and see me graduate from high school," he

Analytical Perspective

There are quite a few posts on the cloud categorized as 'Brainteasers' and here is the one I prefer throwing to an extremely promising candidate (Senior Developer, Architect) during my technical interview. Situation 1 : In a drawer, there are 5 Gray socks and 5 Black socks. What is the least (optimal) number of socks one has to draw (blind-folded) from this drawer which would gurantee a wearable (same color, in case you are wondering what the heck is 'wearable') pair of socks? Perspective: If one draws all the socks, in other words, 10 - that would gurantee a wearable pair of socks - but that would be an overkill, won't it? Remember, we are looking for the optimal number of socks. So, continuing further, let's bring down the number of socks, to draw, to 5. That would give the following possibilites.. One Color   Another Color      5                    0      4                    1      3                    2      2                    3      1       

Inspecting WCF messages

Image
Quite often during the WCF implementation for services layer, we find a need to interrogate the messages inbound as well as outbound at Server (Services layer) and sometimes the same applies for the Client applications too. At a small (and I mean extremely small) data transaction shop, we realized a need to inspect SOAP XML messages inbound to our Services layer and the first thought was to leverage Fiddler . The tool Fiddler does do a good job but for some reason we could never get its reverese proxy  work with our Secured Services layer (using https). Fiddler does wonderful job when running on the client machine to trace Request and Response SOAP XMLs but then by integrating SOAPExtensionAttribute I'd rather do the same from within my own application. The need for us was to trap messages before it hits the Services layer! Anyway, so the need for inspecting messages at a WCF Services layer led me to explore the WCF extensibility model and there we have it.. WCF has a concept

A beginning ...

I've been wondering about creating my own blogsite for a while now and this morning I decided to go for it .. Perspective  as you may find out on this wikipedia page is quite contextual. What I would like to share with the world is cognitive perspectives - the feelings, observations, experience we deal on a daily basis. The observation could be what you see as part of your work, travel, notes you gather from the events happening across the world and so on...