Tuesday, July 30, 2013

Synchronicity

One of the satellite tv stations in Israel has been showing reruns of 'The West Wing' for the past few months. I've seen the first three series and the last two, but had never seen series four and five before, so I was very pleased when these were broadcast. Season four was very good, season five less so.

The schedule has now got up to the beginning of series 6, which begins with a two parter about peace talks held between Israelis and Palestinians at Camp David. It is with some pleasure that I note that in real life, peace talks are (once again) being held between Israelis and Palestinians at Camp David.

One can take one's choice of expression: either plus ca change, plus ca meme chose, or life imitates art. I imagine that in real life, the results of such talks will be much less clear cut than those of the television series.

Monday, July 29, 2013

Transferring more cassettes

I spent a few evenings last week transferring to computer then editing a 60 minute cassette recording of songs which I made with my friend Robert in Feb/March 1973. At first, I had planned to write a detailed review of the material but then I realised that no one is ever going to hear these songs. Even so....

It seems as if I had the same criticisms of my first cassette forty years ago as I did now, as the second cassette answers so many issues that I raised. Gone is the dreadful percussion,  the strongly strummed acoustic guitar and the samey-ness of the songs. Instead I'm playing piano on a few songs, opening the sound out, Robert's guitar playing and time keeping have improved, and the songs themselves vary from the ambitious and fully developed to the quick, forgettable, one-offs. There's even a 12-bar rock'n'roll song presumably entitled 'The Captain Murdo blues', which contains the immortal lines
Hello pretty woman, I'm out at sea
I'm as perky as sailors can be
Playing darts halfway up the mast
I can drink grog till I can see in the fog
I've got my cap on my head
And my head's in bed
I've got the Captain Murdo blues
Unfortunately, we weren't able to execute the more ambitious (some might call it pretentious) material very well so it sounds somewhat lame now. I'm hoping that I'll be able to salvage upto half an hour of reasonably performed songs and forget about the rest.

Sunday, July 28, 2013

A neat hack: right clicking a grid's title bar

In Priority, our ERP program, there is a neat function in which enables one to right click the title of a numeric column;  the total of that column is then displayed. I was reminded of this the other day when I sat with the Occupational Psychologist, looking at a list of dockets which had yet to be paid.

After looking into the matter, it turns out that one has to use the grid's OnMouseDown event and not the OnTitleClick event, as one might naively assume. A dbGrid has the useful function MouseCoord which returns on which line the mouse was when it was clicked, and in which column; the title bar of the mouse is row 0. The first line in the code below checks to see that it was the right button which was clicked on the mouse and that the click was on the title bar. Once this has been checked, we can get on with calculating the total of one of the columns. In the form where I used this procedure, columns 4, 5 and 6 - as they appear on the screen - have numerical data. As far as the underlying dataset (qDockets, a clientdataset) is concerned, these are actually fields 3, 4 and 5; the extra screen column (0) would appear to be the row indicator column. Originally I was going to use two case statements, one for choosing which field had to be summed and one for the message at the end, but I realised that I could access the dataset's fields array and save an expensive case statement.

For those that understand these things, I think that the code below is fairly self-explanatory. The "format ('%1.0m')" is a way of getting a number like 1234 to display as 1,234, as well as adding the currency symbol. As the defined width of the string is 1, there will be no extra white space between the number and the equals sign.

procedure TDoDocketsA.grDocketsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var total, old: longint; col: integer; begin if (button= mbRight) and (grDockets.MouseCoord(X,Y).Y = 0) then begin total:= 0; col:= grDockets.MouseCoord(X,Y).x; if col in [4,5,6] then begin old:= qDocketsID.asinteger; with qDockets do try disablecontrols; first; while not eof do begin inc (total, qDockets.fields[col-1].asinteger); next end; finally locate ('id', old, []); // go back to where we were enablecontrols end; hebcontdlg (qDockets.fields[col-1].displaylabel + ' = ' + format ('%1.0m', [total + 0.0])); end end end;
It would be nice to make the above routine as general as possible but that involves knowing which fields are numerical which means traversing the fields array at the beginning of the procedure and checking each field's type. At the moment, I don't know whether I am going to use this routine in other forms so I am not going to generalise it.

Monday, July 22, 2013

Transferring cassettes

The latest gadget which I have bought from DX is a cassette player with a USB interface: this allows cassettes to be played without batteries and imported into a sound editing program on the computer.


