Sunday, 26 May 2019

The BBC & I on Dust

BBC Crowd Science is one of my favourite podcasts. Essentially, it's a podcast where people from all over the world send them questions on matters of science, and they answer them.

Back at the end of 2017, Crowd Science has featured an episode based on a question from yours truly. I asked them to tell me about the dust in my home and whether I should worry about it (or even clean it). To help them answer my questions, I had posted them dust samples from various sources in my home. Luckily, there is no supply shortage there.
You can read and listen to this episode here.

This week, Crowd Science followed up on my question with yet another episode that goes even deeper into the matter and looks at whether household microbes help or harm us.
You can listen to this newer episode (and to yours truly, again), here.

While at it, do consider subscribing to BBC Crowd Science on whatever platform it is that you're listening to podcasts through. It's a great podcast even on episodes that do not feature me.

Thursday, 9 May 2019

Thoughts on the up and coming Apple Arcade

The App Store is dead.
No, hear me out. I know it’s been making more money than ever, but the financial figures only tell part of the story. Money may be up, probably due to subscriptions, but downloads are down. That is probably because, these days, what used to be the open range safari of an App Store is mostly catered for by a very few companies delivering the big apps that almost everybody uses (thing Facebook, Instagram, Snapchat, Google Maps) and a tiny bit of a few other things on the side that are probably struggling to survive (think Evernote).
That old concept that said all one needs in order to make a killer app and retire a millionaire hasn’t been cutting the threshold of reality since around 2014. Exceptions exist, true, but so do lottery winners, and none of us take lottery winning for granted; we’re smart enough to know the odds mean it’ll never happen to us.
Looking at games, specifically, the App Store is even more than dead. It’s a dead zombie walking. Have a look at all the charts and you will have a hard time finding a premium game; everything is freemium, and - by definition - a freemium game cannot be a good game.  A good game is a game that’s focused on being a good game, usually by delivering a good narrative; a freemium game is a game that’s focused on drawing money out of the coffers of its players.
If Apple was truly caring for us, its users, it would offer search options where games are ranked in depending order of cost. Better yet, it would allow the option of ignoring freemium apps in the search.

If the iOS App Store is dying, then the tvOS App Store can never be said to have been alive in the first place. Sure, when the fourth generation Apple TV came out there was this promise that it would turn our living room into a gaming arena, but that was hampered by two factors:
First, those of us who wanted a gaming arena around their TV already had much superior options to do so with. Think PlayStation.
Second, anyone who tried the Siri remote that comes with the Apple TV will know it’s a pain to use when all one seeks to do is watch something on Netflix; for gaming purposes, it’s a total nightmare. Proper console like controllers can be purchased, yes, but they’re expensive and they are trapped in that chicken-and-egg conundrum of having the games first before bothering to buy a controller.

Into this scene Apple is now proposing to bring the Apple Arcade. For a fee rumoured to be $10 (USD) a month, users would be able to play some 100 games Apple had paid hundreds of millions ($500M, according to this report) for external game developers to create. Assuming the catalog will only grow in size over time, expect the Apple Arcade to open around September 2019 with the release of iOS 13.
Further, those Apple Arcade games would be playable on iOS (that’s iPhone and iPad for you), tvOS (Apple TV), and macOS. In effect, through iCloud sync, that would create an environment not unlike the Nintendo Switch’s: you could play at home on your big TV with a controller, then take the game with you to play when you’re out and about. Or even at work, but don’t tell anyone. The technical capabilities of these devices is certainly not far off the Switch’s, if not better in certain aspects.
The question is, what would Apple Arcade achieve? Would we be better off for its existence, or would it create a worse world as far as good games are concerned?

