Skip to main content


Showing posts from 2008

Anoying XSLT Error

Had a nasty error in using an XSLT today. I was attempting to perform a transform but before I got that far, I kept getting an error, specifically when trying to set the stylesheet property of the xsl template object.
dimxslt,xmltemplsetxslt=Server.CreateObject("Msxml2.FreeThreadedDOMDocument")xslt.async=falsexslt.loadServer.MapPath("my.xsl")setxmltempl=Server.CreateObject("Msxml2.XSLTemplate")setxmltempl.stylesheet=xslt The error I kept getting was "The system cannot locate the object specified" and I kept getting it right at the last line. I would then use my debugger to browse the xslt object and see that all the xml for that stylesheet was loading just fine as expected. I was very confused and spent a considerable amount of time trying to fix it.
Thankfully a colleague had a suggestion and to make a potentially long story short, the issue was that the xslt I was trying to import was trying to include a file that didn't exist. Unfortun…

More Closure Fun!

So earlier today I got some more experience with closures. I had a loop that triggered multiple asynchronous server requests and I needed to keep track of the loop counter with respect to the iteration in which the request was made.
for(vari=0;i<4;i++){window.setTimeout(function(){alert(i);},0);} The code above will alert the number 4 a total of 4 times. I thought I could be tricky. Maybe, if I set it equal to a different variable that gets declared with 'var' in each iteration, that var will create a new variable in memory and the closure will close over each one respectively.
for(vari=0;i<4;i++){varcur=i;window.setTimeout(function(){alert(cur);},0);} No dice. This code will alert the number 3 a total of 4 times. The JS engine apparently doesn't close around a particular state but just keeps track of the variables in the parent functions. Whatever they are when the function gets called, that's what you'll get.
So, what's a programmer to do? Create a…

Introducing Google Turing?

I watched the very beginning of a show on the Discovery channel that was talking about artificial intelligence in computers. They talked about software that can learn and hardware that should be able to power it in a few decades. Even though I'm not an expert at AI, I started thinking about how one could truly write a program that could learn, after all, that's the only way a system could really develop good AI right? For some reason, Google Translate popped into my head. Now the interesting thing with this application is that instead of just writing tons of code with all kinds of fancy algorithms, they took a somewhat simpler and even better approach. They instead used a massive bank of documents that were written identically in various languages and did some fancy work there to see how languages relate to one another (link). Brilliant! Then I thought, "well if only they could get a massive data bank of human conversations, they might be able to put together an ap…