Using jQuery 1.8.1 for Windows 8 Javascript Metro App

If you use jQuery for Windows 8 Javascript Metro App, you may encounter the following error when you run the app:

“HTML1701: Unable to add dynamic content ‘ a’ A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe.”

To avoid this error, you need to edit the offending .js file (e.g. jquery-1.8.1.js).  In other words, you don’t use the minified version.  Also, you cannot use the online CDN version, you must include the jquery-xxxxx.js in your project.

The key is to wrap around the offending lines of code with “MSApp.execUnsafeLocalFunction”.  For example,

MSApp.execUnsafeLocalFunction(function () {
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
});

or you can even wrap around the whole function.  For example,

jQuery.support = MSApp.execUnsafeLocalFunction(function() {

var support,
all,
a,
select,
opt,
input,
fragment,
eventName,
i,
isSupported,
clickFn,
div = document.createElement("div");

// blah blah blah

return support;
});

Reference Article

A Splash Screen using Adobe Edge Animate

Here is how to use Adobe Edge Animate as a splash screen for PhoneGap.

1. assign a id to one of the div

<div data-role="content" id="indexhomeContent">

 

2. In your pageinit/page ready handler, hide that div initially.

// hide the index home content to display the animation
$('#indexhomeContent').hide();
 
3. In your edge action file (e.g. *_edgeActions.js), add the following actions/triggers.  A mouse click will delete the animation stage div.  If the animation completes, it will also delete the stage div.  Then it will show the content div.

Symbol.bindElementAction(compId, symbolName, "${_stage}", "click", function(sym, e) {
// insert code for mouse click here

sym.deleteSymbol();

// show the initially hidden indexhomecontent
$('#indexhomeContent').show('slow');

});
//Edge binding end

Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 7856, function(sym, e) {
// insert code for mouse click here

// delete the stage
sym.deleteSymbol("${_stage}");

// show the initially hidden indexhomecontent
$('#indexhomeContent').show('slow');
});
//Edge binding end

Integrate Adobe Edge Animate with PhoneGap

If your jquery plugins no longer worker after adding edge js files, then it is probably due to the fact that edge js will load “jquery-1.7.1.min.js”. 

So if you load “jquery-1.7.2.js” and then your jquery plugin and then edge*.js, then jquery is basically reloaded with 1.7.1.

You can edit “*_edgePreload.js” and comment out the following line in for aLoader array.

{ load: “edge_includes/jquery-1.7.1.min.js”},

Plesk Error: PleskMainDBException

No one likes to see an error like the following when running the Plesk Panel:

ERROR: PleskMainDBException
No connection could be made because the target machine actively refused it.

0: common_func.php3:619
reconnect()
1: common_func.php3:582
db_connect()
2: auth.php3:14

It is basically a message indicating that Plesk cannot connect to MySQL. 

  1. Confirm both services (MySql Server and Plesk SQL Server) are running.
  2. Check Windows firewall rules
  3. Verify that the file \Plesk\MySQL\Data\my.ini is using the correct SQL port: 8306.

Web API on IIS 7.5 — 405 Method Not Allowed for PUT

PUT http://xxx.com/api/v1/loans/xxx/

I am getting a 405 Method Not Allowed error from my local IIS 7.5.  It works if running under VSDS.

When I use Fiddler Composer to send the request, I am getting error 405 and useful information back from IIS 7.5.

The key is to set up “Failed Request Tracking Rules”.  Here is how.

When I view the “FailedReqLogFiles”’s xml log in a browser, I can see the culprit, WebDAVModule:

image

So I uninstalled the Windows feature:

image

and now I can PUT.