I initially tried to connect the player to my desktop computer but the latter wouldn't recognise the device, so I connected it to my mobile computer. The device comes with the Audacity program, which has the means to decipher data being sent on a USB line as music.

Naturally, the first cassette to be transferred was the first cassette I ever recorded. My friend Robert received a cassette player as a gift at the end of 1972, probably for Christmas, and it didn't take long for me to press the player into use as a recording device. I was teaching Robert how to play the guitar at the time, but he was only at the first stages. We recorded nearly sixty minutes of music in January 1973, me playing crappy acoustic guitar and singing, whereas Robert played bits of guitar and hit found percussion. I doubt whether I have heard these recordings much since they were made, and certainly not in the past 30 years.

I have to separate the listening experience into four: the songs themselves (mainly written by me), the playing, the singing and the recording. Some of the songs have remained in the repertoire until this day and have been sequenced for MIDI; some of those in the pre-Reason days and some in the Reason era. In other words, some of the songs I consider to be good by any standard. Other songs are not so good, and generally display a lack of development. Already my harmonic palette had been formed; there are no 'three chord wonders' and few full cadences (ie V -> I). All the songs are in 4/4.

My rhythm guitar playing is enthusiastic but not particularly subtle. Certainly, I'm not banging out four strums to a bar, but the strumming pattern seems to be almost the same on every song. Most songs display no dynamic variation whatsoever, and obviously I had yet to hear about finger picking. Robert's contributions are enthusiastic but unfortunately only rarely add something to the performance; most serve to distract. There's one instrumental which sounds like he was playing the chords (probably DMaj7 and Em7) whereas I'm playing lead guitar. Unfortunately, it sounds like Robert was playing a 6/8 rhythm whereas I was playing a 4/4 line and we weren't sophisticated enough (we weren't sophisticated at all) to make this sound good. It sounds as if we are out of time with each other and makes it extremely hard to listen to this mess. Now I know why our mothers complained.

The singing is surprisingly good. My voice is higher and thinner than it is now, but I'm belting out the songs with confidence and enthusiasm. It sounds like the higher notes are lacking in accuracy, but in those days we didn't have autotune and so were less used to perfect vocals.

The tape recorder had a built-in microphone so obviously this picked up a certain amount of hum. I suppose if I wanted to be a really good engineer, I would isolate the frequency of this hum and then equalise it out, using a very narrow band. The recorder also had a slide volume control which we used to fade recordings in and out; sometimes these fades worked well and sometimes not. Although we had the 'luxury' of recording second and third takes, these were done by recording over a previous recording, so there are multiple clicks before and after songs. After I transferred the recordings to the computer, I was able to edit these out; I also fixed the fades, sometimes by editing out material at the beginning and end of songs.

I'm pleased that I manage to salvage these recordings - I'll transfer them to disc shortly - but I very much doubt that I'll ever listen to them again. We were at the bottom of a learning curve, and hopefully things can only get better from here. Next to be transferred is a cassette from a few months later: I remember that I played piano on several songs and hopefully Robert improved as a guitarist, so presumably the songs will sound better. On the other hand, I'm not too sure about the songs.

Wednesday, July 17, 2013

A radical change in our ERP program

Priority, our ERP program, prides itself on having a very strong MRP module. This is a program which scans all the open customer orders then issues work orders according to when the goods' delivery dates; it can combine work orders if the same part is needed for several orders and can also issue purchase recommendations. In a sense, it is the basis of any manufacturing ERP system and ours is very good.

In the chair division, there is a clear separation between parts which can be produced in bulk and parts which can be produced individually. If there is an order for 100 chairs with a metal frame, 10 chairs per colour, then the metalworkers can produce 100 frames at one go, but the upholsterers have to produce ten sets of different upholstery. Thus it makes sense for the metalworkers to produce items in bulk and store them in inventory, whereas the upholsterers and the final assemblers work only on ordered items. For a bulk part, we define a minimum quantity and a bulk quantity: when the quantity of the part falls beneath the minimum amount, the MRP program is clever enough to issue one work order for the bulk quantity (if not more). Obviously such work orders are issued maybe once a week. In order to do so, the MRP program has to check inventory and outstanding purchase orders, which takes time.

But in the furniture division where everything seems to be bespoke, there is no concept of producing bulk items for inventory. When a customer order comes in, work orders have to be issued for every single part which has to be manufactured. So here one doesn't need a very clever MRP program.