Naturally, the knee jerk reaction is to welcome any initiative where games receive proper funding and where games are being properly paid for. At first glance, Apple Arcade could be a life saver.
Nothing, however, is simple as it may seem. There is a lot to question with regards to Apple’s approach with Apple Arcade.
Consider the developers it had engaged. The likes of Will Wright of Sim City and The Sims fame; or Hironobu Sakaguchi, the creator of Final Fantasy. Are these the sort of people that need Apple’s cash to create a good game in the first place?
Take a look at the companies Apple has been engaging with. Are Lego and Sega, to pick a couple, the sort of companies that have any problems releasing video games on their own?
Sure, there is nothing wrong with us having more games from these makers. Spare a thought, though, for the small indie developer out there, armed with fantastic ideas and no funding: what hope lies in their future when all the money goes towards the already rich and famous? Worse, who in their sound mind would pay to buy their games when they’re already paying $10 a month to Apple Arcade?
Apple Arcade could be a boon for all those involved, but it could be a disaster for all those left out. And those left behind are the majority of developers out there, the ones that - once upon a time - helped Apple make the App Store the giant it is.
Me, I’d rather see Apple spend its money on smaller developers. Or initiate some sort of a program that would allow them to come up with something, rather than invest in the already tried and tested that we are generally saturated with already.

Then there is the discussion on whether $10 a month would work. Most of us are already spending considerable sums a month on various entertainment subscriptions, be they cable or Netflix for video or Spotify and Apple Music for music. Gamers are already paying for the likes of PlayStation Plus or Nintendo’s generally struggling online service. Do we care to add the considerable sum of $10 a month on top? $120 a year?
I expect many, if not most, to be pushed back by this price. Personally, I’d love to pay for games but I hardly get the time to play them; spending $10 a month when I can only play 1-2 hours a week seems highly irrational to me, no matter the good thoughts that paying for good games bring.
I would have preferred some sort of a tiered payment structure that could ease the pain.

Last, but not least (at least for yours truly), is the matter of privacy.
Ads, tracking, and data harvesting are the hidden bane of modern gaming. Most people are unaware or turn a blind eye, but there are hardly any games or games platforms out there that don’t watch you as you’re playing and go home to talk about it to anyone willing to pay. Most game publishers consider the money they earn through these avenues another legitimate revenue streams, but in effect they are selling our data - who we are - to the highest bidder (and to the lowest as well).
Do you really want anyone out there to know what you’re playing, when you’re playing, and where you’re playing? Maybe you’d consider that data harmless; but it is not so harmless when it is added to data collected about you elsewhere, which allows companies like Facebook to categorise who you are to an extremely fine degree so that the likes of Brexit and Donald Trump can then be sold on to you.
Call me old fashioned, but when I read a book I like to do so by myself. And when I play a game, I also like to do so by myself. Therefore, when Apple announced its Apple Arcade games would come with no in app purchases, no ads, and no tracking, that was - by far - the thing that attracted me most to this service. No longer will I have to switch my phone offline in order to be able to privately play a game without some nasty company like Facebook peering over my shoulder!
The questions I had (and still have) is, how private is private? I have seen (and reported) cases where a company states one thing with regards to privacy but does another thing altogether. Where will Apple lie on this spectrum?
We still don’t know, because Apple Arcade isn’t out yet. And we would have to constantly check in order to be sure over time. However, we got a bit of a promising glimpse into the future when Apple released its own game, for the first time in goddess knows when, to the App Store. This free game is called ‎Warren Buffett's Paper Wizard.
Granted, it’s not much of a game; the back story suggests it’s more of a joke. Regardless, last time I checked yours truly was holding the #8 high score in the world. Not bad for a n00b.
More importantly, yours truly checked Paper Wizard to see if Apple is true to its word when it comes to privacy and tracking. The image below shows all the internet connections made by my iPad while playing the game:


Let me translate it to you: other than normal iOS communications that the device does anyway, and other than saving my position to iCloud, no external ad agency, data harvester, or external analytics service was deployed. Assuming one trusts Apple (and one has to when buying an iPhone), things could not be better on the privacy front.

