Justifying Embarrassing Errors.

I remember when one one of my grandchildren helpfully decided reorganise a bookshelf whilst by himself. Upon being discovered, sitting in front of an empty shelf with books strewn all around him, his instinctive reaction made me feel proud to be his grandpa. He looked up and said, “Oh dear! Oh dear! what happened?”, as if this calamity had occurred spontaneously, astonishing him as much as the angry parent who was going to have to tidy it all up. It is hard to hide amusement when you watch your kids have to deal with their kids.

Advanced Disaster Management Strategy for Grandchildren and Programmers

You see, he had acquired the first step in Advanced Disaster Management Strategy for individuals who have caused the disaster and know it. Display Of Surprise, is good for buying time, creating a flicker of doubt in the prospective accuser, and allowing the next phase to be implemented. Such is the lot of us amateur programmers, who in attempting to display what they had felt was a masterpiece, are discovered having produced mangled unintelligible rubbish. The ever-helpful Perl programming community are able to step in and gently point out that usingperl-untidy was not such a good idea.

The next phase in ADMS in any project, is to Identify Someone Else to Blame. At first glance it might appear difficult in solo projects, but inevitably all projects have dependencies, and one can always say “If only $target_for_blame was able to cope with my advanced needs…”. This target could be a module on CPAN or the language itself.

But eventually you get found out. You get found out because the people you are sharing the code with know a lot more, have experienced bad coding practices, and spoken out against these before. Personally, I have a sneaky suspicion they have done dodgy coding themselves, no matter how much they deny it. But here we are, red-faced, mumbling, shuffling feet and looking at the floor. The next phase starts. You start Justifying the Errors. The old “feature-not-a-bug” strategy. “I wasn’t trying to create obfuscated code…I was trying to make it more compact”.

The eventual “recovery phase” requires a reluctant re-write. It is true that Paella v0.07 grew in size by 80% to v0.09 without adding any significant functionality. This was purely to try and make the code a little more legible, object-orientated, structuring subroutines into packages, such that it may be easier to reuse elsewhere, perhaps allow others to re-spin the code and many other potential benefits. I tried to do this, without grumbling all the time. It was difficult. You see the purpose of the project was discovery, but progress was being held back by the desire to satisfy the tidy-minded observer.

“Mummy is being really Mean, grand-dad,” said the little monster.
“It’s ok, mate,” I tell my offsprings offspring. “Mummy is only grumpy because she doesn’t understand. Her mummy is the same with me.”
“Does gramma tell you off too?”,
“You betcha!”
“I was only trying to fix it, like you said”, sniffles follow.
“Shhhh! I know, but hey, who needs to keep things tidy, when we have more important things to do…?”

You almost feel obliged to encourage the little beggars.

Making time to waste.

Over the years that I have existed in four dimensions, I have come to accept that time is not a linear concept heading inexorably in one direction at a uniform rate. It didn't take an Einstein or Hawking to convince me either. Time is as malleable as the distortions applied by our consciousness, or imposed by those around us. Consider my youngest daughter's essay due to be handed in on Tuesday, a task assigned 4 months earlier. At 4,000 words, it represented roughly 6 words an hour allowing for eating, sleeping, work, weekend fun, and other essential time-devouring activities. Yet the "I have got plennnnty of time, chill, dad!" of a few months ago, has now turned into cries of despair, as she has to do an all nighter at her desk instead of being at some selfie-rich event critical to her mental well-being and social standing.

The same happens at work when I get hauled over to the management because something I have no control over happened that shouldn't have happened. It seems that the eternal role of some such individuals is to improve efficiency and productivity without actually doing anything efficient or productive themselves. A strategy that some favour is to highlight trivial events, hold someone responsible, persistently bring this up at various encounters and thereby have justification for their existence, rather than allow access to the time machine that would enable correction of this past undesirable event.

One thing that might help these recurring, seemingly totally avoidable, but absolutely inevitable episodes, maybe be a set of rules. I have recently discovered RRULES, EXDATES and RDATES that can be embedded into iCal objects to define repeats of events. Some may be be repeated forever, some being confined to certain days of the week, each represented in a human readable form but parseable by machine. In order to achieve as much flexibility as possible, the rule structure is as complex as it is comprehensive.

