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
Casablanca – showing progress for an HTTP download
The current release of Casablanca does not support progress reporting when reading from an HTTP stream, you only know when it’s completed – but, you can read chunk by chunk and get a percentage based on the total size that you can get off the header. Here’s a code snippet that shows one way of […]
Casablanca – JSON POST code snippet
Continuing on with Casablance, here’s a code snippet that shows how to POST JSON data to a web server. C++ does not have reflection, so unlike with .NET, you need to manually create the JSON from an object structure (which may seem like too much work if you’ve used JSON libraries in C# where the […]
Casablanca code snippets – getting and parsing JSON data
Casablanca is very easy to get started with if you’ve used PPL tasks before, and even if you haven’t it’s still fairly straightforward to use. Here’s an example showing how easy it is to make a GET request to a webserver and to extract the response as a string. The test service I was playing […]
Setting VC++ up to use Casablanca
Once you’ve installed Casablanca, you’ll need to add the required include/lib folders to your VC++ projects. I took the same approach used by the sample projects. Open Project Properties / Configuration Properties / C/C++ / General and add the following entry to the Additional Include Directories. (note: line breaks added for formatting) $([MSBuild]::GetRegistryValue( `HKEY_LOCAL_MACHINE\Software\Microsoft\Casablanca\OpenSourceRelease\110\SDK`, `InstallDir`))\include […]
Mapping a Visual C++ filter to a physical folder
There is one annoyance in Visual C++ (2010/2012) for people used to C#’s solution/project folder behavior where a folder in the project maps to a namespace, and any files/classes you add to that folder are physically added to an equivalent subfolder in the file system. Unfortunately, with VC++, the closest equivalent is a project filter […]
DateTime projection in C++/CX
C# projects Windows::Foundation::DateTime as System.DateTimeOffset, whereas C++ just exposes the raw structure. This can be rather unnerving if you are trying to port some C# code to C++/CX. All you have to work with is the UniversalTime property which is a long long that MSDN defines as the number of 100-nanosecond intervals prior to or […]
Compiler errors when using the Bindable attribute
It’s been a long break for me from blogging, but I intend to make up for that over the next few months. I’ll primarily be blogging on topics mostly related to using Visual C++ to develop Windows Store applications. So if that’s the sort of thing that interests you, do check back once in a […]
Visual C++ WinRT FAQ – Winsock and other APIs
When migrating apps or libraries that use sockets to WinRT, the absence of Winsock is often one of the first hurdles for many C++ devs. The suggested alternative to Winsock is to use the Windows.Networking.Sockets namespace. For a full list of alternate APIs that replace existing ones, see: Alternatives to Windows APIs in Metro style […]
Difference between std::move and std::forward
In really simple terms, std::move returns an argument as an rvalue reference while std::forward returns either an lvalue reference or an rvalue reference based on how the argument was passed in to the current function. While this is fairly obvious once you get the hang of it, it can be quite tricky to grasp earlier […]
Building Metro apps without Windows 8
This is an FAQ on the forums. And unfortunately but unsurprisingly, the answer is no, you cannot build a Metro app without Windows 8. If you are running Windows 7 and don’t want to risk screwing up your OS, you could install Windows 8 on a VM or dual-boot off a VHD/2nd partition. Those options […]