Monday, December 26, 2011

Broadband world

Was just trying to get my mother-in-law's laptop to crawl the web a trifle less slowly using her 56k USB modem (they're snowbirds). Amazing how all those modern apps which are always "helpfully" checking for updates and background security downloads can eat into bandwidth these days. Set her up with Opera, which at least has a no-graphics mode. Need to look into a GUI lynx, if that makes any sense...

Friday, December 23, 2011

One-Way Trip

And I always feared that moving to Visual Studio would prove degrading. Not so! To be capable of degrading, a product must obviously support downgrading, i.e. the ability to "Save As..." a file into an older file format.

You know, like how Word 2010 can "Save As..." to Word 97 ".doc", or RTF if you must, or even (heavens) ASCII? And how Excel 2010 can still "Save As..." to Excel 5.0, CSV or even tab-delimited? And obviously, the way Visual Studio 2010 can "Save As..." a new .vcxproj solution to an older Visual Studio 2005 .vcproj?

Well, no. I turns out I made that last one up, because there's no bloody thing. Fooled you, ha-ha! Now you can just expect all your customers to upgrade their compiler, too!

(Granted, okay, at least they're free, but still. It's the principle of the thing. In principle...)

How Not to do SCM

Just some random observations, which regrettably do come from [recent] first-hand experience:

How Not to do SCM
  • When you send out binary releases to customers, don't bother to label them with version numbers, or date-stamps. Or retain a copy of what you sent. Or the source code used to generate them.
  • When a customer requests a new feature, or even better a bugfix of an old feature, just fork the project. Make a copy of some (random, unidentified) version of the code base, make the change, then ship it to the customer. What are the odds another customer might request the same change? (And why limit yourself to only one of the infinite possible implementations? Expand your boundaries!)
  • Why bother to test. It works in your head, surely it will work on hardware as well, yes? To believe otherwise would to believe your mind is insane, which is unthinkable, so don't think it.
  • Fine, so they asked for a manual. Fire up Microsoft Word and give them one. After all, API docs are easy -- just copy and paste the header file into Word and you're there, right? And years later, that old version of the header file will still be there in Times Roman-12, bemusing and perplexing end-users who can't bother to check the source code to see that of course the function signatures have moved on, it's not like we sit on our duffs all day and don't add to the product. So be a good little customer and diff the ASCII header against the formatted Word doc to see what's new. Duh.
I could go on, but I really don't want to. Go on, that is...

Tuesday, December 20, 2011

opt arrrgh

After spending years banging out powerful script invocation options using Perl's wonderful Getopt::Long, this week's been a sad reminder of just how much cruft you must manually craft in C to get even a little bit of work done with getopt long. Sure, there is Boost and all kinds of nifty automation libraries...but they all impose a rather hefty co-installation dependency (requiring legal license approval from both the producer and consumer sides, etc). Often easier just to write the things yourself...or at least it was in Perl :-/

In-Visible C++

Grumble. The MSDN archives are normally fairly complete (you can still download MS-DOS 6.0 and Windows 3.11, something I promptly did on principle), but the series of available downloads for old versions of Visual C++ skips right from 4.2 (1996) to 7.0 (part of Visual Studio.NET, 2002). Makes it kind of hard to recreate binaries compiled from VC 5.0 or 6.0.

Mac ISOre

I don't gripe about Macs much, 'cause I usually love 'em to death, but this was just stupid.

If you double-click an .iso file in MacOS, it auto-mounts it like a normal virtual drive. That's exactly what it should do (and a welcome change from Windows, which pretends that it's never heard of the ISO-9660 format). This proves that Macs know what an ISO file is, and what you probably want to do with one.

Which is what makes it so annoying when you right-click on the file, then choose "Burn to DVD..." from the context-sensitive menu, and you get...a DVD with a single massive .iso file on it. One file, not the expanded image contents.

For that, you need to right-click the .iso, "Open with..." Disk Utility.app, and then click the "Burn" icon. Not so hard, except you waste a blank DVD and 10 minutes of your life when you forget and choose the "obvious" technique by mistake.

(But "eyesore," that was funny, right? iSore? No? Bah.)

Installing Visual Studio from ISO

Just an oddity, filing away in case it helps others:

I could install Visual Studio 2010 and 2005 under 32-bit Windows instances (running under VMWare 3.0, for the record) by downloading the respective ISO from MSDN, mounting the ISO under MacOS, then "sharing" the mount through VMWare with the Windows virts. Worked a charm, was real convenient.

However, when I tried the same trick under a 64-bit Windows image, this time mounted under VMWare 4.0, the installer for both compilers failed with the message "A problem has been encountered while loading the setup components. Canceling setup."

