20201115

Love hate Python

There was Visual Basic 6 (VB6)... and then there was Python.  Both are interpreted languages (i.e. they run from a high-level script rather than being compiled into machine code). Both claim to be easy to program with and both have a huge following. Python is current whereas VB6 is no longer supported.  Python is free whereas Microsoft have made VB6 neither free nor available but say that it is superseded by VB.NET.  But these are very different languages. Having sharpened my teeth on plain BASIC (e.g. BASIC PLUS in college days, QuickBASIC running under MSDOS) I progressed to VB6 which I used extensively for creating test software to exercise electronics I have designed in the course of my work.

In case I ever have the privilege of helping homeschoolers here with teaching computer science, I figured I ought to learn a current language. I did a bit in C# a few years back for a work project and, whilst C# is a very powerful language (meaning you can do certain complex things with minimal coding), I found its syntactical gamut too much for my poor brain. So, what more suitable to up-and-coming programmers than Python, or so I have been told?

Many years ago I authored some QuickBASIC code that would display prime numbers in a square spiral.  The essential part took a mere 20 lines of script, and here's the output, limited to the VGA 640x480 screen resolution of the day with each integer represented by a single pixel. You can click on each image to zoom in.



The point of the program, apart from being an exercise in graphical output and being cool, is to highlight the mainly diagonal line patterns that prime numbers arranged in this way make. Anyway, this became my first Python challenge.

Here's the output of my Python code - a bit prettier because now each integer is represented by a 4 x 4 pixel square. Value 1 is plotted as a blue square, otherwise primes are red and non-primes grey. The essential part was almost 100 lines of code and took a long time to code. OK, so I am a novice but even so...  I tested it with three different algorithms for finding the primes - the fastest involved saving the primes in a Python list.


And here's the same in VB6.  It was so much easier to do the graphics part in VB6.  Python graphics is anything but intuitive and seems to employ the longest path to achieve the least credible results, whereas in VB6 you simply drag and drop graphic widgets and then click on them to open their respective code space. That they are event driven is taken for granted unlike Python.



Oh, and although no-one on ever claimed VB6 was fast, without pausing to do animated screen redraws I found my VB6 code ran about twice as fast as with Python.  I tried different prime algorithms but found the VB6 code ran fastest by dividing each integer numerator by all the denominators from 2 up to the square root of the numerator, which for large integers involves many more test divisions than did my Python code. That VB6 was still significantly faster says something in its favour.

And then, although Python is an interpreted language like VB6 or QuickBASIC, it has no native integrated development environment (IDE) so testing and debugging entails constant swapping between your chosen text editor (I used Notepad++) and the command line.  Although there are 3rd party IDE's and I am currently investigating Microsoft "Visual Studio Code" which, surprisingly, is free.

So do I love Python? Well, not yet, certainly! 


Face masks forever

It's not that I think face masks are totally ineffective in preventing the spread of Covid-19. But probably they are more of a statement of conformity and a reminder for others to "keep their distance" than having any real benefit. It's pretty clear that they do not stop all emanation of droplets from the wearer's nose or mouth but arguably they might direct airflow to the sides and thus away from... well that depends on where the objects of contamination are standing...

And then there is the argument that a mask will harbour nasties and thus exacerbate the problem. I've spoken to a qualified nurse involved on the front line and she pointed out that medics should replace their mask every 2 hours to mitigate this effect, thus clearly admitting this problem. Meanwhile the rest of us indefinitely re-use our single-use masks.

There is a considerable degree of absurdity about the whole issue of face masks.  There is also a deal of misunderstanding like a neighbour I noticed mowing her rear lawn whilst wearing a face mask. Or a cyclist passing me wearing a face mask. Presumably they mistakenly think it will protect them? But I reckon the following examples take the absurdity ticket.

I happened upon a Youtube video of Gustavo Dudamel conducting Mahler's Adagietto from Symphony No. 5. to an empty outside auditorium. All the musicians were not only socially distanced but also wearing face masks! In that video there were only strings and a harp but take a look at these pictures below that I grabbed from the internet. An apt comment on one web site was: How useless , ridiculous and humiliating for the poor musicians who are ready to accept these inhuman conditions in order to keep their job and continue their passion.



Note some but not all examples seek to cover all the exit holes as well as nose and mouth. You have to at least give these ones 10/10 for effort, even if there is little chance of any efficacy. 











20201114

Turkey Tail

We are in Willand again and I have been set the task of collecting Turkey Tail fungus (TT) which, I am told, has desirable medical properties and is plentiful. So I added this task to my existing tendency to go for runs, barefoot. Having visited the pop-up cafe in Bridwell Park to buy cake from their Covid-19 takeaway service and finding that at present they welcome folk to exercise in their private grounds (hoping it will increase sales of cake), I added this place to my run-list and discovered the seemingly one and only instance of Turkey Tail in the whole of this part of Devon. 


nicely rotted timber, but no TT

remains of Culm Valley light railway

rotten wood, fungus, but I think it's not TT

An ideal habitat, but could not find TT

Beautiful, dead, inaccessible, no TT

Ha! Some bracket fungus, but not TT

A stag in Bridwell Park

My former swimming place, note the noose

Noose from other side (how did I get there?)

Could this be TT?  Apparently not

or this?

wrong shape

might be, but we erred on side of caution

certainly not

Ha! At last! We harvested this

Strange pyramid in Bridwell Park

This monument was strange, ugly and out of keeping IMHO. My research yielded only one hit which claims that some 250m east of the house stands a pyramid composed of stalagmites, which incorporates a trefoiled piscina. I reckon the piscina (a shallow basin placed near the altar of a church) had been removed and there was no sign of a church nearby either. Mysterious.  The marquee in the background was part of the "pop-up cafe" before Covid-19 came along.


The lake at Bridwell

More TT