Tuesday, May 17, 2016

JustMock and "Failed to initialize coreCLR" on RC2

Unable to start the process. Failed to initialize CoreCLR, HRESULT: 0x80131500

I just installed ASP.NET Core RC2 and was able to get it working from the command line, on some new basic tests projects. But when I tried to do it from Visual Studio I got the following error. 

If I tried to run "dotnet" in a console opened from Visual Studio, I would get the same error. So the issue was that something was off for the VS configuration/environment. 

After verifying that "dotnet" was able to run perfectly everywhere else I took into the task of comparing the environment variables (dichotomically, of course). One particular variable made the difference: "JUSTMOCK_INSTANCE=XXXXX", so that lead me to notice that JustMock was interfering with it somehow. 

So, if you use JustMock just turn it off for RC2 projects. (No need to uninstall it, just disable the profiler)

Tuesday, May 03, 2016

NODE.js fs.readFile and the BOM marker

Working on a ReactJS project, got a small glitch while trying to read a JSON file and parse it as a javascript object.
  getDataObject() {
        var dataString = fs.readFileSync("./json/data.json", "utf8");
        return JSON.parse(dataString);
  SyntaxError: Unexpected token  

After checking, double and triple checking again that the file was correct I went deeper and realized that "fs.readFileSync" was returning me the BOM for the UTF file at the beginning of the string. So we just need to strip it out.
   getDataObject() {
        var dataString = fs.readFileSync("./json/data.json", "utf8");
        return JSON.parse(dataString.replace(/^\uFEFF/, ""));
I then checked and there are "packages" for this, however I don't think is proper to just import a new dependency just to fix something this small.

The big issue here is why is this considered correct. The BOM is not part of the string, it's a marker used (and also optional) to aid in how to read the content, but it is not part of the content.

Friday, December 04, 2015

Red blinking issue on Microsoft Display Dock

Red blinking light? Check the power supply cord.

I just got my Microsoft Display Dock courtesy of MS after pre-ordering a Lumia 950XL. But after the first attempt I just got a red blinking light on the front and nothing more. The phone won't recognize it and the display connected would just go to sleep.

After playing with it a bit I realized the USB-C connector on the dock's power supply (identical to the "fast charger")  was a bit loose. I then compared to the one that came with the 950XL and voilĂ ! See the difference below.

Left: Adapter from the 950xl box | Right: Adapter from the Display Dock
Since it is shorter (manufacturer error? bad batch? who knows...)  the adapter packaged with the Display Dock won't reach the connector properly. However, it will fit in and charge the 950XL perfectly. I think one of the reasons is the thick casing in the Microsoft Display Dock. Check it out.
The case is sturdy and thick.

So if you happen to have a Microsoft Display Dock, then you already have a 950/950XL that most likely came with a "fast charger" (why else would you get the accessory?). You can either switch them or return the dock to Microsoft for a replacement.

However the chargers are identical and you can also fast charge while connected to the dock.

Thursday, October 08, 2015

Why this new Microsoft is impressive

The last Microsoft event on October 6 showed a few surprises, let me explain you why this is impressive and why I think the new Nadella direction at MS is different. Iris Scanner, Liquid Cooling, Continuum...

A new Surface 4 tablet with Liquid Cooling
The new Surface 4 was a really good upgrade, and a real big one. More resolution in the same size, up to 16GB of RAM and 1TB of HDD and Liquid Cooling. All that packaged in a device as think as this, only 8.5mm of depth.

Check how the cooling works.

New phones with Continuum and Liquid Cooling

I know Windows only have 3% of the market on phones, and that's a bummer because we don't get to have all the apps. But now the new phones have continuum, a feature that allows using a phone as a full size computer. They also manage to get liquid cooling into a handheld device. That's a good direction. Let's just hope this new direction combined with universal apps will get more developers into the boat.

A new Surface Book.

Think got even crazier when MS announced this product, I think is safe to say that nobody saw it coming. A new powerful laptop hybrid (although expensive) and a crazy beautiful product. Looks like Microsoft is finally putting good design in combination with good specs in an effort to gain the consumer market.

That's impressive, right?

A new line of products, beautiful and powerful. New technologies like continuum, iris scanner and liquid cooling in devices so thin and small. New redesigned products like the new Band or the new Pen for Surface. This is a new MS, way different than the one that created the Zune. 

PS: if you reading this from CodeProject then the CP crawler is still buggy and pulling posts without the CodeProject tag.

Friday, October 02, 2015

Fixing Visual Studio 2015 Android Designer with Xamarin

While using Visual Studio 2015 to edit and android layout file (axml) I got this error:

 The installed Android SDK is too old. Version 24.3.4 or newer is required

The number version might be different in your case. Here are a few possible causes for the error:

1) You actually need to upgrade your Android SDK.
2) You have the wrong path for the Android SDK installation on Visual Studio. (change it on Tools->Options->Xamarin)
3) Mixed Xamarin extensions (this was my case)