One has two options when encountering a novelty such as this. One could look through the extensive experience and expertise of the Perl community who would naturally have some way of parsing these rules; easy, efficient and most likely to work. Work such as iCal-Parser by Cedric Cellier and Data::ICal::DateTime by Flávio Soibelmann Glock. On the other hand, one could try and build one one's self.

RRULES can become complicated,

# every year forever
"FREQ=YEARLY",       

# every other week forever
"FREQ=WEEKLY;INTERVAL=2",

# first week every month excluding weekends until                               
"FREQ=MONTHLY; BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1;UNTIL=20141129",

#  every three years on the first Tuesday of October that is not the 1st of October
"FREQ=YEARLY;INTERVAL=3;BYMONTH=10;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8",

Parsing this kind rule can become rather difficult. Generating them reliably to do what you mean without ambiguity is similarly tricky. Feeding back this rule to the user in plain English is something that can also be challenging. It helps to steal other peoples ideas, but often one is trying to crowbar these rules into a project that has already been started, and a more eye-opening, time-consuming failure-ridden approach is required.

Finding time to do the research is difficult when you have a day job and many other demands on the time. I am sure the reader will have many experiences of temporal field manipulation, or perhaps are experts themselves. Time is infinite, but the time allocated to us is finite. We may choose to rush through life collecting as many experiences as possible, maximising the utilisation of this limited resource to earn, spend, learn, teach, give, take, create or destroy. I am told I waste a lot of time. I write code other people have done better for no return other than the same joy my grandson may have from drawing something unintelligible to show me. Sometimes I do it just so that something else more important can be forgotten, for even a little while. One could (or perhaps should) choose to do nothing other than to savour time that we do have, giving ourselves time to do nothing more than be alive.

Time may be precious but it will not be contained, disappearing from our grasp whatever we choose to do or not do with it. For me whatever you with it, time is never wasted. As one who has someone very dear to his heart going through a serious illness, time spent just being with someone you love is the most precious, irreplaceable time of all. Wishing you all happiness, love and peace.

Making a Super Cal if Rage Will Stick Ex Paella Down Us

Something I am not good at

The paella must be possibly the worst national dish ever created, I thought to myself as I looked at the charred remains in my pan. It is as if the mind of some ancient Spanish conquistador, returned from his conquests abroad feeling hungry and unfulfilled, dreamt of bringing byriani to Spain, but in the midst of pillaging had forgotten to take culinary notes.

"How difficult can it be, Jose?" the weary warrior muses,
"Yeah, yeah, its just rice and meat, innit", says his Catalan colleague coming from the Spanish equivalent of Birmingham.
"We could use something flavourless, amorphous and chewy, like mussels, instead of meat",
"Whoaaah, nice,",
"And langoustines...",
"langa-what?",
"I know, right? Just throw them all in, don't bother shelling them",
"Raphael has some tomatoes he doesn't need for pelting passing pedestrians",
"Ahh...the flavours", fanning the flames as the smell of their concoction cooking brings back fond memories of far-away burning villages.

As I proudly presented my still smouldering efforts on the table, I am met with quizzical glances.

"What is it?" asked Mrs Saif, "I mean I can see what it is, but what is meant to be?",
"Its Spanish! Paella!", I exclaimed, "It's what Nadal, Ballesteros, and Ronaldo eat, guys. Come on, tuck in!",
The kids were not too sure, "Looks like your byriani" said one, encouragingly.
"Ronaldo is Portuguese," said another hoping to distract while passing her food to the dog who knew better.
"Look, why don't we order Mexican" said Mrs Saif kindly, "and you can try something you are goo.. err.. not so bad at."

Something I am not as bad at

Failure, I am used to. Under appreciation, I accept as the condemned accepts the noose. If I can divert my attention to coding instead of cooking, I may perhaps have less cause for despondency. But for me, the two streams of activity, cooking or coding, have the same triggers, and very often the same outcomes. Some one says: "You can't cook", outcome: paella. "You can't do this in Perl", outcome: more burnt offerings, sacrificing time and sanity, yielding an unrecognisable, unconsumable concoction for presentation to a community that never wanted it in the first place.

