All You Wanna Do Is Jaw-Jaw

(in which we apply our face, at speed, to the brick wall of Enterprise IT Development Methodologies)

I am, for my sins, embroiled in a Project with our IT people. I assume that some Holy Standards Manual1 somewhere must decree that in order to transition from stage 0.7.4.1.a to stage 0.7.4.1.b2 there is a requirement to develop and publish a “Communication Plan”, such a document having also assaulted my inbox this week. That’s an eight-slide Powerpoint presentation, adorned with pithy quotes and charmingly apposite images. More Powerpointedness than I’ve personally produced in my life, for content that could adequately be summarised in a four-sentence email. Three, if you worked at it. Something like this:

  1. There will be a weekly meetings: on Thursdays at 1400 to review status and issues. (There are a couple more, but they don’t have general applicability so let’s not bother everybody with those).
  2. Everybody should talk to each other as often as necesary to ensure that lack of information does not hold up progress (I’m paraphrasing wildly here, attempting to extract some sense from two ludicrously complicated diagrams)
  3. Documents will be stored on the Sharepoint server that everybody already uses.
  4. Communication will be in English except where everyone involved speaks German and no non-German speaker will need to read/listen.

There. I did it in four without even trying that hard. Took about five minutes. No pictures though. Sorry about that.


1 With no apparent irony, a document received this week declares that the Project is “following a strict Waterfall approach.”
2 The stages may be more fine-grained than that – I don’t know and I don’t want to know.

Ghosts in the Machines

in which we consider the death of Social Networking? How Seasonal…

The world is Socially Networked these days, or at least a seriously chunky proportion of the interwebular world is. I’ll admit to being present (to a greater, or more likely lesser extent) on Facebook, Friends Reunited, Twitter, LiveJournal and to having at least registered on a good few others.

Beyond those, there are places like WordPress, Stackoverflow (and sundry other StackExchange sites), Blogger, Opera, Google, Yahoo! etc etc ad nauseam. You’re reading this so it’s likely that you’re aware of most, if not all of this stuff.

As well as grumpy, I’m also old. Well, by the dictionary I appear to be in the first blush of middle-age, but when you reach the stage in life when all your relatives from the previous generation have died and your peers are starting to shuffle off this mortal coil then you’re at least beginning to be aware – uncomfortably so – of mortality.

So right now I’m all over the Internet. But in fifty years it’s statistically almost certain that I won’t be actively contributing any more.

People die.

More pertinently to my musings here, people on Facebook die. Of the ten countries with the highest estimated Facebook populations, assuming their age distributions are similar to the general population (obviously not, but stay with me) and that mortality rates as per the 2009 CIA World Factbook can be applied, then we get this:

Country FB Pop (m) Deaths/K FB deaths
USA 145.3 8.38 1,217,614
Indonesia 31.4 6.26 196,564
UK 28.8 10.02 288,576
Turkey 23.8 6.10 145,180
France 20.3 8.56 173,768
Philippines 18.8 5.10 95,880
Mexico 17.8 4.80 85,440
Italy 17.6 10.72 188,672
Canada 17.4 7.74 134,676
India 16.5 6.23 102,795
TOTAL 2,629,165

..or about 2.6 million Facebook users dying each year. Obviously the estimate may be a little low, there are only ten countries represented for one thing. What are you going to do when all your friends are dead?

Add in the all the other sites and we’re looking at a small-to-medium sized country-worth of “ghost” accounts, persisting – and inviting interaction, even.

I’m not offering any solutions – heck, I’m not even suggesting that this is even a Bad Thing – perhaps it’s as close to life after death as we’ll ever get. I just keep extrapolating to some inflection point where half the content on the Internet was written by people who are now dead.

So if I stop posting here, is it because I’m bored, out of things to write about or something more … terminal? And if the latter, how will you know?

Restoring Normal Tab Service in Firefox 3.6

(stackoverflow rep: 9948, Project Euler 93/281 complete)

(in which we address something fairly trivial)

Firefox 3.6 introduced a change where by default opening a link in a new tab places the tab immediately after the current one. Which seriously messed up my workflow.