Unfortunately, for reasons which I have never understood completely, the man who runs the production facility in the furniture division (let's call him Vladimir - ruler of the world in Russian - but not his real name) was running MRP maybe ten times a day. This requires a large amount of computer processing, but more importantly prevents anyone else from running MRP at the same time. There is a third division which uses the same database as the furniture division; until recently, they have been "ERP free", but finally they seem to be moving into the computer age. These multiple runs of MRP are causing them havoc.

At the moment, the furniture and chair divisions work on separate databases but there are moves afoot to combine them into one humongous database. When this was first mooted two years ago, I did a feasibility study and saw that there was only one real problem which could prevent the integration - MRP.

Talking this over with my consultant, he suggested writing a work order generator which would function outside of MRP; it would issue work orders but not check inventory levels or anything clever. Several times I have tried to get this suggestion adopted but have never succeeded. I felt that the major reason for my failure was that the word 'change' does not exist in Vladimir's vocabulary. He seems to be content to run things 'the way that they have always been run', whether or not that is correct. Systems and goals change, but Vladimir keeps on in his groove. God forbid we should change how work orders are created - we might not output the correct work orders! [I should note that I suspect that some parts are produced without work orders, so this apparently strict adherence to the need for work orders seems strange at times. There are also plenty of furniture parts which don't have a bill of materials and so don't have work orders at all.]

I had written a simple work order generator for the third division which was sufficient for their needs but not enough for the furniture division.

The company's CEO heard rumours of problems running MRP and so called a meeting; Vladimir and his manager tried to cancel it. I don't know whether this was done innocently, believing that there was no problem, or deliberately in order to maintain the status quo. Whatever, the CEO ruled that the meeting be held and held it was. First, Vladimir explained how he works at the moment, after which I said, "Yes, this is how they work. It doesn't mean that they work correctly". I explained how the proposed work order generator would function, and the representative of the third division said that his simple generator works well.

I must have been persuasive enough for the CEO to decide that we would try to work with the work order generator! To be fair, Vladimir and his manager took the decision well and didn't try any stalling tactics which might be understood to imply that they had ulterior motives - or in other words, maybe the word 'change' does exist in Vladimir's vocabulary after all.

After the meeting I looked at the simple generator which I had already written and saw that I would have to extend it to handle multiple orders. This took a few hours of false starts and problems but this morning I had a program which I could test. I tried it out on a few simple examples, finding a few problems and fixing them. Then I tried it out on a more complex example and the generator passed with flying colours. At this stage, I passed it on to Vladimir for further testing. He found some problems, most of which were due to bad data (parts which had some wrong definitions); I fixed each problem and returned the generator for further scrutiny.

During the test process, I saw how I could simplify matters in the future; this requires a new field in one of the tables, so tonight I'll add the field (I can't do this when people are working) and tomorrow I'll update the generator to use this new field.

During the day, the CEO mailed us asking Vladimir when he would put the generator into production use (the CEO has little patience at times, but he also might have thought that the generator was ready for use instead of being debugged). About an hour ago, Vladimir wrote in reply: after a number of tests in our test database, I have begun to use the generator in our production database. If I find any strange behaviour [ie bugs - NN], I will pass them on to No'am for checking and correction. Generally speaking, it works very well indeed and I haven't come across any serious problems.

Who would have thought it? Vladimir actually going on record about a change (and a fairly radical one at that) working very well and almost instantly embracing it! Maybe I misread the person after all. But it all goes to show that change will be embraced when the user realises that the change is designed to make his job easier as well as everyone else's.

As far as I am concerned, this is one of the most radical changes which I have ever made in the way that we use Priority, and I'm pleased that the political side was so easy. Of course, it does help that Priority is so flexible....

Monday, July 15, 2013

My academic failures

In light of my recent academic success, the casual reader might think that things have always been this way. I'm going to let you into a little secret: unfortunately, they weren't.

In Bristol during the 1960s, there were three 'direct grant' schools for boys and four similar schools for girls; such schools received money directly from the local authority but could spend it how they liked. These schools generally demanded fees from their pupils and were considered elitist; students had to pass an entrance exam, which effectively replaced the dreaded 'eleven plus'. Alongside these schools existed a system of comprehensive schools to which were open for all. I should point out at this stage that the entrance exam was optional (as opposed to the eleven plus), so those who chose not to take it automatically went to a comprehensive. 

