Regrettably, WordPress just wasn’t cutting it, and so I made the difficult decision to move ship to Blogger. My new home on the web is www.toastedcode.com. Yeah I know – if I had set up a domain a long time ago I wouldn’t have had to make this service announcement.
I’m still working on Code Toaster and will create an updated site at a later date with links to download files, documentation, and so forth. For now, check www.toastedcode.com for the latest information.
I hope you’ll follow me to my new home, but if not, it’s been swell!
I looked carefully at the unit test VS.Net 2008 had just generated. Looked standard enough, except… what was this? A class named CodeFragment_Accessor?
PrivateObject param0 = null;
CodeFragment_Accessor target = new
int expected = 0;
target.TextLength = expected;
actual = target.TextLength;
Assert.Inconclusive(“Verify the correctness of this test method.”);
Hold on now! That wasn’t one of my classes – I’d never seen it before, although I did in fact have a class called CodeFragment. I right-clicked and selected Go To Definition from the popup menu.
The class looked familiar somehow. On closer inspection, it appeared to be a copy of my CodeFragment class, except that in this _Accessor version, all the fields I had declared private were declared public. Hmmm.
I cracked open the MSDN documentation and ran a search for the ShadowingAttribute. MSDN displayed the helpful hint: Do not use this class.
Really. That’s what it said. Do not use this class. Lighten up Microsoft, I wasn’t going to use it, I just wanted to know what it’s for! Sheesh. And that’s pretty much all the documentation it looked like I was going to get on the infamous ShadowingAttribute.
But moving right along – the _Accessor class inherits from a class called BaseShadow. Maybe that would provide some clues.
And I was right – MSDN reports that BaseShadow
is used by the publicize method to help you test private types.
Well now, that makes a whole lot more sense, and is actually pretty snazzy too. Although, to be honest, I’m not sure what publicize method they’re referring to. I mean, I see what they’re getting at, but that seems like odd language. Did they mean there’s a class somewhere that has a method named publicize, which uses the BaseShadow class in some way, or does this refer, in a general sense, to the process of publicizing a test? Or something.
Anyway, VS.Net’s unit test framework apparently uses some fancywork (using reflection) to ensure complete code coverage (instead of generating tests for only public fields, properties, and methods). You’re not going to get much help from Google doing a search for ShadowingAttribute, but take it from me that you can (and should) safely use the generated _Accessor class to unit test both public and private accessors in your class. And this is another great reason why you should let VS.Net stub out your unit tests for you instead of building them from scratch yourself – hand coding the “shadow wrapper” would take a while.
Yes, I’m still working on Code Toaster in my spare time. Given several bug reports from the last release involving the COM-based parsing toolkit, ProGrammar, from Norken Technologies, along with the fact that development seems to be inactive right now (read: they stole my money), I decided to yank out all ProGrammar dependent code and replace it with pure .Net parsing stuffs.
And that’s working very well. In fact, I think it’s working better than I expected, perhaps because, this time around, I’m using much better development practices. Like Test Driven Development. In retrospect, it was extremely foolish of me to ever approach a large coding project like this without reams of automated tests – I’ll talk about that later in this post. But first, a little about how the parser(s) work…
Parsing a template is comprised of three steps.
Each step increases in complexity by many-folds. I’ve completed the Template Parser, which was enjoyably challenging but not ridiculously difficult. It’s currently parsing a 1,000+ line template in about 80 milliseconds, which should be fast enough, I think. I’ve done some performance tuning, but may revisit it later to try to speed things up even more. As you’re editing a template, any changes (like variable declarations, new types, etc) need to be available immediately within IntelliSense, which means the backend parser and IntelliSense engine must be lightning fast.
And reliable, which is why I’ve spent a good deal of time fleshing out a suite of unit tests. VS.Net 2008’s new unit testing functionality is just a beautiful thing. It’s actually beyond beautiful. If a test fails, I can easily run just that test (VS.Net is smart enough to figure out what test to run by looking at where my cursor is in the test class), step into the code, and inspect and fix the problem using the stupendous Edit & Continue feature. Yeah, you could do almost the same thing with NUnit, but the process is so much more streamlined now, and just plain easy.
I think I’m on the right track. Getting rid of ProGrammar means there’s no cross-appdomain performance penalties, no COM headaches (like registering and unregistering COM dlls, and all the headaches that could entail, during installation), and most of all, I can tailor the parser architecture to meet the rather specific needs of Code Toaster.
So your next question is probably: what about that C# parser? How long is that bad boy going to take to write from scratch?
And the answer is: not long at all. But that’s a story for another post.
A few security researchers have recently turned their attention from hacking RFID chips to pacemakers and implantable defibrillators.
Apparently a hacker could cause some serious cardiac damage, wirelessly, from less than 5 feet away. For now, the threat appears to be “largely theoretical”, whatever that means. At the least, the idea of someone being able to stop a heart, via remote control, would make for a great novel or movie plotline.
But for those 250,000 folks sporting a pacemaker under their skin, it might be time to start thinking about making suspicious visitors and money hungry, unscrupulous, relatives check their laptops and other wireless devices at the door.
So now, apparently, you can configure an SLI system with three (or more!!!) video cards instead of two.
Is it just me, or is this starting to resemble the razor blade shootout between Gillette, Schick, et al?
From TweakTown’s review:
“It’s clear that NVIDIA has really got its dual GPU SLI technology sorted out, but when you start mixing it up with three or four GPUs the performance increase while present, is very small, especially in relation to what it costs you to go down that route.”
Psychologically, though, I can’t help feeling that, if I had the funds, of course three video cards must be better than two! And most definitely one!
Ain’t that just silly?
You may have noticed this blog has been mostly inactive for a while. A long while. That’s mostly ’cause I haven’t been feeling too good lately. I think I’ve caught every cold and flu bug that’s gone around this season, and along with 1 year old twins taking up a lot of my time, staying up late to work on Code Toaster or blog a bit has been the last thing on my mind.
I’m trying to get back into the rhythm of working on Code Toaster a few hours each night; updates should be forthcoming. Bear with me while I get things rolling again.
Every so often, especially if you work in IT, rather than a fancy-schamncy development shop or somesuch, you’ll be tasked to do something mind-numbingly boring, like editing a 10 year old Word macro. Or writing CRUD code by hand. Or writing (the horror!) documentation.
In which case it can become a little difficult to stay focused. For a little help in that area, try out this Yahoo widget: Ten Plus Two (you’ll of course need the Yahoo widget engine installed).
Ten Plus Two is basically a timer than counts down for 10 minutes (or more, or less, if 10 minutes isn’t your cup of tea) of work, and then counts down for 2 minutes of rest before repeating the process. Work for 10 minutes, breathe for 2 minutes. Your two minutes can be a trip to the bathroom, a quick blog post, or just staring off into space while your eyes rest. Each change is accompanied by a nice little audio cue as well as color indicators – the background turns red when you’re supposed to be working, and green when you can take a break.
Granted, this could possibly get aggravating after a while, but it works wonders for keeping me on track while slogging through monotonous work items when I would much rather be browsing TechMeme or reading the latest from Coding Horror.