Jamie's Blog

The ramblings of a programmer with a little too much time on his hands

Tag: Programming (Page 1 of 3)

Discworld Disorganiser Header Image

Announcing: Discworld Disorganiser Web App

Today’s header image was created by Josh Kirby, you can find the more information on John Kirby here

A New Application?

I’ve wanted to build, publish and release a new application for a while now, one that’s based on an idea I’ve had bouncing around my head for a while: A search engine for Discworld novels.

Enter, the Discworld Disorganiser.

The Name

In the Discworld novels the dis-organiser is a parody of a PDA. It’s a small device, powered by an incompetent imp, which annoys the user. Not into remembering their schedule, in fact most of the features of the Mark 1 dis-organiser are apologies. It just annoys the user, that’s all it’s really good for.

The Application

The name doesn’t really hold with the aim of the application, if I’m honest. It was just a catchy, related name for the thing.

Anyway, the idea behind The Discworld Disorganiser application is that a user can use it to search for a Book, Character or Series.

The Book search would take into account as much of the book content as would be possible, when searching. Things like:

  • Name of the book (which seems quite important)
  • ISBN
  • Book description
  • Characters included in the book

That last step would be tricky, especially with the later books. Snuff (one of the final few books in the series) has over 50 characters, for example. Now most of these characters are not that important to the story, but I wanted to be as loyal to the source as I could in as many places.

A few weeks back, I released a video of an early beta of the app. It didn’t have a full data set, and was missing the Series search functionality, but I’ll include it here for completeness:

A Walk Through the Application

Since releasing that video, I’ve added the Series search function into the mix but have introduced a few bugs along the way.

First an updated video showing off the new features:

The first thing I do is search for a Book, you can see that it uses character names (which is why I search for “Rincewind” and “Nanny Ogg”) along with the book description (why I searched for “Watch”).

Then I search for Vimes on the character screen and we get the first bug: There are quite a lot of entries for Samuel Vimes.

Whoops

Then I do a partial character name match: “rince”. This matches on a few character names, so we get a few results. Again, though, there are too many Rincewinds.

And finally, I do a Series search. Currently this searches only on series names, so you wont get results if you search for “Nanny Ogg” or “Night Watch”. But you do get results for a series name, or for a blank string search.

Wanna Try?

If you’ve gotten this far, then I’m sure that you want to try it. And you can, it’s available for free. All you have to do is point a web browser at: http://discworlddisorganiser.azurewebsites.net

It’s on a free tier of Microsoft’s Azure hosting platform. This means that when the application isn’t being used it shuts down, and can take up to 4-5 seconds to start back up again.

Luckily, this only happens after about half an hour of no one using it

Wanna Know How I Did It?

If you got this far, then I know you’re more than a little interested in how I built this thing. Well you’re in luck, because I wrote up every step that I took to build both parts of the application.

Technically, it’s two applications

The first part of the application is a .NET Core WebApi project which uses Entity Framework Core and Sqlite. There was very little documentation out there for Entity Framework Core when I started building this application, so it was all a bit touch and go. But I documented the process, and you can read all about it here.

The series of blog posts presented in that link are in reverse order, because I like to mess with people.

The second part of the application is a .NET Core MVC Single Page Application using Angualr2 and webpack.

now THAT sounds impressive

I wrote all about the process of building that part of the application here.

I write a fair bit these days, huh?

On top of all that, I’ve released the source code for free. This means that if you follow along with the blog posts that I’ve linked above, you’ll be able to build a version for yourself.

Including the bugs!

WebApi

I’ve tried to keep the design for the  WebApi part to be as open as possible. As long as your dataset is complete enough, you should be able to swap the seed data JSON files for any other set of books, characters and series data.

Want to build a Brandon Sanderson search engine? How about a Stephen King search engine? Both of those are easy enough. Just swap the data in the JSON files, rebuild the app and call /database/dropdata followed by /database/seeddata to see your whole new search engine.

The source code for the WebApi project is available here

WebUi

The UI project is equally as open. As long as you change the address used in the search methods to that of your book engine, then everything will work fine.

The source code for the WebUi project is available here

Thoughts?