A bit of Googling found that others succeeded by manually burning the ISO to DVD, then installing from the physical media. Don't know if this happened because I moved up to 64-bit Windows, or VMWare 4.0. Whatever...

Sunday, December 18, 2011

Subversive joy

I've been whining a lot, so let me take a moment to say how wonderful something is: Subversion. It feels SO GOOD to be using an actually excellent SCM tool once again.

At my last job, while in general they did a pretty good job with Builder Tools, they were inexplicably shackled with Perforce, which I'd have to term mediocre at best. Before that, I was stuck with Clearcase, a complex, overpowered nightmare only a consultant could dream up.

In contrast, Subversion Just Works. It's fast, making the hard things simple and the easy things comfortingly reliable. I'm happy. Cutting a new branch or release becomes a time of joy rather than heartache and pain. Let's give it up for svn!

(And thank you, Judd, for teaching me the value of PCR branching, and pds for getting me into CVS in the first place!)

Stylish gives GForge much-needed facelift

Somehow we got landed with GForge for all our collaboration needs: subversion-based CM, trouble ticketing, and *cough* wiki. I had to caveat the "wiki" appellation, as, unusually for a wiki, GForge doesn't understand wiki markup. At least the way ours is installed, you must use the well-named WYSIWYG "FCKeditor".

And WYG is truly appalling. I mean, it's not as if CSS is particularly difficult (well, it is, but that's a matter for another post). The default stylesheet GForge comes with is about as appealing as a child's charcoal drawing left out in the rain. They pulled in the kerning and leading until adjoining text is virtually juxtaposed, then made all the fonts tiny (even headers), made everything a dull gray-black, then chose an ugly typeface. Oh, while disabling all the things that make wikis useful, like auto-TOC and templates.

Did I mention GForge is a commercial product? You actually have to *pay* to take an old (1.4) version of Subversion, Bugzilla, and a wiki actually *worse* than SharePoint, then roll them up and hide them under an ugly stylesheet.

Which is where Stylish comes in, at least putting some makeup on the pig so you can pretend you're using better tools. Knowing of course that the users who are reading your documentation likely DON'T have Stylish installed, and so believe you're to blame for producing such banal crud.

*sigh*

(I did tell you this blog was going to be a whinge, mind...)

Yammer

Our marketing dept recently rolled-out a Yammer domain to try as an internal intranet / chat room / listserv / wiki / newsgroup, and so far I kind of like it. It's certainly not best-of-breed at any of those things, and big companies with well-staffed IT and HR departments (or some enthusiastic engineers with a few spare Limux servers) could probably do much better with an appropriate selection of freeware. However, if you're in a small, but distributed, hardware-constrained environment, and/or your target audience find Facebook more intuitive than wiki markup, then Yammer might be worth a look. Especially if the alternative is SharePoint.

Though I'd trade it in a heartbeat for Wildfire and MediaWiki...*sigh*.

Saturday, December 17, 2011

Impossible timestamps

I'm installing Windows 7 on an older Dell, and one of the first things I want to do is install Firefox...however, the default IE install and Bing keep complaining of a "certificate error" when trying to reach Mozilla.org. Naturally this sets my paranoia instincts on edge; obviously MS is up to their old anti-competitive tricks again!

Well, no. After a bit of hair-pulling, I finally realised that the system clock was set to 2003, so actually the impossible "future" certificates were "correctly" failing (I said it was an older Dell).

Yet I'm not ready to let Microsoft completely off the hook on this one. First off, the error message could have been a lot more clear about the reason the certificate was rejected, which would have sped fault-resolution. But more fundamentally, a WINDOWS 7 computer was calming accepting a system date of 2003 with nary a whisper of complaint. Windows 7...really?

Experienced programmers know how many subtle and nasty issues an unsynchronized clock can cause, from "make" errors to NFS bugs to profiling miscalculations to logfile misalignment (as well as broken certificate chains). Is it really asking too much to have the OS, which "knows" it was released on such-and-such a date, to automatically detect and warn the user on real-time system datestamps which are self-evidently impossible?

BIOS resets and PRAM battery failures have been common problems for decades...let's put a little smarts into the system to detect and warn of root causes before they develop into real problems. Low-hanging fruit, really.

.PST export

