Debugging Embedded IE Browser with Visual Studio

July 31, 2014

Some Windows applications (like Skype – where I work) use an embedded IE browser to display some content.  With Visual Studio 2013 you can easily debug JavaScript/CSS in these types of applications.  To do this, in Visual Studio select ‘Debug -> Attach to Process’.  Then in ‘Attach to:’ select ‘Script code’ and finally in ‘Available Processes’ select your application.  After hitting ‘Attach’ you’ll be able to use the DOM Explorer (Debug -> Windows -> DOM Explorer) and view JavaScript console (Debug -> Windows -> JavaScript Console).  Also you can view JavaScript code in the ‘Solution Explorer’ and set breakpoints.  Breakpoints can also be set in minified code by selecting desired position in code then right clicking and selecting ‘Breakpoint -> Insert Breakpoint’

Rant time…

April 27, 2013

Time to rant, so i’m working on a project and want to do modern browser things like drag/drop, read and upload files. So, I hear IE9 has nice support for modern ‘html5’ features. Well, not so much. Drag from desktop to browser doesn’t work in IE9 – claiming it is a security issue to allow such a feature but of course works nicely in IE10. The File API is not supported in IE9 – ugh. Is it time for IE9 to go the way of IE6?  If you use IE9, I thoroughly recommend upgrading to IE10. I’ve found great support for ‘modern’ html5 features in IE10.

BTW, a great site to find what features browsers support is: http://caniuse.com

Asus Zenbook UX31A

March 11, 2013

Finally got my Asus Zenbook UX31A. This is my new work computer; took 2 months to get! Apparently a lot of people want this computer. The first thing I did after booting up was to check the amount of RAM. Yes, indeed it does have 8 Gbytes of RAM. This computer must be a special build for Microsoft. I searched the Internet high and low and couldn’t find this computer with 8 Gbytes of RAM.  All specs only said 4 GBytes and apparently from what I read that memory is soldered onto the motherboard – most likely to save space. Anyway, I was very glad to see the Zenbook have 8 Gbytes; otherwise it wouldn’t make much of a dev machine.

The next thing I tried to do was hook the Zenbook up to my Dell U3011. I purchased this monitor for it’s massive size since I knew the Zenbook could only drive one external monitor and I have become quite accustomed to having dual a monitor setup. Yes, the U3011 is large: 30″, resolution of 2560 x 1600 (16:10 aspect ratio). After connecting the micro-HDMI to the HDMI port on the U3011, the max resolution I could get was 1920 x 1200. Ugh! Looks like complete crap. The trade-off solution was to create a custom resolution in the Intel graphics control panel.  I selected width: 2560, height: 1600, refresh rate of 30 Hz, and timing standard: cvt-rb.  Yes, this half the normal refresh rate but is necessary since I believe the source of the problem is the Asus motherboard which doesn’t have the bandwidth to support 2560×1600 at 60Hz.  Anyway, after adding this custom setting and rebooting I was able to get full resolution on the U3011.  I would have expected the quality to be poor but I was not able to notice a difference; maybe due to my poor engineering eyesight.  Probably if you are playing games you might notice the difference, but since mine is mostly a dev machine, I think I’ll be fine.

The next change I made to my setup was to modify how the ‘Asus Smart Gesture’ operates.  I changed scroll so that content moves with finger direction.  This make two finger operation consistent with touch screen operation.

So far, the system works well as a dev machine; cross my fingers.  I’ve had as many four instance of Visual Studio running at time with a dozen web pages open. 

WinJS.Class – unexpected behavior – watch out

January 3, 2013

What would you expect the code below to produce for value of ‘len’? If you said 1, then you, like me, are incorrect! In fact the value is 2. The problem here is that instance members get added to the prototype. So the array ‘test’ gets added to the prototype and both instances of TestClass are working on the same array. This seems very strange and is not clear from the documentation at: WinJS.Class.define. To avoid this issue, the test array must be initialized in the constructor.

var TestClass = WinJS.Class.define(function () {
// constructor
}, {
// instance members
test: []
}, {
// static members
});

var test1 = new TestClass();
test1.test.push(1);
var test2 = new TestClass();
test2.test.push(1);
var len = test2.test.length;

Dead simple to self-host wordpress with azure

December 22, 2012

It took me literally 5 mins to get a self-hosted wordpress site up on azure, see: http://www.windowsazure.com/en-us/develop/php/tutorials/website-from-gallery/