There’s not much else to say other than, go give it a try and let me know what you think. Let me know what you think of the application (or if you find any bugs) in the comments.

Keeping up with Development – Podcasts

Feature image courtesy of www.programmingthrowdown.com

Programming is one of those occupations where it can be hard to stay up to date. Especially since it seems like there are 2 new languages, 3 new frameworks and 18 new Javascript libraries released each week.

All of this means that it can be difficult to keep up with current affairs in our chosen line of work. That’s where chunks of bite size information can come in handy.

I’ve written before about how easy it is to fall behind in programming [LINK to source]:

Anyone who works in software development (regardless of the languages, frameworks or target platforms) will tell you just how easy it is to fall behind. If you are out of the development world for as little as six months, you can fall behind and be left in the dust – it is imperative to remain up to date with what’s going on.

Commuting?

It turns out that more and more people are commuting every day. A 2011 study by the office of national statistics reports that roughly 876,000 people commute into London everyday [LINK]. Most of which where coming into London from neighbouring areas, but some as far as Milton Keynes and Yorkshire.

I like to think that the folks coming in from Yorkshire where infrequent commutes. I can’t imagine it being much fun having to get up early enough to commute to London form Yorkshire (although, I do know someone who does the opposite journey often enough).

As an average (and this is my own guess, based on my experience), I’d say that most commutes are between half an hour to two hours in length. What can you do for that amount of time? Well, one thing is that you could catch up with programming news.

… If you wanted to.

Where to start?

Well, there are all sorts of places: Blogs, Books, Magazines, Reddit (careful that you don’t get too distracted by gifs of kittens, though). However, my favourite is podcasts.

I’m going to assume that you know what a podcast is, but for those who don’t:

A podcast is a series of short (typically between half an hour and an hour in length) audio programmes about a given subject. They are subscribed to, and the latest episodes can be delivered to the subscriber as soon as they are available for download. More often than not they are free to obtain, but some podcasters offer paid-for episodes in an effort to support their work.

In a nutshell: it’s a bit like talk radio, but more specialised as you can get a podcast on just about anything.

Programming Podcasts?

I’ve alluded to podcasts before, on a completely different blog, when I wrote:

whilst programming is a visual medium, discussion on programming can take any format. 40-60 minute discussions on programming can be quite helpful for folks who are looking to fill their daily commute with something entertaining and related to their job (or field of study).

I’ve found that my walk to work (and sometimes into and around town) can be made a little more interesting by throwing on a podcast (or AudioBook, but that’s for another post) and listening while you take your journey. A lot of folks listen to music (either the radio, or their personal collection), so it’s only a small change but one that I’m convinced can be very worth while.

Because there are natural pauses in human speech (and the lack of the loudness war), it can often be safer to listen to podcasts while commuting (either walking, taking the bus or train, or driving), as you can still hear most of the environmental sounds around you. They also make for a quieter environment for those around you, which is useful for if you take the train or subway to work.

A Reason To Do It

It’s no secret that reading and learning helps you out in life. Take this news article from The Telegraph, for instance: [LINK], or how about this one (from The Guardian): [LINK]

According to the 2012 Learning Survey by Niace, the adult learning organisation, there’s a strong correlation between learning and sustained employment. Staff who undertake learning activities are more able to adapt to the changing requirements of an organisation and gain a competitive edge in the job market.

The amount of times that reading comes up on career guidance and advice forums is staggering. It’s one of the most important things that you can do, apparently.

That, and actually turning up to work and doing the job you’re paid to do, obviously.

All of this is ever more important in the development/software engineering/programming/whatever-you-want-to-call-it market. Without continually developing our skill sets, we’ll be left in the dust to fend for ourselves, whilst those with the drive to learn things in their own time will be living the high life.

In fact, there’s an episode of HanselMinutes (see below) all about how and when someone is ready for the title of “senior developer” (and it’s not about how old you are, either).

Confucius once said:

No matter how busy you may think you are, you must find time for reading, or surrender yourself to self-chosen ignorance.

And that’s pretty heady, if I say so myself.

Yeah, ok so we don’t always have time to read, but why not use “active listening” on a podcast or two. It’s worth it, I promise you.