In conclusion, let me ask again: would Apple Arcade improve the world of gaming or hamper it?
We don’t know yet. Personally, I hope it would; it could be the last time a company with coffers as big as Apple’s decides to invest in gaming.  But I suspect some sort of a mixed bag that easily could, if Apple doesn’t pay enough attention, actually reinforce the current status quo. Do we want to continue living in a world where only big companies can release games, and therefore those games they do release tend  to come off the uninspiring pre-established moulds?

Sunday, 28 April 2019

What good is a Privacy Policy?

A friend recently pointed out the existence of an Israeli app called Shiri (שירי), which allows its users to freely listen a large collection of Israeli songs. Generally speaking, I hesitate to install new apps on my phone on account of the regular abuse of my privacy and security performed by most apps (a phenomenon I had already discussed here). However, out of curiosity, I decided to give this particular app a proper examination.

First, I went to the app's iTunes page in order to check its website out. It is there that I found Shiri's privacy policy, which - to my eyes - seemed quite impressive. Under the assumption of fair use (which I believe I have on my side here, as I am about to critically assess this policy), I will quote some of its more appealing aspects:
The National Library collects only personal information provided by you, willingly [emphasis by yours truly], with active and informed consent granted during your user registration process and\or during your request of services and\or...
The National Library will not transfer your personal information to third parties unless (a) it is required to do so by law, and\or (b) it was required to submit information to an authorized authority according to that authority's request, and\or (c) it was necessary for the provision of the requested services and you approved the transfer of the information to that third party.
Given such a lovely privacy policy, I went out and installed the free app. However, before starting the app for the first time I set up a proxy service in order to capture all the online activities performed by the app.
The next thing I did was start the app. I will emphasise here that I only started the app, did not press anything, and got only as far as its welcome page. However, by then my proxy service already showed the following online connections were made by the Shiri app:



Three usual suspects are immediately noticeable: Google, Facebook, and Apple. Apple can be excused by the fact it is the phone's operating system itself that contacts Apple every time an app is started in order to support Apple's app usage statistics. However, there is no excuse for Facebook nor Google to be there. Not when the above quoted privacy policy says that no personal information of mine will be transferred to third parties (which is exactly what Google and Facebook are, in this particular case).
Even if the inclusion of Facebook and Google was included because "it was necessary for the provision of the requested services", I do not recall having "approved the transfer of the information to that third party"; all I did was start the app for the very first time. It cannot be said that I had willingly provided my consent for my information to be collected!
Further, Google and Facebook were not the only trackers to join the Shiri party; they are just the most famous. As you can see in the above screen shot, we also had app-measurement.com, appsflyer, hockeyapp, and crashlytics. Now, it may be argued that these are not your average data harvesting services out there to suck as much information about you (the way Google and Facebook act), but rather services that are there to help the app developer ensure they are providing good service. However, these are still third parties, they are still collecting my information, and I still haven't provided any consent for them to do that. More importantly, in the context of this post, they were never supposed to exist in the first place given Shiri's privacy policy!

Why is it, then, that Shiri is acting this way? Why is Shiri publishing a privacy policy which it then completely ignores?
I strongly suspect there was no ill will on behalf of Shiri here; just good old ignorance. One part of the organisation, with all the good idealism on its side, wrote a marvelous privacy policy; then another part of the organisation (probably with the help of external contractors) went out to develop an app, and that part chose to use SDKs from Google and Facebook. While at it, they chose to use several third party services to help them with the app's development and running. I suspect they did not even bother to read their organisation's own privacy policy.
Who does, these days?

Wednesday, 10 April 2019

Using Multi-Dimensional Arrays in Swift 5


Coming from old school programming, I sort of grew to regard multi dimensional arrays as a given; the stuff one learns at the second programming lesson during one’s early high school career. These days, that does not seem to be the case anymore, to the point of finding myself wasting way more time than I thought I’d need in order to figure how to work it out in Swift 5. This post is therefore here in order to help me solidify my findings, and if - in the process - I’d actually end up helping others, then I have done even better.