Cool Windows 8 Feature – right click on start menu

October 15, 2012

I just discovered a feature in Windows 8 I’ve been looking for quite some time and it was right in front of my face the whole time… In Windows 8, if you move the mouse to the lower left corner you see an icon for the start menu.  Now…if you right click on this icon, you get an awesome menu (below) with shortcuts to many nice features (such as control panel):

Deploy windows 8 app from the command line

May 12, 2012

I was developing a Windows 8 Metro JavaScript app and wanted to get the command line equivalent of Visual Studio “Build -> Deploy Solution”.

Simply do: devenv mysolution.sln /deploy “Release|x86” /project myproject.jsproj /projectconfig “Release|x86”

The result is located in bin/x86/Release/AppX.

This is nice because the result includes the code for the all references.  It also creates a combined .pri (resouces) file.

solution for cygwin unable to remap problem

April 6, 2012

I use cygwin a lot and if you (like me) have had huge problems like:

[main] python 5436 C:\cygwin\bin\python.exe: *** fatal error – unable to remap C:\cygwin\bin\cygintl-8.dll to same address as parent: 0x430000 != 0x6EBB0000

[main] python 5436 C:\cygwin\bin\python.exe: *** fatal error – unable to remap C:\cygwin\bin\cygintl-8.dll to same address as parent: 0x430000 != 0x6EBB0000

[main] python 964 fork: child 5436 – died waiting for dll loading, errno 11
[main] python 964 fork: child 5436 – died waiting for dll loading, errno 11

then most people will tell you to just run ash and then do a  rebaseall, but this doesn’t work for me!

What does work for me  is the following: http://code.google.com/p/chromium/wiki/CygwinDllRemappingFailure

In case the  link above is broken here are the steps:

  • Download the ListDLLs executable from sysinternals (http://technet.microsoft.com/en-us/sysinternals/bb896656.aspx)
  • Run it as administrator while some cygwin commands are running.
  • Scan the output for the cygwin process (identifiable by the command) and for DLLs in that process that do not look like cygwin DLLs (like an AV). Note the location of those libraries (there will usually only be the one). Pick an address space location lower than its starting address.
  • Quit all cygwin processes.
  • Run a windows command shell as administrator
  • cd in \cygwin\bin
  • Run “ash /usr/bin/rebaseall -b <base address>” (This command can also take a “-v” flag if you want to see the DLL layout.)

Basically what was happening to me was a DLL (from Nvidia in my case) was occupying the same address space (0x6EBB0000) that cygintl-8.dll was trying to remap to.  So rebasing to different address space that did not conflict fixed the problem.

Search Bing from Chrome (and vice-versa)

March 5, 2012

Google Chrome is a great browser but has one minor fault, it’s hard/inconvenient to use other search engines.  I regularly search for items using the default search in engine in Chrome (i.e., Google) but when I come to a search dead-end I usually end up using Bing.  Currently to do this you have to open a new tab, go to Bing.com, and cut-paste the search term.  Ugh, please save me some time!  So, I created a handy little Chrome extension that adds a little yellow ‘S+’ button.  Clicking this button while searching in Google automatically opens a new tab and searches for the same item in Bing.  Likewise, if you are Bing and hit this button it opens a new tab and searches Chrome.  Pretty simple.

If you want to try for yourself, here is the code, the install instructions are in the Readme file contained in the zip.

https://skydrive.live.com/embed?cid=A8737C712A19E0F2&resid=A8737C712A19E0F2%211100&authkey=AN4K-lbIIfDfPzM

Cygwin bad PATH on Lenovo T420s with NVIDIA Optimus

January 16, 2012

OK just to help out other people because I spent a bunch of time trying to figure out this problem…

I got a new Lenovo T420s and loaded up all my dev tools including Cygwin… But when I run Cygwin the PATH environment variable is wrong and shows: /usr/local/bin:/usr/bin:/cygdrive/c/Windows/System32/NV:. So what happened to all the other paths from windows that should have been brought over from windows PATH env var?

Well, after much investigating it turns out old NVIDIA drivers are screwing up the path. I previously had drivers from April 2011 and updated to newer drivers and the PATH is now correct!!! It makes sense since the DLLs in the NV directory are from NVIDIA. I’m guessing this all has to the auto-magic that NVIDIA is doing to switch between Intel and NVIDIA graphics (i.e., Optimus).

BTW, I got the driver updates from Lenovo’s website.