Recommendations?

Since I’m a programmer, I’m going to lean this towards programming. There are searchable podcast directories, two of the best being iTunes (which acts as a great podcatcher, too) and gPodder [LINK] (which helps to keep all of your subscriptions in one place). So, if you want to find a podcast about your profession, hobby or whatever, then I’d try those first… or Google.

Anyway, on to some recommendations. Where possible I’ll link to the podcast’s homepage rather than the RSS feed as that’s more useful to most folks.

Programming Throwdown

Patrick Wheeler and Jason Gauci talk listeners through a different programming language, framework or technique every two weeks. They go into detail about the history and where the language/framework of choice is used the most, they also talk about their daily lives and some of the work that they’re doing recently. Each episode is 40 minutes to 1 hour long (just long enough for most commutes), and is really informative.

Coder Radio

Chris Fisher and Mike Dominick host a weekly show which looks at the art and business of software engineering. They have very detailed discussions about each technology, framework or issue that they face and always supply places to go to learn more about the topic of each show in the show notes. It also has a supporting subreddit with even more information and in-depth discussion [LINK].

To be honest, I’d recommend any of the podcasts on Jupiter Broadcasting, they have a wide range of shows covering all sorts of topics.

Hanselminutes

Hanselminutes is a weekly podcast by Scott Hanselman. Scott works on the Web Platform Team at Microsoft, so he definitely knows what he’s talking about. His podcast covers a very wide range of topics in software engineering, from subjects are far and wide as theoretical computer science and web development, to 3D printers and rockets.

Debug

Debug is hosted by Guy English and Rene Ritchie and is described as “the great talk you get at the bar after the conference”. The hosts focus on development for iPad, iPhone, Mac and Gaming but there are gems here for folks who don’t work in those arenas (especially web devs).

Stack Exchange

Hosted by Joel Spolsky (one of the creators of Stack Exchange) with Jay Hanlon and David Fullerton, the Stack Exchange podcast lets you listen in on discussions and decisions about the Stack Exchange Network. The Stack Exchange podcast gives you an unparalleled view into how a startup is created and built as well as some real gems on how to maintain a massive web development project, long term.

Adventures in Angular

Hosts Joe Eames, Aaron Frost, Brian Ford, Charles, Max Wood and Miško Hevery discuss all things AngularJs (Google’s MVVM JavaScript framework). From the origins of Angular, why you would use it, and the potential pitfalls of using Angular to tutorials and helpful tips and tricks. Definitely worth a listen, whether you’re new to Angular or not.

JavaScript Jabber

As with Adventures with Angular, this DevChat podcast takes listeners through “what is Javascript?” all the way to advanced, server side, NodeJs type stuff with everything in between. Almost everyone uses JavaScript these days (even recruiters who don’t know the difference between Java and JavaScript, know that it’s important – relevant link: [LINK])

Full Stack Radio

Adam Wathan brings, along with a special guest each week, knowledge and experience about all the steps of developing software from user interfaces all the way up to system administration the Full Stack, as it were. Worth a listen for anyone who wants to know about all of the steps involved in developing some new software, from the ground up.

This Developer’s Life

Another one with Scott Hanselman, this time co-hosted by Rob Conorey. This Developer’s Life is modelled on This American Life [LINK], and covers the things that a lot of things that most books and other media don’t cover, namely: the real life aspects of being a software developer (the late nights during crunch time, the stress, the tiredness, the amazing feeling when a project completes).

.NET Rocks

Carl Franklin and Richard Campbell have been doing a weekly podcast since 2002 and have covered such a wide range of topics that they offer personalised RSS feeds based on what you, the listener, are interested in [LINK to the feed page]. I cannot recommend this podcast enough.

What now?

So there you have it, a selection of programming related podcasts to keep you entertained and up to date. The selection may seem haphazard, but then I’m like that with my tastes sometimes.

Take a listen to a handful of the episodes for each show, and I guarantee that you’ll learn something new about your chosen field of programming. Also get in touch with a podcast recommendation of your own via the comments, I really like checking out new shows and will give any a listen.

Hot Off The Presses!

