mailto: blog -at- heyrick -dot- eu

Tea v0.10

I have made a couple of small changes to Tea.

The first change is that random values were used to generate the UIDs of schedule entries when exporting as an iCalendar file. Now these random values have been removed and replaced with a CRC generated from the programme title; so the Tea ID, the title CRC, and the start time should all make a unique but repeatable UID.
Why repeatable? It's so you can export a schedule and merge it into your calendar with some existing entries duplicated, but not have duplicate calendar entries.
Tested by exporting three files and editing these exported files to contain only next Friday onwards (as earlier entries were already in my calendar with the older UID style) and then importing them into Google Calendar website, the app, and the website again. As expected, only one copy of each entry is in my calendar.

I've also tweaked the programme fetching to give up sooner in the absence of a valid fetch, so you won't see the error message a few times in a row any more.

The one I'm not going to fix is schedule clashes caused by the channel modifying the programme. Here is a dump from my Schedule (using the debug option):

  5 : A Kind of Spark
      The Spark. Addie finds a witch jar in the woods and begins a life-changing…
      ChannelID = 822; Unixtime = 1716211200; Duration = 25
      Flags: Warned = 0, Pending = 0, OnNow = 0, Clash = 1

  6 : A Kind of Spark
      The Spark. Addie finds a witch jar in the woods and begins a life-changing…
      ChannelID = 822; Unixtime = 1716211500; Duration = 20
      Flags: Warned = 0, Pending = 0, OnNow = 0, Clash = 1

This is the programme that will be broadcast tomorrow just after lunchtime. Sometime between the schedule appearing (I probably would have done it sometime in the middle of last week) and now, the programme is now marked as being five minutes longer and starting five minutes earlier. They are sorted into date order, so #6 is the original, #5 is the updated schedule. It's worth noting that TVGuide.co.uk still has the 2.25pm/20m version. I'll have to set the recorder to cover both possibilities, and cater also for an extra few minutes at the end as CBBC is never on schedule (great lesson to teach children, Auntie!)...
...anyway, the schedule changing is out of my control, so I'm not going to do anything about this. You'll need to re-add the schedule, and note that it will potentially be marked as clashing because if the start/duration change, it won't be seen as a dupe. As for the original, now orphaned, entry, you'll just need to wait for it to expire and get automatically cleared. Blame whoever sets the schedules...

Speaking of which, I've fixed the super-secret debug menu so the menu actually appears. I had forgotten to change the offset when I added the export, so it was being attached to the wrong menu entry (the Export) and not showing up (as Export goes to a subwindow). Okay, that's three things and not a couple. Oh well, I never was good at maths.

Download tea_0-10.zip (385.83K)
For RISC OS machines.

 

cppcheck

From time to time I pass cppcheck over my code, just to catch any whoopsies that the compiler didn't spot.
In order to avoid having to look up the syntax each time, I created a TaskObey file to perform the checks.
Quite a mouthful
This is quite a mouthful.

Let's break it down. There are only two lines. The first sets the current directory to the one in which the Obey file resides, it makes things simpler for the cppcheck syntax.
The rest is all one line and it's the parameters to pass to cppcheck in order to perform the scan.

Let's look at each part in turn:

--enable=all

This is used to switch on all of the checks. This is a longer, deeper, analysis than simply looking for common gotchas.

--inconclusive

This is used to additionally list things that may be issues, but may not be issues. It's up to the programmer to check, but if the analysis flags up something, better to see what is upsetting it even if it's a false alarm.

--config-exclude="DeskLib:"

By default the scan will run through each conditional option in turn, so this is what happens if I check the web fetcher module:
Checking c.fetcher: FETCHTRACE...
Checking c.fetcher: SSLDEBUG...
Checking c.fetcher: SSLEXTRADEBUG...
Checking c.fetcher: _DLL...
Checking c.fetcher: _DLL;_DeskLib_SDLS_CLIENT...
Checking c.fetcher: _DeskLib_Dialog2...
Checking c.fetcher: _DeskLib_Error...
Checking c.fetcher: _DeskLib_Event...
Checking c.fetcher: _DeskLib_Menu...
Checking c.fetcher: _DeskLib_Resource...
Checking c.fetcher: _DeskLib_Template...
That's a lot. As it happens, only the first three are my conditional compilation options (as you can see, it's for debugging). The eight remaining are options to do with DeskLib; so by excluding DeskLib, we don't need to waste time with testing things that have no relevance to the program.

--template "blahblahblah"

