Heading for the Lakes

WP_20130907_19_05_34_Panorama.jpg

It’s been a while since I’ve travelled somewhere with the express purpose of doing nothing when I get there. Heading off to Imagine Cup, TechEd, Campus Europe or whatever is always great fun, but there is always that underlying concern that you might not have the right kind of VGA adapter for the Surface in your bag when you get there. And they might not laugh at the jokes.

Anyhoo, today we are setting off for a week in the Italian Lakes. Actually, not in the lakes, that would be silly, but in a carefully selected, economically priced establishment just on the shoreline. Of course, I’ve not completely released my grip on my iron work ethic, there will be blog posts and pictures.

But I’ll do them when I get back.

Hull Freedom Festival

DSC02526.jpg

Hull is one of the cities in the running for “City of Culture 2017”. On the showing of the Freedom Festival event we went to today I think it is there already.

It. Was. Awesome.

DSC02447_8_9.jpg

They had these fluttering flags all around the city centre.

DSC02654_5_6-Edit.jpg

And the museum up town had been suitably decorated.

I’m ashamed to admit that this was my first trip down to the festival. We are not normally around this time of year, but having seen some of the preparations and with a good (but not great) weather forecast we decided to go for it tonight.

I’m so glad we did. Everything was wonderful. You just walked around a corner and there was another great band, playing superb music. We bounced off various stages and I took some pictures.

DSC02681.jpg

This is Kirsty Almeida, with her brilliant band. Great jazz singing, amazing musicians.

DSC02697.jpg

I’m not sure who these guys are. But by gum they were good. And loud.

DSC02735.jpg

And this is acrobatics to a driving African beat.

Around the streets we had some donuts that were cooked before our eyes (and were yummy), went round an art show and visited the Museum of Club Culture who had a special David Bowie exhibition. Then we bought some strawberry sherbet bon-bons a pig shaped bag from the craft stall (not for me) took in a few more acts and headed home.

The festival is on for the rest of the weekend.

Get. Down. There.

Scary Lifts at Campus Party EU

WP_20130904_16_18_05_Pro

This is the last day of Campus Party down in London. Andy and the crew will be judging the Hackathon Entries and I’m back in Hull. Oh well. Good luck to everyone. And I hope that some of the things that I said on Tuesday (it seems such a long time ago) were useful.

One more story from the experience: We were carrying some stuff back to the “base camp” room with one of the O2 Dome security guys. As we were heading for the lifts the chap was talking about a science fiction film he saw ages ago about this futuristic society. Every year they took the brightest and best of their people and put them in a lift to “ascend to the next level”. Of course there was no next level, just a horrible fate. He finished his story just as he punched the button to close the lift doors.

I made the point that with me as one of the party, everyone was completely safe from anything like that…..

Campus Party EU Day two (for me)

WP_20130903_20_16_24_Pro__highres.jpg

For those of you who that aren’t convinced by the camera in the Lumia 1020 I say Ha! and Ha! again. I’m going to print out an A3 version of this, and I reckon it will look awesome.

I’ve got a confession to make. I’m surrounded by people working through the night, making things and talking tech. And last night at eight thirty in the evening I toddled off to the hotel to watch CSI: NY and turn in. I blame it on my advanced years and the fact I was up at 5:15am yesterday to catch the train here. A poor excuse I know, but I did have enough stamina left to figure out who the killer was A clue: It was mum.

Anyhoo, here are a few more pictures from the event..

DSC02391.jpg

A blimp giving some sound advice.

WP_20130903_14_31_20_Pro__highres.jpg

I bought these from a shop here. Sure takes you back..

DSC02407.jpg

Awesome quad copter with eyes that can follow you round the room. Literally.

DSC02430.jpg

Completely amazing steampunk retro computer.

WP_20130904_11_00_22_Pro__highres.jpg

Picture Puzzle: One of the people in this photograph is wearing a hideous wig. Using your skill and judgement draw a large X over them so that you can’t see them any more.

