Cranial Apocalypse
Lutz Roeder Saved my Mind

 Last night

Last night a coder saved my mind... Lutz Roeder, author of the awesome Reflector, saved me from certain insanity.  Here is how:

Yesterday I had my first really frightening experience with SourceSafe.  I can hear the cries already, "But it's not safe!"  However, I have been using it for years without serious or obviously inevitable incident, mostly because it's always been what my employers have provided, as have many other people.  For easily recoverable, small source trees where versioning is not critical, and nearly everyone has a current working copy, I don't think it is the Agent of Armageddon some would call it, but that's where I stop.  It's when things go a little awry, when something out of the ordinary occurs, that SourceSafe comes into its own as a truly destructive force.

When I work alone on small projects, I use a separate, small SourceSafe database, for change tracking and backup, rather than as a serious source code control tool.  Just as well.  Like this, I can easily chalk up ten to fifteen check-ins during the course of a day, just for a quick roll-back facility if a refractor doesn't work, or I encounter a regression.

Last week on Thursday I began a serious revision of an application I have developed and maintained over the last four months.  It's a small application, comprising essentially a class library, and a trivial UI for testing the library.  I have one class that controls export tasks in the application, using discrete methods in another worker class to actually perform the export tasks.  For every change to the control class, there would normally be about four or five changes to the worker class.  So, after a busy weekend of furious coding, religiously checking in my project after every change and good build, I noticed a little head icon on the worker class in Visual Studio's Solution Explorer.  It seems that could mean a head rolling, mine or anyone else who is eaten up and crapped out alive by SourceSafe.

I had been checking in and out, typing and being prompted to check out checked in files, for four days.  My control class version history shows thirteen changes since Thursday, 26 July, so my worker class probably underwent at least thirty, if not forty, changes in the same period.  I will never be able to give you an accurate number, because the version history for that class in SourceSafe ends on 11 July.

Here is where I admit fault, in that I have never known SourceSafe to do bad things autonomously, although tales of mysteriously corrupted databases are not hard to come by.  SourceSafe finally noticed something was up, and complained about checking out the worker class file.  It said something about it being checked out by another user, so I opened up the SourceSafe application, as integration with Visual Studio can be a little problematic at times, and saw the file was checked out by myself.  Nobody else has used the SourceSafe database since March, and as I had so many small, incremental check-ins, I suspected no real issue when I tried to check the file in, and SourceSafe complained again.  I decided to cancel the check-out and, if necessary, redo the last ten or so minutes work.  I had checked in before testing, and made only minor adjustments after testing.

Imagine my horror when I opened the class in Visual Studio and noticed code I had removed at the beginning of last week.  And it wasn't code I had put in at the beginning of last week, it was code from months ago!  I quickly viewed the history of the file, hoping to get the previous version, and found the previous version, the last check-in, was on 11 July.  I thought maybe SourceSafe had been referencing a file in another SourceSafe database, so I check each one I had ever accessed, with no sign of my file!

With my heart on the floor under my chair, at 10PM on Sunday night, I began resigning myself to redoing the all changes I had made since 11 July.  Then I realized I could maybe disassemble the assembly for the project and salvage some of the code, but I wasn't very hopeful, as I haven't released since last month, and the only up to date assembly I had was in my bin\debug folder, and it may have been overwritten with a compilation of the old worker class.  Reason prevailed, and I realized the project would not have compiled without error in that case, and my assembly would still be OK.

 I whipped out Lutz Roeder's Reflector and disassembled the worker class.  What an absolute life saver!  Almost everything was replicated exactly as it had been when it was compiled into the assembly, except for missing namespace qualifiers.  I use a third party SDK, and all the fully qualified type names from the SDK were reduced to only the class name, which required some tweaking as some identical class names appear in two or three SDK namespaces, but context these names appeared in, and compiler errors helped me sort that quite quickly.  I quickly did away with about fifty initial compiler errors, with lots of search and replace and copy and paste, and I was back in business. 

