Configuring Git to use HTTPS Protocol

A few days ago, I was trying to clone the angular-seed git repository https://github.com/angular/angular-seed. Then I’d use bower to install realated libs with:

$ bower install

But, I was getting the following error, in gitbash:

Additional error details:
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=No such file or directory

After some research, and reading the logs, I’ve found that bower coudn’t execute some commands because Git was using url’s with git:// to fetch some repositories, and I was behind the firewall of the company I work.

To solve this, we need to configure Git to use HTTPS protocol instead the GIT transport, so bower can fetch dependencies:

$ git config --global url."https://".insteadOf git://

It’s weird, but it works.

After this, all url’s will use https:// to find the address. This is useful when you’re under a proxy in your company, or a firewall, for example.

How to get Device/User Info on Windows Phone 8

The Microsoft.Phone.Info namespace can be used to retrieve information about the device and the anonymous identifier information about the user. Unfortunately, some low-level properties are not available yet, such as IMEI or IMSI. But we can use other info to replace those.

First, put two text blocks at the .xaml to display info:

<TextBlock x:Name="DeviceProperties" Text="Device Id: " />
<TextBlock x:Name="UserProperties" Text="User ANID2: " />

Then you can use the following code to get the DeviceUniqueId, for example:

Byte[] DeviceUniqueId =
 (Byte[]) Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
DeviceProperties.Text += Convert.ToBase64String(DeviceUniqueId);

And to display the user ANID2, for example, you can use:

UserProperties.Text +=
 Microsoft.Phone.Info.UserExtendedProperties.GetValue("ANID2").ToString();

There are many properties available in this namespace, as you can see in the Microsoft.Phone.Info documentation

Using VirtualBox and Windows Phone SDK on same Windows

A few days ago, I needed to install VirtualBox to mount my Linux VM’s. Everything worked perfectly, and with 64bit available. Some time later, I had to install the Windows Phone SDK 8, to create a prototype app. It also worked correctly.

But, when I needed to start a VM again, I received the following error:

VirtualBox Import Appliance; VT-X is not available.

Doing a research, I figured that this means that virtualization is not available on the computer, or in the operating system. When checking in the BIOS, virtualization was enabled – since it worked before.

So the problem could be in Windows 8 (which is the host).

The Windows Phone SDK uses Hyper-V

To install and use the Windows Phone 8 SDK,  Hyper-V is required, and it is where it can run the phone emulator.

So the SDK intalls Hyper-V and activates it. Hyper-V starts executing when the computer reboot. (By the way, Hyper-V is extremely heavy for common use, make direct debug the device itself.)

After a boot or reboot, Hyper-V will “take over” of all features on Windows.

When you enable Hyper-V, Windows becomes an virtualized environment and VirtualBox no longer have direct access to hardware. This is normal. Your Windows starts to behave as a virtual machine. And with that, the VirtualBox VM’s stop working.

It’s like trying to open a VM inside another VM. Which is not possible.

Disable Hyper-V and Reboot

To solve this problem, you must completely disable the Hyper-V on Windows:

  1. Open the Control Panel;
  2. Go to Enable or Disable Windows Features;
  3. Uncheck Hyper-V and OK;
  4. Restart the PC

You really need to reboot, so the virtualization layer (Hyper-V) can be disabled in the operating system. Most likely, the emulator Windows Phone 8 will stop working.

I recommend that you use a real device to debug and have a more real feeling of your app.

See Also…