By default, cppcheck outputs information with all sorts of ANSI colour codes, which are of no use in a TaskWindow (or RISC OS in general unless running it via Nettle). Like this:
[1mc.fetcher:114:21: [31merror:[39m Uninitialized variable: domainparts [uninitvar][0m
      bytestotal += domainparts[recurse]; // cppcheck flags this; domainparts is set by SWI
                    ^
By overriding the output template, we can make our own style, which results in this:
c.fetcher (114): error (uninitvar): Uninitialized variable: domainparts
      bytestotal += domainparts[recurse]; // cppcheck flags this; domainparts is set by SWI
                    ^
Much clearer.
Note the double backwards slashes ("\\r\\n" instead of "\r\n").

--suppress=unreadVariable

This is to stop the output being cluttered with stylistic warnings. When I create variables, I habitually set them to '0'/NULL/"" (as applicable) at the point of creation, even if the next line of code assigns them a different value. This helps with debugging as they are always initialised to a known dummy value rather than "whatever was in memory at that point".
As a side note, if you have some code that behaves differently in a debugger than as normal code, it may be because you're using something before it has been explicitly given a value. A good debugger will sanitise memory allocations, usually to zero bytes. What I'm doing is something similar, so if a pointer causes problems and I see it is set to &0, then I know it has not been set. If I didn't assign the pointer to NULL at variable creation, it would have some random value and I'd end up chasing red herrings trying to work out why it was given that particular value; especially if the value changes each run as that sort of thing is often symptomatic of something corrupting the stack...which isn't actually the problem in this example and would, therefore, be a waste of time and effort.
However, cppcheck frowns on the practice and reports many instances such as this:
c.wimp (2924): style (unreadVariable): Variable 'winwidth' is assigned a value that is never used.
   int    winwidth = 0;
                   ^
So this suppression tells it to shut up.

--suppress=variableScope

I also tend to define the major variables used in a function at the beginning of the function. It would be technically possible to place a lot of these variables within sub-blocks, such as within the braces of a loop. I don't like doing this as it potentially leads to having variables created all over the place within the function which is, for want of a better word, icky. So this suppression silences messages like this:
c.wimp (2924): style (variableScope): The scope of the variable 'winwidth' can be reduced.
   int    winwidth = 0;
          ^

--suppress=uselessAssignmentPtrArg --suppress=selfAssignment

These two relate to DeskLib and the compiler.
Most of the DeskLib Wimp handlers are defined in a manner similar to this:
static BOOL iconbar_handler(event_pollblock *event, void *reference)
I don't think I have ever used the "reference" value. It might be useful for applications that have multiple instances of the same window (think of something like Edit or Zap with multiple files loaded, it'll be the same event handlers, with the reference to tell the files apart).
As a particular quirk of mine is to have a program build with zero warnings or errors, the first line of code (after the variable definitions) is:
   UNUSED(reference);
This amounts to a macro that assigns reference to itself in order to stop the compiler whinging about an unused variable. Instead cppcheck would complain:
c.wimp (1002): warning (selfAssignment): Redundant assignment of 'reference' to itself.
   UNUSED(reference);
   ^
Or sometimes:
c.wimp (1001): warning (uselessAssignmentPtrArg): Assignment of function parameter has no effect outside the function.
   UNUSED(event);
   ^

These suppressions are all done in order to reduce clutter in the report, so that actual problems stand out rather than being buried amongst all of the stylistic reports.

.

Finally the dot. This means "check the current directory". If you recall, DOS/Window and Unix-like have the convention that '.' means the current directory and '..' means the parent directory.
As it happens, '@' appears to be understood as well (the RISC OS way of saying the current directory) but I was following the built-in help so I went with a dot.

All together, this makes a "just click on this" file that will invoke the full checking with custom formatting and exclusions in order to cast an electronic eye over my code.

 

Oh, and remember above where I said that I consider any compiler warnings at all to be a build failure? Well, you can guess how much my mind gets freaked out over the RISC OS ROM build, which is hundreds of screenfuls of warnings.

 

Mental Health Awareness Week

Today is the end of (European/UK) Mental Health Awareness Week, which overlaps the American Mental Health Awareness Month.
That you probably didn't know that shows how much people avoid discussing mental health.

There are many types and degrees of mental health issues, so many that it's almost astonishing that there is even a concept of "neurotypical" or "normal".

A lot of people these days are suffering from depression, and it's not hard to understand given that we live in an increasingly confusing and nonsensical world in which we're brought up to be good people yet complete wankers seem to rise to the top. Remind me of this once the orange bloke from Florida is elected President again. The big problem with depression is that it can sometimes seem like trying to find a black cat in the pitch black, there's no light, there's no hope, and frankly please remind me why I even bother anymore...

Related to the above are those suffering from anxiety. It seems as if life was much simpler in the past, the possibility of a job for life and a final salary pension. Actually the '80s sucked for many, just ask a coal miner, but people perceive things to have been better. This, too, is not difficult to understand given the prevalence of Zero Hour Contracts in countries that hate the working class so much they haven't outright banned them; the price of property meaning more and more people will never own their own home or will own it with a scary mortgage, leading to a lack of security as to where they'll be living; stagnant wages and inflation leading to people in modern developed countries having to ask themselves "do I eat or do I heat?"; increasing numbers of children being in poverty; not to mention the knock-on effects of the Covid lockdowns to those who had active social lives and then, suddenly, had four walls to stare at all day.
And if you're a child, particularly a girl, there's all the peer pressure via social media. It was bad enough growing up without it, but now the arseholes have found clever new ways to bully those who are just a little different.
This sort of thing can often be a domino effect, where there's that one little event that pushes the button just a little too hard.

Bipolar, schizophrenia, epilepsy... these are known conditions. Some genetic, some developmental, maybe both. This isn't to say that they are in any way related, I just group them together here to mention them, though I have no specific commentary.

PTSD is a result of people being exposed to situations they just cannot rationalise. This can be partly as a result of underlying conditions such as a family history of anxiety and/or depression, and previous exposure to highly traumatic events particularly in childhood...but on the other hand I think if things are messed up enough (if you're in a situation of extreme terror with people around you dying and you not sure if and when it'll be you) then even otherwise healthy people can end up with PTSD.
Due in part to the taboos around mental health, somebody suffering from PTSD may have an ineffective or non-existent support network, such as missing the psychotherapy that could help them come to terms with what happened.

Eating disorders are also mental health issues as it can frequently take two forms, which both have their origin in a psychological state. On the one hand there's comfort eating. Something is bothering or upsetting a person, possibly a cause of the aforementioned anxiety, and they seek solace in eating. While I would describe linguine as "comfort food", and maybe we all have a little something that makes us feel better, it becomes a mental health issue when it is done to excess. One ice cream is a perk, two boxes of ice creams are a problem.
The other extreme is anorexia, which is often a result of a faulty self-perception. To look in a mirror and see a waif and think "Oh my God, I'm FAT!" and answer that by either refusing to eat, or worse, eating in front of others to seem okay and then dashing off to try to throw it up as soon as possible.
Both sorts of disorder can bring significant health risks, not to mention leading on to other concerns such as depression.

Personality disorders. Some of these are recognised, such as avoidant and OCPD; but I'd argue that there are really far more that have names but don't really get classified as actual mental health problems. For example dependent people and, my favourite, narcissists. I'm sure we have all at some point in our lives worked for a narcissist twat who would never be wrong and never listened to anything he was told. Well, why is this not a mental health disorder? Because you'd be categorising a good quarter of management, perhaps?

Neurodevelopmental disorders. Okay, here's my category. ☺ This, actually, counts for many potential mental issues. Various intellectual development disorders, autism (I would count myself in this group), ADHD (I am in this group), OCD, all the "dys" words: dyslexia, dyscalculia (check), dyspraxia (check), dysgraphia; as well as audio/visual processing disorders, nonverbalism (I was taught a very simplified sign language as a child as I didn't want to talk, I still don't much like talking), visual perception problems... and frankly this lot is just the tip of the iceberg.

 

What annoys/upsets me is that if you overcome cancer, you are a "survivor". If you are dealing with Parkinson's, you are a "fighter". If you hear voices in your head - go away you freak!
Mention anything to do with mental health and people are like "weirdo", "nutter", "psycho".
Why is this?

The human brain is an amazing thing, and it is more complicated than the entire rest of the body added together, and then some.
There are all sorts of known and recognised problems with the body. From fairly benign things like dandruff and ingrown toenails to bigger issues like hormonal imbalances or suddenly crapping in your pants because that thing you just ate contained an ingredient that your body really really doesn't appreciate (gluten, lactose, etc), to massive things like cancer. And then there's a whole host of communicable diseases (and not just stuff like AIDS and Herpes, we can count colds, flu and Covid too). All of these issues are known, some can be fixed, we're working on cures for the ones that cannot yet be fixed (or where the cure is currently as bad as the problem itself - just ask my mother about those cancer pills); yet when it comes to discussions about mental health everybody (who isn't actually suffering some sort of issue) just shuts down. It's a taboo subject, like guys groping their balls to see if there are any lumps, it's just not talked about.

Why?

As mentioned, the brain is fantastically complex. It shouldn't be a surprise that sometimes there are ones that don't behave in a manner that the masses categorise as "normal", defined as "neurotypical". And for those of us who have to live with these differences, even if the symptoms are milder than some, it's neither nice nor helpful to be labelled "weird" or "creepy" especially when it's adults saying that (you can forgive children as they maybe haven't yet learned to filter, but adults should know better).
It is especially annoying when one is trying so damn hard to "be normal" (even though they have no idea what that actually means as often seems to them like everybody else is far stranger).

Ultimately, I think "neurotypical" is mostly an illusion. Some people definitely have lifelong problems (autism, OCD, dyslexia...) but other issues (anorexia, depression...) are not something present from birth, they're a product of an environment, possibly exacerbated by other underlying issues such as a low self-esteem or a lack of learned coping mechanisms. But, whatever, mental health is something that should concern all of us, as it could easily concern all of us. We need more dialogue, more discussion, and fewer taboos.

But, hey, nobody cares, the only people who want to know are those who get paid to do so.
Just be a good little nutjob and dump some Dothiepin / Methylphenidate / Dextroamphetamine / Fluoxetine / Aripiprazole down the hatch and go away. Thank you and goodnight.

This.
Is.
Wrong.

 

Ants

I saw ants around the front door step. So I put down a few drops of gloop. These ants weren't like the ones around back. They saw the gloop and were like "Oh, yes!".
The ant's camp was below me. A mighty space it was, and scattered around various ants scurrying about their business, collecting the gloop to take to their Queen. Directly the Invaders arrived and drank; my gloopy ally attacked them. From that moment - they were doomed.
These ants don't realise...
These ants don't realise the fate about to befall them.

 

 

Your comments:

Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
 
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.

C Ferris, 20th May 2024, 09:51
Sounds like Rick could use some chickens - to thin out the ants. 
 
Brain problems - how does anyone work out how someone else thinks :-/
Gavin Wraith, 20th May 2024, 12:02
Thanks for your thoughts on Mental Health Awareness Week, with which I entirely concur. My younger brother was diagnosed with schizophrenia when he was still at school, and killed himself at the first opportunity, while the doctor in charge was on holiday. My mother thereafter devoted her life to helping those released from mental hospitals. There has been some progress in the intervening seventy four years. At least we know more about the physical changes to the brain that accompany (I hesitate to say cause) schizophrenia. I think there has been some progress, too, in the public perception of mental illness, but there is a long way to go. So thank you Rick, for your piece.
Gavin Wraith, 20th May 2024, 12:09
Not seventy four, but sixty four. Bad morning for arithmetic. Back then nobody knew whether schizophrenia had physical or psychological causes. R.D.Laing was shaking things up. At least he got people thinking about it.
jgh, 20th May 2024, 17:32
"long switches" are useful for understanding the command line, but because of the nonsense that can build up, I think long and hard to create sensible one-character switches with anything I write. 
AsmPDP -DDEBUG infile outfile -v -a listfile 
zip outfile indir -r -v -t 20240501 -M 32K -X 
David Pilling, 20th May 2024, 23:15
TBH I have used AI to explain to me what combinations of command line switches actually do. I was not aware of cppcheck.
A tree-dwelling mammal, 22nd May 2024, 15:28
Careful upsetting the ants. If they're particularly militant, they might decide to chuck your house off a cliff. 
 
Be particularly worried if the ants talk with a Welsh accent that sounds a bit like Phill Jupitus. 
 
(For those that don't get the reference - Rex The Runt, series 2, episode 3.)

Add a comment (v0.11) [help?] . . . try the comment feed!
Your name
Your email (optional)
Validation Are you real? Please type 43441 backwards.
Your comment
French flagSpanish flagJapanese flag
Calendar
«   May 2024   »
MonTueWedThuFriSatSun
  23
6
13151617
21222324
27293031  

(Felicity? Marte? Find out!)

Last 5 entries

List all b.log entries

Return to the site index

Geekery

Search

Search Rick's b.log!

PS: Don't try to be clever.
It's a simple substring match.

Etc...

Last read at 16:15 on 2024/06/25.

QR code


Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0

 

© 2024 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.

 

Have you noticed the watermarks on pictures?
Next entry - 2024/05/20
Return to top of page