I like to jest that I was at the height of my intellectual prowess at the age of eleven. At that time, I was very quick in understanding problems and had a very good memory: these tools were sufficient for my then academic demands. I took the entrance exam for the direct grant schools and did so well that I was awarded a free scholarship for my school of choice, Bristol Grammar School. Those who did well were awarded partial scholarships or fee paying places at their school of choice; those who did less well were offered fee paying places at whichever school had room, and those who failed went to the comprehensives.

I did very well academically in my first year at BGS but my marks began to slip over the next few years. In my fourth year, I took my O-level exams and performed much worse than I should have done. I passed only four subjects and failed four (or possibly even five). I remember a painful meeting with my headmaster a few days before the autumn term of 1971 was to begin: I was about to ascend to the sixth form, but it wasn't clear whether I was going to study sciences or 'arts' (I had two passes in each). In retrospect, I should have repeated that academic year, but I don't remember that option being on the table. It might well have been offered, but I was too cocky at the time to even consider such an option and the loss of face would have been extreme; had there been such an offer, I probably would have ignored it and then would have forgotten about it. I was so young that even had I repeated a year, I would still be leaving school eventually before my eighteenth birthday.

So in 1971 I entered the sixth form, studying chemistry, biology and physics with maths, thus creating a precedent (as my form master put it) for studying a subject at A-level which I had failed at O-level (biology). My A-level exams in June 1973 weren't much better: I passed the first two subjects (albeit with low grades) but failed biology; I received a complementary O-level pass.

Again, in retrospect, I should have repeated that academic year, but now it was almost impossible as my parents had returned to Cardiff (thus I would lose the scholarship) and anyway I was dead set on going to Israel for a year (more of this later). Even had I gone to some sixth form college in Cardiff, a small event in October 1973 would have terminated this option (again, more of this later).

In June 1975, I sat my first year exams in university. Out of shame, I have never told anyone that I failed two of the five. I then spent two months in Israel and came back to resit those two exams. I did spend some time revising, but concentrated on areas which hadn't been covered in the first exams. Unfortunately, the resit exams were basically the same as the originals, so I didn't do well in these either. During the latter half of the second exam, I basically broke down and starting writing a letter to my examiners, pleading my case. Obviously I must have been sufficiently persuasive (or considered having sufficient potential) as I was allowed to continue my studies. I note that one other fellow student was passed onto a diploma course (ie downgraded) and one was dismissed altogether.

I then spent the next six months working for in the central analytic laboratory of Schweppes in Hendon, north west London (Sept 1975-March 1976). This period was very important to me as it allowed me to both do a job which I enjoyed and also gain some intellectual confidence. A lecturer said to me after my return to academia that all the students return confident after their first period working in industry.

The equivalent to my second year exams where held in March 1977, and for the first time in the decade, I felt confident and more importantly, prepared for them. I don't remember whether we received actual marks for those exams but I know that I did well. I haven't failed an exam since.

My final exams at university were in March 1978; again, I did well, but the final degree class was dependent upon course work as well as exams. Included in this were reports about five seminars which we attended; at the time, I don't think I realised that we would be expected to write reports which would count towards our final marks and so I didn't make many notes. I have a vague memory of sitting at my parents' new home in Cardiff and trying to write these reports several months after the events happened.

Anyway, I was awarded my B.Sc. (Honours) in Food Science, 1978, with the mark 'lower second class', which means an average of 60%. No one in the history of the department had ever been awarded a first class degree, 70% average. One student in my class was awarded a third class degree after he went to pieces in one of the final exams. I write 'awarded', but we never had a ceremony like in Heriot Watt. 

As I wrote at the beginning of this blog, I was very quick in understanding problems and had a very good memory: these tools were sufficient for my then academic demands. Unfortunately, I didn't realise for some years than being quick and having a good memory weren't sufficient; one has to learn how to synthesize the knowledge that one has in order to create something new and/or original (this sounds like some of the early material from my doctoral studies). In other words, I wasn't taught how to learn. No one was, but I imagine that those who had to work hard in order to understand the material that they were taught in primary school had fewer problems in studying at higher levels. I absorbed everything like a sponge in primary school with absolutely no effort, so I simply wasn't used to having to learn. It took me several years to achieve this, the 'seven years of darkness' as I call them, from about 1969-1976.

Saturday, July 06, 2013

35 years ago