Rob at Campus Party EU

DSC02334_5_6.jpg 
I call this photo “Down in the trainstation at 6:00 am”..

What do Rob and George Osbourne have in common? Well, not a lot as it turns out, which is definitely good news for him. But one thing we do share is that we are both at Campus Party EU today.

I don’t think George did a talk on Windows Phone development though, at least I didn’t see him at mine making notes. I had a great audience of folks who were all keen to have a go at writing something for Windows Phone. There was quite a wide spread of development experience in the audience, so I kind of went for the “broad comedy” approach that seemed to go well enough.

DSC02351.jpg

This is the audience being warmed up for me.

DSC02353.jpg

And this is Riaz doing the warming.

DSC02384.jpg

They have an Xbox one here, not sure what the game is though. The whole thing is great. Like the Hacked.io event I went to earlier this year, but much, much bigger and international. The clue is in the name I guess. A big chunk of the dome is full of people making things, doing stuff and sharing ideas. A lot of fun is being had and good done.

WP_20130903_12_15_33_Pro__highres.jpg

I found this drawn on one of the Whiteboards. Indeed.

For those of you who were at my talk, you can find my Windows Phone App Studio screencasts here. You can find App Studio here. And you can find me in the open area near the Xbox One sitting typing at my Skinned Surface.

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.

Peter’s 3D Printer

IMG_7511.jpg

I went out this afternoon to take a look at Peter’s 3D printer. You can find out more about it here. I’ve actually seen it now. It’s awesome. The most impressive thing is that all the parts were designed by Peter and some of them were printed by me. And it works. To the point that the fan mount on the picture above was actually printed by the printer itself.

I made my printer from a kit and I’ve been slowly discovering the best way to get things from a roll of plastic fibre into a useful shape. The learning curve has been steep at times, but what Peter has done is much more tricky. He has had to construct and align all the components himself.

The design of the printer is totally unlike mine. The position of the printing head is controlled by the movement of the three carriages up and down the three pillars. The controlling software drives stepper motors that are connected to cable that is looped around each pillar and pulls the carriages up and down. The great thing about this design is that the head can move really fast, and during printing the item being printed doesn’t move at all. The tricky thing is that printing in straight lines involves all the motors making complex movement (which is not a huge problem, the software does all the tricky maths) but any inaccuracy in the movement will result in straight lines becoming curved or slanted.

Peter has spent a lot of time aligning everything and now he is getting some excellent results. Eventually he will be using his printer to make a whole new one.

IMG_7532.jpg

This is my favourite view of the printer.

What does ?? mean in C#

WP_20130829_17_11_38_Pro__highres.jpg

I sent out a tweet asking folks if they knew what the ?? operator in C# does. Quite a few people did, which was nice. For those of you that haven’t heard of it, here is my explanation.

If you are a C# programmer you will know about references. The way that C# works, a variable can be managed by value or reference. A variable of value type is stored in a location in memory. For example:

int i;

This creates an integer variable called i. When the program runs the system will decide where in memory the variable should live. You can think of computer memory as a whole bunch of numbered locations. Because that is what it is. Perhaps the variable i could live at memory location 5,000. Then when we write the code:

i=99;

The effect of this is to put the value 99 in memory location number 5,000

So, if I write code like:

j = i;

This would copy the value held in memory location 5,000 into the location where the integer variable j is stored.

This is how value types work. Whenever we do an assignment of a variable managed by value what happens is that the value is copied from one memory location to another.

So, what about values managed by reference? Well, in these there is a level of indirection between the variable and the actual data. Suppose we have a class called Account, which is managed by reference.

Account a = new Account();

This statement makes a new account variable and then sets the variable a to refer to it. The variable a will hold a reference to the new Account. Perhaps the new Account will be located at memory location 10,000 which means that the variable a (which might be stored at location 6,000) will hold the number 10,000 – because that is where the Account instance is stored. The Account class might have a Name property, so I can write code like:

