Monday, 8 January 2018

Division by zero

I've just watched this video which was embedded in this Quora answer about division by zero. The video is so entertaining I had to share it. A guy is asked to perform a division by zero on his mechanical calculator. Is it dangerous? Does the machine catch fire?
I wonder whether it occurred to Charles Babbage to try this with his difference engine.

On today's computers I'm surprised that this isn't dealt with at a high or low level. An attempt to divide by zero can crash an app and it's surprisingly easy to do. Should it be necessary for a developer to have their wits about them every time they perform a division using a divisor that is a variable? And have to write an extra line to check that that variable is not set to zero?

It would perhaps be more elegant if the processor returned the largest possible number (INT_MAX or FLT_MAX etc depending on the type of the divisor). Yes, that's the wrong answer, but we're working with approximations all the time - for example,

float f = 1.0;
if (f == 1){
 // unlikely to be executed because f as a float isn't exactly 1 - it has a 'precision',
 // in terms of its bits it'll probably be 0.999999999999 or something

There are some very interesting philosophical points in Dave Williamson's answer. Such as the fact that infinity isn't a number. Zero is more generally considered a number, but that is questionable.

All of this inspired me to draw this:
Science Museum, year 2422. Yes, this is Babbage's original difference engine. At the unveiling, he mistakenly gave it a calculation involving a division by zero. Since he hadn't thought to put any kind of cancel button, it's been chugging away pointlessly ever since

Saturday, 6 January 2018

Lifestyle for LIFX and LIFXstyle - what's going on?

This post has the relevant keywords in the title for the benefit of anyone who uses Google to find clarification.

For some years now (since Oct 2014) my app for controlling LIFX bulbs has been called LIFXstyle (pronounced Lifestyle by me but no-one else would know that and is free to say it how they like). Incidentally it's based on Hue-topia (for Philips Hue bulbs) which goes back to 2013.

I started the year with some optimism, as you do, determined to spend the time and jump through the hoops and publish more of my apps on the Mac App Store. This 'can-do' attitude was quickly knocked into touch after two rejections of this app (technically one 'more information' and one rejection). One of the reasons for rejection was the name.

It's frustrating to be faced with an imperative to change the name of something so well-established (and well-selling). So I'm not changing the name of the version sold outside of the Apple Store, unless LIFX themselves complain, which they haven't to date.

"XXXX for LIFX" was the format suggested by Apple in the rejection. The rejection was under their 'copycat' policy, I guess it was too similar to "LIFX" which is the name of LIFX's own app. Anyway, of course I went with their suggestion, keeping the new name as similar as I possibly could to the original name of my app.

That's the reason why the version available for web download is called LIFXstyle and the version on the App Store is called Lifestyle for LIFX

Friday, 5 January 2018

2018 begins with a meltdown

We have started the year with the kind of story that TV and radio love. "Nearly all computers worldwide - and many other devices - have been exposed to security flaws which leave them vulnerable to attacks by hackers" (direct quote from BBC News).

Tech correspondents were in their element, "The CPU is the 'brain' of the computer, if you like, and if someone can read everything in your brain, then they can read all of your sensitive information.." (I paraphrase only slightly).

The culprits are fiendishly-named Meltdown and Spectre.

Intel's response was the amusing classic, "It's not a bug it's a feature". The detail of it sounds much like a small boy caught red-handed, "I didn't do anything. Anyway, the others did it too."

In a nutshell, meltdown is easy to fix and has been. If your High Sierra system is up to date then you should be ok. Spectre is hard to patch and hasn't been so far but it's hard to exploit. (see Further Reading for more details.)

Install updates when available. And don't have nightmares.

Further reading:
Opinion on Intel's response:
Thorough and understandable rundown of the problems:
The BBC (who should know better) sensationalising and enjoying the chance to have a dig at Apple users:

Wednesday, 3 January 2018

New Year - Thoughts on the Mac App Store, Integrity Plus available there once again

If you've asked me over the last few years why I don't sell my apps via the Mac App Store, I'll have answered that I hate the store. One day I threw a tantrum over a problem (a catch-22  involving version numbers following a few rejections with one of my apps) and I petulantly took all of my apps off the store.

A decision made with the heart rather than the head, which is in character. But I'd been frustrated with the store since day one. Back then Apple took 2-3 weeks to review an app... Fast fixes to problems weren't possible.

Sandboxing was introduced and then made compulsory for apps listed on the Store. This is a security measure which gives you hoops to jump through and makes certain features impossible.

The iTunesConnect site (used for upload / submission) was not very user-friendly early on (let's not get into why the default music player was involved with installing apps on your computer). Apps get rejected. All of this meant that getting an app listed on the store was time-consuming and frustrating. Then Apple took a whopping 30% of your revenue.

It didn't (and still doesn't) allow for trial periods, which has always been very important for me. Developers get around this by making the app free and offering a 'pro' version (which is something I already have with Integrity / Integrity Plus) or making the app free and offering in-app purchases or subscriptions to a service. Or using advertising. None of which I really like in other apps and won't get involved with myself (another emotional rather than business decision).

I've been waiting for the day that the only way to install an app is via the Store, or by 'jailbreaking' your Mac, as with iOS. That day hasn't come (yet) but Gatekeeper has steered people away from web-downloading apps - even a code-signed app requires a 'lower' security setting than installing apps from the app store.

With all of this said, I do find things much improved.

New year - new start. I have let my logical head overrule my feelings and made the business decision to list paid apps on the store once more. The reason is simple, I want as many people to discover and use my apps as possible. In return for the frustrations and giving Apple a big cut, you get more users.

There are many things to conform with  (screenshot sizes, compulsory fields, all of which is pretty reasonable). Uploading and submitting wasn't so painful. Sandboxing still applies, as does the huge cut Apple take. I was amazed to find Integrity Plus approved within hours of finally managing to submit it.
Future plans - I don't think that Scrutiny will appear on the Store again, it has some important features which aren't compatible with Sandboxing, such as the scheduling. But I am drawing plans for an 'Integrity Pro' which adds the SEO stuff that only Scrutiny has at the moment.

Monday, 1 January 2018

Drag and drop colours from and to LIFX and Hue bulbs

If you're an existing user of LIFXstyle or Hue-topia you may think "that's not new". Versions 1 and 2 did allow you to drag colours around but with version 3 and much new functionality, the drag and drop has been missing.
The drag and drop does now carry the warmth / colour temperature value. (And of course brightness and saturation.) So if you've found a nice setting for one lamp, whether that's white with a little warmth or a full-on colour, you can drag the colour to other lamps / groups / locations.

This will be in Hue-topia 3.0.9 and is already released in LIFXstyle 3.1.1