First, I will point you to the sources I have found the most helpful. That honour falls unto Paul Hudson for this post, to which I will add I have been finding his posts (and for that matter, his books) very helpful.
My second source of inspiration was this post Multidimensional Arrays in Swift from iAchieved.it, which provides some good practical examples.
Feel free to pause and have a look at these two before reading the rest of this post.

On to the main event.
The problem I was facing, which can be generally summed up as “how do I use multi-dimensional arrays in Swift 5”, can be further broken down into the following:
  1. How do I declare a multi dimensional array in Swift 5?
  2. Once declared, how do I even address a particular member in the array’s matrix?
  3. How do I add values into such an array?
  4. In particular, how do all of the above happen when my array is not of a simple type (say, Int or String), but is rather a multi dimensional array of a complex struct that is made its own arrays, booleans, and other complex structures?
  5. How do I manipulate particular (and generally unknown) cells in the array’s matrix, while leaving most of the other cells alone? Specifically, how do I get to do that in Swift, with its prudish (but justifiable) emphasis on declaring and initialising anything and everything?

With that in mind, let’s have a detailed look at the various solutions and compromises I was able to identify. I’m sure experts will have a look and then laugh, but - regardless - this is what I was able to come up with within a reasonable timeframe.
The declaration part is easy. This is how one defines a two dimension array of a struct that I called Cell:
var grid = Cell()

Once declared, accessing a particular “cell” in the matrix is done via:
grid[i][j]
Where i and j point at the row and column in that array.

Obviously, before accessing grid[i][j] there have to be values there (or Xcode will raise a runtime error), which brings us to the more tricky bits.
I have found that simply asking Xcode to add individual “cells”, say grid[0][0], would not work. I had to append rows to the matrix first!
For example, in a case where I needed a matrix of 10 rows, I needed to do something like this in order to get rid of runtime errors later -
for _ in 0…9 {
            grid.append([Cell(value: 0, providedByUser: false)])
        }
This adds 10 rows and 1 column into my grid, all of which contain data that I could - for now - ignore.
What is worth noting here, however, is the syntax I had to apply in order to append my values. As mentioned, individual cells in my matrix are made of a struct that is more complex than, say, Int; in this particular case, they are made of value (which is an Int) and of providedByUser (which is a boolean).

With this initialisation of the grid now performed, I was finally able to enter the individual values I wanted into specific cells of my grid. However, as per usual Swift standards, I had to do it properly and in order, so I ended up doing it using for loops:
for i in 0…9 {
            for j in 0…9 {
                if j == 0 {
                    grid[i][j] = (Cell(value: 1, providedByUser: true))
                } else {
                    grid[i].append(Cell(value: 1, providedByUser: true))
                }
            }
        }
In the above, do note the different way of setting values when dealing with the first column of a row as opposed to when dealing with the rest of the row. That difference is a side effect of the fact I had already created that first column when I declared my 10 rows earlier with the minimum I could get away with - a single column.
Obviously, this very issue indicates at more elegant ways in which a multidimensional array could be set up. The point, if there was one, is to point out the importance of initialising rows in our multidimensional arrays and point a finger at ways to do so.

Now, if I want to print the values of my grid, that is how I do it:
for i in 0…9 {
            for j in 0…9 {
                print(“\(i) \(j) \(grid[i][j])”)
            }
        }

I cannot claim to be ecstatic about the way I manipulated the array in order to get the result I wanted, but I did end up with a working multidimensional (or rather, two dimensional) array. I guess if it was all lovely and simple, there would not have been a need for this post…
One question I still don’t have an answer for is, how do I achieve everything I had achieved here in a case where I do not know the size of my matrix in advance. I can think of ways around it, but they all require some form of non elegant manoeuvring that is likely to get frowned upon by the purists. Purists whose feedback and inputs I’d love to have, BTW.