29 July 2008

Choose Me

We support a number of different question types in our surveys. As a questionnaire designer, you can ask a question that has to be answered with a number, or with a date. Or you can ask for a long free-text answer: EFM Community calls this an "essay question." But the predominant question types are two: Choose One and Choose Many. (Older versions of EFM Feedback called these Single Select and Multiple Select.) These questions can be asked either one-by-one or grouped into tables or matrices. Maybe 80% of the questions asked in deployed surveys are either Choose One or Choose Many.

A Choose One question is usually rendered with radio buttons, though sometimes designers use a dropdown.

What is your favorite color?

Red Orange Yellow Green Blue


While a Choose Many (a/k/a Choose All That Apply) uses checkboxes.

What Metro line(s) do you ride regularly?

Red OrangeYellow Green Blue


These two question types look to be so similar, and yet there are subtle differences in the way the data for them is collected and analyzed, and I've seen more than one analyst stumble over the differences.

Let's say that you're architecting an application that lets people design and administer surveys. What are the pitfalls? Here I'm focusing on how to model the actual survey responses that are collected, rather than how to model the metadata that constitutes the survey design.

A single database attribute is sufficient to store the respondents' answers to a Choose One. For our example question above, assign the values 1 through 5 to the five color choices. Then you can store the survey respondents' answers in a relational database column typed as an integer of some suitable size, 8 or 16 bits, perhaps. It depends on how many possible choices you want to provide for in your survey software app.

On the other hand, for a Choose Many, you need as many database attributes as there are possible choices. One way to do it is to use one boolean database column for each choice: five columns in our example above. Or you could pack the answers into a bitfield, although querying and filtering on individual choices would then be a problem. Whatever path you take as the software architect, the key point is that the respondents' answers will be represented differently than for Choose One questions.

Generally, Choose Ones are just easier to deal with—a generic design is more accommodating. This fact probably explains why almost all of the free online polls that you see (hosted by outfits like polldaddy) are Choose Ones.

If your survey app allows designers to change a survey's design by adding more choices after the survey has been released to the world, you can see that adding a choice to a Choose One (just another possible value to be stored) is a lot simpler than adding a choice to a Choose Many (maybe a new database column).

What is your favorite color?

Red Orange Yellow Green Blue Indigo Violet

What Metro line(s) do you ride regularly?

Red Orange Yellow Green Blue Silver Purple


Even trickier is enabling a survey designer to rewrite a Choose One as a Choose Many, or vice versa.

What are your favorite color(s)?

Red Orange Yellow Green Blue

What Metro line do you ride most often?

Red Orange Yellow Green Blue


In this case, you're not simply extending a relational schema by adding columns or possible values, but rather you've got to convert one column type to another.

Reporting and analyzing survey responses for the two question types is likewise different.

For Choose One questions, you can do a frequency analysis that adds up to 100%:

What is your favorite color? (N of respondents=100)

  • 45% Red
  • 12% Orange
  • 10% Yellow
  • 17% Green
  • 16% Blue


And if your corresponding numerical scale makes sense, you can compute means and other statistics. (Granted, this makes more sense for computing something like average customer satisfaction than for computing an average favorite color.) Analysis like this can be presented effectively with a pie chart.

But for Choose Many questions, the numbers never add up.

What Metro line(s) do you ride regularly? (N of respondents=100)

  • 45% Red
  • 22% Orange
  • 65% Yellow
  • 22% Green
  • 40% Blue


An unstacked bar chart is probably the best way to present this information graphically. At least you can depend on the longest/tallest bar being no more than 100%. Also notice that you don't have a numerical scale, just booleans, so you can't compute means and standard deviations for Choose Many questions.

I haven't delved into some of the more fiddly bits of designing a survey app that supports Choose One and Choose Many questions. Things like support for "none of the above," "I don't know," "not applicable to me," or "I'd rather not say" choices, or requiring that the respondent check at least one box or radio button, or at most three checkboxes.

19 July 2008

