Monthly Archives: February 2012

Unable to activate Windows Tailored application error

Attempting to build a simple JavaScript application using Visual Studio 11 on the Windows 8 Developer Preview today and received the fun error “Unable to activate Windows Tailored application”.  I’m running the software using Virtualbox (4.1.8).  Turns out that my screen resolution wasn’t high enough in the virtual machine.  It needs to be at least 1024×768 and I had left it at the Virtualbox default of 800×600.  Changing the screen resolution and then attempting to run the program again succeeded.

Apache2/PHP Crash – Yikes

I was working on a patched Debian system recently using PHP functions feof and fread.  I went to run my test script and managed to auger Apache in while at the same time dumping over 1GB worth of errors into the Apache error log in a matter of minutes.  Over and over (over 5,000,000 entries, actually), with these errors:

[Wed Dec 07 11:17:00 2011] [error] [client xx.xx.xx.xx] PHP Warning:  feof() expects parameter 1 to be resource, boolean given in /web/public_html/newsite/testfeed.php on line 5
[Wed Dec 07 11:17:00 2011] [error] [client xx.xx.xx.xx] PHP Warning:  fread() expects parameter 1 to be resource, boolean given in /web/public_html/newsite/testfeed.php on line 6

I ended up having to stop apache and restart it but it’s a scary denial of service in a few lines of PHP code.  It took about 2 minutes and 23 seconds to produce over 5,000,000 errors in the error log for this script.

 

 

Windows 8 Promise Object and JavaScript

One of the best features that I’ve found so far (and I have many more yet to find) are promises.  When building Metro-style apps using JavaScript, the framework utilizes asynchronous requests through xhr.   Within that paradigm, there’s a promise object which essentially says that there will be data there sometime in the future (thus the async request).  The promise object has a method called then, which accepts three arguments, a success function, error function, and a progress function.  This makes the promise object, or the then method, tailored to what we do everyday with AJAX requests:  Send a request, give progress and do something with the results (error or success).

Pseudocode:

WinJS.xhr(“http://example.com/webservice”).then(successFunction, errorFunction, progressFunction);