This is a view template rendering html. When running it, it caused the page to freeze (i.e. the page keeps loading).
<h3>Services</h3>
<% for (var ix=0; ix < view.services.length; ++i) { %>
<% var service = view.services[ix]; %>
<p> <%=service.name %> </p>
<% } %>
Took me a while to grasp it. I tried various things, thought that the templating-engine code was bad, blamed every line of code in the application, until I actually re-read the template code carefully
You see, the indexer is “ix” while the ++ is working on “i”.
Since it is Javascript, no “I do not know what i is” exception was thrown. Instead, the first time it was encountered, JS decided it equals zero, and then the poor thing just kept increasing, probably until it would have overflowed.
In case you have missed it, it was javascript. Not AspView, nor Jsp. I am using a new, super-simple javascript base templating engine, for places where embedding something like AspView would be an overkill, and using NVelocity would be as annoying as using NVelocity.
I hope to have it released as open source soon. Basically it is a simple transformer into simple JS code, and I’m using the supercool Jint libraryfor running it within .NET. I am also planning on making it available for Java at some point using Mozilla Rhino
take:
The end result is:
I’m going to take care of that now.
Imagine you have something weird going on in an application.
Something is not behaving they way it should be, yet no exception is being thrown.
Then drilling down you find this piece of magic:
try
{
DoSomething();
}
catch (Exception exception)
{
exception.ToString();
}
Regarding my last post on the matter, Justin has commented with:
Javascript debugging has been around since VS2003.It’s not the most obvious or straight forward as in VS2008, but it’s pretty easy.The “Script explorer” window in VS2005 lets you see all the files downloaded for a certain browser process Visual Studio is currently attached to. From those files you can set a break point. So yes, it wasn’t easy, but it isn’t ground breaking either.
Josh took it one step further mentioning Visual InterDev.
I consider myself a rather sophisticated user, especially when it comes to IDE of any kind.
However, I did not use Javascript Debugging in VS2005 and VS2003, for the simple reason that it was not easy enough, and did not give me enough knowledge of the runtime vars etc. while using it.
When I started .NET-ing, I’ve had no VisualStudio license, and no idea about SharpDevelop. So I used notepad + csc.exe + WinDbg.exe . It’s workable, but it sucks. Just like JS debugging in VS.
Since javascript runs in the client, on the generated markup files, and not on the server’s templates (aspx, whatever), it’s not as useful as FireBug’s ability to set a breakpoint on a proper client html file.
Now, quoting from ScottGu’s post:
f you add/remove/update the breakpoint locations in the running HTML document, VS 2008 is also now smart enough to perform the reverse mapping and update the breakpoint in the original .aspx or .master source file on the server. This makes it much easier to get into a nice edit/debug/edit/debug flow as you are iterating on your applications
As I said - my main reason to move to VS2008 is it’s multi-target support, and js intellisense. Sure, I can get js intellisense with a lot of cool non-MS tools, but I want to have a single IDE window per solution.
The easier js debugging IS ground breaking for me, as it seams that I’ll be able to use it for debugging js in IE, a thing I’m not currently doing with VS since I don’t like it so much.
In a lecture I’ve recently gave in our company, I’ve discussed aboutthe differences between Debug and Release builds, and ways to change the standard VS.NET configurations to better suit our build needs.
I’ll post the important stuff hereduring the next few days, including some links, diagrams and other things that will make the things as clearer as can be.
Please visit here again in the next days to see the post, and comment me for any mistakes I may have, or any other suggestions in that area.
Crash all the bugs (was that your auntie?)