I posted a quick rant about the experience on CodeProject, and quickly drew quite a few sympathetic replies, the majority of which convinced me to get as far away from SourceSafe as quickly as possible.   My thread even made it into CodeProject's Insider newsletter for today.  Here are some of the responses:

 
"Yup. Surely, one of the great mysteries of the Universe is whether or not Reflector's greatness is matched by VSS's suckage." - Shog9, creator of the phenomenal CPhog GreaseMonkey script for CodeProject forums.

"I will never, ever, use SourceSafe." - Marc Clifton, CodeProject MVP and author of 115 articles.

"This is why we stopped using SourceSafe. Personally I consider the product too dangerous to use. I'm astounded it's so crappy.   -   Microsoft: You have billions and billions of dollars. Buy a company that has a decent source control product." - Chris Maunder, a co-founder of and the man who wrote CodeProject.

 

Acer Extortion

 My laptop screen broke on Tuesday night. Acer have just told me they don't sell spares over the counter, thereby forcing me to pay their only service centre to fit a new screen, and forcing me to accept their unacceptable waiting time of five to seven days. I am a software developer, and my laptop is my livelihood, so being without it for up to seven days could result in significant loss of income. Acer can rest assured that this extortion is not only publicised on this web site, but everywhere I can, to warn other unsuspecting consumers away from the the trap they may fall into by purchasing an Acer.

I'm going schizo.

As I mentioned yesterday, I have taken a blog on mydigitallife.com.  I am going to split my blogging now, and do my social commentary and general opinion peddling over there, while focusing more on my more technical experiences and thoughts over here on this blog.  I though I name change was a nice way of observing the shift.

 Apocalypse dosn't mean a catastrophic end, but a revelation:

apocalypse:

c.1384, "revelation, disclosure," from Church L. apocalypsis "revelation," from Gk. apokalyptein "uncover," from apo- "from" (see apo-) + kalyptein "to cover, conceal" (see Calypso). The Christian end-of-the-world story is part of the revelation in John of Patmos' book "Apokalypsis" (a title rendered into Eng. as "Apocalypse" c.1230 and "Revelations" by Wyclif c.1380).

Online Etymology Dictionary. Douglas Harper, Historian. 20 Jun. 2007. <Dictionary.com http://dictionary.reference.com/browse/apocalypse>.
 

My alter ego

I have another blog, on the new commercial/social networking site myDigitalLife.  I went against convention and may possibly be seen in a bad light, and I made my maiden posting there one for financial help for a fellow developer.  This morning, Rex summoned all his courage and made a plea for help on the CodeProject community site, where he has been a well known and respected member for years, under the nick code-frog.  He asked fellow community members to check out his web site,   ,where he makes an impassioned plea for help as a last resort.  He was inspired by the Million Dollar Home page, and if that can work, I sincerely hope Rex can be helped.  Please check out the threads in The Lounge on CodeProject to observe people vouching for and helping this man, they also know and respect him from his contribution to the development community.

TashiTagg.com, The Sun on the Web.

This SA lifestyle site purports to entertain, and it's hostess, Tashi Tagg, certainly does.  She wants advertising for Grand-Pa headache powders banned, because they're addictive, she says in her fashionably sensationalist article GrandPa Advertising Must Be Banned!

"It was all very horrible and exactly as a drug addict is - and it's very much because of GrandPas. There's just something about them that's different from Panado or Disprin or Myprodols etc, and once I stopped taking them I didn't feel the need to take anything else."

Yeah Tashi, and there is cocaine in Coca Cola, and LSD in your corn flakes.  Have you warned Elvis about Grand-Pa?

I've just had my second cup of coffee, and it too is giving me a nice rush of energy.  Should Tashi ask Kobus Wiese to stop selling coffee?

Too Much Sunshine

