Wednesday, May 09, 2012

Early footage of The Band

In the wake of Levon Helm's death, footage of The Band at various stages in their career has started to appear on YouTube. I only became aware of this the other day, so I haven't had much of an opportunity to view the footage, nor see how much is pre-Last Waltz and how much is post (I have The Last Waltz on DVD).

I did see two versions of 'The Weight' - the first was from Woodstock (yes, The Band was there but their manager, Albert Grossman, didn't want their material in the film or on the soundtrack, possibly because Robbie Robertson's microphone was live) and the second from a concert in Pittsburg a year later (there are four songs in this film). I want to focus on this latter footage which seems to have been made by a single camera.

The camera starts off by focusing on Robertson - after all, he is the guitarist, appears to be leading the musicians and has a microphone in front of him into which he appears to sing - but after a while, the cameraman realises that Levon Helm behind the drums is the one who is singing the verses. During the chori, he pulls back to show Rick Danko (and Robertson) singing. Where does the third voice in the chorus break come from ('and ... and ... and ... she put the weight back on me)? From Robertson, of course. Richard Manuel? Never heard of him. Garth Hudson? Unheard and unseen.

After the cameraman finally learns that Helm is singing the verses, he returns to the drummer at the beginning of every verse, only to discover in a panic that Helm is not singing the fourth verse.  It takes a while, but the camera pulls back and starts searching for someone moving his lips. Eventually it settles on Rick Danko, singing about crazy Chester.

As there was only a single camera, there obviously was no director who can be blamed for not doing his homework. So the sole cameraman is guilty: he didn't bother to find out who the vocalist is before the concert. Poor man: little did he know that The Band had three world class vocalists who would often sing in unison or pass the tune around (at least in the early days). 

"Time to kill" is the opening song which features a constant duet between Danko and Helm; the camera stays on Danko almost all the time and one is left to guess to whom belongs the second verse.

There are means of saving films shown on YouTube as avi files; I am storing these clips and will one day burn them to DVD.


Sunday, May 06, 2012

ERP beats Excel at CRM

Today I witnessed what was supposed to be a small victory in my fight against using Excel in the workplace. I was called into the General Manager's office where I was asked about our ERP program's abilities in the realm of Customer Relation Management (CRM). I explained that I had developed a module several years ago for tracking events and all the people that were invited to that event, including the status of each person (invited, declined, participated, etc). I also explained that I have instructed at least four people in the use of this module and none of them had left much of note (all of these four no longer work with the company and I sincerely hope that there was some other reason than this module!).

Enter the woman who has been dealing with CRM the past few months. She of course has been maintaining her 'database' in Excel and sees nothing wrong with that. The GM told her that her data have to be transferred to Priority so that they can be managed properly - here is my small victory (I didn't have to persuade the GM that Priority is a better tool than Excel for CRM).

A few hours later, the woman sent me her spreadsheet and straight away I knew that we had a problem. Although theoretically I can simply copy her list of contacts and paste it into Priority, this won't work in practice because not all of her contact have previously been defined in Priority. Not only that, some of the contacts were defined with first names only; as unfortunately no one has ever bothered to devote the necessary amount of attention to defining contacts in Priority, some of the contacts already existing are also on a first name basis only. There may be a match between the first names, but the non-existent surnames may well be different.

I tried to show her how to work with the program but she wasn't too enthusiastic. "Why can't I continue to maintain my lists in Excel?" was the question; I explained to her why Excel is not the tool for the job. At the moment, we have deadlock as she is not prepared to take her list, to check whether each person exists in Priority, to check the details, etc.

Hopefully she does appreciate the value of the data once they have been entered. But she's heavily pregnant and wants to get the job done today (this is a failing of many people here; they want to get the job done but don't want to handle the necessary paperwork). We are currently waiting for the GM to return in order to discuss the subject further.

Thursday, May 03, 2012

Some MBA metadata

At yesterday evening's session (where we went over an old exam question discussing the performance of a company which has branches in Britain and America), I acquired some MBA metadata:
  • 24% of the students who took the Finance exam with me in December failed outright
  • A further 7% received a conditional fail (this means that they scored between 45-49%; under certain conditions this might become a pass)
  • Several of the students who are studying Strategic Planning with me are also studying Project Management and are finding it extremely hard (or rather, finding that the lecturer doesn't lecture very well).
The Finance results are interesting. Apparently, quite a few students memorised the multiple choice questions which have appeared in previous years. Out of the 20 MCQs which appeared this time, only one had previously appeared, so these students were already at a great loss. Apparently they hadn't bothered attending the lectures or hadn't absorbed the material (and we had a good lecturer). I don't know who failed - I haven't seen most of the students from that course since.

As regards Program Management, I was fortunate in that a Scottish lecturer came and gave us three extra lectures. His material was highly illuminating and basically sorted out the entire course. I'm sure that those who attended his lectures did well in the exam (as did I). I will give my fellow students my notes, but I suspect that they won't derive as much from them as I did (given that the notes are in English and in my handwriting). Perhaps I should give them a tutorial.

Sunday, April 29, 2012

Two films

I saw two films yesterday which couldn't have been more different in style and in content: 'The girl who played with fire' and 'Serious Moonlight'.

The first film ('GPF') is, of course, the second installment of the 'Millenium Trilogy', about which I seem to have written quite a lot. The film was in Swedish, but I'm used to reading sub-titles, so this wasn't a problem (Hollywood has only made a version of the first book so far). Fortunately, the film makers read the book and edited the multiple storylines into something much more understandable; the film runs for almost exactly two hours. In fact, I'm not sure whether the film makers dumbed down the book too much; knowing the story allows my mind to fill in any details which might have been missing from the film. Otherwise it was a faithful rendition of the story and was executed well. Not very much coffee drinking and protagonist Blom­k­vist didn't get much bedroom action.

The second film is a newish film (2009) of Meg Ryan. Co-starring is Timothy Hutton, who was Ryan's fiance in 'French Kiss'; maybe this film is the sequel to that earlier film - at least, had Ryan married Hutton, instead of Kevin Kline. The first hour of the film was tolerable, but after that it completely degenerated and finished a mere twenty minutes later. It's as if a whole section of the story had been left out. I felt short changed at the end of the film, and its good parts in no way compensate for the exceedingly weak ending. This is definitely not a film worth seeking! 

Ryan and Hutton are supposed to be a couple who have been married for thirteen years; at one stage, there is a flashback to their wedding party and some wedding photos are shown. Fair enough, but the two actors don't seem to have aged since their wedding (in other words, they look exactly the same in the flashbacks as they do 'today'). Had the producers bothered a bit more, they might have tried to get some pictures of Ryan and Hutton from their earlier film - they definitely look younger then!

Saturday, April 28, 2012

Indexing on a calculated field in a TClientDataSet

Two months ago I wrote about generic code for creating indexes (or indices, as I would prefer) on every field in a clientdataset. Yesterday I discovered two caveats to this code
  • An index is not created for a field which is not displayed
  • An index is not created for a calculated field - in fact, trying to create an index for such a field causes an error.
 I was working on a report whose query contains a field which returns a number which is then used as an index into an array ('cash', 'cheque', 'transfer'). It seems like too much overhead to define a table for means of payment when there are only three such means, so the program contains an array of strings, and certain tables contain values which index into this array. I want the report to display the name of the means of payment as opposed to the index, and so I have to use a calculated field. If the user should click on the grid's title bar, then the report is supposed to sort itself according to the chosen field; that's why there's an index for each field. But how is one supposed to create an index for the calculated field?

It took me a while to get to the correct answer. The first caveat above states that an index is not created for a field which is not displayed - but this does not mean that I can't manually create such an index. The calculated field's value is based on the value of the non-displayed field, so what I did was to create an index for the non-displayed field, but number it as if it were the calculated field.

I had to alter the 'BuildIndices' procedure so that it now reads like this
Procedure BuildIndices (cds: TClientDataSet);
var
 i, j: integer;
 alist: tstrings;

begin
 with cds do
  begin
   open;
   for i:= 0 to FieldCount - 1 do
    if fields[i].fieldkind <> fkCalculated then
     begin
      j:= i * 2;
      addindex ('idx' + inttostr (j), fieldlist.strings[i], [], '', '', 0);
      addindex ('idx' + inttostr (j+1), fieldlist.strings[i], [ixDescending], '', '', 0);
     end;
   alist:= tstringlist.create;
   getindexnames (alist);
   alist.free;
   close;
  end;
end;

Then I added two extra lines to the calling program; the calculated field is the sixth field so its indices are idx10 and idx11, and these values would have been skipped in the above code.
 BuildIndices (qReceiptsList);
 with qReceiptsList do
  begin
   open;
   addindex ('idx10', 'cash', [], '', '', 0);
   addindex ('idx11', 'cash', [ixDescending], '', '', 0);
   alist:= tstringlist.create;
   getindexnames (alist);
   alist.free;
  end;
This works very nicely.

Friday, April 27, 2012

Metonymy

This is an intellectual warming-up exercise for my proposed doctorate, discussing how the use of spreadsheets negatively affects the successful implementation of ERP programs. I literally woke up this morning thinking 'Excel', and then went over several points in my mind. The following material is probably written in an anecdotal style as opposed to an academic style, which means that this material probably won't find its way into the final product. 

 I first came across the word metonymy in David Lodge's excellent novel "Nice work". Here it is described as "substituting some attribute or cause or effect of the thing for the thing itself". Looking around on the Internet, I discover that two classical rhetoric terms, metonymy and synecdoche are almost the same thing, and at the moment I can't really distinguish between them. 

[I]t is often difficult to distinguish between metonymy and synecdoche. Plastic = credit card is a case of synecdoche because credit cards are made from plastic, but it is also metonymic because we use plastic to refer to the whole system of paying by means of a prearranged credit facility, not just the cards themselves. In fact, many scholars do not use synecdoche as a category or term at all." (Murray Knowles and Rosamund Moon, Introducing Metaphor. Routledge, 2006).

My examples of metonymy mainly come from the commercial world, in which a leading product comes to represent all the products in the same market
  • Can you hoover the carpet?
  • I'll just pop this cassette on my walkman
  • Let me google that
  • Send me some excels and I'll prepare an evaluation
Although this sort of thing doesn't happen so much in Israel, it certainly exists in the hi-tech world ("send me the excels"). I heard one lovely example of the television a few months ago during a news article discussing the affects of mobile phones on pre-teenagers: "What kind of Pelephone is your i-phone?".  Pelephone is a metonymy, as this was the name of the first mobile phone carrier in Israel (literally, miracle phone). Since then, more carriers have joined the market, but some people still refer to mobile phones in this manner.

I am sure that marketing managers would be very pleased when their product transcends the market and become the name for the market. Rowland Hanson was Microsoft's marketing manager in the early days, and he dictated that the product's name should be prefixed by "Microsoft" in order to enhance the Microsoft brand as opposed to the actual product name. His suggested name for Microsoft's spreadsheet program was 'Microsoft Plansheet', whereas other names considered were 'Number Buddy', 'Mr Spreadsheet' and 'Sigma'. 

Finally a district manager suggested Excel: Bingo!

Upon the program's release, Microsoft was promptly sued by Manufacturers Hanover Trust, which offered a computerised banking service under the same name. A settlement stipulated that use of the word was okay - as along as it was preceded by Microsoft. Rowland Hanson's revenge was complete.
(Stephen Manes and Paul Andrews, "Gates" (1994), pp 276-7.

All of the above is a long-winded explanation of why I will probably use the specific product name "Excel" in the doctorate's title as opposed to the generic 'spreadsheet'. You mean that there are other spreadsheet programs (cue a blog about the history of computer spreadsheet programs)?



Wednesday, April 25, 2012

Debt of Honour


Lately I've been struggling to read 'Debt of Honor' by Tom Clancy; reading this book is like putting one's life on hold for a few weeks. The printed version of the book weighs in at just over 900 pages; I can tell that it's a long book on the Kindle because I read and read, but the percentage meter stays at 10% (it's now at 82% which means that the end is in sight! Hurray!).

As with all of Clancy's books, it is in dire need of an editor to chop out all the extraneous sentences. It's a shame that Clancy devotes so much love to the military hardware - something with which most of his readers will have had no personal experience whatsoever - whilst devoting less attention to more familiar subjects, like characterisation.

I reflected at one point that it is a good thing that I have taken an MBA degree, as this book touches (sometimes at depth) on several of the subjects taught. There's a great deal of macro-economics and finance (spoiler: the Japanese try to take down Wall Street), there's probably project management, organisational behaviour and human resource management and there's certainly negotiation. Of course, the entire book is about strategic planning! The only things missing are accountancy and marketing.

Regarding negotiation, it was interesting to read what Clancy writes on the subject, now having completed a course in the subject. And by a neat coincidence, today the results of the negotiation exam arrived - 79! This means that supposedly negotiation is my second best subject, nestling between accountancy and project management. I will be the first to admit that my high mark is due to knowing how to answer the questions, and is not due to my extensive knowledge of negotiation. Maybe with a little practice, I might actually become a negotiator - but it's not my personality. Had I received another mark, I would have been in the 'X' grade ("A with distinction").

Friday, April 20, 2012

Levon Helm, RIP

Levon Helm, singer and drummer for the Band, died on April 19th in New York of throat cancer. He was 71. 

"He passed away peacefully at 1:30 this afternoon surrounded by his friends and bandmates," Helm's longtime guitarist Larry Campbell tells Rolling Stone. "All his friends were there, and it seemed like Levon was waiting for them. Ten minutes after they left we sat there and he just faded away. He did it with dignity. It was even two days ago they thought it would happen within hours, but he held on. It seems like he was Levon up to the end, doing it the way he wanted to do it. He loved us, we loved him."

Wednesday, April 18, 2012

Mixing and producing

Someone on the Peter Hammill mailing list asked a few weeks ago about the difference between mixing and producing (I don't recall what the background to this question was). I wrote an answer, most of which is quoted below. Unfortunately, there was no follow-up to the question, so I couldn't add any more material to my answer. But as I have a blog, I can expand as much as I want....

Mixing, in a nutshell, is balancing all the various sound sources together to make a coherent final product. This includes setting volume levels (which might change during the course of a song), panning, equalisation (tone), reverb (along with other effects), etc. This is generally done by the producer along with his engineer, although there are people who specialise in mixing songs which have been recorded by other people. The mixing stage takes tracks which have already been recorded, so the mixing engineer might have nothing to do with recording the tracks themselves. A good VdGG example would be Shel Talmy - according to The Book, Shel took the tracks which had been recorded by John Anthony for 'The least we can do' and mixed them, adding more treble.

Another good example of a mixing engineer working separately from the recording is the story of The Band's "Stage Fright". This was recorded by The Band themselves, so they can be considered to be the producers. They sent the tapes to two different producers, Glyn Johns and Todd Rundgren, and asked each of them to mix the album. The final product contains mixes by both producers, though no one seems to know who mixed what. As I have several different accounts of this process, I don't remember exactly who said the following phrase and where it was quoted, but this sums up the dilemma of the separate mixing engineer: There are four different guitar tracks. Which is the track that they wanted?

Originally, as someone else pointed out, a producer was the person who booked the session - the musicians and the studio - and liased with the record company (a good example of this would be Teo Maceo and the Miles Davis records that he produced). There would have been an A&R (artistes and repertoire) person who would have chosen the material to be recorded. In the early 60s, this situation began to change with the likes of Sir George Martin and Phil Spector, who became much more involved with the songs themselves. These days, there are several kinds of record producers: the kind that we know is someone who listens to a band demo recordings, comments on their structure, suggests instrumentation, oversees the recordings and picks the takes. Each producer has his own strengths and weaknesses, and of course his function is also dependent on whoever is being recorded. 

The best way for understanding a producer's contribution is to listen to the output of the same group with different producers - eg VdGG pre- and post- 1972. The earlier recordings (especially H to He and Pawn Hearts) have large numbers of overdubs and are quite theatrical, whereas from Godbluff onwards, there seems to be much less overdubbing and a more direct sound.

Try listening to 'House with no door' followed by 'My room' - two recordings with the same instrumentation: piano (Peter Hammill), bass (Hugh Banton), saxophone (David Jackson) and drums (Guy Evans). Listen especially to the difference in sound of the drums and vocals between the two songs: in the first song, the vocal is panned to one side and has a certain amount of reverb added to it, as do the drums. In the second song, the sound of all the instruments is dry (no reverb) and almost all the sounds (especially the vocal) are panned to the centre. In other words, John Anthony's productions are distinguished by their use of reverb and stereo. 

I'm not saying that JA's tracks are better or worse than the self produced tracks that came after the reformation in 1975 - they simply sound different. VdGG also took a producer's decision when they decided to 'dumb down' (my words) their sound when they issued 'World record', which is exceedingly simple, at least when compared to their earlier works. Of course, a real producer would have done something about the length of 'Meurglys 3'....

Obviously, the number of channels available when recording make a big difference. When a producer had only one or two tracks, there was very little that he could do regarding the technical side, so the sound would be mixed live and the producer would influence mood and rhythm. Even when there were eight tracks available (for example, 'The least we can do'), the producer was still somewhat limited, but sixteen, twenty four and thirty two tracks gave the producer much more room. Of course, in today's digital world, the number of tracks is basically unlimited, which can make the job of both the producer and the mixer very hard.

Most tracks, thankfully, are produced well, but there is the odd track which could have had a better production. I was listening to one such track today - 'Full moon' by Sandy Denny. Her first solo album was coproduced with John Wood and Richard Thompson, and features RT on every track. Whilst the sound may not be the best, it is certainly distinctive. Her second solo album, 'Sandy', was produced by husband to be Trevor Lucas, and is richer sounding and more even (I think that it's the best produced of all her records). But after that, Lucas' production skills declined (if ever he had any; Richard Thompson plays on all the 'Sandy' tracks and so counteracts any of TL's mistakes), and her final solo record, 'Rendezvous', was a complete hodge-podge.


'Full moon' is a good song: it has exquisite lyrics, a good tune but a so-so harmonic palette. The recording features one of Sandy's best vocals, improving on the written tune and providing excellent phrasing. But the arrangement - with or without the strings - is plodding and pedestrian. The string arrangement tries to be good, but it is very one dimensional. To be fair, there isn't much of a chord sequence with which to work. The only good part of the instrumental track is the clarinet solo, played by Acker Bilk (of all people). This is the work of a so-so producer.  The fact that there are five verses (four with words and one instrumental) necessitates variety in the arrangement, in order to maintain the listener's interest. Whilst Sandy's impeccable vocal certain catches the ear, the somewhat boring string arrangement and lumbering rhythm only serve to turn the user away. A good producer would have recognised that a different instrumental approach was necessary.

Tuesday, April 17, 2012

Strategic planning

As I've mentioned a few times before, my final course for the MBA degree is called 'Strategic planning'. For a variety of reasons, the flow of this semester has been problematic: frequently there has been a lecture one week but not the next. This has made it hard to get a handle on the course material. I spent some time, however, in the past week, going over the lecture notes and improving my understanding. There were only five or six lectures which dealt with source material, and most of these reiterated material which came from previous courses such as accountancy, economics, finance and marketing.

That said, a more appropriate name for the course might be 'Business Analysis': after finishing the source material lectures, we moved on to practicing examination questions, and these tend to require an analysis of a company on the basis of data provided in the question. I completed one of these exercises when I was ill and we went over it the last time we met (nearly two weeks ago).

The day following the lecture, I found myself in a meeting with one of the business units of my company, discussing their performance. This business unit behaves as if it were existing fifty years ago: there is only a nodding acquaintance with the ERP program, the manufacturing side tends to be ad hoc (every order is different and there are no real standard products) which means that purchasing similarly is haphazard. There are no real marketing forecasts and each project is manually analysed with the help of a spreadsheet. Their inventory management is a disgrace.

During the course of that meeting, our CEO performed an analysis as if he had been sitting in the lecture the previous night (he already has his MBA degree); obviously he didn't calculate financial ratios, but he was very strong on the conclusions and list of actions which have to be taken. As I commented to the CFO (my boss) afterwards, we should send all the business unit's managers to business school as it can only improve their understanding.

Since then, I've done a little work for them by giving tools for forecasts and costing, but it will take some time before they start using them (if at all). I have been trying for the past three years to get them to use the ERP program in order to run their production but this seems to be one huge up-hill climb. Until recently, I felt that there had been no progress whatsoever, but now it seems that the CEO is going to add his influence and be present at some of the future meetings, which means that changes might actually get implemented.

They performed a stock taking at the end of March and I have been working on some analyses the past few days (which is why I am reminded of my current course as I note failings and how to correct them). Today I came across a particularly egregious mistake which I thought that I would note here.

One of the standard (or almost standard) products that this business unit makes is the entire apparatus which holds the basket (see picture). I analysed the bill of materials for one such product before the holiday and discovered to my surprise and dismay that the final product was composed of 50 sub-assemblies! This means that for every such basket apparatus, 50 work orders have to be issued and there have to be 50 completions entered into the system. As at the moment, this business unit has difficulty in entering even one such completion, I can't see how they are going to enter fifty. Presumably changes will have to be made in the bill of materials in order to cut down the number of work orders.

But, even worse, today I discovered a problem with the inventory costing of this product. One of the sub-assemblies is made by a sub-contractor: we supply him with parts, he produces whatever he produces and issues an invoice for his work. So far, so good. But the good people in this business unit order from him the final assembly and not the sub-assembly which he makes - thus every time the sub-contractor issues an invoice (which we faithfully input into our system), we add another unit of the final product to our inventory. 

To use some figures: the sub-contractor charged 850 NIS for his work for one sub-assembly. But inventory recorded one complete assembly at a value of 6,000 NIS! At that moment, the value of our inventory was artificially inflated by 5,150 NIS - which of course improves our bottom line.

Ooops!

Sunday, April 15, 2012

I've sort of been on holiday for the past week and a half, which would explain the lack of blogging. It was the Passover week, during which the company in which I work is normally closed. My daily schedule was something like -
  • work - between one and two hours a day, although one day I did travel to Haifa bay, making that a full day's work
  • reading - between one and two hours a day
  • television - the Educational television ceased screening 'Spooks' a few weeks ago, reverting to 'Silent Witness'. I recorded several episodes before having the opportunity to watch even one episode, but I'm slowly working through the backlog
  • programming - I spent several hours a day at the beginning of the week working on programs for the Occupational Psychologist
  • sequencing - I've been working on sequencing a version of Van der Graaf Generator's song 'Pilgrims'. I've completed one version, but when I play it back, it gets boring towards the end. I need to find something interesting for the second chorus.
  • eating - probably too much. My weight stayed the same for the week, which I take as a good sign
Actually, the most interesting thing that happened took place before the holiday -  a week ago last Wednesday, I had a lecture in Strategic Planning, where the class discussed a problem that we had been set, which was about a company with several products, some of which were losing their way. The next day, I took part in a meeting at work about one of our business units which functions as if the computer had yet to be developed. I felt that the evening before, I had been going over the academic aspects of how to run a company, and that during the meeting, I was getting a practical lesson in running a company. My conclusion: the managers of this business unit ought to take a course in business studies!

If I'm talking MBA, then I have to report on our mystery visitor from a fortnight before. I talked with a student who had been hovering near the economics lecturer while he had been talking to the visitor, so she recalled who I meant. She didn't know who it was, but she was certain that it was not Professor Schechtman. The only real way of knowing is by asking the economics lecturer, but he has finished his series of lectures on a Wednesday evening and so I will never see him again (unless we have some form of graduation ceremony, but I doubt this).

Wednesday, April 04, 2012

Spring is in the air

April might be the cruellest month, but as far as I am concerned, it welcomes the arrival of Spring. The clocks went forward last Friday, giving us an extra hour of sunlight in the evening (but I'm walking the dog at dawn); the temperature has increased by a few degrees, causing me to change to my summer footwear (Crocs Santa Cruz), and all the worries which were shackling my feet for the past month have disappeared.

Spring is in the air!


It's also the time when thoughts turn towards summer holidays: I've tentatively started planning this year's adventure. Our destination will be Dubrovnik, where we will spend about ten days. Dubrovnik offers a wide range of self-catering apartments of various sizes, and these seem to be a cheaper but more conducive environment than hotels. These apartments also seem to be  reserved very quickly which is why I have already booked an apartment in the building whose picture appears on the left. We'll presumably have have half of the top floor.

The next most important factor after accommodation is transport; I spoke with our travel agent yesterday about flights from Tel Aviv to Vienna and thence to Dubrovnik, but she said that in the summer months there are direct flights from Tel Aviv to Dubrovnik. We'll get an update in the next few days.

I have probably written this before: sometimes it seems that I derive more satisfaction from arranging these trips than I do from actually taking them. This time I intend that we have time for evening strolls on the beaches or in the Old Town, a chance to relax and enjoy ourselves instead of a compulsive need to try and see as much as possible whilst utilising every minute to the maximum. I've been setting up a variety of day excursions (including visits to Montenegro and Mostar), although I haven't ordered these yet.

One thing of which we will have to beware is the vast number of day trippers who descend upon Dubrovnik (by staying over a week, we can morally look down on most of the tourists!) from the huge ships which ply the Adriatic. This will mean that most days we will take a trip out of Dubrovnik during the central hours of 10am - 4pm, then spending time in the city in the late afternoon/evening.

Saturday, March 31, 2012

Sequencing "Darkness" / 2

Having nothing better to do this morning, I decided to record vocals for my cover of Van der Graaf Generator's "Darkness". The first and third verses went well enough but I had several problems with the second verse, requiring several takes. I then 'comped' the vocal track and put it through the pitch corrector. The original song is in the key of E; this was too high for me so I dropped my version down to C. Whilst some parts were easier to sing, I found myself having to reach for the C# an octave above middle C. I just about got there (and of course the pitch correction software helped) but those high notes have no power.

Whilst mixing the song, I decided to make a change in the music track: this has a flute on the right hand side and a French horn on the left. During the instrumental solo, I thought it would be a good idea to exchange the instruments' stereo placement, which required a little mixer automation.

The vocal, as always, sounded too polite (partially due to the high notes). It sounded good in mono so I didn't use my usual technique of recording in stereo and delaying one side by 50-60 milliseconds. In order to get parts of the vocal sounding more evil, I copied the vocal track to a new file, silenced the parts which I didn't need, converted the file into stereo, added a little delay on one channel and then flanged the track. The idea of the above is to thicken the vocal track at specific parts, adding a little distortion. The result is interesting but not exactly what I was looking for.

I uploaded the track to the Internet; it can be downloaded here.

After listening a few more times to the track, I came to the unavoidable conclusion that the song is still pitched too high. I transposed the song down another three semitones (it's now in A) and created a new music track. I'll listen and get acquainted with it before trying to rerecord the vocals.


Thursday, March 29, 2012

Nobel prize winner visits MBA


Wednesday evening is MBA evening this semester; unfortunately I seem to have been cursed and have managed to make only five out of eight meetings.

While waiting for our lecturer to appear, I noticed further down the hall a tall and distinguished gentleman holding a conversation with the lecturer in Economics. It took me a moment to place his face; unless I am much mistaken, I was looking at Professor Daniel Shechtman, who won the 2011 Nobel Prize for Chemistry. 

This is most peculiar, as I can't imagine why such a distinguished academic would show his face in a somewhat run-down institution (whilst we learn a British curriculum run by a British university, our lectures are held in an Israeli college whose rooms have seen better days), especially as we are a business school and he is pure science. Maybe he was a childhood friend of the Economics lecturer?

To my regret, I didn't approach him, primarily because I had nothing to say to him except 'what an honour'. And what if it wasn't him? 

Sunday, March 25, 2012

Pharyngitis, Darkness

I spent most of last week resting at home, after having been diagnosed with pharyngitis. As part of the public service, "Learn something new each day", I discovered that pharyngitis and tonsillitis are both infections in the throat that cause inflammation. If the tonsils are primarily affected, it is called tonsillitis. If the throat is primarily affected, it is called pharyngitis (I didn't know what the difference between the two types of infection was).

My throat had felt like it was participating in a sword-fight every time I swallowed; funnily enough, talking seemed to alleviate the pain (and I had to talk a lot last Sunday and Monday). But by Tuesday I was feeling very weak so I managed to drag myself to the clinic where I was diagnosed (without a throat swab, I note). The doctor prescribed antibiotics and pseudoephedrine, which was supposed to act as a nasal decongestant.

Fortunately, I didn't run a high temperature; most of the time I simply felt weak, along with great difficulty in swallowing and producing large amounts of mucus from my nose. I could also barely speak.

I spent the time by working from home, reading and by completing a new cover version of a Van der Graaf Generator song, "Darkness". I found a version which I had sequenced once, which was about 90% complete. Unfortunately, I apparently had aimed at sequencing the song as it was played (including double sax parts) as opposed to creating my own version of the song, so after I completed the copy, I then started a new version which borrowed only slightly from the original. This alternate version is much lighter than the original, which is just as well, as one couldn't really create a darker version had one tried.

Looking at this song now, some 41 years after having heard it for the first time, I am struck by how much it displays Peter Hammill's unconventional approach to chord sequences. There is nary a minor chord to be found, but there are almost all the major chords based on the white keys; the song is in E and features E, F, G, A, C and D. Note that the dominant fifth chord, B, does not appear. 

When I sequence a song, I first get its structure correct, then start adding fills and solos. This latter stage can last a long time, as I listen to the song repeatedly and get new ideas. When taking the dog for a walk (I was feeling a little better at that time), I played the song once more in my head and noticed a similarity between a few bars of 'Darkness' and 'Something in the air' (Thunderclap Newman). I immediately took the instrumental part of SITA for those bars and pasted them in to the corresponding place in 'Darkness'; that part has always reminded me of the Marseillaise, which I took as a musical joke aimed at 'All you need is love'. If so, then I am prolonging the joke. I don't know whether the casual listener would be aware of the quote; at the moment, my ears are sensitised to this lick and so it stands out.

Due to my illness, I have yet to record a vocal, although paradoxically the sound emanating from my throat might sound better than my normal singing voice.


Friday, March 16, 2012

Rubber duck debugging

I was reading yesterday about Rubber Duck Debugging, in the context of Stack Overflow. The scenario, which has happened to me several times, is as follows:
  • Programmer is stuck
  • Programmer writes a description of the problem to a help desk
  • Whilst writing the description, the programmer realises what the problem is and how to fix it
  • Programmer deletes the letter to the help desk
I went through a version of this today; following is the background. For one customer, we have to print sticky labels with identifying details on the label (this of course is not a problem). The problems start when one of our factories produces three sub-assemblies which together make up the part which the customer ordered. My program was printing three labels (so far, so good), but I was asked to serialise them (which means printing on the first label 1/3, printing 2/3 on the second label, and 3/3 on the third label).

The external program which we use to print the labels has the capability of serialisation, but this is slightly limited. Let's say that I had to print two labels for one part and another two labels for a second part. The labels should bear the tags 1/2, 2/2, 1/2, 2/2. Unfortunately, the external program was printing like this: 1/2, 2/2, 3/2, 4/2. No matter what combination of flags I tried, I was unable to print what I wanted.

Then I called the help desk - they noted my details but promised nothing.

Thinking about the problem a little more, I came to the solution. The ERP program was inserting into the 'labels' table two rows, where each row was to be printed twice. The simple fix was to insert into the table one row for every label to be printed, where each row would be printed once. I also included the total amount of labels to be printed for each part (I know that this is a seriously muddled explanation, but all will soon become clear). Now I get the results that I want.

Before:
Part numberQuantity
1232
5672

After:
Part numberQuantityNumeratorTotal
123112
123122
567112
567122

All I needed was the metaphorical (apocryphal?) rubber duck in order to look at the problem from a slightly different angle and so find the solution. All of these problems (like the Excel comments problem which I wrote about the other day) seem totally trivial after they have been solved, but they are very confusing beforehand.

Thursday, March 15, 2012

Sequencing "Lost" / 2

I had some spare time recently so I thought that I would try to record some vocals for my version of Peter Hammill's epic song "Lost". We had three power cuts on the first evening when I tried recording (there was a ferocious storm raging outside) and most of what I recorded was not worth keeping. After an hour of frustration, I realised that fate was against me and so abandoned any further attempts.

I had another go at recording the vocals last Saturday, in a break from revising about negotiation. The only conclusion which I had made from my previous abortive session was that the song was too slow; I increased the speed from 80bpm to 84bpm, which may not seem much but made it much easier to sing.

I then proceeded to record an almost complete take, only to stumble over the words in the final verse. So I recorded the final verse again, mixed the two together, deleted the original .... and discovered that I had muted the almost complete take, resulting in a composite vocal of the last verse only. Gnashing of teeth. This first take, however, served to warm up my throat, and and I recorded a complete second take shortly after, complete with minor sound effects such as the dog barking, my stomach growling and what sounds like the door to the balcony being opened. I was able to silence most of the dog's barking and my stomach; the aural artifacts that remain can only be heard when the vocal is soloed in the mix.

I have begun using pitch correction software - I have a tendency to sing about half a semitone flat - and it seems that this program can't handle lengthy files (the take lasted about 10 minutes, which means that it was about 50 MB in length - recorded in mono). At first I wasn't sure what to do, but later I had the idea of copying the original vocal file into several sections (carefully noting the offset of each section from the file's beginning), correcting each section  and then stitching the five resulting files back together. This plan worked admirably, although every file started playing a few milliseconds too soon; moving them in time was easily achieved.

Once I had all the pitch corrected files playing at the right time, it was only a small matter to create a composite file (without deleting the originals!) which became my master vocal take for compression, eq and reverb. As usual, it was very difficult to find the right eq settings; I have been using a new microphone which supplies completely different tonal qualities to my previous one and I have yet to settle on standard equalisation settings. Eventually I decided to add a strong treble boost which provides a nice sound - it doesn't sound very much like me, but that's not too important. I always find mixing vocals and music very hard; I work on it for an hour, create a finished mix, do something else for an hour and then return to the mix.

I finally settled on a mix which satisfied several rounds of listening (each time lowering the level of the vocal); I uploaded this to a file server and notified the PH mailing group. So far, the response has been encouraging; those that have commented have noted that my arrangement is different but interesting (including the vocals).

This version can be found here.

Of course, after having uploaded what was supposed to be the final version, I had some more ideas which I have yet to check. One of them involves playing the tune to a later Peter Hammill song, 'Masks'. There's an instrumental lick played at one point which reminded me later of 'Masks' and changing the lick to the 'Masks' melody should be simple - although it will involve a slight harmonic change. Another idea involves inserting a few more bars into an instrumental break in order to enhance the dynamics - I don't know how this is going to work yet. It will also involve adding some silence into the vocal file. Normally I don't care for the 'digital razor blade' but adding four bars of silence (at 84bpm, 16 beats should last 11.429 seconds) shouldn't be too difficult.

Tuesday, March 13, 2012

Post mortem on the Negotiation exam

If I am ever to be found walking the Tel Aviv boulevards on a sunny, spring day, with only happy thoughts in my mind, then it's a sign that I've completed another exam in my MBA course. Today's exam was on Negotiation, a subject which I don't seem to have written much about. Almost all of the lectures were held in December/January, leaving us six weeks in which to forget the material. About three weeks ago, I started revising, and I was pleased to note that I remembered most of the material. Since then, I've been working on specific points and looking at previous exam papers, in order to see what is required.

The exam is structured in the following manner: the opening case study has five small questions, each worth eight marks. After that, there are three essay questions, each worth twenty marks. The first three questions regarding the case study are almost always the same, so these can be learnt by heart, although obviously the data has to come from the case study. The latter two questions come from a slightly wider pool but these also can easily be memorised.

And so it was today: the case study was about a French company contracting with a British company who would provide training courses. A day before the agreement was to be signed, the French company sent an email which basically reneged on all the terms of the agreement. What are the interests of both sides? What are the negotiating issues? What is Negotek and how can it help? These questions were like an arcade game: I wrote the answers and could hear in my mind how my score was steadily increasing, ching ching! The fourth question was about the email - a clear case of closing stage manipulation to my mind. I wrote about this subject at a deeper level than the previous questions, ching ching! The final question of this section was about each side's BATNA (Best Alternative To a Negotiated Agreement) - also easy, ching ching!

The first essay question required us to contrast Fisher and Ury's "Principled Negotiation" with Kennedy's "four stage plan", specifically in the context of negotiations between management and workers in a factory about a pay rise. Since I had gone over the four points of F&U with a fellow student five minutes before entering the exam room, this material was extremely well known. Ching ching ching!

The final two questions were slightly awkward in that in first reading, it wasn't clear what they were about. After reading them through a few times, I noticed that the clue to both was in the final sentence. Unless I am very much mistaken, the penultimate question was about constructive/destructive behaviour (Carlyle and Rackham), whereas the final question was about the ten ways to making decisions. I wouldn't say that the arcade game was going ching! ching! ching! as I wrote my answers, but I should have done well on these questions.

Summing up, it looks like that I did very well on this exam, which would be somewhat ironic as it is a subject not close to my heart. On the other hand, appearances can be deceptive and the examiner may be more balanced regarding my mark. I'll know in about six weeks.

All that is left is Strategic planning.....

Monday, March 12, 2012

Proposed doctorate

After posting my previous blog, I realised that I hadn't updated my readers why the tags for it were DBA (Doctorate of Business Administration) and ERP (Enterprise Resource Planning). I wrote about a year ago about working towards a doctorate, where my subject was to be areas in which the classical model of ERP fails. But after a few months of cogitation, I concluded that I was able to find solutions for these areas of ERP failure, and so I needed to find a new subject.

This wasn't too hard as I shortly came across an article entitled Attack of the killer spreadsheet which was very much aligned with my own thinking. To quote some of the article,
The really important thing to remember about spreadsheets  is they are not the companies ERP system. The company ERP/MRP system must always remain the backbone, the main data repository, the source for management information and where business transactions and processes are recorded and tracked.

But what’s wrong with spreadsheets – I hear you ask? Well, the way most spreadsheets are configured means that they miss fundamental (and critically important) ingredients that most ERP’s are equipped with out of the box!

Improper use of spreadsheets often stems from a perceived lack of functionality within the ERP system or a work around where the ERP logic isn’t aligned to way the company wants to operate. Often the easiest, or the perceived easiest, method of fixing that is to “plug” a spreadsheet in to solve the problem. We’ve all seen these out in the field and their function can vary from a simple list (my ERP doesn’t record all the data I need) to acting as an EDI interface between a customer and supplier ERP system.

On this basis, I put together a doctoral proposal, part of which currently reads as follows:
ERP programs are packaged with reporting systems of various level of complexity and capability; these systems are normally based on SQL (Structured Query Language), a database computer language designed for managing data in relational database management systems. The use of SQL is normally the province of IT professionals who configure and support the ERP programs; the end user is dependent upon the professionals and rarely has the ability to create reports of her own within the system.

In order to circumvent this inability – and for other reasons – the use of Microsoft Excel is prevalent within organisations using ERP. The use of Excel can both help and hinder the effectiveness of ERP systems: "when employees use spreadsheets, they create the very problems that ERP systems are meant to address: silos of data, inconsistent information, manual tracking of information and broken business processes".

I propose to investigate the use of Excel in organisations using ERP in an attempt to determine whether Excel does indeed help or hinder; it may well be that certain functionality helps whereas other functionalities hinder.

I propose to ascertain this by conducting interviews with users of ERP/Excel. The majority of the interviews will be conducted with users of the Israeli developed Priority ERP system, as I am most familiar with this product. I intend, however, to conduct interviews with users of ERP systems such as SAP, Baan and Kav (another Israeli product). I also intend to conduct interviews with Priority users in Britain and possibly other countries. These interviews will enable me to determine whether the efficacy of Excel depends on the user's level of sophistication (and knowledge of her ERP system), on the ERP program or on the national culture.

So, whenever there's a blog entry about someone intending to do something in Excel and me suggesting that they do that something in Priority, know that this is connected with my (proposed) doctorate, hence the DBA tag.

Although I have applied to the DBA programme at Heriot Watt University, I have yet to be accepted, as the accepting committee will only discuss my application after I complete my MBA degree.

Another example of Excel usage

My company frequently sends chairs as examples to customers; the customers can use the chair for a period and in so doing 'get a feel' for the chair. Hopefully, a sale will result from this trial period. Even more hopefully, we will collect the example from the customer. Unfortunately, we don't have a very good record for collecting, although that has been improving lately.

Each example is sent with a delivery note; Priority (our ERP system) can track the delivery notes and can also determine which examples are still extant, yet to be returned. Today, those who are supposed to be collecting the examples decided that they would improve their performance by keeping a record of their contacts with customers who have extant examples.

I was asked how they could create the non-returned examples report in Excel; I explained how to do this. Then I was told that they intended to add comments about each example within the spreadsheet. The red light above my head immediately turned itself on.

Looking at the delivery note screen in Priority, I saw that there was an accompanying 'task log' screen which could maintain all the comments for each delivery note. The existing report would need to be modified to add the new data, but that would be a trivial matter. 

So, instead of a spreadsheet which might be passed from hand to hand, which everyone can edit (but no track is kept of who added what), which might get lost, damaged or exist in several versions, we now have an elegant database report which contains the same information, is accessible to all, has its changes logged, will always be up to date and will never be damaged. The user has to perform the same amount of work (if not less) to add the comment to the database. As far as I am concerned, this is an all-around win situation.

To be fair, my solution was enthusiastically accepted and adopted.

The solution this time was trivial, but that's not the point. The point is that when something has to be documented for the first time, people automatically think of using Excel! Of course, Microsoft  don't get a royalty for every spreadsheet which gets opened, but they must be pleased at the amount of market penetration that their product has achieved.

Thursday, March 08, 2012

House with no door / 2

I've been very tied up with family problems in the past week and will probably continue to be tied up for another week so I haven't got much time nor mental energy to devote to blogging. I do have enough time and energy to blog this scrap, though.

Continuing the discussion about the authorship of 'House with no door', I had occasion to look at the cd sleeve and the songwriting credits, which are as follows (original orthography)
Killer (Hammill/Banton/Smith)
House with no door (Hammill.........Jackson)
The Emperor in his war room (Hammill)
Lost (Hammill)
Pioneers over c (Hammill/Jackson.........Band)
As we know that Killer was definitely a joint composition, one can assume that the use of the slash (/) means that the songwriting credit is shared - thus 'Pioneers' was definitely written by Hammill/Jackson. One can assume that the use of the ellipsis (.....) indicates an arranging credit: thus 'Pioneers' was written by H/J and arranged by the band. Hence 'House' was written by Hammill but 'arranged' by Jackson - this is how his instrumental woodwind arrangement was credited.

Saturday, March 03, 2012

Incremental search in a combo box

Lately, I have increased the use of combo boxes in my programs and it has come to my attention that I sorely need incremental search. A standard combo box finds strings according to the first letter only - if the user presses 'b', then the combo box finds the first string which starts with a 'b', but should the user then press 'r' (let's assume that he's looking for 'brian'), the combo box jumps to the first string which starts with 'r'. Incremental search would cause the combo box to find the first string which starts 'br'.

Obviously some functionality has to be overloaded, but it's not clear exactly what. Googling doesn't bring up many possibilities; here is one of the more complete versions which I found.

procedure TMainForm.DocEntryCBEnter(Sender: TObject);
begin
 GS := '';
 GCOUNT := 0;
 TComboBox(Sender).ItemIndex := 0;
end;

procedure TMainForm.DocEntryCBKeyPress(Sender: TObject; var Key: Char);
begin
 AutoMatch(TComboBox(Sender), Key);
end;

procedure AutoMatch(cbo: TComboBox; var keyascii: char);
var
 sbuffer: pchar;
 s: string;
 retval: longint;

begin
 getmem (sbuffer, 255);
 if Keyascii = #8 then
  begin
   dec (GCOUNT);
   s := copy (GS, 1, GCOUNT);
  end
 else
  s := copy (GS, 1, GCOUNT) + (Keyascii);

 try
  strpcopy (sbuffer, s);
  retval := sendmessage (cbo.Handle, CB_FINDSTRING, word(-1), longint (sbuffer));
  if retval <> CB_ERR then
   begin
    cbo.ItemIndex := Retval;
    GS := cbo.Text;
    Inc (GCOUNT);
    Keyascii := chr (0);
   end
  else
   begin
    messagebeep (0);
    cbo.Text := GS;
   end;
 finally
  freemem (sbuffer, 255);
 end;
end;
Whilst this code includes some nice ideas and looks impressive, it transpires that there are several lines which are inefficient and a few which are simply wrong. At first, I thought that the AutoMatch procedure ought to be part of the DocEntryCBKeyPress code, but it is written cleverly in such a way that it can handle a multitude of combo boxes - or not, as the accumulated string gs would be common to all the combo boxes, when in fact it should be separate.

The first inefficiency is creating a temporary buffer of 256 characters every time the user presses a key (this is the call to 'getmem'). Why not create a permanent buffer for the combo box in the same way that the variable gs is created? But why even do that? This buffer is only required as a parameter to the SendMessage, and it seems that the writer had only an incomplete knowledge of type casting - whilst he type casts the pchar (sbuffer) to a longint (as required for the fourth parameter of SendMessage), he could also have typecast the gs string to a pchar - thus obviating the need for sbuffer, along with its allocation and deallocation.

It also seems that the writer had never heard of string concatenation - he can simply add the new keystroke to the accumulated string (gs) without having to use the 'copy' function.

There is an error in the line which handles the 'backspace' keystroke (#8): should the first key to be pressed be backspace (however illogical this may be), gcount will logically receive the value -1, which will probably be rounded to 65535. Instant memory problems!

The other mistake which I found only became clear after using the code - let's say the user presses 'b' (whilst looking for 'brian'). The call to SendMessage will succeed; the line cbo.ItemIndex := Retval means the combo box will display the first string which starts with 'b' and then the accumulated string is set to this value. Let's say that the found string was 'Bobby'; now the accumulated string will be 'Bobby'; when the user presses 'r', the accumulated string will now be 'Bobbyr', which presumably will not match anything!

My code looks like this:
Procedure IncCBKeyPress (cb: TComboBox; var key: char; var fsaved: string);
var
 retval: longint;
 len: word;

begin
 len:= length (fsaved);
 if (Key = #8) and (len > 0)
  then setlength (fsaved, len - 1)
  else fsaved:= fsaved + key;
 retval:= sendmessage (cb.Handle, CB_FINDSTRING, -1, Longint(PChar(fsaved)));
 if retval <> CB_ERR then
  begin
   cb.ItemIndex:= Retval;
   key:= #0
  end
 else
  begin
   messagebeep (0);
   cb.itemindex:= 0;
   fsaved:= '';
  end;
end;
I've changed the variable names slightly - what was gs has now become fsaved. This is in preparation of creating a new TIncComboBox component. This code can definitely be shared between several combo boxes as the accumulated string is passed as a parameter.

Tuesday, February 28, 2012

Sequencing "Lost"

Over the past few weeks, I have been working on sequencing the song "Lost" by Van der Graaf Generator, which appeared on their album 'H to He' in 1970 (either their second or third album, depending on how one counts). This is one of my all-time favourite songs, so much so that I was moved to record a version on cassette played by myself and two friends in 1975 (it's probably not very good). It's about time that a digital version (with controlled vocals and full instrumentation) should be created. There are only two problems with this song: it's very long and there are multiple time signature changes.

The structure of the song can be said to be thus: verse type A (VA), VA, verse type B (VB), verse type C, VA, VB, VB. I suppose that this is somewhat similar to the verse|verse|chorus|middle 8|verse|chorus|chorus structure which appears frequently, but the B verse is definitely not a chorus, and the 'middle bit' can hardly be construed as a 'middle 8'. Not only that, but the A verse is almost a song in itself, being very long and constructed of several sections.

Just to complicate matters, most of the A verses could be considered to be in 3/4 time, but towards the end, the rhythm moves into 4/4. The B verses are in plain 4/4, as is the 'middle bit'. Whilst the sequencing program which I use can handle multiple time signatures, Reason cannot; I solved this problem by having a 4/4 time signature for the entire piece, having the A verses sequenced in 12/8, written as 4/4.

My version is about 255 bars in length and plays for about 12:45 minutes (depending on the fade), running at 80bpm. The original lasts about the same time, but is faster; it contains two instrumental interludes which I elided.

I sequenced the opening verses sometime in 2009; I remember that it took me a long time to achieve something which sounded reasonable - the opening 12/8 section had to be played in a 'dignified' manner and not 'swung'. For reasons which I cannot recall, I left the work in progress to be completed at a later date. I resumed work on the song about three weeks ago, in which I added all the missing parts and then worked on making a complete and coherent arrangement. As it happens, I made very few changes to the first part - an organ riff was added to the opening verse which later transferred to what was originally a flute part. The flute transmogrified into a soprano saxophone at a very late stage. I found some good drum loops which help the final B verses immensely

I now face the awkward prospect of having to sing this thing! I don't expect any problems with the A verses nor with the middle bit, but pitching has been a problem with the B verses.

Stitching the song together has not been easy; I recall that Peter Hammill once related to me how the 'H to He' album was recorded on 16-track, thus enabling them to record songs in pieces, changing instrumentation and ambience. For a long while, I didn't think that this song was part of their live set, but I have at least one complete live performance in my collection and there is also a partial video, which used to be on YouTube.

What am I going to do with the song once it is finished? I can't upload it to SoundClick as I don't have publishing rights for the song and have no intention of seeking them. I'll probably upload it to a file sharing service which I sometime use then inform the PH mailing list about it.

Monday, February 27, 2012

More spooks

I wrote seven weeks ago about watching this prize-winning television series. Then I was in the middle of the fourth series ... little did I know what awaited me. I've just seen the third episode of series 8 and I have to admit to being shocked. Somehow, previous cast deaths had left me somewhat apathetic but today's episode left me speechless.

A few weeks ago I found the tv tropes homepage, a site which describes and notates all the various tropes which are used in television and film. As far as Spooks is concerned, [it was] a show where Anyone Can Die: Most of the time when you finally grasp who the main characters of the story are, you can expect that these characters will survive through the end of the story. Well, this is not that trope.

If earlier series of Spooks hinted that someone was going to disappear by adding a new actor, the past few episodes have seen a total demolition of the staff with no replacements arriving in advance. Thus there is no warning that someone is about to die.....

I have managed to get my wife addicted to the series as well, although she didn't see the early series and hasn't had much time lately to watch. A few weeks ago, when I was in Tel Aviv, I knew that she intended to catch up on a few episodes, including the series 7 opener. She telephoned me to say that she was crying after the death of ...; according to the Spooks forum, this was not an uncommon event. I had purposely not warned her of what was going to happen. Probably by the time she gets to this episode, I will be somewhere else and will have forgotten what happens.

Sunday, February 26, 2012

Refactoring

Unfortunately I spent a few days at home last week, mainly in bed; I had a mild case of flu. Fortunately, I didn't run a high temperature, but I was very weak and my head felt like cotton wool for most of the time. But that's all over now....

After my head returned to normal service but before my body regained its strength, I spent some time refactoring the code in the OP's management suite program. As this suite has been a work in progress for more than two years, it's not surprising that certain functionality has been repeated which can now be safely factored out. It turns out that a function to calculate how many days there are in a month appeared in three different units (and at least once I ignored leap years); this was easy to fix.

About 14 months ago, I wrote about sorting data in grids and included some very simple code. When I was looking at the management suite the other day, I realised that several units contained this kind of code,
with qTest do
  begin
   open;
   addindex ('idx0', 'num', [], '', '', 0);
   addindex ('idx1', 'num', [ixDescending], '', '', 0);
   addindex ('idx2', 'extra', [], '', '', 0);
   addindex ('idx3', 'extra', [ixDescending], '', '', 0);
   strings:= tstringlist.create;
   getindexnames (strings);
     strings.free;
   close;
  end;
After some cogitation, I realised that I could make a double saving: I could write a routine which automatically created two indices (one ascending and one descending) per field in the table, and of course I could use this routine in every module. If I remember correctly, about eight modules used this generic code; of course, now I can add it to more modules without occurring any development cost. As a side effect, the size of the executable has shrunk.

As I point out to the OP, centralising code (or refactoring) means (amongst other things) that there is only a single point of failure for each function.

Here is the new code:
Procedure BuildIndices (cds: TClientDataSet);
var
 i, j: integer;
 alist: tstrings;

begin
 with cds do
  begin
   open;
   for i:= 0 to FieldCount - 1 do
    begin
     j:= i * 2;
     addindex ('idx' + inttostr (j), fieldlist.strings[i], [], '', '', 0);
     addindex ('idx' + inttostr (j+1), fieldlist.strings[i], [ixDescending], '', '', 0);
    end;
   alist:= tstringlist.create;
   getindexnames (alist);
   alist.free;
   close;
  end;
end;

Thursday, February 16, 2012

Solving the unflushed inventory problem

Just over a year ago, I wrote at length about unflushed inventory. In the year that has passed since then, I have been fighting a mainly unsuccessful battle in order to raise public awareness of the problem. Suddenly, a solution appeared about a month ago.

I was talking with our company's ERP consultant about one of the problems inherent with bills of material (BOM): the BOM tells us how much it costs to make a part and whilst also providing the raw input into the manufacturing process. There have been times when I have needed to divorce these two functions. Even though we have discussed this before, the consultant hadn't provided any kind of solution, but this time he mentioned, off the cuff, that if I mark a certain flag in the parts table, then the part will not be sent to the production floor as a result of a production order.

There are parts whose BOM contains virtual parts such as royalties. We need the BOM to contain the royalty because this contributes a certain amount to the cost of the final product. On the other hand, negative inventory of this 'part' builds up every month which only serves to confuse the inventory system. Once I marked this royalty part with the special flag, it carried out its costing function without interfering with manufacturing. 

Such a small change can produce large gains.

Thinking about this a few weeks later,  I realised that this flag held the key to solving the unflushed inventory problem. To recap: ERP's work order (based on the BOM) says to use a certain amount of raw material (wood), but via the use of an external optimiser, the workers are able to produce the same amount of finished product with less than the dictated amount of raw material. This causes problems with stock keeping and creates what Priority calls unflushed inventory. 

For a while it seemed as if Priority was ignorant of the output from the optimiser, but then I realised that there was a 'warehouse transfer order' entered into Priority which transferred the required amount of wood planks from the raw materials store to the factory floor - this order is the optimiser's output. After some more cogitation, I realised that I could utilise this order: I could convert it into the list of parts which had been removed from the factory floor, consumed by the production process. In other words: the optimiser would cause X amount of planks to be sent to the factory floor, then my program which would remove those X planks as if they had been consumed normally. As the plank parts had been marked with the special flag in Priority, the fact that the default BOMs required Y planks became totally irrelevant.

The required program took a few iterations to write correctly, but after a few days it was working perfectly (it is now run automatically every evening). Every day I check the inventory of the shop floor in order to ensure that no wood planks are listed; if there are, then I correct the faulty definition of the plank in the computer in the knowledge that the plank will be removed from inventory the next time that my program runs.

Thus the unflushed inventory problem has been solved ... at least, as far as wood is concerned. There are still far too many parts to be found in the unflushed inventory, but as most of those parts seem to be screws or similarly small and insignificant parts, I can't get anyone interested in the problem.

Wednesday, February 15, 2012

Maslow's hammer beats again

The design and engineering departments at work have started to use the SolidWorks (SW) program; it is intended that this program will replace AutoCAD in a few years. Presumably because SW creates more files than AutoCAD, the person running the project is considering using a Product Data Management (PDM) system which integrates with SW (good idea). Unfortunately, the PDM costs a lot of money and the powers that be wish to delay the purchase of a PDM until they see that SW is integrated properly into our work practices (another good idea).

What to do in the interim? The same project manager sent off an email a few weeks ago saying that "a jointly managed Excel file saved on a network drive would maintain the SW file list". I almost had an apoplexy when I read this! I immediately sent back an email stating that Excel files might be fine as long as they are personal, but multi-user Excel files suffer from a multitude of problems, mainly due to file locking. They are also unsophisticated. What we need (I wrote) is to appropriate the database functions of Priority in order to maintain such a list; automatically we will get such advantages as proper multi-user handling, numerators, indices, auditing and text handling (an optional text screen in which users can write comments). 

We had a meeting about this on Sunday, attended by several grey Russians who tend to the inflexible. At least one was horrified by the suggestion that we maintain this database in Priority; he calmed down somewhat when I explained to him that this 'database' would be maintained in a corner of the program and would neither impinge on the rest of the program nor would require the user to be conversant with the rest of the program (although one of the huge benefits of Priority and other ERP programs is that once one has learnt how to manipulate one screen, that person can then manipulate all the other screens in the program with little additional effort, otherwise known as leveraging). Presumably this gentleman is fearful of Priority; I wonder how he is managing to learn SW. It took me about an hour to set up the database tables, screens and triggers necessary to implement what was agreed.

This discussion demonstrated a point which is very close to my heart: unsophisticated people will use a given tool, not because it is the best tool for the job but because it is familiar to them. In other words, this is a case of Maslow's hammer: when the only tool you have is a hammer, every problem looks like a nail. In this case, the hammer is of course Excel.

This is the sort of behaviour which I intend to examine once I start my DBA.