Entries from February 1, 2009 - March 1, 2009

Monday
Feb092009

SharePoint – Name ActiveX Control error.

image

 

This error pops up on SharePoint MOSS publishing websites that are in the Internet security zone for IE browsers.

This is because the core.js file wants to use ActiveX control “name.dll”, this ActiveX control is responsible for the presence information for SharePoint.

In the Internet security zone, IE pops this question to the user to ask them whether they want the ActiveX to run.

In development

For developers, if you have accidentally clicked “Yes Allow it to run”, then you won’t see this error and it can hinder your debugging of your public SharePoint site.

This is a RegEdit fix to get rid of this key to see name.dlll ActiveX warning in IE again.

HKCU\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{E18FEC31-2EA1-49A2-A7A6-902DC0D1FF05}

I have been told that some server machines doesn’t seem to have this key.

UPDATE try: HKCU\Software\Microsoft\Windows\CurrentVersion\Ext\Stats\{E18FEC31-2EA1-49A2-A7A6-902DC0D1FF05}

Fix


  1. MS has a KB article that shows you a broken way of fixing this.  It doesn’t work.
  2. We’ve found two other ways that are slightly better, one way is to override the JavaScript function that calls this – you have to be careful of the timing of which events are called first.
  3. The other way is to implement a HTTP output module to strip the reference to core.js from the output stream.  This can only be done safely for anonymous users, as core.js contains required JavaScript that is necessary for content editing.
Monday
Feb092009

Javascript - jQuery + ASP.NET – post-AJAX events

From jQuery, we get $(document).ready which is wonderful.
From ASP.NET, we get the UpdatePanel control which is fantastic.

 

One of the common problems that people have is regarding how to re-run the scripts after the UpdatePanel ajax update.

Here is one javascript-based solution – I consider these less intrusive than the code-behind solution with ClientScript.

Disclaimer – I learn this from previous projects I’ve worked on with personal experimentation – but I have not since read much documentation.

 

Original:

$(document).ready( function() {
$("a.link").css("border", "1px solid red");
})


The improved:

function setupLinkBorder( parentElement ) {
$("a.link", parentElement).css("border", "1px solid red");
}
$(document).ready( function() {
if (Sys &&
Sys.WebForms &&
Sys.WebForms.PageRequestManager &&
Sys.WebForms.PageRequestManager.getInstance()) {

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function(src,args){
setupLinkBorder(args.get_panelsCreated()); // when UpdatePanel are first loaded
setupLinkBorder(args.get_panelsUpdated()); // when UpdatePanel are loaded via AJAX
});
}
})



  1. Split out the actual script into a separate function
  2. Make sure you have a Sys.WebForms.PageRequestManager.getInstance() object – the code for this part was a bit scary.
  3. Add event handler to handle pageloaded event fired by ASP.NET (which occurs for UpdatePanel update as well)
  4. Rely on the parent element property of jQuery to limit jQuery selector to elements within the updated panel only.  This ensures you don’t fire the jQuery code on elements that are outside of the UpdatePanel – which can be bad.
Friday
Feb062009

re: Dell Newsletter

After reading yet another Dell monthly newsletter, I decided to reply to it.  I figure it’s rant-worthy.

Hi Mr Dell,

When I purchased my laptop, I was after a couple of spare 9-cell battery for longer battery life, and I was told it was out of stock, which is fair enough – these things go out of stock from time to time.

I specifically left instructions that when they are in stock, I would like to be notified.

Because I _really_ want them.

It has since been 6 months, and I find it hard to believe that they are still out of stock.

I think it’s good customer relationship management to:

1. give me an update on what's going on

2. you may need to fix your CRM software, because I think these are simple instructions that should have been followed up on at least every 3 months - especially since the customer is already telling you he wants to spend the money

3. you should already know which laptop model that I bought from you, and that which I've specifically told the sales girl to put down a note that I want the better batteries for this laptop.

jliu