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.

Scheduling for Makers

Here's a great essay by Paul Graham: Maker's Schedule, Manager's Schedule.

One of my favorite parts:
When you're operating on the maker's schedule, meetings are a disaster. A single meeting can blow a whole afternoon, by breaking it into two pieces each too small to do anything hard in. Plus you have to remember to go to the meeting. That's no problem for someone on the manager's schedule. There's always something coming on the next hour; the only question is what. But when someone on the maker's schedule has a meeting, they have to think about it.

For someone on the maker's schedule, having a meeting is like throwing an exception. It doesn't merely cause you to switch from one task to another; it changes the mode in which you work.
This shines a lot of light on some of the most frustrating parts of my previous job as a Business Systems Analyst. I was never happier than when I had a meeting-free day to work on my deliverables and help my developers with theirs. The problem was that I was also expected to attend a lot of planning, project management, and status meetings that shouldn't have been in my job description.

Meetings interrupt creative and analytical processes. They use time that would be more efficiently spent on solving problems. Sometimes they are a necessary evil, but often they are just plain evil.

I wish every manager and every scrum master would read Graham's essay, digest it, and internalize the lessons. It would make a world of difference to the people who work with and for them.

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.

Wednesday, March 5, 2014

Baby Steps

I am working on a pretty big C++ project to take XML, parse out certain fields in it, and then use it to populate various tables.
My first few efforts in writing this class were akin to giving a mouse a drink from a firehouse -- extremely frustrating, and not particularly enjoyable or profitable. It dampened my fur, to say the least.

But then I remembered some of the best programming advice I ever received, and that has helped things to go better.

When in doubt, remember Bob's method: baby steps. It'll make you feel much better.

Tuesday, March 4, 2014

The Pragmatic Programmer: Craftsmen and Cathedrals

I'm still only in the preface to Andrew Hunt's and David Thomas's The Pragmatic Programmer, but I can already tell it's going to be a favorite.

Hunt and Thomas have this to say about about the importance of craftsmanship in software development:
Think about the large cathedrals built in Europe during the Middle Ages. Each took thousands of person-years of effort, spread over many decades. Lessons learned were passed down to the next set of builders, who advanced the state of structural engineering with their accomplishments. But the carpenters, stonecutters, carvers, and glass workers were all craftspeople, interpreting the engineering requirements to produce a whole that transcended the purely mechanical side of their construction. It was their belief in their individual contributions that sustained the projects.
We who cut mere stones must always be envisioning cathedrals.

-Quarry Worker's Creed  
 (p. xx of The Pragmatic Programmer, Boston: Addison-Wesley, 2000 )
Good stuff -- makes me want to do more than just sling code that compiles. It's an excellent reminder that there is always room for beauty and elegance, even in the seemingly mundane.

Monday, February 3, 2014

Stuck? Review, Debug, Rebuild.

Just finished troubleshooting a very irritating bug.

In the process, I ran up against a couple of walls and got pretty frustrated. I ended up just setting it aside for awhile, since I was out of strategies to try. I think this was the best course of action for someone with my admittedly limited experience.

I asked a senior developer about it this morning, and he encouraged me to follow this flow in the future.



















I don't know if it was something funny about my IDE or just the standard n00b problem of missing some important steps, but my current build of the project was pretty screwy. This caused an error when my C++ app tried to execute a script in SQL Server. Cleaning and doing a full rebuild was just the ticket.

So, when I don't know what to do next, I'm adding "full rebuild" to the list of options.