A recent post in The Lounge on CodeProject had quite a number of us maybe slightly puzzled, but nonetheless quite amused.  A linked site yields a letter written to an Arkansas newspaper, in which a concerned reader suspects that the early start of Daylight Saving Time, due to a "plot by a liberal Congress", is the cause of unusually warm conditions in Arkansas for March, because of the extra hours of sunlight.

I visit to Snopes reveals that the the letter was written tongue in cheek, but the intentions of the author are secondary to what really is funny, and that is the response to the letter by other esteemed readers of the newspaper.  The full texts are available on snopes, but I present what matters:

"There is no more daylight than usual, regardless of the time."

"Nature and weather are, of course, unrelated to our choice of how we divide the day."

"In March, we had the exact same number of hours of daylight as we do every March. While Congress has the power to change many laws, it cannot change the laws of nature. All the members did was change the time on our clocks. They did not actually add any hours of daylight."

"Anyone with even a basic understanding of reality knows that the number of hours of daylight we have on any given day isn't altered by simply resetting a clock."

"What I am confused about is, no matter whether our clocks are set forward one hour or back one hour, don't we continue to have the same amount of daylight hours every day?"

  What I find amusing is how the readers that responded deemed it necessary to explain why the first letter was wrong.  Do they genuinely consider themselves the intellectual guardians of Arkansas on the grounds that they understand the relationship between the Earth and the Sun?  Is this the moment they have been waiting for to shine, to rise up and be counted among Thinkers?

Axe Airlines - New Kid on the Block
I saw the new Axe advert n TV last.  They have stunning babes pampering the all male passengers to their hearts content.  My whole point with this post is, I wonder how many cranial voids are going to email me asking for ticket prices.
TDD Presented
This morning I presented an overview and example of Test Driven Development to my office peers.  I had very little, if any time to prepare, so I completely ad-libbed it and used a Development Driven Presentation TM approach with a simple Person class with only one property. 

I started with a brief summary of the concept, and using NUnit and TestDriven.NET I proceeded to use tests to drive the development of my sample class.  I tested the constructor and property get using comparison asserts, then tested property validation by expecting an exception.  I added a data service class with a tested SavePerson method, and added a Save method to Person to call the service.  I tested this using NMock to fake the data service and expect a SavePerson call.

Some questions arose from our discussion during and after the session:

1.       I identified a need to increase knowledge on programming with interfaces.

2.       We all have concerns about adopting TDD ‘mid-cycle' on a large and complex solution.  I suggested only testing changes and new code, and realised some sort of discrimination would be required between code Before Tests and code After Tests, possibly aided by a coverage analyser.

3.       One of us raised the issue of automating repetitive tests, e.g. for high numbers of property methods on business entities.

4.       Another expressed a lack of confidence in the principle of only testing public types and members.  He felt it would be risky not to test all classes.

5.       We use Nettiers and Codesmith to generate our DAL and business entity classes.  It looks possible to also generate tests for these, but this is outside the ambit of TDD as the code generation is driven by a trusted third party application.  Customisations of generated classes can however be test driven, and the generated tests may provide a helpful starting point.

6.       TDD for our UI presents a huge challenge.  It is a very complex, AJAX enabled, ASP.NET front end.  Automating it is not feasible at the moment, unless someone knows of a shiny secret that is cheaper than buying a house .

 
In all, I was impressed by the energy presenting this subject generated in me.  Despite being dead tired, enough to fumble into some really gruesome copy and paste or typing errors, I could have gone on for hours.  Two hours is very short for an ad-lib session.  It was small audience, and while some were maybe a little intimidated by some complexities, everyone is now keenly interested and recognises the value of adopting the TDD approach.

Grandma Rules
In a very Norman Batesish move, Alex Papadimoulis has renamed his popular daily web offering from The Daily What the ***, or http://thedailywtf.com/ to Worse Than Failure.  Amongst reasons for doing so he cites his Grandmother. 
Cross Platform Widgets

