Bye Bye Windows Phone 8.1

Three and a half years ago I got the best phone I've ever had. A Lumia 1520 running Windows 8. Amazing screen, snappy performance, brilliant battery life, fantastic camera. And now Windows Phone 8 is dead. 

Sigh.

Ten years ago number one son was kind enough to bring me back a first generation iPhone from his travels in the US. It was the cheapest version with only 4G of storage, no 3G, no GPS, no proper email, and barely enough applications to fill the home screen. One of the first apps was a compass, that's how desperate they were to get things to put on there. And yet it was obviously the future.

I'd show mine to Microsoft folks at conferences and tell them it was going to eat their lunch and the response was usually that they knew this, but the folks upstairs didn't see it as a threat.  And anyway, how can you sell more copies of Windows and Office using a mobile phone? 

After a year version 2 of the iPhone brought 3G, GPS, an app store and proper email. I was second in the queue to get one at the O2 store. Around this time Microsoft seemed to think that the future was hexagonal menus.

I got more worried. I even emailed Steve Balmer (and, to his credit, got a response). But nothing happened. The version of Windows Mobile that was supposed to solve all problems and re-discover the high-ground was suddenly pulled and replaced with not a lot.

Finally, Windows Phone 7 came along. I loved it. A genuine attempt to move the field forward. Quite a few others loved it too. Not enough to get back the all market that Windows Mobile used to have, but enough to build a sizeable user-base. 

Then, just as Windows Phone 7 was starting to get traction (I thought), along came Windows Phone 8. This was a staggering technical achievement. We now had "full fat" windows running on a phone platform. And it worked really well. Snag was, it needed new hardware. And Windows Phone 7 owners suddenly found that they didn't own the future any more. 

And by now Android was taking over where Windows Phone should have been, picking up the 80% of the market that Apple don't tend to bother with. Microsoft hit back by making compelling, wonderful, devices like my Lumia 1520. But it was all for nothing in the end. 

I still have my Lumia 1520. It now runs Windows 10, wonderfully well. The user interface is streets ahead of my iPhone. I can't use it in real life of course, because lots of the things that I want to use on a daily basis are either unavailable or don't work properly. But I'm going to hang on to it to show people when they pull our their latest "wonder phone".

Spider-Man: Homecoming = good film

After yesterday's web picture, today finds us at the Spider-Man: Homecoming movie.

It's a good film. Probably the best Spider-Man film I've seen. Maybe it's the hyphen. But then again maybe it's Marvel, who seem to have a knack of creating slick tales with just he right amount of mayhem, slow bits, plausible (ish) baddies and plot twists. 

Everyone involved delivers and the Marvel universe is looking quite a nice place to be at the moment. 

Creating Cheese Lander in Snaps

Yes. Cheese Lander is back! I'll be using the mostly world famous game in my Monday Games Snap series to demonstrate how to make a Windows program using Snaps that will almost certainly not make you rich and famous. But it might make you poor and notorious. The aim of the game is simple. Move the bread to catch the cheese before it reaches the bottom of the screen. If you miss the cheese, you lose. If your bread is moving too fast when it hits the cheese, you lose. If I'm in a bad mood, you lose (actually this might not be the case). 

Last week we took a look at one of the Snaps sample game programs (read that before you read this). This week we're going to take that game code and move it into the "startup" program that runs when a Snaps application starts running. Then we're going to add some bread, cheese and a suitably starry background with a view to getting things moving next week. 

Open up the BeginToCodeWithCSharp sample project and take a look at the Solution Explorer in the top right hand corner:

Open the BeginToCodeWithCSharp project and then find the My Snaps Apps folder. Inside that you'll find a source file called MyProgram.cs. Open this file.

This is the StartProgram method that runs when a Snaps application starts up. It's the one that runs first because it is in a class called MyProgram and that is always the one that contains the initial StartProgram. Let's replace this StartProgram with the game code that we created last time:

public void StartProgram()
    {
        SnapsEngine.StartGameEngine(fullScreen: false, framesPerSecond: 60);

        ImageSprite ball =

                new ImageSprite(imageURL: "ms-appx:///Images/ball.png");

        SnapsEngine.AddSpriteToGame(ball);

        while (true)
        {
            SnapsEngine.DrawGamePage();
        }
    }

Copy the above method out of this text and paste it over the StartProgram in the Visual Studio editor so that it looks like this.

Now, when we run the program we get a nice round ball in the top left hand corner:

Balls are OK, but we want cheese. I've put all the image assets for the game into a file you can download from here. The images include the cheese, the bread, the starfield background and the game message screens. Download the zip file and put the images from it somewhere (I put mine on the desktop). 

