If there's something that I detest while working on my computer is having to switch between mouse and keyboard. Depending on what I'm doing, I'll typically have a keyboard-centric or mouse-centric approach.
For example, coding is very much a keyboard-centric approach, and I very much dislike having to use the mouse for anything.
Browsing, on the other hand, is largely a mouse-centric thing I do. I still haven't found anything that allows me to navigate links with the keyboard as effectively as I can with the mouse.
Being a mouse-centric experience, all that I can do to keep using the mouse just makes things better. If you haven't checked out Mouse Gestures for Internet Explorer, that's a pretty nifty add-on. I haven't had problems with it so far,
Enjoy!
Of course these opinions are mine and are not meant to represent those of my employer.
Yesterday the availability announcement went up on the team blog, so why wait? Get yourself some updated bits and start data binding, blob'ing, paging, projecting, and counting entities, all from within the comfort of your programming chair!
If you haven't already, now is a great time to subscribe to the feed on the team blog. New content to help you make the most of the update will be posted regularly now that the release is out.
Enjoy!
In case you're like me and you're anxiously hoping that your Christmas orders arrive in time, here's a quick tip.
To find the tracking page for your package, just enter the tracking number in the Bing search page and hit Enter. That should bring up the link to the Fedex tracking page.
Alternatively, if you're using Bing as the default search engine in your browser, you can just press Ctrl+E to put the focus on the search box, paste the tracking number and hit Enter - voila!
As I understand it, this also works with other services like UPS, but I haven't tried those myself yet.
Enjoy!
Just a gentle reminder to readers, that different languages will capture outer variable with their own nuances, and sometimes these will make a difference.
So, for example, C# will capture only what's needed in the inner function. See this post from Bill Wagner for a great discussion on the topic. Raymond Chen also covers this here.
One gotcha found in C# and VB.Net, for example, is that there is a single closure per scope, so if you have multiple functions capturing variables, they will all get the same scope.
ECMAScript also has some gotchas. In particular, just declaring the inner function is enough for all variables in scope to be captured, regardless of whether they are ever used.
You can try it right now in your address bar (yes, another silly trick).
javascript:(function(b){var a=1;var f=function(){alert(eval("a+b"));};f();})(2)
Here is the formatted version of the code:
(function(b) {
var a=1;
var f=function() {
alert(eval("a+b"));
};
f();
}
)(2)
Running this will product a messagebox displaying '3'. So here we have a function that doesn't actually reference any variables directly, but they are still in scope because 'eval' can find them. Yes, parameters are included as well - they are function variables for all practical purposes.
If you had other locals in the function, for example a large array, that wouldn't be collected until the inner function was out of scope for the program, and you'd have to remove the reference 'by hand' by setting it to null for example.
Enjoy!
If the error HTTP 403.9 may comes up when making multiple requests to an ADO.NET Data Service, the first thing to check is the operating system the server is running on. Windows XP and other client operating systems have a limit on the number of simultaneous connections that are supported.
The KB Error Message: HTTP 403.9 - Access Forbidden: Too many users are connected describes this situation in terms of Windows 2000 Professional, but this applies to other client systems as well.
Enjoy!
More location bar silliness, this time showing you all the members defined on the window object. This will probably wrap quite badly, so I'm colorizing it a bit for readability, but it will allow you to just copy and paste.
javascript:(function(){for (var i in window) { document.body.appendChild(document.createTextNode(i)); document.body.appendChild(document.createElement("BR"));} })()
This comes in handy if you're looking for global variables defined and constructors (unless you're using IE, in which case these exist but do not necessarily enumerated - blessing or curse, pick your favorite). The list is interesting to see and can sometimes be used to figure out whether your browser has some specific capability you're interested in, like localStorage or captureEvents.
Enjoy!
If you're visually oriented, you need to check out this video, with escalation engineer Tess Fernandez showing off some very nifty debugging features, including the ability to work with managed-code dump files and the "thread aggregating" stack views. See the whole thing, or jump to ~2:10 to get the dump, ~3:20 to open the dump, ~6:40 to view the parallel callstacks.
For more on the parallel stacks view, this video is your friend.
Enjoy!
The ASP.NET AJAX library is one very cool, performant work of engineering that has smoothed the programming experience for web developers, and now they're taking it to the next level.
Dino Esposito writes about Live Data Binding in ASP.NET AJAX 4.0, and shows how some of the cool tricks are pulled off to get things like two-way data binding. Definitely worth reading.
Funnily enough, he references the mechanism introduced by IE4 to do data binding, and yet even today that's one of the top hits for "html data binding" on popular search engines. It's good to see improvement in the space, and kudos to the ASP.NET AJAX folks for giving us a good cross-browser solution.
Enjoy!
If you build web sites and applications, you owe it to yourself to check out the resources at http://www.microsoft.com/web/ and to subscribe to the feed of the team blog to keep up to date with tools and capabilities. No reason to pass up on free software or to avoid leveraging the software you already have.
Enjoy!
So, you know how you can go to your browser's location bar and type a bit of JScript code to have it execute? Go ahead, try it now, just type this and hit Enter:
javascript:alert('hi there')
This evaluates a bit of code, but you can also use this evaluation to create an anonymous function and execute it.
javascript:(function(){var i,s=""; for (var i in document.images) s += i + ":" + document.images[i].src + "\r\n"; alert(s)})()
Note that you have to surround the function in parens (highlighted in blue in the original), otherwise it looks like a top-level function declaration and then the invocation after that doesn't make sense, so nothing happens.
Personally, I just type this bit by bit, just to make sure everything lines up.
javascript:
javascript:()()
javascript:(function)()
javascript:(function(){})()
javascript:(function(){alert("do something here");})()
Of course there are better options if you're going to be doing anything that you don't want to lose just by tab'bing away and back (I imagine the browser thinks you never finished typing your new destination and shows you the real URL for the page you're seeing). Just go ahead and press F12 to bring up the Developer Tools window in IE8, go to the Scripts tab and type away on the right-hand side part of the window. That gives you multiline, history of commands, and the result of evaluation - a much nicer story.
Enjoy!
When loading / compiling an XSLT document into an XslCompiledTransform instance, we've seen some customers hit an interesting gotcha.
In this case, a particular stylesheet had grown over time, through a series of, erm, clipboard operations, to about a 300KB file with a single template. Rather than factoring out common processing, we found it was repeated. While the functionality was correct, it took many minutes and a large amount of memory to compile. Why? Because a template translates (roughly) to a generated .NET method, which in this case turned out to be over 500KB in IL (normally a method will turn out to have less than 1KB). Clearly this is not a common case scenario, and the JIT was designed for a different point, but a mechanical translation can end up producing these kinds of problems.
So, remember - factoring is good for you, your platform, and your future program maintainers! Which probably includes you as well :)
Enjoy!
The fix to requests for XHTML DTD files from the W3C Web server has been recently released. Windows Update should offer the fix automatically, but you can download and install the fix manually from the following links for various MSXML versions:
http://support.microsoft.com/?kbid=973688 [MSXML4 SP2... if you haven't tried SP3 yet see below]
http://support.microsoft.com/?kbid=973685 [MSXML4 SP3]
http://support.microsoft.com/?kbid=973686 [MSXML6 Out-Of-Band, for XP SP2 and Win2K3]
http://support.microsoft.com/?kbid=973687 [MSXML3 and MSXML6 for all OSes where these components are in-band]
What exactly is this about? Well, there are a number of cases where this can happen, but one common scenario that we've seen people run into when writing AJAX web pages is to request a page of information from the server, load it into an XML document and extract some information or merge it into the existing page.
The problem with this approach is that when you load the document into an MSXML document "by hand" (ie, not through responseXML on the XHR object), DTD processing is enabled, and the DOCTYPE declaration directs MSXML to go look up the XHTML DTD so you can use entities like .
Multiply this by each web browser accessing a popular site, and you can imagine why no-one is happy with this situation: web sites break when the resource is not available, the W3C servers get overloaded, and users of web sites lose functionality with odd scripting errors.
The fix caches the XHTML DTDs in MSXML - these resources haven't changed for years and will likely end up in different URLs if something new comes along. So now clients save at least one round-trip (possibly more) and always get the DTD support they need.
Try running this bit of script in a .js file to see the awesomeness in action.
function pullXHtml() {
var xml = new ActiveXObject("Msxml2.DOMDocument.3.0");
xml.async = false;
xml.loadXML(
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" +
"<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'><head><title>simple document</title></head>" +
"<body><p>a simple paragraph</p></body></html>");
if (xml.parseError.errorCode != 0) {
var myErr = xml.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
WScript.echo("Yay!");
WScript.echo(xml.xml);
}
}
pullXHtml();
If you don't have the update, you might get an error such as the following.
You have error The server did not understand the request, or the request was invalid.
Error processing resource 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'.
If you do have the update, you'll see the parsed XML. Run this with Fiddler open and you'll "see" the absence of network activity.
Enjoy!
... when the amount of spam you get on your blog stops bothering you. Hopefully the new winter look will get me inspired to write some more.
Happy Thanksgiving - best wishes whether you celebrate it or not!
Fabian Winternitz is one of our awesome tools developers, and you can see some of his work in this post. That's a Visual Studio extension that will display searchable diagrams for the model exposed by any service endpoint that exposes OData metadata. Which these days includes a lot of software.
Personally, I think it's great to see on one hand the level of support for the ecosystem, and on the other hand the balance of power, expressiveness and simplicity that OData provides. Back when everything started in the early days of Project "Astoria", I don't think anyone had any idea as to how broad a spectrum of software components would play in this space, but it looks like sticking to simplicity and proven standards paid off.
Enjoy!
Over at the team blog, you can find this post about ADO.NET Data Services changing its name to WCF Data Services in the .NET Framework 4 time frame. This is goodness by every account - over time, this just means a more integrated experience when developing for these stacks, with less seams and caveats.
Enjoy! - in anticipation if nothing else :)