 |
 User: Login | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Address URL | http://yuiblog.com/blog Registered: 26-Apr-2008 |
| Ads: | |
Send to email | Production JavaScript Debugging in Development | By Nicholas C. Zakas el 27-Jun-2008 | You know the scenario. A bug is filed for a JavaScript issue
in production. You update your development server to the same files (allegedly)
that are in production but you can’t reproduce the issue. Debugging your
JavaScript code is horrifically difficult, if not impossible, because you’re
following best practices and crunching the file using the YUI Compressor.
You start by typing the URL of the JavaScript into a browser to confirm that the file is there. It is, and in fact, is being loaded into the browser without issue. So something must have gone wrong during the deployment process, but you need to know what part of the code is failing. Firebug, your trusty companion for JavaScript debugging, is essentially useless as it has a hard time deciphering all of your code from a single line.
When I end up in this situation, I turn to a little-known but incredibly powerful tool from Microsoft called Fiddler. Fiddler is an HTTP debugging proxy that filters all the requests coming to your machine via HTTP. It interfaces directly with WinINET, the Microsoft Internet communications stack, so it automatically picks up any requests and responses by programs using this library. By simply starting Fiddler, it will automatically pick up HTTP traffic for Internet Explorer, Safari, and Opera. Firefox doesn’t use WinINET, so you need to manually set it up to go through Fiddler. You can do so by going to the Tools menu and clicking on Options. Go to the Network tab and click the Settings button. Select Manual Proxy Configuration and enter localhost as your server and 8888 as your port. Click OK to apply the settings.
Setting up Firefox's options in preparation for using Fiddler.: Paste this image in your site, Myspace, Facebook, Ebay copy this code...
Once that’s done, you’re ready to start debugging that production JavaScript. The key to debugging is really to create a readable version of the JavaScript so that Firebug (or any other JavaScript debugger) can be used to step through the code and set breakpoints as normal. To do so, download the file in production to your local machine. Use a pretty printing tool, such as Einars "elfz" Lielmanis’ online beautifier to create a more readable version of your code and save it to a local file. It’s important to follow this process instead of using your development version of the JavaScript to ensure that you’re using the exact same code that is on production; you can more easily rule out deployment issues this way.
The Fiddler Autoresponder tab.: Paste this image in your site, Myspace, Facebook, Ebay copy this code...
Next, click on Fiddler’s AutoResponder tab. The settings on this tab allow you to intercept requests and respond as if you were the server. It’s possible to respond with a status code or with actual content. To enable this feature, check the Enable automatic responses checkbox. The Permit passthrough for unmatched requests checkbox should be checked by default, which is necessary to avoid interfering with other requests. Click the Add button to create a new entry. The textbox on the left should contain either the complete URI for the JavaScript file you want to intercept, or you can create a regular expression by preceding your text with "regex". The second textbox is for the response that should be sent. Click the dropdown arrow and select Find a file. Select the pretty-printed JavaScript file from your computer and click the Save button. This places your filter in Fiddler’s memory so the next time a file matching the given URI or description is requested, it will respond by sending back the file on your computer.
After that, you can navigate back to the production server on which the problem exists knowing that your file will be inserted in place of the actual production file. The browser itself is none the wiser that the file has been swapped out, so you’re safely able to debug readable code without making any changes to the code on the server. This technique has helped me debug some of the more complex issues I’ve dealt with at Yahoo!, and I hope that it can help you as well.
Read 8 times

|
|
 |
 |
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Production JavaScript Debugging | You know the scenario. A bug is filed for a JavaScript issue
in production. You update your development server to the same files (allegedly)
that are in production but you can’t reproduce the issue. Debugging your
JavaScript code is horrifically difficult, if not impossible, because you’re
following best practices and crunching the file using the YUI Compressor.
You start [...] [..] Read complete article |  | Published 27-Jun-2008 by Nicholas C. Zakas in Development Read 8 times. More hits in  |
|
 | Nerdblog | Blogger | Provides news about hardware, software, notebooks, laptops, PCs, Mac, PDAs Nerdblog.Net |