Now find the click on the cheese in your download folder and then drag it into the Images folder for the solution. 

If you do the drag correctly you'll get a warning message because the demo programs (like all my products) come with cheese pre-loaded. However, we want to use the newer cheese because it is the right way up, so click yes to overwrite:

Now we can change our program to draw cheese rather than a ball.

ImageSprite ball =

        new ImageSprite(imageURL: "ms-appx:///Images/cheese.png");

Now, when you run the program you'll see a piece of cheese, rather than a ball. Yay!

Now drag all the other images assets into the images folder.If you find that moving individual items is too much of a drag (ho ho) you can select multiple items and drag them all at once. 

Now you've got the image assets, lets add the background to the game. We can use a new ImagesSprite for that. We can call the new sprite background:

ImageSprite background =
    new ImageSprite(imageURL: "ms-appx:///Images/Background.png");
background.Height = SnapsEngine.GameViewportHeight;
background.Width = SnapsEngine.GameViewportWidth;

This creates a new sprite called background. It also sets the width and the height of the sprite to match the size of the game viewport, so that it exactly fills the screen, which is just what we want the background to do. We can add the new sprite to the game, remembering that sprites are drawn in the order that they are added to the game. So we draw the background first, and then put the cheese on top.

SnapsEngine.AddSpriteToGame(background);
SnapsEngine.AddSpriteToGame(ball);

 

The complete program looks like this:

using SnapsLibrary;

public class MyProgram
{
    public void StartProgram()
    {
        SnapsEngine.StartGameEngine(fullScreen: false, framesPerSecond: 60);
        ImageSprite background =
                new ImageSprite(imageURL: "ms-appx:///Images/Background.png");
        background.Height = SnapsEngine.GameViewportHeight;
        background.Width = SnapsEngine.GameViewportWidth;

        ImageSprite ball =

                new ImageSprite(imageURL: "ms-appx:///Images/cheese.png");

        SnapsEngine.AddSpriteToGame(background);
        SnapsEngine.AddSpriteToGame(ball);
        while (true)
        {
            SnapsEngine.DrawGamePage();
        }
    }
}

Run this and we'll see some cheese against a starry backdrop. But the cheese looks a bit big for the screen. Now it turns out that a recent meeting of the International Standards Organisation for Cheese Related Gaming has standardised cheese and bread sizes for the cheese landing games as a twentieth of the width of the screen and an eighth of the width of the screen respectively. Fortunately the Snaps framework provides a method that will scale a sprite and retain it's aspect ratio:

ball.ScaleSpriteWidth(SnapsEngine.GameViewportWidth / 20);

Add the statement to scale your cheese, and then add the bread sprite and scale that too. This will put bread and cheese on the screen. Next week we'll make them move about a bit. 

See the Lego Batman Movie