After reinstalling the Android SDK and checking the everything was fine on that part I went to check on Visual Studio extensions (Tools->Extensions and Updates). It turns out that  I caused a mix up of versions, since I already had Xamarin and Visual Studio 2013 side by side. and now 2015 had another one, my Visual Studio 2015 ended up with 2 extensions for Xamarin. Disabling one of them solved the problem and the designer was working again.

The one that I disabled was titled "Get Xamarin" and I kept the one that shows in the image. Unfortunately I uninstalled the bad extension before taking a screenshot.

Now you might not experience this problem if you have VS2015 in a clean install, but my computer does not have a clean install since 2011. Good luck!

Monday, February 23, 2015

Was the Lenovo/Superfish thing so unique?

It is a big deal, and by no means I would defend them; I don't think anyone can. They did a cheap and horrible thing by installing a piece of adware junk, that not only was used to monetize on the buyers, it is also a major security breach. Many people are still upset at lenovo and blaming everything on the "chinese government" and talking about all sorts of conspiracies.

But I don't want to talk about who did it or why, as I was reading about all this, I just could not stop wondering:  are they the only ones? Of course not.

The Gemalto hack

But did you know about the Gemalto SIM card hack? A massive sim card hack that allegedly allows US and UK spies access to billions of phones. The Gemalto hack quoted here from PC World:

"Gemalto, based in the Netherlands, produces about 2 billion SIM cards a year. About 450 mobile carriers, including AT&T, T-Mobile, Verizon Wireless and Sprint, use the company’s SIM cards.
With the compromised encryption keys, the surveillance agencies would be able to monitor mobile communications without the approval of the carriers or foreign governments, The Intercept story said. The encryption keys would allow the agencies to intercept mobile traffic without court-ordered warrants or wiretaps, the story said."

The supercookies

Also Verizon and AT&T got involved into some pretty high level user tracking, using something called  "supercookies". Basically they would be able to track all internet usage by users, no matter if they were using private navigation or incognito modes. 

So this is not a new thing, big companies and governments placing adware and/or tracking us while compromising our security? It is not new. 

What can you do?

You can use a Tor browser for better privacy online, VPNs are also a good option. And the next the time you buy a new PC at the Home Depot, do a clean install and put everything yourself.

Friday, November 14, 2014

My bipolar approach when recommending a mobile device (phones)

Recommending a new device to somebody else requires a lot of analysis, first of all, they will think you are trying to push your own preferences. And that could be true, at least up to a certain point. For me, however, recommending a device becomes a more complex thing. As a developer I work with and own a lot of them: iPhone, iPad, Android phones and tablets, Windows tablets, both "RT" and regular x86. And while my own device is a Windows Phone (Lumia 925) the right device for you depends on a lot of factors.

First, the Phones

Let's compare the three platforms, but only phones for now, we'll be talking about tablets later. So we have iOS (iPhone), Android and Windows Phone. At some point the discussion must be about a specific brand, but at the end we will have to sort results by platform.


