Rob at Tech Days 2014 NL

In a few days I'll be off on my travels again. I've done sessions at TechDays in the Netherlands for as long as I can remember, and they are always great fun. Even when all the demos fail. This year I'm doing three:

For the hardware one I've got flashing lights and all kinds of good stuff, and I'm really looking forward to telling folks about the wonders of MonoGame. And there will be special treats for the ones who turn up at the 7:45 am session to find out all about Phone to Phone communications. If you are coming along to the conference I'd love to see you.  I've even written some new jokes..

You'll Like Girls Like Robots

Girls Like Robots is a neat puzzle game for Windows Phone. It starts simply enough, making sure that girls get to sit next to robots rather than geeks, but as the number of protagonists increases and the arrangements change it can get a lot more head scratchingly difficult. 

The presentation and the background music are fine and dandy too. It is now down to 79 pence in the UK store. I paid quite a bit more for the game and considered it good value, at that price for such a well presented and well realised game it is a bit of a steal. 

4G in Hull

Oooh. 4G

Oooh. 4G

I think I've found the best place to browse the internet on my Lumia 1520 phone. It is the Starbucks in St. Steven's in the middle of Hull. I'm on a 4G contract now and I've been pleased to see that the 4G indicator light up when I go up town. I wan't expecting the extra G to make that much difference, but pages seem to flick into place really quickly, even faster than when I'm using WiFi. 

I really like browsing on the phone. The entire site is under my fingertips and the screen is large enough to show an entire page without needing to pan and zoom around it.

The only problem is that because I'm not massively rich I'm on a capped contract, with only 1G of data a month allowed. I've a feeling that if I went nuts with the phone I could use that up really quickly. In the future (you know, the one where we all have jetpacks and work one day a month) when cheap, fast, data is ubiquitous, I can see all kids of possibilities for this. 

You Need to Get App Folders for your Windows Phone

App Folder Start

It's quite simple really. If you've got a Windows 8 Phone you need to get App Folders. It lets you organize your applications into, er, folders, making them much easier to navigate. I've got tons of apps on my phone and scrolling through the list gets quite tedious. Of course, I can pin the important ones to the start screen, but then that gets kind of large too.

App Folders lets you create a folder that contains a subset of your apps. You can then pin this to the start screen, giving you quick access to those apps.  You can see it in action above, where I've put all my photo processing apps in one place.

App Folder Items