So when one person on Reddit presented a gist to use bash, ncal and Perl to create a week counting calendar on a terminal, I thought, hey this could be done in Perl alone.

calendar.gif

What's the point?

Here-in lies the problem with the irresponsible, belligerent coder, unsatisfied with mere re-implementation of another's code, who has to add his own flavours into the profusion of existing successful recipes. After all, MetaCPAN has no shortage of Calendar Modules, including Manwar's collection of excellent exotic calendars. EDIT: In fact Dave Cross' Calendar::Simple has an example which does exactly this.

I have started yet another project, this time a Calendar Application for the Terminal, which will (eventually) be interactive, customisable, use terminal colours for highlighting, allow adding and removing of events, will import, export and use standard .ics files, and create crontab lines. Or it might end up an exercise that once again reveals how inadequacies overcome aspirations.

Similar things exist (CalCurses, uses curses library) and (khal in Python) as well as cal and ncal, for those interested in such tools. Of course, I know my limitations, and this project will be Pure Perl. Pure Madness. Of course, if someone gets the title of this blog, somehow, it will prove to me that there are such other mad people around.

When Saif Met Sarah

The Perl and Raku Conference 2023

The Perl and raku Conference 2023 in Toronto was an event I was really looking forward to. A chance to rub shoulders with the giants of Perl and Raku, absorb insights and innovations of the nerdy Perly community...everything they said in the blurb. It was very well organised thanks to Alex, Sawyer, Makoto, Amber and Peter, herding an army of volunteers. Such a knowledge-intensive event should be recorded for posterity, trapping the wisdoms and inspirations from the wise and inspiring in the container that is YouTube.

Amber the jolly secretary also brought two additional support workers in tow. Logan, a bright, engaging young sprog immediately announced two critical facts when I first shook his hand. 1) that his younger sibling, Oliver, was extremely mischievious, and 2) he was an expert in drawing and making videos. He had in fact made 4 while I had to admit I had made none. Not wishing to be outdone by an 8-year-old, it was inevitable that I should volunteer to join the video committee; no sooner had I done this did I realise the complexity of the task at hand and my devastating lack of competence.

An operation run with military precision by Sawyer with extremely fine-grained attention to detail (he had 4 pages of narrow typed instructions labelled "Rough Instructions", just for pressing a button the video recorder), the mission objective being reliably capturing 3 days of talks running in 3 parallel streams, each talk in two separate media. The media would have to swapped and rushed off after each talk to the waiting hands of Alan with a production line efficiency that would put Henry Ford to shame, for uploading to various local and cloud storage systems. These would then be picked up by Josh our media manipulating moghul. Sarah, a trained nurse and naturally able to handle critical, life and death scenarios, absorbed the position of lieutenant and took charge. This is going to be easy, I thought.

IMG_5526.jpg

Do you ever get the feeling that perhaps you shouldn't have tried to compete with an 8-year old? I learnt the hard way. You'd think that as attendee and speaker at a computer programming conference, I would know how to use a laptop. I fumbled, panicked, had no clue how to handle the alien device that was Bruce's laptop. Bruce was Sarah's husband. Alan, ever structured in thought and deed, had developed a "system" and had to take over as I approached hysterics, unable to figure out the two finger click, drag, twist, and tumble that might do the trick without the macbook exploding into flames. It was at this point that Sarah put my hand in hers.

When Sarah took me by my hand, it could logically only have meant one thing. I knew Sarah wasn't blind, I mean she wasn't bumping into walls or anything. I also knew she wasn't a poor judge of character, after all she managed to snag Bruce. I must be dying I thought, and Sarah's nursing instinct must have taken over. Instead she reassured me, gently dragged me away from the computer and let Alan do what he did better than I could. It was agreed I would ferry the media back and forth, and try and minimise the damage I could inflict on the operations. She also discretely ushered in Jonathan who literally saved the day sacrificing himself by taking on the task of Sisyphus at the computer transporting hundreds of gigabytes of data, his fashionably manicured fingers a magical blur over the laptop.

