## Should I enter that Radio Competition?

It’s been a closely followed competition on Greatest Hits Radio and like the distracting adverts, this post will be equally off-topic. It did, however, let me try out some ChatGPT assisted pondering and I wanted to see how my ‘logic’ stood up to the lure of quarter million daily prize pots from the Bauer / Planet Radio group of radio stations.

Can GPT help us make better decisions? Now I’ll be the first to disclaimer this by saying that these numbers are rough and, possibly in the case of GPTs data, plain false. Please check and do these calculations yourself for more accurate information; whilst I believe GPT can help us build the framework for better arguments, this needs to be done with a layer of ‘verification’ to check our homework.

## So What are my Odds?

Rajar (RAJAR) provides quarterly info on listener ratings for radio in the UK. Whilst the BBC radio network still represents about 50% of all listeners in the UK, the group of stations under Bauer media group looks like about 10% so I passed this info into our friend GPT (as it has no stats beyond 2020) – we had to make a couple of assumptions but this was its summary of the competition;

• The total number of radio listeners in the UK is approximately 55.9 million.
• A competition is running on a popular group of radio stations that represent up to 10% of the total listenership, reaching approximately 5.59 million listeners.
• Based on the estimate that 36% of the UK population participates in paid competitions or lotteries, we can infer that around 2.01 million listeners from the network are likely to enter the competition.
• The entry fee for the competition is £2.

Winning Odds: Since the total number of entrants is not known, it is difficult to determine the precise odds of winning the £250,000 prize. However, with 2.01 million participants and a single prize, the odds are 1 in 2.01 million

Revenue Generation: With an entry fee of £2 per participant, the network stands to generate approximately £4.02 million in revenue from applicants. This revenue can contribute to supporting the network’s operations, programming, and future competitions.

## Now for some context

I asked more generally about the odds for the UK national lottery and finally I asked for some examples of probabilities that are equally similar to the chance of winning either (as both cost £2 to enter).

Roughly a 1 in 2 million chance:

• Being struck by lightning in your lifetime (source: National Weather Service).
• Being accepted into the Harvard University undergraduate program (historically, the acceptance rate has been below 5%).
• Winning a Nobel Prize in Physics, Chemistry, or Physiology/Medicine.
• Becoming a professional musician and achieving mainstream success with a hit song or album.
• Winning a ‘Greatest Hits Radio’ competition

Roughly a 1 in 45 million chance:

• Becoming a professional athlete in a major sport (e.g., football, basketball, soccer, etc.).
• Winning an Olympic gold medal in certain events.
• Being dealt a royal flush in a five-card poker hand (without drawing additional cards).
• Winning the UK National Lottery

There is a slight variation in this competition to others, in that it allows you to enter multiple times per day which I have ignored as it is impossible to know the probability without the exact number of entries.

However if we were to assume the odds were to average out to be the same 1 in 2 million, whilst each entry would be cheaper, the total expenditure and elapsed time won’t be favorable with more entries per day in any meaningful way:

In conclusion and on average, you would need to enter the competition over 2 million times and spend approximately £4 million before you would win the £250,000 prize fund.

Now, the average human lifespan varies across different countries and populations, however according to the World Health Organization, the global average life expectancy at birth was around 73 years (in 2019). Average human lifespan in days ≈ 73 years * 365.25 days/year. That’s 26,723 days or in other words;

# It would take approximately 75 lifetimes to win this competition.

So whilst the competition odds of winning look great compared to something like the national lottery, when viewed in real-world terms, just as with most competitions, the probability is still incredibly low. Meanwhile, the competition hosts always come out better off, in this example it looks like Bauer Media Group are making upwards of £4 million every single day from competition entries.

## Clipboard API Workaround in iFrames

Admittedly not the catchiest of titles but if you’re seeing a message like this

Disabled in this document by Feature Policy

then you are probably running in to the same problem as me. I’m writing a fulfilment application for Shopify and the UI has a handy ‘Copy’ button for some useful details. Shopify uses an iframe to load apps inside the admin area but here lies the problem!

The solution to this error is to simply allow clipboard-write in the iframe like so;

```<iframe src="index.html" allow="clipboard-write"></iframe>
```

But wait… My app is inside the iframe; I don’t have access to the iframe tag attributes. It seems like I’m not the only person who ran in to this issue but after a year of no response I didn’t have much hope that this would get fixed soon. https://community.shopify.com/c/shopify-apps/using-the-clipboard-api-in-the-app-iframe/td-p/1007594

So for the workaround, we can check if we have the correct permission and use document.execCommand(“copy”) as a fallback;

```        navigator.permissions.query({name:'clipboard-write'})
.then(function(result) {
if (result.state == 'granted') {
navigator.clipboard.writeText(copyText.value);
} else  {
document.execCommand("copy");
}
});
```

And the whole function, passing in the id of an input element;

```    function copyToClipboard(id){

var copyText = document.getElementById(id);
copyText.select();
copyText.setSelectionRange(0, 99999);

navigator.permissions.query({name:'clipboard-write'})
.then(function(result) {
if (result.state == 'granted') {
navigator.clipboard.writeText(copyText.value);
} else  {
document.execCommand("copy");
}
});
}
```

Now, if the permission is not available, the function falls back onto the deprecated method. If the mighty ruler of the iframe tag grants those permissions, the function doesn’t need to change, the preferred method using Clipboard API is chosen.

## Introducing WardPal!

WardPal is a care focused fast paced task app for all healthcare workers designed by ward staff for ward staff!

Visit WardPal.com to start using WardPal, its completely free; nothing to install; and no, we won’t even ask for an email address!

### Holistic Care

Where a todo list might seem like reducing patients to tasks, WardPal is different. By giving you a fast way to add, check and complete tasks you’ll spend barely any time looking at a screen and more time focused on your patients! Prioritizing effectively and automatically means that unlike a never-ending list, WardPal shows you the time between tasks; and when you have those, you can take Moments to think about your patients.

### Continuity of Care

Not only does WardPal help you be consistent in your care throughout your shift, it also helps to deliver continuity of care when your day comes to an end.

Handovers let you to share outstanding items with fellow health workers allowing them to carry on exactly from where you left off.

## A Really Simple Star Rating Input in React

One of our current projects has come with a few interesting UI designs, some can turn out to be quite complex but this was possibly one of the simplest yet. Looking online there are a few packages that can do this but it soon became clear that it might be much quicker to just write a lightweight component to do just what was needed.

## Testing in .net Core with xUnit

I’ve recently been getting my head around some new technologies that we were looking to use in an upcoming project. With a chance to work with the .Net Core framework as part of this, I wanted to look at unit testing frameworks to see what worked well. I’m familiar with MSTest in the .Net space but there’s been a shift towards xUnit as an alternative.

Continue reading “Testing in .net Core with xUnit”

## Coding the Feynman Technique

This is what I hope should be a growing blog post as I create a starting point for turning the Feynman technique into a usable and reusable piece of software. It’s something I have been thinking of multiple applications for but ultimately all rely on the same core functionality.Continue reading “Coding the Feynman Technique”

So I finally decided to move everything to the cloud and use Dropbox pretty much exclusively for all my data. The problem is I still wanted an extra layer of security for confidential information; password management, banking, insurance and personal identification in the event of Dropbox having a serious security breach or someone hacking into my account.Continue reading “Fast, Scripted Access to Encrypted Volumes using Dropbox and VeraCrypt”

## Hello World.

If you’re seeing this you’re either really early to the party or I procrastinated way longer than I anticipated.