When I tap the folder on the start screen I get instant access to all the apps in it. You can create as many folders as you like, and really get yourself organised. You can find the program (it's free by the way) here.

Getting Windows Phone App Reviews

image

One thing that will encourage potential users of your application is good reviews. However, users are not that inclined to give good reviews to programs, even when they got them for free and have used them many times.

Lee Stott did a great little blog post a while back that shows how to add a review facility to your application. It is very sensibly designed, in that it only nags once, after ten uses of the program, so it doesn’t become a pain for the user.

You could also use the same technique to add timed release behaviours to your application, so that it could suggest new things to do over time.

Free Windows Phone 8 Book

DSC04208_09_10.jpg

I’m very pleased to be able to report that my Windows Phone 8 Book (the Blue Book that is a companion to the Yellow Book) is now available for free download from Microsoft Faculty Connection. There are around 250 pages of developer goodness spread over 15 chapters, along with a over 50 demos.

BigGreenButton

This is the button that you use to download the content. Click on the word Download. You don’t need to be a member of the Faculty Connection to get the content, it should just arrive as one large zip archive with the Blue Book document and all the demos.

Here’s a quick overview:

  • Getting Started with Windows Phone
    • The Windows Phone Platform
    • The Windows Phone Ecosystem
    • Windows Phone Program Execution
    • Windows Phone Application Development
  • Making a User Interface with XAML
    • Program Design with XAML
    • Understanding XAML
    • Putting Program Code into an Application
  • Visual Studio Solution Management
    • Getting Started with Projects and Solutions
    • Debugging Programs
    • Performance Tuning
  • Constructing a Program with XAML
    • Improving the User Experience
    • Working with XAML text
    • Using the TextChanged Event
    • Managing Application Page Layout
  • Advanced Application Development
    • Data Binding
    • Displaying Lists of Data
    • Pages and Navigation
    • Using ViewModel classes
  • Isolated Storage on Windows Phone
    • Storing Data on Windows Phone
    • Copying Files into Isolated Storage
  • Using Databases on Windows Phone
    • An Overview of Database Storage
    • Creating Data Relationships with LINQ
  • Networking with Windows Phone
    • Windows Phone Network Support
    • Networking Overview
    • Addresses and Networks
    • Creating a User Datagram Protocol (UDP) Connection
    • Creating a Transmission Control Protocol (TCP) Connection
    • Reading a Web Page
    • Using LINQ to Read from an XML Stream
  • XNA Game Development
    • XNA in Context
    • Making an XNA 4.0 Program
    • Player Interaction in Games
    • Adding Sound to a Game
    • Managing Screen Dimensions and Orientation
    • Using MonoGame
    • Making a MonoGame XNA program
  • Using Speech in Applications
    • Speech Synthesis
    • Controlling Applications using Speech
    • Simple speech input
    • Using grammars
  • Maps and Location
    • Determining the geoposition of the phone
    • Using the Map component
  • Using Bluetooth and Near Field Communications
    • Using Bluetooth
    • The Intercom Program
    • Using Near Field Communications
  • How Applications Run
    • Background Processing
    • Adding a Live Tile to an Application
    • File Transfer Tasks
    • Scheduled Notifications
  • Marketing Windows Phone Applications
    • The Windows Phone Icons and Splash Screens
    • Preparing an Application for Sale
    • Windows Phone Store
    • Making your Application Stand Out

Enjoy.

Time Travel with Windows Phone

Untitled

Apparently there are people who will believe that a software upgrade will make your phone waterproof. The “Preview for Developers” application for Windows Phone doesn’t actually turn your phone into a Tardis, but it does allow it download future versions of the Windows Phone operating system for testing. That way you can make your applications work with the latest versions of Windows Phone before they are released to the general public. It also means that you can use upcoming new features like Drive mode and application management.

Untitled

You can now terminate applications from the the App-Management screen (hold down the Back key to open this). Although why anyone would want to terminate the wonderful VoiceMusic application is a mystery to me.

Nokia Glance Background Pictures

DSC02959.jpg 

One of the many nice things about having a Nokia phone is that it provides “glance” content. This is stuff that appears on the screen when the phone is locked. The display is not very bright and seems to have a negligible effect on battery life, but it does add a lot of value. Currently the glance content is just the time and the charge status, but hopefully over time it will extend to include missed calls and alarms, and maybe even calendar details.

However, right out of the blue, Nokia have released a beta version of a program that lets you put pictures on your glance screen. The application ships with a few pre-set pictures, including the rather nice tiger above, but you can also process your own and add them to the four that cycle round. If you have a Nokia phone that is running the GDR 2 release (this is being rolled out at the moment) then you really should grab a copy and have a play it really is rather neat. You can get the program here.

Windows Phone Progress Indicator

image

You might find this useful. If you want a Windows Phone program to show that it is busy, maybe updating content from the network, binding data to a page or emptying a bank account then it turns out this is very easy. All you have to do is create a ProgressIndicator and bind it to the SystemTray.

ProgressIndicator prog; 
protected override void OnNavigatedTo(NavigationEventArgs e)
{
prog = new ProgressIndicator();
prog.IsIndeterminate = true;
prog.IsVisible = false;
prog.Text = "Leave me alone. I'm busy";
SystemTray.SetProgressIndicator(this, prog);
}

The code above makes the ProgressIndicator in the OnNavigatedTo method for the page, there are lots of other ways to do this. You can set the colour of the text and background of the display, but I use the default because I’m boring. If you set the IsIndeterminate property to true (as I have above) , this means that you don’t know how long the action will take. If you set this to false you can then use a SetValue method to adjust the size of the bar that is displayed.

Then, when your program is busy it just has to go:

prog.IsVisible = true;
This turns on the busy indicator. I’ve made a tiny demo application which uses two buttons to turn the indicator on and off. You can find it here.

You really should go to “Your Really Should” events at C4DI

WP_20130827_18_14_46_Pro__highres.jpg

Simon Hudson (left) and Jon Moss, with a Lumia 1020 in the middle..

I seem to be spending  a fair bit of time at C4DI at the moment. Tonight I was there for the first of their “You really should be..” events. The format is simple enough. Take the words “Your really should be..” and put them in front of something that you can talk about for fifteen minutes. Then take questions and repeat twice. It works really well, generating discussion and interesting things to do in equal measure. And the first topic was right up my street, when Simon Hudson spoke on “You Really Should Be giving a Windows phone a try”. Absolutely.

Simon gave a great description of what makes Windows Phone is such a nice platform, starting with some impressive sales figures (now phone platform number three) and moving on to the neat and useful things you can do with the device. Of course, I don’t need convincing of any of this, but it was lovely to hear someone else voice the same opinions and give some strong context about how Windows Phone is proving so useful to them. Highlights were Voice SMS, Live Tiles and Rooms. You can find Simon’s presentation here. For me the killer fact was that his daughter was into Windows Phone first and he got his after her.

Next up was David Gilson: “You Really Should Be buying Bitcoins!”. Bitcoins are “maths made money” in that the actual currency is created as a series of mathematical proofs, each of which identifies a particular coin. Coins are mined by computers that grind through calculations to generate the proofs which are assigned to owners.

When you buy a bitcoin or use part of it to pay for something the transaction is stored as part of the bitcoin infrastructure in a series of tamperproof blocks. You can use bitcoins to pay for stuff and you can buy them and keep them in your digital wallet. There are 21Million possible Bitcoins out there, and they will get both harder to mine and more valuable over time. At the moment around half the Bitcoins have been “mined” and people are investing in ever more powerful systems to find more. The idea is to do away with the present volatile paper based currency systems and replace them with something clean and mathematically sound.

As you might expect, the world of finance is looking a little askance at this attempt to make an end run around the systems that have made, and are keeping them rich. Bitcoins, with their untraceable ownership and easy electronic transfer, are also also ripe for use by various unsavoury enterprises. Me, I’ll be keeping my cash in traditional forms for the time being, but David did make a very compelling case for “having a flutter” on Bitcoins.

Finally Jon Moss rounded off a very enjoyable evening with a session called “You Really Should Be using Textexpander”. The TextExpander program installs on your Mac and allows you to create and manage keyboard shortcuts to vastly improve your speed when creating documents. Rather than typing “From the pen of the desk of Rob Miles” at the end of each email I could assign that to ESIG or some other combination of letters and numbers. TextExpander monitors your keyboard and then inserts the expanded version when it sees the shortcut.

That’s nice enough, but there is a lot more besides. You can create template documents, for example meeting minutes or email responses and have them all created automagically. If you find yourself typing the same phrase, or building the same document, time after time then this system would save you a lot of work.

It is a pity that the program is only available on Mac (although it is available across all the Apple platforms and works really well on iPhone and iPad). If you fancy having a go at this and are using a Windows PC Jon reckoned that PhraseExpress is your best bet.

It was an absolutely great evening. And when I went out of the office I was able to grab a nice picture of The Deep again.

WP_20130827_19_30_41_Pro__highres.jpg

C4DI have set up a web site:

http://www.youreallyshouldbe.com/

You really should be keeping an eye on it.

Updating Display Elements in Windows Phone

WP_20130820_16_20_32_Pro.jpg

This is another in my series of “put this in the blog so that you don’t forget it” posts.

Everyone (or nearly everyone) knows that you can update elements on a Windows Phone display by setting properties on them:

statusTextBlock.Text = "Hello Rob";

This would display “Hello Rob” on the phone screen. The snag is that only code that is running in the context of the page can do this. In other words, I can change the display when page events occur, for example buttons being pressed, but I can’t change the content of the TextBlock in response to a network message arriving because the network message code is not running in the same context of the display page. If I try to do this the program fails at runtime with an exception.

The way to fix this is to use a “dispatcher”. The dispatcher is part of the display management system and it will run things in the context of the display system for you. So, you have to give the dispatcher the thing you want to have done, and it will do it on your behalf. This is a bit like you sending one of your kids to go and buy you some Disney Infinity figures because you are to embarrassed to go yourself. Rather than do the task, you hand it off to another process to have it performed for you.

The best way to do this is to use a “lambda expression”. I hate this name. It makes the expression sound all clever and mathematical, when actually it is really just a useful trick that lets you treat executable code as a lump of data that you can give to something else. What you do is use a the “lamda expression” to wrap you your update behaviour and then pass the result of this expression into the method. In fact it all works with delegates, but to make simple use of the feature you don’t need to know this.

statusTextBlock.Dispatcher.BeginInvoke(() =>
{
    statusTextBlock.Text = "Hello Rob";
});

The Dispatcher object is the member of the XAML component that will run the method for us. All XAML display elements have a Dispatcher and it exposes a method called BeginInvoke that will run our code. The parameter to BeginInvoke is the code we want to have run, and this is where the Lamda magic starts.

statusTextBlock.Dispatcher.BeginInvoke(() =>
{
    statusTextBlock.Text = "Hello Rob";
});

I've highlighted the actual lamdba expression in the code sample above. It is everything between the ( and ) that goes into the BeginInvoke method. If we pull it out of there we can get a closer look.

() =>
{
    statusTextBlock.Text = "Hello Rob";
}

The item at the top, the () part, means that the code in this lambda expression does not act on any data. If you want to pass parameters into the code inside the lambda expression you can do this, but we don’t need to.

The => sequence is the lambda itself, and it is followed by the block of statements that are obeyed. If we were buying Disney Infinity figures this would be where I put the behaviour to ask for a “Mrs Incredible”. What actually happens is that the lump of code is stashed somewhere and a delegate (which in C# is how we manage pointers to code) is created to pass into the method.

So, when my program runs the BeginInvoke method in the Dispatcher is given a lump of code to run. It adds this lump of code to a list of “things to do” next time it has to update the display. This means that the display doesn’t actually update precisely when you ask it to, but the process happens so quickly that this is not a problem.

Lumia 1020 Sky

WP_20130822_08_23_46_Pro__highres.jpg

I took this picture on the way into the office this morning. I just love that sky. The picture was taken with my Lumia 1020 phone. I was going to do an HDR version, but in the end I just used the one shot.

The picture is also interesting because you can do a “brick wall resolution test” with it. If you look at the bricks as they get smaller and smaller moving away from the camera they stay as individual items (you can click on the image above to view the full sized on on Flickr if you like). On some cameras the brick lines turn into a messy blur, but here they are perfectly resolved. Lovely.

Excellent Windows Phone Development Book

image

Sometimes you can’t beat a great big book. The internet is great for answering questions, but often you don’t know exactly what question to ask. In the Good Old Days™ you could thumb through a big thick book on the subject and find the answer you want. And Windows Phone 8 Development Internals brings back the good old days for Windows Phone developers. The content is well organised and presented and the coverage is vast.

The book will not teach you how to program. It is a book for seasoned developers who want to know how to make proper Windows Phone 8 applications. I managed to get my copy from an “alternative supplier” off the UK Amazon site for around 25 pounds. At that price it is an absolute steal. Strongly recommended.

High Dynamic Range Photography with the Nokia Lumia 1020

WP_20130818_14_27_18_ev0_Pro__highresAnd4more.jpg 

I really wanted to try some High Dynamic Range photography with the Lumia 1020 so today I took a walk around Cottingham and took some shots. High Dynamic Range photography is where you take multiple pictures of the same scene at different exposures. Then you use software to merge the images, taking the best exposed bits of the different shots and making one “perfect” pictures. 

You can see the effect in the photograph above. In a picture taken at normal exposure the dark shadow in the foreground would be completely black. This bit was taken from some of the overexposed shots, with the bright bits of the church being taken from the underexposed ones.

The Lumia 1020 is a good bet for this because it will automatically shoot the “bracketed” shots. In fact you can get it to take five pictures over a range of up to 3 EV (exposure values) each side. This means that you just press the button and the phone takes all the shots for you.

There are a couple of problems with this though. The first is the obvious one, in that shots take a lot longer to complete. The phone does a good job at shunting the enormous amounts of image data from the sensor into storage, but you still have to hold the phone up for 30 seconds or so while all five pictures are taken. Actually, I’ve not found the results of using 5 exposures to be much greater than 3, and so I’d just take 3 in the future.

The other problem with the Lumia 1020 HDR photography is that you have to select this “bracketing” mode before each shot. This is probably sensible, in that you don’t want the camera get stuck taking normal snaps five times, but it is a pain when you forget.

WP_20130818_14_28_28_Pro__highres.jpg

This is a single “ordinary” shot taken from the camera and just cropped slightly. You can compare it with the shot at the top of the post, which was made from five separate exposures.

I used Adobe Lightroom to import the pictures from the phone and this works fine. I plugged the phone into my laptop and then uses the normal Lightroom Import command to bring the pictures in to my collection. Then I used Photomatix to combine the different pictures. Photomatix also does all the tone mapping to get either a fairly natural result as in the top picture or a more artistic one like the one below:

WP_20130818_15_12_47_ev0_Pro__highresAnd3more-Edit.jpg

This was taken from five images and then tone mapped using a “Painterly” pre-set that gives quite a nice effect. I’d be quite happy to print an A3 version of this, and from the look of the pixels, it would print out great too. Amazing.

In short I’m very impressed with the Lumia for HDR photography. I’d like to have the camera grip to make it a bit easier to hold the phone steady though. This also has a tripod fitting that would also be useful for longer exposures.

If you are into photography but bored with carrying your camera around, then you should take a look at this phone. The results really are impressive.

Lumia 1020 at Movie Buffs Fair

WP_20130817_10_49_45_Pro__highres.jpg

I’ve managed to get my hot little hands on a Lumia 1020. It arrived on Thursday, but owing to van driving commitments I’ve only just managed to pick it up.

I love it.

Now, remember that you are reading the words of a Microsoft MVP and Nokia Phone Champ, so you might expect me to like it a lot. But I really, really, do. People have been muttering that the Windows Phone operating system isn’t developing as fast as they might like, but I think that what has been happening is that everyone has been busy behind the scenes making it into a really “proper” phone contender.

For example, the installation of my new phone simply meant telling it which old phone backup that I wanted to use (it is going to replace my Lovely Lumia 920) and then letting the phone get on with it. Contacts, applications, SMS, call history, all magically appeared over time. The only things that caused the tiniest amount of grief were my own applications that I’d put on the phone because I’m a developer, and the ones from Windows Phone Application Studio, which couldn’t be restored because the new phone didn’t have the certificate. I can always put these back on later.

I told number one son about this and he just said “Hmm. Just like my iPhone does”. And yes, that’s precisely the point. Microsoft and Nokia have realised that for the phone to be a contender it has to be at least as good as the other offerings, and on the basis of my experience setting up my new device, it is getting darned close.

WP_20130817_10_49_45_Pro.jpg

I took the phone to Hull Movie Buffs Collectors Fair, which was very, very busy with huge queues to get the signature of “Darth Vader”, or David Prowse as the man in the suit was called. There were loads of people in costumes. Above you can see the Ghost Busters striking a pose. This picture is interesting because it is actually a crop from the high resolution shot at the top of this post. If that doesn’t bear out the claims about digital zooming, I don’t what what does. I had my camera with me too, but in the end I didn’t bother with it.

WP_20130817_10_29_47_Pro.jpg

It’s kind of intimidating when they all turn and face you at the same time. Although the Stormtrooper on the left did rather spoil the effect by then asking me how tall I am.

WP_20130817_10_51_27_Pro.jpg

These guys were guarding the way out….

Anyhoo, I had a great look round and bought a 1966 vintage Thunderbirds board game that I’m looking forward to having a go with.

There’s another Collectors Fair on 30th November. I’ll be there and I won’t be bothering to take my camera.