The Lego Batman movie is way, way better than it needs to be. Hanging off two solid franchises (the clue's in the name) it could confidently expect to make a fortune just by showing up. At least for one episode at least. 

However, it is very, very, good. Just the right balance of action, story and knowing self-reference to keep everyone happy. I don't think I've laughed out loud at a film so many times for a while.

Very strongly recommended.

Reckitt Benckiser at c4di

David Keel of c4di explains what we are about

Spent an afternoon talking about robots and chatbots. In other words, a good afternoon. We had folks from Reckitt Benckiser over to talk about a new partnership with c4di. We were showing off stuff what we had made and I brought along a few Hull Pixelbots. 

Another satisfice Hull Pixelbot customer...

I really love it when I show someone a bit of tech and they go "Oh, so that means we could use this for......." That's a big chunk of what c4di is all about, and there was a lot of it about this afternoon.

Then we went straight into a Hardware meetup. It was great to see everyone come along, Ross brought his beautifully made Hull Pixelbots and we had a good natter about how to control them. 

Great stuff. 

Hull Pixelbot Rumble at c4di today (Thursday)

Finally, a blog post that isn't a thinly disguised plug for one of my books....

Anyhoo, today I'm plugging the Hardware Meetup at c4di tomorrow (Thursday). Ross is going to bring his robots, I'm going to bring some of mine, and we are going to do some robot things that might include rumbling.

You're welcome to come along and marvel. Sign up here. The meetups are in the ground floor of the awesome c4di building. We start at 6:00 pm and go on until 8:00 or until we run out of things to talk about (which usually means a bit later..)

If you've any interest in hardware (computer or otherwise) then it would be great to see you. 

Monday Games Snap

You might have heard of my Snaps framework. Then again you might not. I created it for my Begin to Code with C# book

The idea behind Snaps is that learning to create Windows 10 Universal Applications is hard because it takes a while to get to the point where you understand enough to have a bit of fun writing C#. 

So I created a bunch of helper functions that grew into an entire library for app and game development. 

As a celebration of being awarded another year as an MVP (thanks Microsoft) I thought I'd put the whole Snaps framework up on GitHub and then people can download and play with it, and maybe even take it further. 

Every week I'll take a Snaps function and explain how to use it, along with a bit of detail about how it works. Monday is now officially "Snaps Day". I'm going to start with the games creation framework and go on from there. 

This week I'm going to tell you how to get started and make your first sprite. You need Visual Studio 2015 or Visual Studio 2017 (it works with either). You'll also need to be running Windows 10 64 bit edition.

You can download the entire framework from GitHub. It's a single Visual Studio Solution that you just have to open. You might get warnings about the dangers of loading projects downloaded from the internet. Ignore those in this case. 

If you run the solution you'll get the Snaps main menu:

On the left you can select the book chapter. On the right you can pick an exercise from the book to run. Pick the one you can see above (Ch15_04_CompleteGame from Chapter 15). It's a complete game with moving sprites and all sorts. Click "Run and App" and the game will start. 

The graphics aren't the best to be honest. But you can control the game by the cursor keys, or mouse/touch on the cursor pad on the lower right hand edge. One sprite will chase you while the others look on. Everything is running under WPF and I'm very impressed with the performance. 

If you want to get ahead of the game you can grab the book and see exactly how the code works. For now though, use Visual Studio to stop the game (go back to VS and press the red Stop button), and take a look at the Solution Explorer on the top right. If you open up the Chapters folder you can find a folder for each chapter:

Open up a chapter and you can find all the sample code. The names of the samples are keyed to the ones you can find when you run the program. Take a look in Chapter 15:

Open up the one indicated (Ch12_02_BallSprite) It creates a single ball sprite and displays it.:

    public void StartProgram()
    {
        SnapsEngine.StartGameEngine(fullScreen: false, framesPerSecond: 60);

        ImageSprite ball = new ImageSprite(imageURL: "ms-appx:///Images/ball.png");

        SnapsEngine.AddSpriteToGame(ball);

        while (true)
        {
            SnapsEngine.DrawGamePage();
        }
    }

All the action takes place in the StartProgram method. It starts the game engine, creates a sprite and adds it to the game. Then, once we've made the sprites, we start a game loop which continuously draws the game page. It does this 60 times a second, because that is the frame rate requested at the start. The image for the ball is an asset which is in the Images folder in the project:

You can use your own images if you like. Drag them to the images folder and make sure that their build action is set to Content (as below). Then use the appropriate name to draw them.

If you run the framework and select this example (Ch12_02_BallSprite) you can see the ball on the screen. If you change the above code and use the handy "Run That Again" button you can see your changes. Don't worry about breaking the examples. You can always download a fresh set from GitHub if it all goes horribly wrong.

You might like to add more sprites, or fiddle with the properties of the existing sprite, in which case Intellisense is your friend:

See what adding :

ball.CenterX++;

.. to the while loop does. You should have:

while (true)
 {
        ball.CenterX++;
        SnapsEngine.DrawGamePage();
 }

If you make anything especially impressive take a video of it, send me the link and I'll start a hall of fame on this page. Because this is a Universal Application it can run on any Windows 10 device, including Xbox One and Raspberry Pi (although it is not as fast on the Pi)

Of course the best way to find out all these things (and learn to program as well) is to buy my book. 

But if you don't want to do that, then I'll have another Monday Snap for you next week.

Jeff Lynne's ELO are Awesome

I've liked ELO since, well, forever. And when I found out they were coming to Hull, I got tickets. They were playing at the KC Stadium. It's big. And it was full.

ELO did not disappoint. The support from The Shires and Tom Chaplin deserves special mention too for being excellent too. 

At the end they created enormous plumes of fire in time with the music. Awesome. 

A fantastic night that was only slightly let down by the one hour we spent in the car park trying to get out. The guide for the event said that "entry is gained by cash payment to the cash handlers". Sure enough, on arrival there were people in high-visibility jackets to take our money and direct us to our parking spaces. Unfortunately the guide also contained the ominous phrase "Vehicles exiting the car park are allowed to self regulate". What this meant was that come closing time all the chaps in high visibility jackets had disappeared (presumably to count their money) so there was nobody to direct the traffic, resulting in an enormous log-jam of cars going nowhere.  But it was still a great concert though. 

Apple Airpods

Number one son told me not to buy them because I couldn't afford them. 

So I bought them. Go me.

I've got a book on the go, I'm working quite hard (for someone supposed to be retired), and there's a prospect of another book after this. And besides this was close to Fathers Day. Enough said. 

I wasn't expecting to be able to buy them in Hull, but KRCS in Hull had just received some stock and they did look very nice.  

I don't regret the purchase. The Apple Airpods are quite pricey (after all, they are Apple) but their integration with the iPhone and the Apple watch is very impressive. You don't "pair" them in any kind of Bluetooth sense. You just open the dental floss like box they come in and your iPhone asks if you want to use them. And then they just work. With all your other Apple stuff as well. You can also press a button on the case to activate pairing with other Bluetooth devices, but I've not done that yet. 

The earpieces look like slightly longer ordinary earphones, minus the wires. And that is very important. You don't realise how annoying headphone wires are until you get a wireless pair. There's no sudden jolts when the cable catches, or walking away from the desk and watching your phone being dragged off the desk onto the floor. 

They fit perfectly in my ears and I've never really worried about them falling out. Even when wearing them to mow the lawn. Your experience might be different, I'd advise you to try a pair if you're thinking about getting some. 

The headphones work well with the Apple Watch, although I have a bit of a fight making them work with the watch if the phone is nearby. 

The sound quality is good enough. More expensive headphones sound better, as do some cheaper ones. The earpieces don't block out all external sounds, but that's probably a good thing bearing in mind you're going to wear them out and about, and you probably want to hear warning shouts about oncoming busses. Apple happen to own a headphone company and so they're not going to make their headphones sound better then ones they want to sell you for twice the price.

The sound has an emphasis to mid and high frequencies, the bass is there but you won't hear it unless you're somewhere quiet. 

The earphones are powered by tiny rechargeable batteries which are charged from a slightly larger battery that lives in the little case they come with. The case has a lighting connector that you can use to charge it. The earphones will go for around three hours and the case can charge then a few times before you have to get a wire out and plug things in.

The earphones detect when you take them out of your ears, so the music stops when you stop listening. If you only take one earpiece out of the box you can listen in mono. Double tapping the earphone (which probably looks quite silly) triggers Siri. Each earpiece has a microphone in it and uses some fancy audio beam forming shenanigans to pick up quality sound. I used the setup in a conference call and everybody seemed to understand me. 

Of course they are expensive. But they do what they say on the tin. I've used them a lot because they just make using headphones easier. 

Astonishing Customer Service

I've seldom been so happy to lose a bet. 

A week or so ago one of the taps in the kitchen broke. Or, perhaps to be more precise, I broke it. While replacing the internal fitting (the bit that you have to change every now and then otherwise the taps drip) I put the handle screw on cross threaded and managed to strip the threads so that the tap handle wouldn't fit properly.

This was the cue for a whole selection of MacGuyver-esque escapades as I tried a bunch of different tricks to try and attach the tap cover. Some were quite successful. One lasted all of a day.

Number one son watched these attempts up until the point they stopped being amusing (i.e. for around ten minutes) and then suggested that I contact the company and ask for a replacement for the broken part. "Don't be silly" I replied haughtily. "No one does that kind of thing any more. I bet you fifty pence that if I contact them I'll get no response". 

Anyhoo, a bet is a bet, so last week I filled in a web form describing the problem and received a reply from Anna telling me that the replacement parts were in the post. No charge. 

Astonishing service. Thanks so much Brita. You've restored my faith in customer service. I'll pay number one son next time I see him. And be very happy to.

Will Robots Take Over the World?

So, today I did my half an hour on "Will Robots Take Over the World?". I stated of by saying I was fairly sure that then won't, but that they are already here and all around is in the devices that we use from day to day. From that it was a short hop into the joys of software and I finished off with a plug for the Hull Pixelbot and a demonstration from Chrystal Masie, Commander Custard and Aunty Violet, who responded well to commands from the audience. 

Thanks for being a great audience folks. You can find the slides for the talk here

AI Rob Miles

Here's a nice quote: "The world is not only stranger than we imagine, it is stranger than we can imagine."

Now, here it is in action. On Thursday last week I blogged that I was giving a talk about robots taking over the world, but I had no recollection of arranging it. The blog post then gets some comments from folks who think that this Rob Miles should probably have been booked instead.

Then, today, AI Rob Miles (as I shall refer to him) got in touch offering to do the talk. From the videos that he has produced (you should watch them) I reckon he'd do a much better job than me. I've fiddled with AI and whatnot, but I wouldn't call myself much of an expert. AI Rob Miles is. 

Rob Miles is not an uncommon name I suppose, and there are lots of techy people out there. But even so I'm impressed by the coincidence.