|
7 August 2002 The programmer's lifeblood is reuseable code and the Copy/Paste function. Don't let anyone, anyone tell you differently. If someone asked me to put together a plain C Windows program right now, it would probably take me close to an hour just to create the basic Hello World dialog - and that's only if I have access to the help files. Given access to my previous projects, neatly archived on my system? About five minutes. I can write HTML without looking at old code, but I wouldn't be able to include a separate stylesheet or the doctype. So when I tackled this printer yesterday, I was leaning very heavily on the three sample programs that had come with it. One of them was useful only in showing me that most of the elaborate stuff in the other two was mostly unnecessary. One of them was very useful when it came to figuring out how the printer sent and received data, and I expect to go back to it when I'm ready to test it actually printing. The third... The third program was hideously complex - over 36 printed pages of code in 191 different subroutines. (And a lousy development environment, I might add. Better than plaintext, but not much.) However, the third program was the only one that involved talking to the RFID reader. Without much hope, I copied the RFID module and pasted it wholesale into my test project, and then I started looking for subroutines that weren't actually contained in that module. Astonishingly enough, there were only two. I found and copied those. I dorked with the project some more. I put it on the printer and ran it... It didn't work. When I'm debugging programs in Windows, there are two things I can use. The first is actually a debugger that comes with the development environment, which allows me to run the program one step at a time. At each step, I can stop the program and look at the values of all the variables currently hanging in memory. This is usually a very good way to figure out why things are breaking. The other is called a messagebox - just a little window that pops up with information. You've probably seen them - the little popups with the OK/Cancel buttons? That thing. I can make it say whatever I want. This is another good tool to use if I'm fairly certain I know where the error is. The printer's development kit does not have a debugger, and the printer does not have a messagebox function. It has an LCD readout: Two lines, sixteen characters per line. That's it. I had to write a simple messagebox routine and then try to confine my reporting messages to thirty-two characters. After almost two and a half hours of walking into code I didn't really understand (copied and pasted from the sample project as it was) I finally figured out the problem: That beautiful initialization routine that opens the connection between the printer and its RFID reader doesn't do me any good if I don't run it before I try to use the RFID reader. Oops. That was my day at work yesterday. After work, Matt and I went to the grocery store, and then we came home and I tried a new recipe for dinner. If you want to see my raving, go here. Dinner took a while to prepare, though. By the time I settled down after we'd eaten and got ready to do some writing, it was nearly 8:00. I was tired; I wanted to go to bed around 10:30. So I just wanted to get through to a reasonable stopping point. I wasn't even trying to finish the chapter. But I kept getting distracted. At 11, I thought about going upstairs to where the TV wouldn't distract me. But Antonio Banderas was going to be the guest on the Daily Show. He's kind of cute, so I stuck around to watch. I should have gone with my first impulse - he showed up with a full beard, looking scrawny and scruffy and not at all appealing. Alas. I rushed through the last five hundred words or so and got the file up to K.T. around midnight. In four hours, I only wrote 2700 words. And the last five hundred or so I'm afraid to go back and read, because I'm pretty sure they suck. Ah, well, at least I got something done. I love having interesting, challenging work to do at work, but it does cut into my writing time pretty hard. |
Last Year: - It's astonishingly boring. Not to mention mildly frustrating.
Word of the Day: parlay (v) - 1: to bet in a parlay 2 a: to exploit successfully; b: to increase or otherwise transform into something of much greater value Song of the Day: What'cha Gonna Do by Cowboy Mouth Currently Playing: - Neopets Current Projects: - Hall stuff - my blog |