Most likely the app you need is available for both iOS and Android. There is a huge app gap, as well as a huge number of low quality apps in some stores, so my recommendation is for you to check if the apps that you need are available and if they worth it. For example I don't have Candy Crush on my Windows Phone (yes: I can live without it) but the Instagram app on WP is way better than those on other platforms, and it will let you have multiple profiles, more editing features, regram, etc. You will in fact need several apps to accomplish the same result on iOS. In any case, considering the number of apps available alone:
  1. Android:1.3M (source
  2. iOS: 725K  (1.2M total with 475K iPad-specific source)
  3. Windows Phone: 350K (source)

Second only to phone calling, texting and LOL-ing, FB-ing, etc, there are the maps...And while we can  all have Google Maps on all devices and iOS even having their own, my recommendation goes to the HERE Suite. This suite of products was named after Nokia some time ago; but it actually works on any Windows Phone and is going to be released for iOS and Android. The suite contains HERE  Maps, HERE Drive+ with voice and turn by turn navigation, offline maps, and the HERE Transit app . So when it comes to maps:
  1. Windows Phone
  2. Android
  3. iOS
Do you like to take pictures with your phone? Do you take a lot of them? Do you try to take pictures in a club at night? Suffering from those blurry photos? Do you have to use flash all the time? Ok, here we can't compare OSes, We need to talk about the actual devices.  So we can check iPhone 6 vs Galaxy S5.  or Nokia Lumia 1520 vs iPhone 6+, or we can bring into the fight devices like the Lumia 830, 925, 930, or the 41 MP Lumia 1020. So if we try to sort platforms by selecting  the best cameras to represent  them, would be like this:
  1. Windows Phone (because of the Lumias with PureView technology)
  2. Android (some Samsung and Sony models )
  3. iOS (iPhone 6+ is the only one with OIS and only 8MP)
Here again it's very hard to decide unless we talk about specific models. Since some Samsungs are IP67 certified, they look like the clear winners. Lumias (and Nokias in general) are known to be tough devices (remember the 3310?)  The Lumia series of polycarbonate and gorilla glass turn out to be extremely resistant devices. You can actually smash other phones with a Lumia without  having a scratch, and even without an IPxx certification, I have put some of them in water and they are still working. So my ranking would be this one:
  1. Android  
  2. Windows Phone (a close second)
  3. iOS (iPhone is one of the most fragile devices ever created, especially the iPhone 6+ )

The winner here is the iPhone. You can find almost any compatible toy, tool, sensor, reader, drone, home automation system and fashion cover out there for it. Android is a second option here, with Windows Phone being a distant third, so:
  1. iOS
  2. Android
  3. Windows Phone
Have you heard about the recent celebrity leaks? Well, security is something important on modern devices, not only because some private photos might be exposed, but also because we keep a lot of information on them, we perform online purchases, access our bank accounts, and reserve plane tickets. When it comes to security, Windows Phone has the edge, and they are the most secure smartphones out there. Android, in the other hand, is the most insecure one due to lot of fake apps in third party app stores, spyware and many security issues. It is in fact the only one where you actually need an antivirus. 
  1. Windows Phone
  2. iOS
  3. Android
Here is the full Kaspersky report. See below how 98.5% of the mobile malware targets Android.

Also check this 2014 Pwn2Own.

Design (Hardware)
I could not sort devices in general by this aspect, since judging a  device by its design it's a subjective task and each person has its own preferences. I would say iPhone 5S has a good design, then the HTC One M8 and Lumia 830, 930 and 925.

Design (UI)
Well, are you tired of icons? I am. Decades of icons it's enough. But don't take my word for it. Let's just show an image I took in the skytrain at DFW airport. Notice they used an iPhone-ish style for the hardware but the inside design is "modern UI" like Windows Phone and Windows 8 (formerly "metro"). Sadly the app itself is not available for Windows Phone (talking about app gap, right?)

The ad shows a modern UI design inside an iPhone case; however the app is not available for Windows Phone.
Clearly, a preference over design is most likely subjective and not possible to measure, however we can notice that even iOS and Android are flattening their UIs to make it more "modern". What do we get from that?

So, what should I get?
It's up to you... What is the most important thing for you? At the end we are talking about phones, and all of them can make phone calls and messaging. So that extra thing that you want will make the difference.

Here's my order of priorities:  Security,  Camera, Maps and Durability, and that's how I ended up with a Lumia 925 and probably will get a 1020 successor when it comes out.

So now tell me: what's in your pocket?