March 6, 2014
Regular expressions are a very powerful tool to have on your toolbelt. They have an arcane syntax and often end up looking like a random stream of characters, but they can save you a lot of time parsing and interpreting text. Here are some problems that you can solve with regular expressions:
Find a list of phone numbers in a large text file
Check that a user-provided email address is valid
Verify that a password meets custom strength requirements
Locate all outgoing links in an HTML document
Modify all <img src="..."> tags to refer to an HTTPS address
In this post I'd like to take...
February 28, 2014
I spent a great week in Canada despite the super-cold weather for my taste. After all, in Israel, sub-freezing temperatures are enough of a reason to cancel school and bring public transportation to a halt. So for me, stepping outside in -15 degree weather was pretty much of a shock.
The week started with three days in Toronto, visiting the Sela Canada branch and delivering two talks at user groups - an introduction to Android development with Eclipse and Xamarin, and an introduction to Node.js on Windows Azure.
Then, I flew in to ConFoo, a conference for web developers in Montreal....
February 20, 2014
I spent a few hours last week chasing a non-paged pool leak caused by a simple Win32 application. After some divide-and-conquer work, we were able to pinpoint the line of code causing the leak -- a seemingly innocent WSARecv call that performs an asynchronous socket receive. How can a user-mode application cause a non-paged pool leak that quickly accumulates to dozens of megabytes of kernel memory? Read on for the details.
If you'd like to replicate this problem yourself and experiment with the diagnostic process described below, use the following gist. It's 54 lines of code including error handling and #includes.
February 14, 2014
On Thursday I had the pleasure of delivering a session at the High-Tech Mizpe Ha-Yamim event for decision makers (VP R&Ds, CTOs, and CIOs) in the beautiful and tranquil Safed/Rosh-Pina area. My talk focused on Visual Studio 2013 and how it can make developers' lives better by improving productivity and collaboration, making it easier to diagnose difficult problems in development and production environments, and helping explore large amounts of existing code.
I built the talk around four core areas: productivity, exploration, diagnostics, and collaboration. The demos included using IntelliTrace with Windows Azure Cloud Services, using Visual Studio's .gcdump support with...
February 6, 2014
Last week I had the pleasure of delivering a free half-day introduction to Android development at our Haifa branch. The day focused on both native application development on Android (with Eclipse and ADT) and C# development with Xamarin. We developed a simple "todo list" application that displays pending tasks, tracks the user location, and stores tasks in persistent storage on the device.
Here are some useful links I promised to post during the session, which you might find useful when replicating this application's functionality:
Download the Android SDK Bundle (get started with Android development in Eclipse)
Xamarin.Android (get started with Android development...
January 20, 2014
I was helping a student debug a WCF service the other day and stumbled upon a very annoying problem. Visual Studio refused to add a service reference to his service, no matter what we tried. After spending a few minutes copy-pasting configuration snippets from Stack Overflow, I decided to proceed more methodically and see what we're doing wrong.
Here's the error we were getting, courtesy of the Visual Studio "Add Service Reference" dialog:
At first, I was under the impression that something is wrong with the metadata endpoint itself. Perhaps I used the wrong spelling of IMetadataExchange? Or maybe I don't...
January 7, 2014
I recently came across the need of hosting a .NET assembly (DLL) as an out-of-process COM server. While .NET ships with excellent support for COM interoperability, this particular scenario isn't directly addressed by the interop layer. While there are some fairly complex solutions such as COM+ hosting or custom class factory registration, I would like to show you how to accomplish this task using dllhost.exe, the default COM surrogate process, with just a handful of registry modifications.
The reason I was looking into doing this is quite simple. Suppose you have a 32-bit only unmanaged DLL that you can't recompile...
December 28, 2013
December 24, 2013
Yesterday I had the pleasure of giving a one-hour webinar on Windows Azure Mobile Services. If you follow my blog, you already know that this is one of the technologies I am most excited about. In the webinar, we covered the basic capabilities such as data access, push, and authentication, and had time to discuss some additional (newer) features like Custom API and Notification Hubs. We have mostly seen demos from Windows 8 and Windows Phone, but the backend we built is also perfectly capable of dealing with iOS and Android clients.
The demo app I used is my good...
December 19, 2013
In addition to my three breakout sessions, I've also had the pleasure of delivering two workshops at the Sela Developer Practice: Improving .NET Performance and .NET/C++ Interop Crash Course. Although these workshops are quite time-tested, I always try to add new materials and tools to make them more interesting for both myself and the audience. There's also constant interest in these topics -- I had 110 people registered for the performance workshop and more than 40 people at the interop course.
In the performance workshop, we cover various performance measurement tools. I always try to squeeze in new tools in...