| JavaScript 2's new direction
(InfoWorld) | | InfoWorld - Standardization efforts for the next version of JavaScript have taken a sharp turn this month, with some key changes in the Web scripting technology's direction. JavaScript creator Brendan Eich, CTO of Mozilla, has helped forge a consensus on how to proceed with the direction for JavaScript's improvements. “JavaScript was sitting still. It was [...] [..] Read complete article |  | Published 26-Aug-2008 by Nerdblog in General Read 1 times. More hits in  |
|
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Non-blocking JavaScript Downloads | About the Author: Stoyan Stefanov is a Yahoo! web developer working for the Exceptional Performance team and leading the development of the YSlow performance tool. He also an open-source contributor, conference speaker and technical writer: his latest book is called Object-Oriented JavaScript.
External JavaScript files block downloads and hurt your page performance, but there is an [...] [..] Read complete article |  | Published 22-Jul-2008 by Stoyan Stefanov in DevelopmentPerformance Read 3 times. More hits in  |
|
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Free Chapter from Douglas Crockford?s ?JavaScript: The Good Parts? | The #2 book on Amazon’s JavaScript shelf this morning is Douglas Crockford’s forthcoming Javascript: The Good Parts (currently available for preorder and due for release later this month). In this volume, Douglas articulates a philosophy of coding in JavaScript that builds up on and extends the content of his popular video series and articles. [...] [..] Read complete article |  | Published 05-May-2008 by Eric Miraglia in Development Read 6 times. More hits in  |
|
 | Kotaku`s The Gamers Guide | Blogger | XBOX 360 Gamers Weblog
Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred |
| E3 Gate Crasher: Ghetto Vader - Let Him In? [E308] | | Ghetto Vader here came all the way from The Bronx to crash E3 even though he doesn't have an invite. Should we let him in? Gawker Media polls require Javascript; if you're viewing this in an RSS reader, click through to view in your Javascript-enabled web browser. [..] Read complete article |  | Published 16-Jul-2008 by Noah R in e308 Cosplay E3 08 Gatecrasher Ghetto vader Project 420 Rap Read 3 times. More hits in ![Images about E3 Gate Crasher: Ghetto Vader - Let Him In? [E308]](./images/photo.gif) |
|
 | Kotaku`s The Gamers Guide | Blogger | XBOX 360 Gamers Weblog
Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred |
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Notoptimal Dev?s New YUI-Based Accordion Menu | Juan I. Leon at Notoptimal Dev went looking for the perfect Accordion Menu recently, but the search was not a success. The criteria:
be lightweight
use unobtrusive Javascript techniques (ie not have scattered Javascript all over the markup)
use simple CSS to make it look nice
needed to support both single and multiple sections opened at [...] [..] Read complete article |  | Published 07-Jun-2008 by Eric Miraglia in Development Read 6 times. More hits in  |
|
 | Kotaku`s The Gamers Guide | Blogger | XBOX 360 Gamers Weblog
Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred |
| id Software Begins Production on Doom 4 [Industry] | | We may not know if they're going to E3, never mind that the ESA says they're not, but at least we know something. Today id Software announced that they have begun production on Doom 4 and is looking to hire folks to help work on it.
?DOOM is part of the id Software DNA and demands th [..] Read complete article |  | Published 07-May-2008 by Brian Crecente in Doom 4Id SoftwareIndustryNews Read 4 times. More hits in ![Images about id Software Begins Production on Doom 4 [Industry]](./images/photo.gif) |
|
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Bookmarklet for the YUI Logger Control | Rajat Pandit has put together a bookmarklet for YUI Logger that allows you to pop open a logger console on-demand — a big convenience when you’re debugging. Check out Rajat’s blog and bookmarklet page for more on this project.
Keep in mind that the YUI Logger Control outputs messages logged via YAHOO.log; to see full [...] [..] Read complete article |  | Published 01-Jul-2008 by Eric Miraglia in Development Read 4 times. More hits in  |
|
 | Kotaku`s The Gamers Guide | Blogger | XBOX 360 Gamers Weblog
Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred |
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
 | Yahoo User Interface Blog | Blogger | Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries. |
| Global Domination, Part Two | | As I continue the practice of the craft of programming, I am always examining
my practices. Can I improve the patterns that I use so that I can make my
programs clearer, stronger, better? This is particularly important when working
with a language like JavaScript which has a bias that favors patterns that are
confusing, weak, and worse.
One of [...] [..] Read complete article |  | Published 16-Apr-2008 by Douglas Crockford in Developmentjavascript Read 4 times. More hits in  |
|
|
Warning We are not responsible of information posted from external feeds. Use this website at your own risk.
Notice: We will not be liable for any direct or indirect loss or damage arising under this disclaimer or in connection with our website, whether arising in tort, contract, or otherwise.
|
|
| |