Showing posts with label efficiency. Show all posts
Showing posts with label efficiency. Show all posts

Tuesday, April 1, 2014

XML Formatting in Edit Plus

I was thinking of writing a macro to help me format XML in Edit Plus. Fortunately, someone else already came up with a better solution 5 years ago.

In case this link ever dies, here's the code he used:
var stdin  = WScript.StdIn; var stdout = WScript.StdOut; var xml = WScript.createObject("MSXML2.DomDocument"); xml.loadXML(stdin.ReadAll().replace(/\t/g, '').replace(/\r|\n/g, '').replace(/\>\</g, '>\n<')); stdout.Write(xml.xml.substr(0, xml.xml.length-2));
This is why I love the internet.

Thursday, March 27, 2014

I Love DeBugger

I'm not sure how I ever got along without using my compiler's debugger. It's SO much nicer to see the call stack and step through my code rather just making wild guesses about what might be wrong.

I am reminded of Winston Smith's epiphany at the end of 1984 (though, I hope, without the sinister overtones). With apologies to George Orwell:
O cruel, needless misunderstanding! O stubborn, self-willed exile from the loving breast! Two gin-scented tears trickled down the sides of his nose. But it was all right, everything was all right, the struggle was finished. He had won the victory over himself. He loved DeBugger.