C++/Cx: Getting around the very limited DateTime object

You know, I have been writing a LOT of C++/Cx recently and I have hit a bunch of issues. This particular one is about the DateTime object in C++/Cx. If you look at the C# version of the DateTime object, it contains a ton of niceties. There are properties that will give you the Day, […]

WinRT in C++/Cx and registering and unregistering event handlers

Having to work in C++/Cx, every day I have new appreciation for C#. Things that I take for granted in C#, well, they are not straightforward C++. Take the example of event handlers. In C#, the usual way of registering and unregistering event handlers is pretty straight forward: e.g. Click += Button_click_handler and Click -= […]

Getting access to the UI dispatcher from a background thread (Win8/8.1)

I recently struggled quite a bit trying to get access to the UI dispatcher from a background thread. I had a scenario where when I receive a push notification, I had to update the XAML page UI. Obviously, I did not have access to the UI thread from the background thread so I binged quite […]

C# synchronization blocks containing await or how to lock a block with an await

Recently working on a project, I came across a scenario where I needed to lock a block so that only one thread could enter the block at a time. Simple Monitors, I thought. However as soon as I put the C# lock statement around my block, I noticed Visual Studio started complaining. The problem was […]

C#/XAML App suspend: Bug/Feature – OnNavigatedFrom called during app Suspend

Got hit by this bug in suspension manager (C# and XAML) and wanted to share it with you in case you ever hit this scenario. Recently, I have been coding an app with Azure backing and I got hit by a bunch of interesting scenarios that left me scratching my head, thinking, “Hmm, how do […]

Lesson 11: Scope in JavaScript

In this lesson, I focus on the nitty gritty of Scope and Lifetime of variables in JavaScript Language. JavaScript has similar scoping model as most other C like languages with a minor difference in that it does not have block scope. Here is the code: 55-scope

Lesson 10: Prototypes in JavaScript

Sorry for the long delay between the last lesson and this one. Lots of travel and work got in the way of this post. Without further ado, here is the lesson on Prototypes. Prototype is much misused keyword in JavaScript. Prototype word in JavaScript is used interchangeably for two subtly different concepts. This has lead […]

Lesson 9: Constructor Functions

Constructor functions in JavaScript are special functions that allow you to create a factory function that can create many objects of the same type through code reuse. For Object Oriented programmers, constructor functions are a familiar concepts. The code for this lesson is here:  Constructor Functions

Lesson 8: JavaScript Functions

JavaScript functions are what gives Javascript its power. With JavaScript functions, you can break down your code into small modules which, helps with readability, debuggability and reusability of code. JavaScript functions double up as objects as well. Here is the code file for this sample: 50-functions.js      

Lesson 7: Assignment 1 – Etch-a-Sketch and CScript

Hello and Happy New Year! I am back in the new year with the first blog entry that will exercise your mind and give you some hands on experience as you progress through it. Reading input using node.js is not straightforward, and hence, in this assignment, I am having you guys use this tool called […]