Universal Windows development in Windows 8.1 and Windows 7

The bold concept Windows 10 introduced was Universal Windows Platform (UWP) - "Write once, Deploy anywhere" truly and literally. To make it more simple and clear, if you create Universal Windows application, then you can run the same app in variety of devices ranging from Desktop, Tablet, Mobile and upto your holographic computer (HoloLens) without recompiling your code. Initial requirement for UWP app development was Windows 10 and Visual Studio 2015.

Things have changed now! With the recent announcement at //build/ 2015, you can develop UWP app in Windows 8.1 and Windows 7 operating system using VS2015. But, please note the experience may defer. For example, if you are developing UWP app in Win 8.1/7, then you cannot deploy the app to your Local Machine or to any simulators. Instead, you need a real device for development and testing. The exception is, Mobile emulators will be there. Also, XAML Designer support will not be there, but Intellisense is. For developing UWP in Windows 7, you need to wait till VS2015 hits RTM.

Here is a screenshot of UWP OS support which was share during //build/ 2015 event.

This is a welcome change. There is always a large community who cannot immediately migrate to Windows 10 exclusively for UWP app development. This move will definitely help them and those who are hesitant to update to developer preview of Windows 10.


Fix: Annoying Adsmatte popup in desktop and smartphones

Phew! It killed a whole day of mine.

For last few days, I was bombarded with annoying Adware popup from Adsmatte. I first noticed it when I navigated to my blog for updating the template. Insaneously, I was surprised by bunch of ads popping up from my blog when I click on the post title or whenever I make any random clicks on blank area. And, that to without my consent.

I was facing this issue in both Internet Explorer as well as in Firefox. Initially, I thought it was because of any addons that got installed in my browser. I cross-checked the add-ons, disabled it, reset the browser, deleted temporary files, opened in InPrivate mode; but didn't helped at all. Along with this, I saw this issue in my other laptop and in windows phones. That gave me red signal. Does the malware affected my router or ISP? And, it's start spreading to all devices connected my router. Ah, oh! Literally, I have tried everything except Refreshing my PC and resetting my phone.

I searched through the internet and could hardly find 2 threads - (http://forums.androidcentral.com/moto-g-2014/528571-adware-redirects-most-websites.html, http://www.asus.com/zentalk/forum.php?mod=viewthread&tid=8189) which explain this problem. I am very surprised by the timing of this issue. Because, the thread was opened approximately on same day, I started facing the issue. I opened a thread in Microsoft Answers - http://answers.microsoft.com/en-us/protect/forum/protect_other-protect_scanning/how-to-get-rid-of-adsmattecom-adware-opening/06b20667-586a-4ebd-9876-6d28c8528a1f?rtAction=1431798827824, and could see that other affected users too.

I started analyzing step-by-step. This issue is not related to my blog alone, I started seeing this in other websites also. If that's the case, then it should be related to some services that is widely used across all the websites. Could that be Google AdSense? Yes, that's a valid possibility. I quickly tuned off the ads code in my blog. But, the issue reappeared. That made me angry. I borrowed some patience, started digging for the JavaScript code (using IE Developer Tools) that loads this annoying popup and finally figured it out. I managed to extract the JavaScript code, that opens the annoying adsmatte popup. Carefully going through the code, caught my attention on one Google service - Google Analytics. Bingo!

I quickly commented my analytics code and refreshed the browser. There you go. No popups, no ads, nothing. It's clean and clear.

Yes, that's it. Google Analytics is the culprit here. Some nasty clever hacker has figured the loophole in Google services and targets the malware. Wait! The solution that I just figured out is a temporary fix. Practically, commenting out analytics code in every website is not practical and is not ideal at all. I believe, Google should investigate this further and come up with a fix which wipes out this issue.

Hoo!!! It's too late here. I just want to share this information with whoever reading this. So, I stayed late and published this.

Hope this helps. Please leave your comments, if it helped you.

Thanks a lot for reading this.

Thanks again.

UPDATE: A thorough analysis reveals that my router was hacked and the malware injected malicious code to the script files along with each webpage request. Since Google Analytics script is widely popular, it would be way more easier for malware to scan for the script and inject the code. This was the reason why you were getting ad pop-ups in websites which has google analytics and not in other websites. I finally brought new D-LINK modem to solve this issue.


Fix: Error on posting data using HttpClient

 Last week, I’s spending some time exploring OneDrive Rest API. While trying to send a POST request for receiving access token, I got a error as - “{"error":"invalid_request","error_description":"The provided request must have content-type 'application/x-www-form-urlencoded'."}”. 

I modified my code further. This time, I got another exception – “Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.” Finally, I figured out the correct way to set the content-type header while sending a POST request using HTTPClient. And, here it is.

HttpClient client = new HttpClient();
StringContent content = new StringContent(BodyContent, Encoding.UTF8, "application/x-www-form-urlencoded");
var responseMessage = await client.PostAsync(Uri, content);

Phew! Hope this helps.