Windows XP and Samba

I bought a network hard drive for my home setup, largely so that I would have something for backing up my laptop. The laptop (named Mulligan) is an HP Pavilion ze2000 running Windows XP Professional at Service Pack 3, while the workhorse machine on my home network is a dual-G5 Mac running Leopard (Mac OS 10.5), named Dedalus.

Over the holiday weekend, I brought the hard drive home (an Iomega Home Network 500GB), plugged it in, configured it over the web interface from Dedalus. I named the drive Boylan, did a Go > Connect to Server... from Finder, and It Just Worked. The network drive shares files with the Samba protocol (a/k/a SMB, or Server Message Block), and Mac OS speaks fluent Samba.

Not quite so easy connecting from the Windows machine. I tried using the Iomega-provided Discovery Tool Home to mount the shared folders. The tool could find the drive and folders, but when I picked a folder and clicked the button, the tool popped up a dialog with the rather unhelpful message "Exception Error."

I fiddled with the port settings on the firewall that I have running on on Mulligan (Norton), but no luck. I disabled the Norton firewall and went back to Windows Firewall, but no joy again.

I started a chat session with a support rep from Iomega and learned the first secret: the Discovery Tool is just a GUI for Tools > Map Network Drive..., because that's all that the rep used to work the problem. Unfortunately, Map Network Drive... was equally unable to mount the shared folders, and provided no clue as to what was not configured correctly. He asked me to check some settings on the router, and at the moment I had a glitch logging into the router, so I had to close the chat session.

The next day I had some free time to do some searching, and I turned up a page of David Lechnyr's Unofficial Samba HOW TO that taught me the second secret: Tools > Map Network Drive... is just a GUI for the console command net use. So I tried


net use e: \\192.168.0.101\public


and I got back the message "System error 1231 has occurred." Finally a clue! More searching, and I found a nicely comprehensive list of System Errors and troubleshooting tips. The page for 1231 reads, in part:


...when we checked the Properties of the LAN, we found the Client for Microsoft Networks and File and Printer Sharing for Microsoft Networks were disabled.


I bounced off to the Properties sheet for my network connection, and indeed, Client for Microsoft Networks was disabled. I checked that box, rebooted, and much satisfied mounting of folders was mine. Furthermore, now both Boylan (the hard drive) and Mulligan (the laptop) show up in My Network Places under Microsoft Windows Network and the node for the workgroup.

So, while File and Printer Sharing for Microsoft Networks enables other devices to access shared external resources from the local machine, Client for Microsoft Networks works in the other direction—it enables the local machine to access external resources.

17 July 2008

Yet another yacc post

Naomi Hamilton jumps way out of alphabetical order to interview Stephen C. Johnson, developer of the yacc parser generator, for her A-Z series.
YACC made it possible for many people who were not language experts to make little languages (also called domain-specific languages) to improve their productivity.

And that is exactly what happened in my case: with no prior academic preparation, I used yacc to build a translator for a COBOL-like reporting and OLTP application language called XPL. (That is, I used yacc, lex, and every trick I could find in a couple of the seminal books on compilers that were available in the early 1990s: the 1986 edition of Aho et al. ["the dragon book"] and Schreiner and Friedman's Introduction to Compiler Construction with Unix, which we called "the unicorn book.")

I did this work for a company called Magna Software, now defunct, which has left few online traces of its existence. I've lost my conversancy with language translation and compilers, so I don't know how it's done any more—I doubt that yacc could support the interpret-on-fly behavior that Visual Studio gives me.

14 July 2008

My Toolbox

Back when I was a wee graduate student tapping away at a borrowed Texas Instruments Silent 700 terminal for beer money, the scope of my development environment was rather small. One language to code in (SPSS), one text editor (SOS—I tried to teach myself TECO and failed), the SPSS executive, and the DEC-10 command shell—DCL, I think it was. I have more gear to manage now.

Languages

My assignments in this Microsoft shop call for declarative and/or imperative code in the following languages:

  • C#: we're using version 2.0 of the .NET framework
  • SQL: both DDL and DML; we do most of our development against SQL Server, but we also support Oracle
  • HTML: the app itself uses XHTML 1.0 Transitional, and the generated surveys are HTML 4.0 Transitional
  • JavaScript: we don't rely heavily on JavaScript, at least not directly, but we do use it as a glue language
  • CSS
  • XML


We use the little languages regular expressions and XPath expressions. ASP.NET markup to declare a server control or to code a @Page directive is a little language too, but isn't it interesting that it doesn't have its own name?

We have legacy code that uses Delphi and XSL/T.

Compilers, etc.

At any given moment, my desktop may have windows open for the following tools. In the course of a week, it's almost certain that I will use all of these.

  • Visual Studio 2005
  • SQL Server Management Studio
  • Perforce Windows Client, for access to the source code repository

    Perforce's means for coding client specs is its own perplexing little language. We depend a lot on the context menu pick Create/Replace Using as Template...

  • Firefox 2, equipped with ColorZilla, Firebug, Flashblock, View Source Chart, and Web Developer
  • Internet Explorer 7, equipped with IE7Pro and IE Developer Toolbar
  • a VMware workstation running Internet Explorer 6, for more browser compatibility testing
  • Remote Desktop Connections to other servers
  • a paint program for managing screen shots: my GUI team lead likes Jasc Paint Shop Pro
  • UltraEdit: clunky like a Swiss Army knife with too many blades, but it handles .csv files that Excel can't, and it can make XML readable
  • any of two or three different file compression utilities
  • a command line


We're starting to use Team City for automated builds. Some people on the team swear by ReSharper, but I find that it just slows down my compile and test cycle. Every once in a while I'll need to pop open the Windows Services manager, or the IIS Manager to set up a new web site. My boss likes Beyond Compare, so it's installed on my machine, but I'm lazy and never bothered to learn how to use it; I depend on the default comparison tool provided by Perforce. Now that I look in there, I see that there's a lot of stuff in my Start Menu that I've never used. And sometimes I'll have a pattern-search chore than I can't use Visual Studio or Windows Explorer's Search for (maybe wading through web server log files), and then I'm glad that I have a copy of Windows Grep.

Third Party Controls and Libraries

For everything from managing Ajax interactions, to business graphics, to file-format translations, to fancy web controls, we license tools from ComponentArt, Dundas, Aspose, Telerik, and Steema Software. And, as I posted earlier, we built the Community Builder Module with DotNetNuke.

Communication

When I log in, Microsoft Outlook and AOL Instant Messenger automatically launch. I treat IM software as a necessary evil, as most of the rest of the team likes to use it.

We use FogBugz for bug tracking, and we've just started using its integrated wiki for documenting procedures, tracking issues that are more complicated than individual software defects, and advance planning. I really prefer wiki software that puts you in control of the final product (like MediaWiki, which powers Wikipedia), but we chose a tool that could be picked up by a broad base of users.

Lest we forget, for project specs and planning: Microsoft Office, primarily Word, Excel, and Project, with a smattering of Visio.

The Desktop

Sitting on my desk, holding up my telephone, is a PC running Windows Server 2003. The shelf over my monitors is holding about a dozen books, but I only pull out three or four of them. The one I go for most is Spainhour & Eckstein's Webmaster in a Nutshell. For more details, I rely on my Safari subscription. And, perhaps most importantly, a big desk pad loaded with paper.

02 July 2008

Some assembly required

Dimomidis Spinellis constructs an emulator of the Antikythera Mechanism with the Squeak EToys multimedia authoring environment—and a lot of overlapping polygons.
Having the gears as polygons makes modeling their interactions child's play. Etoys has a built-in primitive to locate overlapping objects. Thus, on each time step, I simply look for overlapping polygons and rotate them in the appropriate direction until they no longer overlap.
EToys runs, among other places, on the XO laptop of the OLPC intiative. A download of the emulator's project file is available from the author.