a.Name = "Rob";

When the program runs it will go to location 6,000 (where a is stored) and read the number out of there to find out where the Account is. In this case the variable a holds the number 10,000 and so the program will go to the Account there and set the name.

So if write code such as:

Account b = a;

This creates a new Account reference called b which refers to the same Account instance as a, in other words it will refer to location 10,000.

So, in the case of the value the information is just there in memory, but for a reference we have to go where the reference refers. With references you can also set them to null:

a = null;

This has the effect of putting a “magic value” in the variable a that indicates it really points nowhere.  It is a way of saying “this reference does not point to any object”.

The null reference is often used in programs to indicate that the thing you asked for could not be found, or hasn’t been made yet, or doesn’t matter.

This “nullability” is so useful that people wanted to be able to make values “null” as well. So they invented one.

int? ageValue;
The addition of the question mark makes an integer variable (ageValue) that can be made null. For example, the bank might store the age of a customer when it is important (when the age is less than 20 say) but once a person reaches a certain age, from then on the age is completely irrelevant to the system. They can mark the ageValue as null to indicate this.

ageValue = null;

Programs can also test for null

if (customerAge != null)
{
// Stuff you do if the age matters
}

In XNA you often find nullable value parameters being sent to method, so that the method can know to ignore them.

So, I’ve been writing for what seems like ages, and I’ve still not explained what ?? does.

Well, ?? provides a convenient way that I can map the null value of a nullable variable onto a specific value

int actualAge = customerAge ?? -1;

It saves us having to write code that tests for null and sets a value appropriately. The above statement sets the value of actualAge to the value in customerAge unless the value in customerAge is null, in which case it sets it to –1.

if (customerAge == null)
actualAge = -1;
else
actualAge = customerAge;

In other words ?? is a short form of the above test.

Feminine Logic

WP_20130827_17_04_42_Pro.jpg

Last week our washing machine broke. Yesterday I fitted the new one. Only problem is that the new machine is slightly larger and catches a cupboard door so that it won’t quite open as wide as it used to. This means that we can’t get the cleaning bucket out of the cupboard very easily. My proposed solution was to design and 3D print a new hinge that moved the door pivot point as it was opened so that it didn’t catch the washing machine and the door could open further. Number one wife suggested we put the bucket in another cupboard.

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.

Disney Infinity

WP_20130826_13_09_55_Pro.jpg

Mrs Incredible (anyone know her first name?) I bought her so I could have two player action in the Incredibles world. I guess over time I’ll acquire the whole darned set..

Some time back I was lucky enough to be able to make a trip to Disney World in Florida. The place is amazing. The design and execution of the buildings and the rides and the way the experience is packaged is just fantastic. You can have great fun just looking for the places they have have hidden the iconic outline of Mickey Mouse and his big ears. Those three loops are in the paths, on the walls and even on the water tank. Everyone at Disney World is committed to giving you a great time, from the cheery train drivers who welcome you in the morning and say a heartfelt goodbye as you leave to the “cast” members in costumes who are happy to sign autographs all day long.

And yet, and yet, the place is really a great big machine that has been designed with the purpose of taking as much money as possible from you during your short stay. Around every corner are hot dog stands, ice cream stalls, souvenir shops and ride photo booths. While in theory it is possible to pay nothing once you have entered the park, in practice it is actually darned difficult. Particularly with kids.

Which bring us to Disney Infinity, the new release from Disney Interactive. It is a computer game and toy series that seems heavily influenced by Skylanders and Lego City, but able to draw on the vast reserves of Disney characters. For your money (and you will need money) you get a video game, high quality plastic models of Disney characters and a base that you can plug into your video game console of choice.

Each figure contains some RFID cleverness that lets the game recognise the figure so you can play them in the game, and also store game stats. In addition there are “power up” disks that you can add to give extra items, such as a horse to ride or boost a character health by 25% or so. There are also “world” models that give you access to different worlds.