Happy New Year all!

After a long period of not posting anything (aside from a tutorial post, shortly before Christmas, on how to use MakeMKV) for half a year, I’ve decided to post something new.

Shortly after the new year, I decided that this blog could do with a new theme, so I’ve changed it up a little. What do you think? I think that the typeface is a little easier to read, and that the extra width in the main column makes my code listings stand out a little better.

Speaking of which, I recently expanded my GitHub account to include Gists. Gists as tiny blocks of code that you can host on GitHub and post elsewhere, kind of like PasteBin and the like, except that you’re not supposed to post reams and reams of code – you’re only supposed to post enough so that the reader gets the gist of what’s going on. Get it?

Anyway, so I’ve gone through all of my code example listings on this blog and replaced most of the code listings with versions that are hosted on my GitHub Gists page. The reason I’ve done this is so that, if I need to change the code, I don’t need to change the contents of the post.

Anyway, I’d better get back to my Sunday. Have fun, y’all. I’ll try to get some time to post something new every week (even if t’s only a small amount).

J

A Mid-Afternoon Puzzle

I love that this one puzzle has two possible solutions:

This problem can be solved by pre-school children in 5-10 minutes, by programer – in 1 hour, by people with higher education … well, check it yourself!

8809=6
7111=0
2172=0
6666=4
1111=0
3213=0
7662=2
9313=1
0000=4
2222=0
3333=0
5555=0
8193=3
8096=5
7777=0
9999=4
7756=1
6855=3
9881=5
5531=0
2581=?

See if you can figure out both possible solutions.

Random Quotes Generator Screenshot

Random Quote Generator

Edit (18/01/2013)

I have edited this post on the above date. However, the only change that I have made is that I am now hosting the source code (found at the end of this post) on GitHub. This means, that if I need to make a change to the code, I do not have to edit this post again – as it will pull the latest version of it from the relevant page on GitHub whenever it is accessed by a reader.

So, I was looking through some of my old hobby code today and happened on an old quote generator. It’s a neat little (the executable weighs in at 24Kb) C# program that provides the user with a random quote from some of my favourite TV shows.

Random Quotes Generator Screenshot

A screen-grab of my Random Quote generator showing a picture of Professor Ueda Jiro and a quote from the TV show Firefly

The Algorithm

  1. Find a text file called “Quotes.txt”
  2. Load each line in the text file into an element in an array
  3. Display a standard Windows form with a picture and a text box.
  4. When the user pressed the “Generate Quote” button, ‘randomly’ pick one and display it in the text box.

The Code

