Nish's Blog
For several years I hosted my blog on my personal domain, but it got too tiring to keep maintaining WordPress every time they released a bug-fix or an update. So I finally moved it to WordPress.com.
Recent blog entries
Announcing the Central Ohio C++ User Group
If you are a C++ developer/enthusiast who lives in or around Columbus, OH, then you may be pleased to hear that we are launching a C++ specific user group in Columbus, Ohio. The first UG session is scheduled for the 14th of March. Quick Solutions, Columbus, OH has kindly agreed to host the meeting. Details [...]
WinRT : Databinding with C++
Here’s my 2nd article on WinRT with C++. Visual C++ and WinRT/Metro – Databinding Basics Databinding (at the moment) is easier with C# or VB than with C++ since with C#/VB, the .NET interop handles the required plumbing required to get databinding working. With C++, the required interfaces and functionality need to manually implemented (which [...]
Intro article on using C++/CX
Here’s an article I wrote for The Code Project on the fundamentals of using C++/CX to create WinRT apps. Visual C++ and WinRT/Metro – Some fundamentals The article tries to explain what happens when you instantiate and consume WinRT objects from C++.
C++/CX – keeping C++/CLI syntactically alive
As most of you already know by now, the C++ Component Extensions (or just C++/CX) introduced in Visual C++ 11 will basically use the C++/CLI syntax with minor differences. Someone asked me on Code Project what I thought of that and I replied to him, (paraphrasing here) – “Years of using an unpopular syntax to [...]
The future of C++/CLI
With all the unverified but reasonably believable rumors about the new Windows 8 API (Jupiter) and how it supports managed and native APIs, questions can be raised as to the need or use of C++/CLI as a Windows programming language. Well here are a few reasons why I think C++/CLI won’t go away and will [...]
Mixed-mode scenario with tracking handles to value types
This question was recently asked in the MSDN forums and answered by myself, and I am blogging it here so I have a page to link to if something similar gets asked again in that or some other forum. The OP had a C# caller that called a mixed-mode DLL’s method that took 3 arguments [...]
Validating a bit flags enum value
This was recently asked in the Code Project Q/A forums, and while there were several responses posted, I think the following is succint and works well. private static bool IsValidFlagValue<T>(int x) where T : struct { int aggregate = Enum.GetValues( typeof(T)).Cast<int>().Aggregate((z, y) => z | y); return x <= aggregate && (aggregate & x) > [...]
Using Socket.Disconnect(true)
Recently, someone asked this question on the CodeProject forums where the OP wondered if reusing the socket would mean he’d get the same client endpoint. This is the gist of my response to him. Calling Socket.Disconnect(true) will internally result in Winsock’s DisconnectEx function being called with the TF_REUSE_SOCKET parameter. From the docs: Prepares the socket [...]
What about static indexers in C#?
Well, that’s not really possible but often people do ask if they can do this. Here’s a solution I recently gave someone which comes quite close which uses a singleton class instead of a static one: class Test { static Dictionary<int, string> map = new Dictionary<int, string>(); private Test() { } private static Test instance [...]
DateTimePicker focus issue
The Winforms DateTimePicker has this odd behavior. If you set focus to either the day or the year, then when you tab out of the control and tab back in, focus is not restored to the month as it is by default (even if you reset or change the DateTime value for the control). There [...]