In September 1974, aged barely 18, I moved from Cardiff to London in order to start my university studies. My course was called 'a sandwich course in Food Science' - my father humourously put it that I was being taught how to make sandwiches. What this really meant was that the course was structured with one year of studies, six months working in the food industry, one year of studies, another six months of work and then a final year of study. The final term of the final year was spent in the laboratory, carrying out a research project. As opposed to most graduates, the graduates of this course emerged with both a degree and with valuable work experience.

My final exams had been in March 1978, after which I had a short holiday then commenced work on my project, trying to find new methods of detecting the chemical xylitol in food (with little success, I might add). I can't find my old diaries so I can't be specific about dates, but I remember that sometime in June 1978 I packed up in London and moved to my parent's house in Cardiff (not my childhood home). I would be there for only a few months as I was scheduled to emigrate to Israel in September. This had to be after my 22nd birthday which fell at the beginning of August 1978; this would mean that I would serve only 18 months in the army, whereas if I would emigrate before my 22nd birthday, I would have to serve 24 months. It was worth waiting for a few weeks in order to save six months of army service.

As a newly minted Food Science graduate with a year's experience, I was able to find a summer job in an analytical laboratory in nearby Newport. It wasn't a very demanding job: I remember that there was one lady who was occupied with water analyses and two men who were experts in coal analysis; I helped the chief analyst with the food analyses. 

Two analyses have stayed in my mind: one day, someone came in with a package of fish and chips and wanted to know whether we could determine how old the oil used to fry the fish was. The chief analyst and I sat on opposite sides of a table with the fish and chips between us. He ate a chip, I ate a chip. I said that the older the oil was, the higher the concentration of free radicals (this is what one gets when water molecules are placed in very hot oil; they are very destructive). I ate a piece of fish, the analyst had another chip. Basically we had no means of determining the concentration of free radicals, but we had to admit that the fish and chips tasted fine. We enjoyed our lunch.

The other event was when someone came in with about ten punnets of blackcurrants (or maybe blackberries); the person had spent a day on a farm picking (and eating) the currants after which he had diarrhoea. I was of the opinion that the diarrhoea probably resulted from eating too many currants. I think that we made a half hearted attempt at checking whether there were any pesticides on the berries but we didn't really have the equipment. I took the punnets home and enjoyed blackcurrant cakes for the summer (blackcurrants are one of my favourite fruits).

Every weekend I would take the train to London where I would spend a sad weekend in the commune where I used to live. Almost all of my friends had dispersed so there was virtually no one with whom I could spend the time, although it was still better than spending the weekends in Cardiff where I knew nobody. Also, most of my belongings had been packed up prior to being sent to Israel in a container so I had no books nor music. Thus I couldn't really occupy myself by reading or by listening to music; I think that I used to borrow books from the public library in Swiss Cottage on one visit then return them on the next visit.

I would eat Friday evening dinner with a religious family who lived nearby. The first time that I went, the father threw a piece of challa at me after blessing the food. As a veteran cricketer,  I caught the bread instinctively but I was very surprised. After I (and everyone else) ate the challa, they explained to me that the idea was that no words should come between the blessing and the eating; normally I would have said "thank you" after receiving the bread, but one does not normally thank after having food thrown at one.

I was saving the money from my summer job in order to fulfill the one dream which I had before emigrating to Israel: to visit San Francisco. In the middle of August, I flew from London to San Francisco. Whilst I can remember details about the flight (the first leg was from London to Newark, then a wait and finally a flight to San Francisco arriving at midnight local time, but 24 hours after leaving), I don't remember how I got to Heathrow. Thinking about it now, I probably traveled on the train from Cardiff to London the day before, then took the underground to Heathrow. I'll write about this at a later date.

Friday, July 05, 2013

Doug Engelbart, inventor of computer mouse, dies at 88

Read the obituary here.

I first head of Engelbart years ago when I read Stephen Levy's seminal book 'Hackers'. I came to the computer revolution relatively late as far as the events in the book, but reasonably early compared to most people.

I first worked with a computer at the beginning of 1983: a terminal (typewriter and printer) which was connected by landline to a PDP/11 computer some 20km away. A few years later, we got screens and keyboards along with our own PDP/11 which was a huge improvement. In around 1984, I was teaching programming in Pascal on Apple computers using the UCSD system and eventually wrote my own 'book' called Pascalgraphics. I bought my first IBM clone in 1985 (1986?) and remember taking a university class in Prolog at the same time.