It is astonishing to me that there still isn't a standard way to export an Outlook .pst into mbox or Maildir for import into other clients. It would be lossy, sure - you'd lose all kind of non-standard Microsoft "value-add". But that would be kind of the point: at its heart, a .pst is a minimally indexed zipfile of RFC-822 emails, with a scattering of MIME enclosures. All we want is to unmarshall those contents (and it's OUR mail). Why is this so hard?

Graphviz and Cygwin

I love Cygwin. It's the first thing I install on a new Windows image, going a long way towards making Windows "minimally useable." I'm also a big fan of Doxygen on big C++ projects (comparable to javadoc and perlpod). In particular, the auto-generated UML diagrams that Doxygen can smoothly infer from even undocumented headers can be a godsend in quickly spinning-up on a complex new codebase.

But for the graphs, Doxygen needs "dot", and for "dot" you need Graphviz, and that's why I'm frustrated that the Cygwin port of Graphviz appears to be abandoned. You can install the Windows binaries, but Doxygen seems to call them with the wrong pathname convention from Cygwin. And I didn't have much luck getting the GV sources to build under Cygwin either.

I was able to convert the paths dynamically with a bit of sed, and of course everything works flawlessly from my Mac, but still.

One of you unemployed CS grads looking for experience? Fix this port and I'll write you a reference :-)

MSBuild dislikes vdproj

So I was happy to confirm that Visual Studio solution files (sets of projects, each representing one library or executable or whatever) can in fact be built from the command-line, an essential interface for most automated build / test environments. However, I was nonetheless greatly frustrated to find that the cmd-line MSBuild simply skips over .vdproj projects, the logical "final" project in many common solution patterns which then takes all the previously compiled libraries, applications, documentation and what-not and packages it into a tight little .msi installer file.

Being able to automate generation of your code is grand, but that final skipped step kind of undermines the whole point of automated release management, including "testing what the customer will install." Bizarre.

Visual Studio stop on failure

There's a nice rant here about the amazing fact that in 2011, Microsoft's premier code development suite still can't figure out that, when you're compiling a multi-project solution, and project B depends on project A, and project A has failed due to compiler errors, then there is no point at all expending a lot of resources rebuilding project B — something "make" figured out some 30 years ago. I stumbled across the post in a search for that very option, certain that I must be "doing it wrong," and was astonished to find that this was in fact the case.

Friday, December 16, 2011

Turing over in his grave

Loved stumbling into this one:
MFC functions declared to return type "BOOL" can return more than 2 discrete values. (example)
Geez, why bother declaring variables as "int" when you can more legibly define them as "BOOL" and then give them thousands of different values? Much easier to read that way...

vim in Visual Studio

Gotta put a shout-out for VsVim, which turns the Visual Studio edit pane into a mostly-functional "vim" clone. Doesn't provide absolutely everything, but just having the key mappings for "hjki", insert, yy/p, ctrl-f/b, /search, G-go, :w, etc work is fantastic. (Crashes every once in awhile, but worth having even so :-)

XMarks VMWare goodness

XMarks (formerly FoxMarks) is handy for numerous situations, but it's a godsend when you're hopping between a bunch of VMWare instances. Sooooo nice to be able to access all your latest bookmarks (ticket queue, project wikis, etc) no matter which version of Windows or Ubuntu or Mac or whatever you happen to be testing in at the moment...

About this Blog...

So, what is this blog for, anyway? Why are you writing this?

A couple of reasons:
  1. I'm a programmer sitting in a nice lab surrounded by a bunch of friendly EE / mech / optical engineers who have essentially no interest in programming. Therefore, I have nobody to talk to about the interesting / frustrating / amusing little things I stumble across in my daily software excursions. So I'm talking to you instead :-)

  2. Some of the things I'll post here required a bit of Googling to discover. Some may have been buried rather deeply in message board postings, archived mailman threads, etc. Where a workaround appeared frustratingly obscure, I'm using this to repost the final solution for others to find, hopefully with somewhat more descriptive keywords and narrative context.

  3. While I've been programming for many years, mainly in Linux C/C++/Java/Perl environments doing database middleware, web interfaces or system scripting, I've recently jumped into an all-new "pond" involving Microsoft Visual Studio, C#/VB, USB device drivers, LabView, and a bunch of interesting technologies that I've rarely had to mess with before. Therefore I have a lot of fresh "noob" perspective that I might as well leverage into breadcrumbs (for my own reference as well as others).

  4. I guess Facebook has put me in the mindset of sharing interesting little anecdotes, yet perversely Facebook itself is a poor forum for technical chatter: it seems more for aunts and cousins than work dialogs. Too much technobabble on FB will likely just get you blocked from the feeds of otherwise purely social contacts (quite reasonably, I should add).

Lastly, some of this is stuff I would normally document on a departmental / company wiki, but my current company doesn't provide much in that regard (GForge...bleah), so you reap the benefit instead :-)