Sunday, February 28, 2010

Still working even when feeling lousy

I was feeling lousy yesterday afternoon/evening. This has been happening a lot lately, and it always starts around 5pm (maybe sometimes earlier and maybe sometimes later). This is probably due to the fact that I seem to have reasonably high blood pressure and that the bp rises during the day. I spent two weeks at the beginning of the month measuring my blood pressure twice a day, and although the results showed that the bp tends to change and reach an undesirable peak, they weren't conclusive enough for my doctor, who ordered a 24 hour continuous measurement. I have a followup meeting with him on Thursday to discuss those results, which apparently too weren't totally conclusive. In the mean time, there are days when I have a headache and don't feel well; analgesics might hide the pain but they make me feel weird as well. Yesterday was one of those days.

I was trying to revise for the Organisational Behaviour exam which is in another 10 days. Whilst I feel more confident about knowing the material, I am suffering from an inability to turn that knowledge into an essay which answers a question posed. The exam does not consist of questions like "Discuss the differences in the content theories of motivation" but rather will present a short story about someone and ask "How would your knowledge of OB help this person?". I read about leadership styles in the morning (there are basically four theories, but I'm not going to go into that now) and got them organised in my head, but in the afternoon I couldn't think about anything connected with OB.

I took the dog for a walk and thought about what I could do in the hours remaining before I go to bed. I decided to do some work for my occupational psychologist, hoping that I would be capable of doing something which required me to use knowledge which I already possess as opposed to trying to cram more knowledge into my hurting head. Our flagship exam consists of 400 questions and takes about 40 minutes to complete; she has contracted with some kibbutz to present a smaller exam which tests for only about six or seven characteristics. My job was to figure out which questions needed to be asked for those characteristics and prepare an exam program which asked the minimum number of questions needed – as opposed to a plan which we had several years ago in which the examinee answers all the questions, but scores are generated only for the characteristics that we want to measure.

The first part of this was easy, setting up a resource file which contained the necessary questions in English and Hebrew. Then I wasted about an hour trying to automate the production of an equivalent resource file with Russian questions before I realised that I was on the wrong track (does the word 'unicode' mean anything?). Once the penny dropped, I hand edited the existing Russian resource file, whittling it down from 400 questions to 246 (which is the number of questions in the new exam). This effort may be pointless as there may be no Russian speakers who will answer the questionnaire, but it's better to do the work now then later.

Then I started trying to convert the exisiting exam to use only 246 questions instead of 400. This actually shouldn't be too difficult as the code is fairly parameterised. As I want to use the existing report generator and store examinees' results along with everyone elses, the exam program has to use the same file format for its output, and this includes a 480 element array for the answers. Why 480? Because originally the exam had 480 questions before we scaled it down slightly to 400. The current resource file has a list of non-existing questions (80 numbers) and sets the appropriate elements in the results array to a certain value. I hit a conceptual block when considering how I was going to implement this list in the new exam. I had done enough work for one evening, so I tried to watch the news and then had a shower.

As funny as it may seem, I do a lot of creative work in the shower, and the answer to my conceptual problem swiftly appeared. I had been storing the list of non-existing questions as a string in this format '1,5,12,218, 337', etc. As a (small) string in Delphi can hold only 255 characters, it would seem that the list is limited to only about 90 questions. This was ok when I had 80 questions not to be included but was unsuitable for 234. The answer in retrospect was easy: store in the resource file two strings (because the length is limited), where each element represents a question. If the element is '1', then the question is valid, and if the element is '0' then the question is not to be asked. Thus the strings stored in the resource file will be something like '00011110011010….'. In the exam, I will load these strings from the resource file, traverse them and mark the array in the output file appropriately.

I also need a flag in the results program to signify the fact that an examinee took the shortened exam and that results should be calculated appropriately. I know how I'm going to do this, but haven't got there timewise yet.

No comments: