Thursday, April 10, 2014

Need to View Files from your Chrome Cache? Here's a Solution!

Here's a great solution to a problem that I was about to solve the hard way. I was trying to retrieve some images (just the images) from a web page I had visited in Chrome.

(They were wrapped in a design that wouldn't allow just right-click, then save as. And, yes, I had a good reason for needing them... it's a long story regarding my church's flaky web provider.)

In Chrome, if you type "about:cache", it brings up a list of the files the browser has recently loaded. When you click on them, though, you see a large HTML file with a hexadecimal code in the body. This is true even for binary files like .jpg or .png.

Senseful Solutions has posted a great little tool for translating the hex back into pages (or, in my case, images): Viewing Chrome cache (the easy way).

This is what programming is all about: making people's lives easier by creating elegant solutions to everyday problems.

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.