The code itself is pretty simple. It compiles on .NET 2.0.50727 and will only run with a text file called “Quotes.txt” located in the same folder as the executable.
[gist https://gist.github.com/4569288 /]

For those wanting to compile this code, you’ll need to provide Visual Studio with a JPEG image. In the original solution, I called this image “Dontokoi!” (as this is the catchphrase of the character in the image). Without this image, I doubt that the program will execute correctly.

Post Mortem

Aside from the above comment about the image being required for compilation, I did notice another potential problem with the program.

For some reason, apostrophes (‘) aren’t rendered correctly when the accompanying text file is encoded in anything but UTF-8. Since I know very little about text file encoding and the default way that the .NET libraries import text into a string array and the way that .NET draws this text into a text box, I can only assume that the problem is related to the formatting of the text file (saved, using Notepad++).

Either that, or it’s related to one of the settings within the Visual Studio IDE itself. I do remember that, around this time, I was attempting to compile all of my code with direct support for Unicode, so maybe that’s it.

I’m not sure, to be honest. But I am planning on opening the solution file (at some point) and having a good look around. The reason I haven’t opened the solution file at the minute is because I don’t own a copy of Visual Studio; which makes opening a Visual Studio file quite difficult.

Here’s a link to a zip of the entire solution, in case you wanted to take a look (The executable is in Bin/Release along with an old Quotes text file) [LINK]

Until next time,

J

Problem Six – In C

EDIT (18/01/2013)

I have edited this post on the above date. However, the only change that I have made is that I am now hosting the source code (found at the end of this post) on GitHub. This means, that if I need to make a change to the code, I do not have to edit this post again – as it will pull the latest version of it from the relevant page on GitHub whenever it is accessed by a reader.

 

Reading a comment on my most recent post, I felt that I could optimise my code for Project Euler’s Problem Six. So, I went away and read up on the information provided by Kristan (in the comments section), and decided that I’d give it a go… in C.

There were a few reasons for switching to C, the biggest was that I only have a C compiler installed on this machine (a minimal install of MingW), another being that I’m a little more informed about the optimisation options (which I didn’t use for this project) that gcc provides.

Anyway, on with the code.

Firstly

This is a solution to problem 6 on Project Euler. I’ve not posted it up here to gloat, or to provide answers for cheats. I’ve posted it, so that you can see how I solve this kind of problem.

The original problem reads like this:

The sum of the squares of the first ten natural numbers is,

12 + 22 + … + 102 = 385

The square of the sum of the first ten natural numbers is,

(1 + 2 + … + 10)2 = 552 = 3025

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 – 385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

The Algorithm

Based on my code from the previous version of this project, and the knowledge provided by Kristan and The Internet at large, I’ve used a slightly different algorithm this time around. I’ve covered the algorithm in the comments section for my code, though. So, I guess you should just scroll down and read that.

I’m not a massive fan of providing information twice, in the same format. That and redundancy. That and redundancy

The Code

I’m not going to spend time explaining the code, since it contains enough information in the comments (within the code itself) and in the description of the algorithm above.

So, without further ado, here is the finished code:

By the way, I compiled this code with the following command:

gcc “Problem_Six_In_C.c” -o “Problem_Six_In_C.exe” -Wall

A simple problem with an extremely simple, now optimised,  solution.

Here’s a link to the c file: LINK

Until next time,

J

Sums and Squares – Or: How I Solved Project Euler Problem 6

Edit (18/01/2013)

I have edited this post on the above date. However, the only change that I have made is that I am now hosting the source code (found at the end of this post) on GitHub. This means, that if I need to make a change to the code, I do not have to edit this post again – as it will pull the latest version of it from the relevant page on GitHub whenever it is accessed by a reader.

Firstly

This is a solution to problem 6 on Project Euler. I’ve not posted it up here to gloat, or to provide answers for cheats. I’ve posted it, so that you can see how I solve this kind of problem.

The original problem reads like this:

The sum of the squares of the first ten natural numbers is,

12 + 22 + … + 102 = 385

The square of the sum of the first ten natural numbers is,

(1 + 2 + … + 10)2 = 552 = 3025

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 – 385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

The Algorithm

There’s only one way to solve this problem.

This one is real simple – dependant on your understanding of Mathematics – assuming you can understand Square Numbers.

It’s a two step approach:

  1. Sum (add up) all of the squares of the numbers between 1 and 100
  2. Sum all of the numbers between 1 and 100, then square the answer
  3. Then find the difference between them (subtract one from the other)

There’s a slight problem with this method, though. Skipping ahead – and, hopefully teaching you all a little about speed-of-light Maths – we get:

There is a well known story about Karl Friedrich Gauss when he was in elementary school. His teacher got mad at the class and told them to add the numbers 1 to 100 and give him the answer by the end of the class. About 30 seconds later Gauss gave him the answer.
The other kids were adding the numbers like this:
1 + 2 + 3 + . . . . + 99 + 100 = ?
But Gauss rearranged the numbers to add them like this:
(1 + 100) + (2 + 99) + (3 + 98) + . . . . + (50 + 51) = ?
If you notice every pair of numbers adds up to 101. There are 50 pairs of numbers, so the answer is 50*101 = 5050.  Of course Gauss came up with the answer about 20 times faster than the other kids.

That version of the story comes, courtesy of Dr. Math. The actual story has been around for… well, since the days of Karl Friedrich Gauss

Anyway, skipping to the end, we find that the sum of all the numbers from 1 to 100 comes out at 5050. A quick calculation tells us that 5050 squared (5050 * 5050) is 25,502,500. Quite a big number, wouldn’t you say?

That’s fine, but logic tells me that the other number I’m working out (the sum of the squares) will be huge, compared to this one. So, and int just wont do it.

Dependant on your system, an int can store a value between +2,147,483,647 and – 2,147,483,646 (32 bit)

So because of this, potentially, massive answer, I decided to code this by using an unsigned long long (sometimes called a long int) type.

Again, dependant on your system, an unsigned long long can store a value between 0 and +4,294,967,295 (32bit)

Of course, I’m running 62 bit, so the maximum values that these two variable types can hold are doubled. But that’s not the point.

The Code

I’m not going to spend time explaining the code, since it contains enough information in the comments (within the code itself) and in the description of the algorithm above.

So, without further ado, here is the finished code:


A simple problem with a simple solution.

Here’s a link to the cpp file: LINK

Until next time,

J

Pining For Primes – Or: How I Solved Project Euler Problem 5

Edit (18/01/2013)

I have edited this post on the above date. However, the only change that I have made is that I am now hosting the source code (found at the end of this post) on GitHub. This means, that if I need to make a change to the code, I do not have to edit this post again – as it will pull the latest version of it from the relevant page on GitHub whenever it is accessed by a reader.

Firstly

This is a solution to problem 5 on Project Euler. I’ve not posted it up here to gloat, or to provide answers for cheats. I’ve posted it, so that you can see how I solve this kind of problem.

The original problem reads like this:

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

The Algorithm

Firstly, there are two ways to solve this problem. One involves brute force, and one requires a little savvy.

Technically, there are a whole bunch of ways to solve this problem – dependant on your understanding of Mathematics. Hopefully, both of these methods will be simple enough to follow – assuming you can understand Prime Numbers.

The brute force check goes like this:

  1. Start at n, check this against all numbers in m
  2. If n divides evenly (i.e there is no remainder) by all the numbers in m, stop. This is the answer
  3. If not, add 1 to n and start again.

“n” starts at 1 (this is the smallest positive number that will divide by all the numbers from 1 to 20)

“m” starts at 1 and goes only as far as 20 (this is the series of numbers that “n” has to divide by)

That’s it.

The smarter algorithm goes like this:

  1. Start with n at 2520
  2. If n divides evenly (i.e there is no remainder) by all the numbers in m, stop. This is the answer
  3. If not, add 2520 to n and start again.

This method assumes that you recognise a few things from the problem statement. Let’s take another look:

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

Since the numbers between 1 and 20 contain all the numbers between 1 and 10 (1, 2, 3, 4, 5, 6, 7, 8, 9 & 10), some of the work is done for us. We can assume that, since 2520 is evenly divisible by all numbers between 1 and 10, that it must be evenly divisible by all the numbers between 1 and 20.

This algorithm speeds up execution exponentially. Instead of going through every positive integer between 1 and he final answer, we can jump in steps of 2520.

The Code

I’m not going to spend time explaining the code, since it contains enough information in the comments (within the code itself) and in the description of the algorithm above.

So, without further ado, here is the finished code:

And there you have it, another problem solved (and optimised) in minutes.

Until next time,

J

UK Tech Days – Day 2 (Windows 7 Phone)

The publishing of this post as postponed by three days because of problems with Jamie’s connection

Today was the second day of Microsoft’s UK Tech Days conference on the Windows 7 Phone format. It took place at the Fulham Broadway Vue and covered the topics involved in developing and deploying software ‘apps’ for the Windows 7 Phones.

The Start screen of Windows Phone 7

Image via Wikipedia

Content

Today’s content was focused on data loading and types. Whereas most of yesterday was based on loading the data into memory and manipulating it, today’s focus was on getting the data to the device in the most efficient way.

A user wont use your app if they notice that their [phone bill’s] data rates go through the roof

That goes hand in hand with the key point of the Windows Phone 7 presentations:

Reducing app installation regret; we don’t want users to install an app, then have regret about using it for any reason. This can be accomplished by having great quality code on these devices alongside quality data loading

The keynote for today was going to be Brandon Watson going through some of the key information in Microsoft’s press release from last night, but his voice wasn’t up to scratch. Instead, he took us through some key ideas and features that Windows Phone 7 devices have in place of the iDevices and the Android phones.

It says a lot about a device when the best selling app is an app killer. Windows Phone 7 has the best garbage collection service out there…

I’ve been told that the Android devices are better because they have dual cores, but a dual core takes more power, and more power means less run time…

The amount of software libraries that we [Microsoft] provide to developers is ridiculous…

Hardware Limitations?

All phones have compasses built into them, but very few of them have pre-built API’s to access it – something that the Windows Phone 7 SDK has. One thing to remember, though, is that some Windows Phone 7 devices don’t have gyro’s in them.

If a gyro isn’t present, then motion detection and the augmented reality API will be buggy

Software for Developers

Along with Visual Studio – current version is 2010, but there is a new version out soon (2011) – there are a plethora of different tools available for Windows Phone 7 developers.

There are the Mango development tools; which will enable developers to get a handle on the new features coming to version 7.1 (or 7.5, or “Mango”) of the OS FOR FREE

There are design tools; for instance Expression Blend, which allows designers and developers alike to quickly program the UX (User eXperience) with the standard code by dragging and dropping items onto a design area.

There’s obviously Silverlight; which looks like it powers the entire device. Also, it’s NOT a replacement for flash (as most people seem to be saying).

The No 1 Thing to take From the Conference?

The importance of design, rule #1: DON’T GET A MULLET

Mullet’s look out of place more than most hair styles, and so do “dodgy” controls and UI items. If they’re not meant to be there, don’t use them.

UK Tech Days – Day 1 (Windows 7 Phone)

Today was the first day of Microsoft’s UK Tech Days conference on the Windows 7 Phone format. It took place at the Fulham Broadway Vue and covered the topics involved in developing and deploying software ‘apps’ for the Windows 7 Phones.

Windows Phone 7 Review

Image by clintonjeff via Flickr

Content

Most of the content was made up of developers who have created some truly amazing apps, discussing their apps and showing off the code.

That’s one of the things about Software Development that doesn’t make sense. With all the NDA’s (Non Disclosure Agreements), patents and copyrights placed on Software, it almost doesn’t make sense that these guys would be showing off their code with such pride. But, that’s just it: they’re proud of the code that they’ve produced.

The keynote speech was provided by Brandon Watson, one of the many geniuses working over at Mircosoft, trying to make the Windows 7 Phone format as good as it can be. He seems like an awesome guy, and he had plenty of time for questions after his keynote.

He even took the time to answer my, probably zanny questions.

Code Examples

Most of the code discussions and examples revolved around data structures and performance – which is pretty cool. I mean, mobile phones only have a finite amount of CPU power and memory.  Some of the information given makes a lot of sense now that I think about it, again. I mean:

  • When a timeout occurs, or the screen locks, the program that is currently running is terminated. The program will restart from where it left off, when the screen is unlocked
  • De-Serialise (or load) data from storage into memory using a background thread, not the UI thread. Doing it that way works out as a better experience for the user, because you can keep animating your progress bar
  • As long as your program has a splash screen and a progress bar (for loading), most users will wait patiently for the program to load
  • Always assume that the network the phone is connected to is quite flimsy, and could cut out at any time. That way, you force yourself to use it sparingly
  • Target audiences always want simplification when it comes to mobile apps. They don’t need to know how the app works, just that it works

Excellent Quotes

Brandon started the whole day off with the best piece of pseudo-code I’ve ever seen. When a manager is asking you to provide some information about return on investment, just show him this:

[sourcecode language=”cpp”]
if (Developers.Happy())
return OnInvestment;
[/sourcecode]

Then there was this amazing gem of code. It’s C#, but will show up as C++:

[sourcecode language=”cpp”]
SomeFunction myFunction = new SomeFunction();
myFunction.SomeMethod += (s, a) => {
//code in here to catch an exception
};
[/sourcecode]

That code block is a short hand form of the standard way to catch a thrown exception. The only problem is, I’me not sure if it’ll only work on a W7P project, or whether it’ll work in a C# listing. Since I’m not at home, I can’t test it out.

That’s all for now, but I’ll make sure to post about what happens tomorrow (including some of the information about a press release that Microsoft are giving out tomorrow)

J

Page 1 of 3