Tab background courtesy of FF's new "persona" skinning thingummybob. Not sure how I feel about that, either.

I have a bunch of links (Google Reader, Hacker News – or rather Giles Bowkett’s rather spiffy Hacker Newspaper, reddit, stuff like that) from which I open any interesting links, to be consumed with my breakfast while my brain gets into second gear. Maybe it’s just me and my inability to move with the times, but I like my tabs sorted in the order in which I opened them, thank you very much.

This (http://support.mozilla.com/en-US/forum/1/602853#threadId602882) is where I found the fix.

For the idle of click, this is what it says:

Type about:config into the URL/location bar and press the Enter key.
Click through any warning (i.e., promise to be careful)
Copy and paste the following into the Filter box:

browser.tabs.insertRelatedAfterCurrent

Double-click the line listing that preference to change the value to false.
Restart Firefox (File > Restart Firefox)

And that’s it. Seems to work. Which is nice.

A Little I18n “Fun” in Excel

(stackoverflow rep: 9595, Project Euler 91/277 complete)

I work in the London offices of a multinational banking corporation, with the majority of my colleagues located in Germany. Unsurprisingly, most of these colleagues use the German language version of Excel, which is almost transparently compatible with the English version we have here.
One little edge case cropped up this morning, however: date formatting strings in TEXT() functions. Where I would write =TEXT(A1, "DD/MM/YYYY") one of my German colleagues would have =TEXT(A1, "TT.MM.JJJJ") for Tags and Jahres. Excel doesn’t translate this – and I don’t see how it could, at least, not automatically.

After a little thought, we cooked up the code below, presented here (a) in case it might be useful and (b) because I’m curious to know if anyone has a better way to do it:

Option Explicit
' assume for now that there is only one date format used in TEXT() functions
Private Const ENGLISH As String = """dd/mm/yyyy"""
Private Const GERMAN As String = """TT.MM.JJJJ"""

Private Sub Workbook_Open()
 If ThisIsGermanExcel Then
  SwitchDateFormats ENGLISH, GERMAN
 Else
  SwitchDateFormats GERMAN, ENGLISH
 End If
End Sub

Private Function ThisIsGermanExcel() As Boolean
Dim dt As Date
On Error GoTo Catch
 ' do we know if there's a "correct" way to identify the language version?
 ' English Excel doesn't like this, I'm told German Excel does...
 dt = DateValue("23.02.2010")
 ThisIsGermanExcel = True
Finally:
 On Error GoTo 0
 Exit Function
Catch:
 ThisIsGermanExcel = False
 Resume Finally
End Function

Private Sub SwitchDateFormats(ByVal fromFmt As String, ByVal toFmt As String)
Dim sht As Worksheet
Dim cel As Range
 For Each sht In ThisWorkbook.Worksheets
  For Each cel In sht.UsedRange
   ' lots of ways this may need to be more careful...
   cel.Formula = Replace(cel.Formula, fromFmt, toFmt)
  Next
 Next
End Sub

So what do people think? Anyone? Anyone?

Fifty Candles (each)

(stackoverflow rep: 4675, Project Euler 72/240 complete)

The first programming language I learned was a peculiar version of BASIC, running on the ICL mainframe installed during my abbreviated university career. I seem to recall it used a magnetic drum as its primary storage device. My second programming language, and the first I was ever paid real money for working with, was COBOL. It was the lingua franca of business computing, had been around forever and I started to learn it early in 1979. It turns out that “ancient” old COBOL had at the time only been around for about 20 years. As indeed had I, and this year we both turn 50.

Ah, the fun we had!

Ah, the fun we had!

When the only tool you have is a hammer, everything looks like a nail. (I remember vividly a school “handyman”, inexplicably nicknamed “Sausage”, who would repair desks by applying a large hammer to drive screws). I used COBOL for things to which it really wasn’t suited. For a couple of years, that didn’t just mean writing peculiar code, it meant punching cards on an IBM 029 punch machine.

Programming for work was done on paper coding sheets, converted into machine-readable format (80-column punched cards) two evenings a week by Hazel the Punch Girl. Times change.

Once upon a time all code was written on these

Once upon a time all code was written on these

It wasn’t as bad as you might think: we only got to compile or run our code twice a day anyway, the rest of the time involved pencils and paper. Lots of paper. Some things change less than others.

Anyway, designing, coding, compiling and testing/debugging a program was a mammoth task: it took months. Lots of months. I think in the three years I was a programmer in my first job I wrote about eight complete programs.

Virgin input to the 029...

Virgin input to the 029...

In all, I was primarily a COBOL programmer for about 12 years, although there were secondary activities in PL/1, Fortran and C in the same period. I haven’t written a line since some time in early 1990. Can’t say that I miss it, not even now that it has object-orientation, a scary concept for a language that didn’t even use to have data scoping below “global”.

So happy birthday to COBOL, whenever it falls during the year. I can’t say I miss you but you paid the bills for over a decade, and for that I’ll always be grateful.

Lazing On A Sunny Afternoon

(stackoverflow rep: 2906, Project Euler 59/230 complete)

Below (lightly edited) is a recent answer to a question on StackOverflow. The question is pretty much a waste of time, but what an answer!

Laziness is indeed the first of the Three Programming Virtues, but it is misunderstood. Programming Perl defines it well:

* LAZINESS: The quality that makes you go to great effort to reduce overall energy expenditure.

Good programming calls for laziness, but laziness requires hard work. Good programmers must constantly think of and implement new ways to be lazy. The first compiler had to be written in assembly, and the first assembler had to be written in machine language. Wonderfully lazy, but hard. You don’t get to call it a day after an hour just because what used to take a day takes an hour.

That’s about as close to an encapsulation of my personal programming philosophy as I’ve ever seen. The virtue of Laziness is closely related, if not identical to the DRY (Don’t Repeat Yourself) Principle as espoused by the Pragmatic Programmers in The Pragmatic Programmer.

(I just found myself wondering if there’s a way to refactor that last sentence to remove some of the duplication)

Laziness - all I have to do is this...

Laziness - all I have to do is this...

The idea behind xlUnit (which has been languishing somewhat since being codeplexed in, good grief, September) was to minimise the amount of manual repetition involved in testing Excel/VBA code as it is developed. As a useful side-effect, it also made TDD (Test-Driven Design, or Development, depending on your choice of definition) possible. A fair amount of the code complexity of the framework is involved in eliminating repetitive manual tasks such as test class creation.

There are only three significant UI-level entry points in xlUnit as it stands: application creation (used rarely, only about once per app) class creation, used rather more often, and test execution, which is used all the time. Oh, and there’s a little “Options” dialog, but it only has one setting and that’s not really very interesting so we’ll gloss over that.

Since the first two things are used relatively infrequently, I tucked them away on a menu, whereas the test execution, which is an all-the-time thing, gets a toolbar button. I could have been fancier with that, but I never got past the simple text “Run Tests”, which had the extra benefit of giving a larger target area for the mouse.

...and I get this for free.

...and I get this for free.

There is no interface within the VBE, which is most definitely a shortcoming. To be honest, I only even tried briefly (failing, obviously) to get it to work: with a dual screen setup, which my working environment has had for the best part of a decade, both workbook and VBA are usually visible, so I can get to the “Run” button easily enough. For a similar reason, there is no built-in keyboard shortcut at present. Of course, in Excel 2007, it’s all a bit of a mess. I have the (massive) RibbonX book, by the way, I just need the intestinal fortitude to sit down and read it.

The “Create Testable Application” and “Create Testable Class” routines both live in the add-in itself and are located within UserAccessibleEntryPoints.bas. I’ll come back to “Run Tests” another time – not only was it a bit tricky but I have some new ideas that would make it even trickier.

Choosing to create an application causes a throwaway instance of the xlUnitCodeBuilder class to create a workbook and its tester and create references from the tester to both the application (so it can call classes there) and the framework (so it can use the framework). The same class contains the code to create new classes. I think I put the functions together because they’re about building code but I don’t think I’ve achieved very good separation of concerns here: there’s workbook creation and test class creation and they would probably be better off being separated. Since there’s work to do with Excel 2007 anyway, I think I’ll refactor that bit next time it’s open.

I mentioned “throwaway instance” above without explanation: it’s a way I describe this VB pattern:

    With New UsefulClassThatDoesntReallyNeedToBeDimmed
        .DoSomethingProfound
        .DoSomethingSimilarlyDeep "AndMeaningful"
    End With

Is there a more “standard” way to describe this? Something using “anonymous” perhaps? Anyway, I use it a lot (and I’m now fervently hoping that no-one points out some awful risk that I’m running as a consequence) as it’s a way to get part of the economy of class (“static” methods in Java or C#, where the word means something rather different than in VBA) method.

Dropping the (logic) bomb

My son Johnny (7) was asked a while back (by some feebly unimaginative adult) what he wanted to be when he grows up. “A normal person” was the reply. Fair enough. Not sufficiently deterred by that, the same adult persisted, enquiring what he’d like to do for a job. “What Dad does” was the reply. Good lad.

Actually, Johnny might well be very suitable – he may be borderline Asperger’s, which hasn’t exactly proved a millstone around the neck of a certain Mr William Henry Gates III (OK, no formal diagnosis on that one). More to the point, my little boy has a powerful intuitive grasp of logic already, as the following example should demonstrate.

Assume for a moment that you’re seven years old again, it’s almost time to leave for school and your shoes are nowhere to be found, not an entirely uncommon occurrence in the Grumpy household, if I’m honest. You have utterly no idea whatsoever where they are. Not a clue. They were presumably on your feet some time yesterday, but you can’t really be held responsible for what happened after you took them off, can you?

When presented with a theme park rollercoaster

When presented with a theme park rollercoaster...

Then your mother asks “Don’t you know where your shoes are?”

Pop quiz, Hotshot.

What do you do?

If you answer “Yes”, I’d say you’re showing some real signs of aptitude for programming. Mum, of course is going to be be nonplussed. For all her other sterling and wonderful qualities she’s always going to be the kind of person who centres text in Word through the heavy-handed application of the spacebar.

I’d assert that the answer has to be “yes”. After all, reversing the question to “Do you know where your shoes are?” has to receive the opposite answer. Were we to make the question more explicit, perhaps something like “Is it true that you don’t know where your shoes are?” then the answer is again obvious.

...a small boy has surprisingly little problem finding his shoes.

...a small boy has surprisingly little problem finding his shoes.

I’ve always struggled with these questions myself, having learned that people usually (but not always) expect the “wrong” answer. That brings in the necessity of attempting to work out which answer they’ll interpret as the one I want to give, which makes my head hurt. So I tend to provide the logically correct answer and then qualify it, which gets me an old-fashioned look but ensures that I’m less frequently misunderstood. “Yes, I don’t know where my shoes are”.

Spoken language is trickier, than most of us realise. It’s a reason why taking refuge in the rather less ambiguous world of code is often so comforting.

Note that I am substantially older than seven, have several pairs of shoes and know where most of them are most of the time.

Back And Blue

(stackoverflow reputation: 1984)

they understood

OK/Cancel: they understood

While waiting for my eleven o’clock Starbucks this morning (and by the way could someone please tell them it’s not bloody Christmas yet?) I was idly watching two young fellows Macbooking away from the “comfort” of their armchairs. They were hunched over the screen as they did whatever Mac users do and I couldn’t help thinking about how horribly incorrect their postures were from a workstation health-check point of view. I’m a little sensitive to such matters at present, probably due to the prolapsed disc in my lower spine.

At the office I use two 19″ 1280×1024 monitors, each sitting on two packs of paper (on my 4″ elevated desktop) to raise their tops to my eye-level. That gets me to something approximating a “healthy” set-up for my height (6′ 3″, or 190cm). At home, I’m crouching over my laptop like those Mac-boys and despite having almost as much screen real-estate (1600×1050) I can’t concentrate for very long, so I end up leaning back and reading blog posts instead of innovating (you may call it something else).

Mine is like this (only black)

Mine is like this (only dark blue)

I also finally got around to complaining about my office chair, with the result that, after a suitable bureaucratic wait, a rather spiffy new one was delivered, in which I’ve been enjoying correctly-located lumbar support all week, for the first time in years. The difference is, quite frankly, marked.

This matters, because I’m seeking to spend one or two days a week next year working from home, so I think I’m going to need to invest in some serious new desktop hardware. Something with three screens would be nice. A serious new desk needs to be considered, too.

For sitting, I had been planning on a Herman Miller Aero, but I’m now wondering I should be budgeting rather more for one of these instead.

If it’s Thursday…

(stackoverflow reputation: 1423)

One of my activities on a Thursday is to charge my nifty little MP3 player and load it up with the week’s batch of commute-time podcast listening material.

Beyond Excel, I’m interested in most things within the Agile programming camp, Ruby (on and off Rails), a little bit of .Net here and there and well, computer stuff.

I don’t (won’t) have an iPod or use iTunes, so I have to download stuff as it turns up in Google Reader. Not a huge imposition.

These are what tends to get listened to regularly:

Rails Envy: Weekly, about 15 minutes long and mostly about Rails and Ruby, it’s also funny enough to be worth listening to if you don’t have any interest in the technology. Maybe. “We ain’t got no rspec” (#38) is destined to become a great Ruby catch-phrase. If a programming language can have catch-phrases and in-jokes, that is.

Stackoverflow: Weekly, about an hour, this is usually a rambling conversation between Joel “on Software” Spolsky and Jeff “Coding Horror” Atwood. Up to #25 now (linked) and the most recent included Steve Yegge of Google, who is usually worth attention. I’d say the podcast is starting to find its feet of late as the proponents become more comfortable with the medium.

FLOSS Weekly: Regular hour or so interviews with various open-source luminaries. I don’t listen to them all, but I’ve enjoyed the ones with the original author of Audacity, Simon Phipps of Sun, Ward Cunningham (father of Wikis) and D. RIchard Hipp (SQLite) among others.

Rubyology: You’d think after 71 podcasts, the guy in charge would have sorted out the frequently dodgy audio levels, but apparently not. If you can stand the ropey sound, there’s a reasonably high standard  of Ruby-related content.

Herding Code: Four guys talking about programming topics with some bias towards Microsoft platforms, sometimes with a guest or two. Not the first one I dial up, if I’m honest, but it ticks along nicely in the background.

Not me, I get on at Cannon Street

Not me, I get on at Cannon Street

Fighting Talk: Nothing about computers that I’ve noticed, just a funny sports-oriented panel show from BBC radio, that I tend to miss when broadcast due to the requirement to be ferrying children to various weekend engagements. I hope no-one on the train thinks my occasional inane grin is directed at them.

I don’t listen to anything about Excel – I couldn’t find anything useful. Shouldn’t there be some kind of advanced Excel show? God knows there ought to be an audience for it. Maybe with a banjo theme tune?

Programming for (programmer) convenience

Here’s another piece of idiocy from Lotus Notes. I should say that I found this in version 6.5 and in the version that has now been inflicted on me, 8.0.1, it has been fixed. But I won’t let that stop me, it’s still a marvellous example of an entire development team failing to make that one last simple connection:

Could you just for once actually do it, could you?

Could you just for once actually do it, could you?

Have you spotted the idiocy? Notes has recognised that I have the post (sort of) open in the Preview Pane (much as in Outlook) and it doesn’t feel that it can delete it, perhaps because it might leave a decision about what to do with the empty space. So it closes the preview and invites us to try the delete again. Duh.

Just in case anyone’s struggling, I’ll spell it out: the program tells us it will do something we may not have known it could do (automatically close the Preview Pane) and then tells us to manually repeat an action that we know it definitely can do: delete a post. It says “document”, which might offer a clue, but I’m a user here – these are just emails as far as I’m concerned.

In the time it took to code the “problem” identification and the explanatory dialog, the developer could have just deleted the damn post.

Software like this does wonders for my self-esteem, I tell you.