Defeated, this change of plan worked out in my favour. I managed to meet some of the super-brains of the Perl community. Curtis "Ovid" Poe, was a quiet, wise man who listened more than he talked and quietly absorbed my incoherent mumbles as I spoke to him. David Rolsky was there towering over everyone in both stature and his comprehensive expertise in multiple languages, giving a powerful and compelling talk about Rust; he looked around wondering where the sound was coming from as I attempted to speak to his navel. Ingy, the eccentric entertainer, demonstrated his ability to speak in tongues, having memorised the entire Rosetta Code website. The energetic Will "The chill" Braswell was there with his super-chilled partner Bennie. He had menacingly trained his pet workstation to replace all other Perl programmers, at least after we found batteries for the remote control. We even had a remote talk by Paul Evans, who presented the most eagerly awaited feature of new Perl...a new way to do things even more differently than before. The White Camel award went to Mohammed for his magnificent project he had humbly created, The Weekly Challenge. Zaki demonstrated how cleverly he had ported his own cerebral connections into PDL. Sawyer, former Pumpking, gave talks to a full house, standing-room-only, which were personal, thought-provoking and insightful. There was even a quiz, I managed to get 4/30, beat that suckers! Indeed, everyone of the attendees and speakers were celebrities in their own right but unable to split myself in three, I was unable to interact with all. Listing all the talks and interesting delegates would be impossible; the meeting was packed, exciting and managed to deliver a rare combination of education, social awareness and fun.

After 3 solid days I left exhausted, satisfied and proud of being a part of this glorious community. As I type this blog, I realise how easily this group of strangers welcomed me, made me part of their family. I felt blessed.

Inevitable Improbabilities

Guys anything can happen. There is literally no way of avoiding something that you haven’t prepared for. So in the face of mounting anxiety over the huge number of unexpected scenarios that may be around the corner, what can you do? You can contemplate insulating yourself, try and minimise the hazards, control your environment to a fine level of detail so that the surprises are infrequent and hazards are mitigated. At work I am drowned in Health and Safety Guidance, IT security protocols, Fire Safety Training. This means that work is to a large extent a somewhat boringly protected environment for me, my colleagues and my patients. Yet, even this can not avoid surprises. So what about your home, sitting in front of your computer. All the protection provided by protocols here are more vague, less policed, seen more as guidelines rather than mandatory.

The worst enemy

Being left to your own devices is perhaps one of the most dangerous situations to find yourself in. I find it difficult to imagine there to be a more extreme difference between the personal perception of safety and the severity of potential calamities in these circumstances. It is therefore incumbent upon those with idle time, to utilise that time to create simulations to prepare for the unexpected apocalypse around the corner. The probability that one may find one’s self having become lost, ending up 400,000km away in an experimental lunar lander may be extremely small, but possibly not zero. There may be small risk that the lander’s automatic attitude and thrust controllers have become inoperative requiring manual control to land the craft in terrain that is not generally flat. Even if it is extremely unlikely, one might find this endeavour to be made more hazardous by previously undetected vacuum breathing aliens, also orbiting the moon. Got to be ready.

The right attitude

Rocket science this ain’t.

An orbiting landing module may have a transit roughly parallel to the surface of the satellite. In order to descend the lander would need to use thrusters to slow the craft facing away from the direction of travel; this decreases the forward motion, the craft descends to a lower orbit adding a motion vector in the direction of the surface of the planet, and gravitational forces start the acceleration towards the ground. to fast an approach makes the next burst of thrust directed at both slowing the forward velocity as well as the rate of descent. Once the forward velocity is reduced enough the loss of centripetal forces means the vehicle is now experience the full force of lunar gravity, and the right amount of downwards thrust is now required the safely land the vehicle

Earth’s last hope

The initial landing may hopefully avoid the orbiting space monsters; the craft is unarmed, as one might expect from rocket engineers who failed to consider the evidence from countless movies on this subject.. Whilst on the lunar surface I would need to build a regolith cannon to fight the aliens, whose next target would potentially be earth. Humanity would be counting on me to suppress this invasion or die trying. Wish me luck, guys, I am getting ready.