In my last instalment of my Mac Diaries I described my first experiences with developing cross platform between the Apple Mac and the PC, and in ending I mentioned the CocoaSharp, the Mono initiative which promises to make many of the nice native Mac OS X widgets accessible to .NET developers.  I said I would consider implementing a dedicated Mac GUI with this platform if I can't achieve a satisfactory user experience through standard Windows Forms on Mono.

I have spent two days trying to find out a bit more about CocoaSharp, and have decided that it is definitely not a library I will be using in a production project anytime soon.  Despite encountering several mentions of the Mono team adopting it in preference to Gtk# for the Mac side of things, this project is not receiving yet enough attention to be credible.  I also looked at MonoDevelop during this time, but to say that the build and install process on the Mac is not for the feint hearted is a gross understatement!

What I gathered to be the official web site is empty, except for a very short project description, and two links.  One of the links refers back to the main Mono site and offers some relief to those unfortunate enough to first follow the other link to the CocoaSharp Wiki.  This wiki is atrocious, and not just for lack of content.  It is badly organised, offers confusing and duplicated topical links, and has several broken links.  Although the team appeals for contributions in the home paragraph, I don't think enough people even are aware of the project, never mind willing to volunteer for documentation contributions.

The only real contribution I can see on the wiki is that of Tim Davis, who offered a few meaningful tutorials and examples.  This man was kind enough to leave a contact email address, and respond to my queries about anomalous differences between my current installation of CocoaSharp and the content on the wiki.  He has also been kind enough to mail me more current example projects that no longer exhibit these anomalies.  I will be posting his updated examples here soon, but if anyone would like I could mail them to you.

During a long Google session I discovered the world of wxWidgets though its .NET port, wx.NET.  The wxWidgets library is a popular cross platform GUI toolkit that can be used on most operating systems, in C++, Python, Perl, or C#.  One of the differences between this and other cross-platform toolkits is that at the implementation level, it uses the native controls of each specific platform to achieve a look and feel familiar to users.

wx.NET is a C# wrapper for the main wxWidgets library, and although active development on this project has ceased, the last version includes a Perl script to generate C# wrappers by parsing the wxWidgets C++ header files.  It also includes the TowxNET tool, for converting wxGlade or XRC files to C# or even VB.NET.   Very good UI designer support for the toolkit is available through the wxDevC++ IDE, which although requiring some C++ coding from people like me who aren't very used to it, provides a solid design and coding experience.

However, I still have one major challenge to continuing this port, and that is to include a fancy WYSIWYG HTML editor on several forms.  Every HTML editor I have found for MS Windows Forms uses some aspect of the Internet Explorer COM component, and I simply haven't found any such editors for wxWidgets or Mono Windows Forms.  Although Mono has a WebBrowser project, which attempts to mimic the Windows version by using the Mozilla browser component, it looks stalled due to technical difficulties or lack of interest and no response is forthcoming from the project owner.

Getting to Know Mono
I have just run my first semi-functional C# application on a Mac, using the Mono framework.  Some time ago I was briefed to determine if we could port my client's existing Windows application to the Mac, and it has been an interesting introduction to this flavour of cross-platform development.  The application executes a database query and displays the results in a grid through data binding, and is compiled on my Windows XP machine using Visual Studio 2003, then simply copied over to the Mac and run using a simple command line.  Kudos to the Mono team for this impressive achievement.

Getting just this far has not, however, been all wine and roses, and there are still some issues for concern.  My first test application was a simple MDI style text editor designed to test certain aspects of.NET and in particular the Windows Forms libraries.  The simple MainMenu control didn't operate properly on the Mac, not dropping down the File menu to display its menu items.  This is not a show stopper, as the application I am supposed to port doesn't use this control, but there are a few other nigglies that might become usability issues later on.  Mono WinForms applications run under X11, and I think this may have something to do with why, on my application window, the little red close button is disabled, and the window resize handle at the bottom right is plain missing.  Reinstalling Mac OS X Tiger (10.4.2), X11, and Mono didn't solve these problems, but it did reveal a surprising defect in the Mac OS X install.  It wouldn't continue until I had provided basic user information, such as name, address etc. but this screen assumed I was in the US and presented a only list of US states from which to choose, and it insisted on a five digit zip code.  Do Apple know they have customers elsewhere in the world?

I also learned a bit about another cool interoperability initiative called CocoaSharp, which is a port of the native Apple GUI library, Cocoa, to Mono.  If I don't achieve much success using a standard WinForms GUI on the Mac, we will be looking at implementing a dedicated Mac GUI using CocoaSharp.  This library uses the same NIB files used by native Cocoa, which can be designed using proper Mac GUI widgets, in the XCode Interface Builder, resulting in a more genuine Mac OS experience for our users.  The big drawback here is having to play ping-pong with code and NIB files, coding on PC's and building UI's on the Mac.  There is a Mono development IDE available, called MonoDevelop, so I could always move to coding on the Mac, but I'm hoping that if I have to do this, I can find something that will allow me to build Cocoa NIB files on my PC.

Mango Republic

The launch of new airline Mango has generated quite a bit of news recently.  Most of this has covered the dismal performance of their internet site and call centre.  Jumping in selling tickets at as low as R200 for a Jo’burg to Cape Town flight and not expecting high volumes of site hits and telephone calls can hardly be considered  very competent  management.  Nonetheless, I will definitely be trying them out, and hope they can offer a wholly better deal, if not just price, than their rivals in ineptness, kulula.kak, who also had a mention in the same article this morning.

Gidon Novick, chief executive of kulula, considers reasonable prices for local flights a ‘treat’.  He says, “Forgive me if I brag but we introduced low fare air travel into this country over 5 years ago and in that time have doubled the size of the market, have treated over 5 million fans to low fares.”[1]  After reading this, and experiencing the puerile drivel spewed forth by kulula cabin crews in their horribly misguided attempts to entertain , I am convinced that this airline regards their customers as little children that should be grateful for their ‘treats’.

Office 2007 First Impressions

MS Office 2007 B2TR only has three colour themes, and the first one I tried was Black.  I’m very partial to black in aesthetics, and the default Blue was just way too blue.  I may have been preoccupied by several re-installs, but I entertain the notion that before the Technical Refresh I only had these two options; Silver wasn’t there when I looked.

My initial impression of, “Oooh, this looks schweet!’ was nipped short by an uncouth interruption by Outlook.  This suddenly, after an almost protracted skirmish with the incumbent  Outlook 2003, gave up the machine and, with the aid of JohnEdwardsUILib, presented a message box proclaiming only “MAPI32.DLL”. 

How fondly I remember those early moments.  At some point the new Outlook bled to death and its Response and Options faculties were spilled on the ground.  Even Google could not council, as only I was Chosen.  A quick survey of multitudes of Beta users worldwide played a key role in reinforcing my assertion and I was indeed alone.

Many searches and practical decision reinforcements delivered me to a Microsoft Knowledge Base article about problems with Terminal Server and Outlook 2007, which has nothing in the world to do with my problem except the funniest thing happened on the way another re-install;  I followed the instructions to enter a new product key, and It was good.  And It was even activated.

I have yet to identify anything new in Office 2007 truly of value, but I think these guys have done some homework on the UI if not the install.  My first opinions of Office 2007 are good, and I will definitely be giving the suite another chance now that its settled in a bit.

10 Tips for Moving From Programmer to Entrepreneur
Have a look at this article by Ian Landsman.  It has a few good pointers for developing software for the market versus developing it for some entity.
Cool Mailing Lists

I've been subscribed to some of these lists before, and now after a break I am again, and I'm impressed with the overall levels of expertise and the esoteric nature of some of the problems discussed.  These 'forums' are guaranteed to be "Ignore this" free.

 I am currently subscribed to the following lists, which seem to cover .NET development quite well:

ADVANCED-DOTNET
DOTNET-CRL
DOTNET-CX
DOTNET-WINFORMS
DOTNET-WEB

Try them out.  The volumes are by no means excessive 

More Posts Next page »