2016
05.07

After recent Windows 10 System update (I am using Insider Preview), my Xamarin Android Player (XAP) refused to work. Everytime I tried to start the emulator, it will prompt error.

DeviceManager_2016-05-07_01-03-03

Error! The details is in the log file (if you can find it)

Error! The details is in the log file (if you can find it)

Since I don’t know where the log file is located, I just run the VM from VirtualBox. This time, I got more informative error message.
VirtualBox_2016-05-07_00-56-35

Details of my system:

  • Windows 10 Insider Preview. Build 1433.rs1_release.160422-1940
  • VirtualBox 5.0.20 r106931
  • Xamarin Android Player 0.6.5

From the error message, it seems something wrong with the VM’s network option. Looking into VirtualBox’s network settings, I don’t see anything amiss.

File -> Preference

File -> Preference

VirtualBox_2016-05-07_01-38-25

VirtualBox_2016-05-07_01-38-33

The network settings are already follow the recommended values. Perhaps we can find something in Windows’ network settings (Win-R, ncpa.cpl, ENTER)

Right-Click, Properties

Right-Click, Properties

dllhost_2016-05-07_01-45-52

Hmm…VirtualBox NDIS6 Bridged Networking Driver strangely is not checked. Could this be the cause? Let’s just check that and try to start the XAP again.

chrome_2016-05-07_01-51-41

It works! Heng ah! πŸ˜€

Worth sharing?

  • Facebook
  • Twitter
  • Google
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
2016
05.05

Today I installed Ionic Pack for Visual Studio 2015. This extension will provide IntelliSense when editing Ionic’s HTML source code.

Unfortunately, this extension will clashed with ReSharper’s HTML IntelliSense. Here’s how to disable it.

  1. Open ReSharper’s Option
    devenv_2016-05-05_16-57-23
  2. Select IntelliSense -> General
    devenv_2016-05-05_16-59-16
  3. Select Custom IntelliSense
    devenv_2016-05-05_17-01-15

This way, I enable ReSharper only when editing .cs files. And it works!
devenv_2016-05-05_17-03-58

That’s all. I hope it helps.

Worth sharing?

  • Facebook
  • Twitter
  • Google
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
2016
04.15

Long time ago, Konstantin reported that the ouput of JSON Table editor is in encoded format (unicode-escape character). For example, if the input is:

{ 
   id: 0, 
   text: 'ΠŸΡ€ΠΈΠ²Π΅Ρ‚', 
   translation: 'Hi' 
}

The output will be:

{ 
   "id": 0, 
   "text": "\u041f\u0440\u0438\u0432\u0435\u0442", 
   "translation": "Hi" 
}

Thanks to Mathias Bynens’ great article on Javascript problem with unicode, I can fix this problem.

First, we need to ensure that method String.FromCodePoint is available. Some browsers like IE and Safari didn’t have this method. Thus we need create the polyfills:

/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
if (!String.fromCodePoint) {
  (function() {
    var defineProperty = (function() {
      // IE 8 only supports `Object.defineProperty` on DOM elements
      try {
        var object = {};
        var $defineProperty = Object.defineProperty;
        var result = $defineProperty(object, object, object) && $defineProperty;
      } catch(error) {}
      return result;
    }());
    var stringFromCharCode = String.fromCharCode;
    var floor = Math.floor;
    var fromCodePoint = function() {
      var MAX_SIZE = 0x4000;
      var codeUnits = [];
      var highSurrogate;
      var lowSurrogate;
      var index = -1;
      var length = arguments.length;
      if (!length) {
        return '';
      }
      var result = '';
      while (++index < length) {
        var codePoint = Number(arguments[index]);
        if (
          !isFinite(codePoint) ||       // `NaN`, `+Infinity`, or `-Infinity`
          codePoint < 0 ||              // not a valid Unicode code point
          codePoint > 0x10FFFF ||       // not a valid Unicode code point
          floor(codePoint) != codePoint // not an integer
        ) {
          throw RangeError('Invalid code point: ' + codePoint);
        }
        if (codePoint <= 0xFFFF) { // BMP code point
          codeUnits.push(codePoint);
        } else { // Astral code point; split in surrogate halves
          // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
          codePoint -= 0x10000;
          highSurrogate = (codePoint >> 10) + 0xD800;
          lowSurrogate = (codePoint % 0x400) + 0xDC00;
          codeUnits.push(highSurrogate, lowSurrogate);
        }
        if (index + 1 == length || codeUnits.length > MAX_SIZE) {
          result += stringFromCharCode.apply(null, codeUnits);
          codeUnits.length = 0;
        }
      }
      return result;
    };
    if (defineProperty) {
      defineProperty(String, 'fromCodePoint', {
        'value': fromCodePoint,
        'configurable': true,
        'writable': true
      });
    } else {
      String.fromCodePoint = fromCodePoint;
    }
  }());
}

Now we can use this function to replace any instance of unicode escape character.

str = str.replace(/\\u([a-fA-F0-9]{1,6})/g, 
         function (e, n) {
	    var t = parseInt(n, 16);
	    return String.fromCodePoint(t);
});

That’s it guys. So happy that 2-years old bug is finally fixed πŸ˜€ Cheers!

Worth sharing?

  • Facebook
  • Twitter
  • Google
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS