In western countries, the weekend is Saturday and Sunday, but in Israel it's Friday and Saturday. There are plenty of people who work on Fridays (normally until 1 or 2pm) but there are also plenty of people who don't. A five day work week was instituted maybe ten years ago, adding an hour to every work day. For those who do work on Fridays (my bank, for example), there is usually one weekday when they don't work (the bank is closed today). If one works on an hourly basis (as does my wife), then it's better to work during the week and not work on a Friday as one works more hours this way and so gets paid more.
The point of this over-elaborate introduction is that two phrases which are resonant in western society ("I don't like Mondays" - the Boomtown Rats, "Someone's got a case of the Mondays" - the film "Office Space") don't really make much sense here. Instead, one could say "someone's got a case of the Sundays", but I've never heard anyone say that. There is definitely a sense of transition, although for religious Jews, this occurs on Saturday night when Shabbat "goes out"; there is a small ceremony held, called "Havdala" (difference) in which this transition is marked.
For me, the first ten minutes on a Sunday are slightly difficult as my head is normally full of the programming which I've done over the weekend, and now I have to clear my head instantly and take on a different set of responsibilities. I'm going to write here about the fun and games of the weekend, and not the fun and games of the day job.
The occupational psychologist for whom I work developed a questionnaire whose results indicate which profession is suitable for the person sitting the exam. The target population for this exam is mainly pre-university youngsters although there are elder populations for whom the questionnaire is applicable. I computerised the questionnaire several months ago; this was fairly routine. Even the program which reads the raw data and "calculates" the suggested profession is fairly routine, although we did spend a large amount of time designing and programming the output in order to make it user friendly.
As we intend this questionnaire to be distributed "in the wild", there are certain aspects which are unique to the program suite (there are four or five programs involved).
- People will have to pay in order to get their results, which means that there has to be a mechanism for issuing and distributing licenses.
- The raw data has to be sent from the client's computer to our server, the results have to be calculated and the output file has to be returned.
The first point was fairly simple to implement: I added a 'licenses' table to the database, which has fields for username, email, license code, counter and multi-user. If the license is defined as multi-user, then the same code can be used many times (this is intended for external establishments, who presumably will pay according to the license counter, which is incremented every time a licensed data file is received). For a normal user, the license is good for one time only.
In order to implement the second point, I added to the distributed questionnaire program a code snippet which automatically sends by email the raw results file to a specific email address. I then wrote a program which polls this email address every five minutes and downloads any letter which has certain characteristics (it's not going to download spam!). The program extracts the attached data file from the email and passes it to the calculation and output stages of the results program and then returns the output file by email. How does it know where to send the email? Because output files are sent only to registered users and the email of the registered user is known. So even if someone bothers enough to fake a registration code, they won't get the results.
The previous paragraph glossed over several points which actually took me quite a time to get right. Finding a free email server which handles POP3 was surprisingly difficult and took several attempts before I found one whose mail I could download successfully. I had never written a program which downloads email before, so I had to learn how to do the ins and outs of this as well. Checking the license and the multi-user status of the license was tricky but not difficult.
There were several little parsing errors which needed to be solved, but on Friday night, the occupational psychologist's son (who is in the target population) was roving the kibbutz with a mobile computer and the computerised questionnaire, getting all his friends to complete the questionnaire and getting the results back by email. Well, not quite: there was a problem with the file returning code. I woke up at 6am with a possible solution to the problem; it wasn't the correct solution, but did help pave the way.
This mobile computer was a pain in the neck by itself. I had programmed the display for a normal computer screen, but this mobile was one of the new breed of notebook computers with an aspect ratio sufficiently different from a standard screen to cause problems. The normal screen displays instructions at the top and five questions; on the notebook, the screen was truncated and only one or two questions were being displayed - and there were no scrollbars visible which would have enabled the user to scroll the display in order to see the missing questions.
I spent a few hours on Friday afternoon solving this problem. The other son of the occupational psychologist had done some design work with me on the program, resulting in an aesthetically pleasing display. His design called for the questions to be displayed in a dialog box with no borders - and it transpires that such a dialog box cannot have scrollbars. After knocking my head against a brick wall for some time, I found a compromise solution in which the dialog box has no caption but has a minimal border. This allowed the vertical scrollbar to appear (I fiddled with the width of the dialog in order to prevent a horizontal scrollbar from appearing).
There was another wish which I had been avoiding for the time being: the output file should be a PDF file and not a Word file. I know that Word 2007 has a 'save to PDF' option but we are using Word 2003 and upgrading solely for this ability seemed non-proportional. Yes, I know that Open Office can save to pdf, but then I would have to learn how to automate Open Office, a task which seems somewhat daunting at the moment, especially considering the lack of documentation. I tried a command line program which sort of did the job, but it seemed very slow, required most of the computer's cpu time whilst converting and was not free.
After a brief nap on Saturday afternoon, I contemplated the pdf problem again. The program which I had tried automatically invoked Word and instructed it to send the file as output to a printer driver which the program had installed. This is when the light went on over my head: we already have a pdf printer driver! I had erroneously assumed that it couldn't help us as it always asks where to save the file and then invokes a pdf reader after the file has been created. Wrong! The printer driver has settings which enable the user to avoid the 'file save' dialog and not invoke the pdf reader. After five minutes work, I had a test program which wrote to a Word file via automation and then converted that file to pdf.
I still had to install the pdf printer driver on the server, sets its definitions and add the necessary few lines to the output program, but these tasks were trivial. Now the automatic downloader/dispatcher program will send a pdf file back to the questionnee! (This is yet to be tested as no more data files have been received since I added this, but I am confident of the results).
In conclusion: I now have to switch off the part of my brain which has been operating on finding solutions for the problems posed by this questionnaire suite, and reprogram it in order to meet the challenges provided by the day job (for example, show where the differences in inventory value for examples in the last two months come from).
No comments:
Post a Comment