In the starter set you get characters from Monsters University, Pirates of the Caribbean and The Incredibles along with a “world” block that gives you access to those three words. In no time at all you can be wandering round the campus as Sully, scaring all and sundry.

Each world sets you a number of challenges, very like the Lego City game, although for me the interaction with the environment isn’t quite as smooth as the Lego world and the narrative is nowhere near as interesting or well presented. When you complete challenges you “power up” your character, get cash you can spend on more toys and also tokens to unlock game elements that you can use to build your own worlds.

And therein lies the really interesting part of this enterprise. Because the Disney Infinity folks have also been taking a long hard look at Little Big Planet and Minecraft, and have included a mechanic that lets you build and share worlds. The only snag(and I reckon it is a big snag) is that you have to work through lots of mildly diverting, but not great, gameplay to get all the pieces that you will need to construct your creations. And a lot of the time it feels like work. And that is not what a video game should feel like.

The underlying engine seems able to handle the worlds very well. For me perhaps the most impressive part of the game was the very first stage, where you travel through a landscape that builds itself as you walk towards it. I’ve not really got far enough into the game to be able to make much interesting yet. My characters are slowly ascending through the ranks and making appearance in the “Hall of Heroes” that you must visit, simply to view the huge number of empty pedestals for heroes that have yet to be purchased…

Disney are in this for the long haul. They have spent a lot of money building their virtual theme park and the have huge amounts of back catalogue on which they can create new scenarios and sell us more pieces of quality painted plastic. The power ups provide a nice swapping mechanic (you are never quite sure what you will get in a bag) and the prices are enticing rather than completely extortionate.

If you went to Disney World and enjoyed it then you will love Disney Infinity. The starting pack is a very well thought out entry point, in that it gets you into the game but leaves you wanting more, and the beautifully painted models are an end in themselves. And if you really want to create your own fairy castle, complete with race track and pirate cove, you can use Infinity to do it. Good for children of all ages I reckon.

Deep Projection

IMG_7336_7_8.jpg

Last night the chaps at C4DI were doing some trials of video projection onto “The Deep”. So a bunch of us went down to take a look. It was a lovely evening when we arrived and so we wandered round taking a few pictures. Today I got them out of the camera and took a look.

IMG_7411_2_3.jpg

This is a slightly processed image of the footbridge over to The Deep.

IMG_7450.jpg

This is a nice way to brand a building.

IMG_7478.jpg

And these are jellyfish.

The test was for something big coming in November. Keep an eye on the C4DI website for more details.

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.

I can bring any system to its knees

Earlier this year I bought a new computer. And now I seem to have broken it. I appear to have a rare talent, I can over time reduce any computer to abject uselessness. I have behind me a trail of Dell, Novatech and even Apple machines which have slowed down to a snails pace and become much harder to use. Just because I’ve been using them for a while.

My lovely Sony Ultrabook is still mostly lovely, but the touch screen driver has acquired an irritating habit of suddenly tapping the touch screen rapidly and making the mouse unusable. I can get rid of that problem by using CTRL+ALT+DEL to bring up the lock screen but it is still irritating. I’m not sure if it is hardware or software to be honest, it seemed to start after I took the (apparently stupid) step of enabling the automatic download of updates and the machine turned itself on in my bag and tried to commit thermal suicide.

I can live with the occasional touch screen foibles though, what I’m finding much harder to deal with is the way that the “Anti Malware Service Executable” will suddenly and violently take my machine away from me by pushing the hard drive activity to 100%. This happens after a reboot and when I’m trying to get something done and is very annoying. The stupid process seems to have no way of working out that “Robert is actually using the machine now” and just wades in and breaks everything.

While it is amusingly ironic that a program designed to protect me against my machine becoming clogged and unusable is actually making my machine clogged and unusable, it is also darned annoying.

Verity Stob writes of cruft, which builds up and slows down a machine, and I’m probably suffering a bit from that. I think that when Windows 8.1 shows up I’ll do a complete re-install and see if that sorts things out.