Friday, September 27, 2013

A checklist for asking good questions

I love answering questions about MvvmCross (and more besides) and I spend lots of time doing it.

Often the questions are a joy to answer - and they help add lots to MvvmCross itself.

Here's a checklist of tips to help make sure your question is a joy to answer. It's stolen and adapted from Jon Skeet at: http://msmvps.com/blogs/jon_skeet/archive/2012/11/24/stack-overflow-question-checklist.aspx

  • Have you done some research before asking the question? 
  • If you found anything relevant did you include that in your question?
  • Have you explained what you've already tried to solve your problem? 
  • If your program throws an exception or performs 'incorrectly', have you tried to reproduce the behaviour in a small test app?
  • Have you specified which language and platform you're using, including version numbers where relevant? 
  • If your question includes code, have you written it in a way that will allow others to run it? Are there missing parts? Have you cut out as much excess code as you can?
  • If your question includes code, have you checked that it's correctly formatted? 
  • If your code doesn't compile, have you included the exact compiler error? 
  • If your question doesn't include code, are you sure it shouldn't? 
  • If your program throws an exception, have you included the exception, with both the message and the stack trace?
  • If your program throws an exception or performs 'incorrectly', have you included any trace or log messages that might be useful?
  • If your program produces different results to what you expected, have you stated what you expected, why you expected it, and the actual results?
  • If your question is related to anything locale-specific (languages, time zones) have you stated the relevant information about your system (e.g. your current time zone)?
  • Have you checked that your question looks reasonable in terms of formatting? 
  • Have you checked the spelling and grammar to the best of your ability?
  • Have you read the whole question to yourself carefully, to make sure it makes sense and contains enough information for someone coming to it without any of the context that you already know?  
  • If you've included a technical term is it going to be clear to a reader what you meant by that term - e.g. if you asked "I want to display a notification" then does that mean just some/any visual indication or does it mean an Android notification?
  • Does your title describe the question you've asked?
  • Have you asked about just one thing? Answering one specific question is much easier than answering several different things at the same time.
And one more....
  • Have you tried squeezing a technical question into 140 characters on Twitter? If you have, please delete your tweet and try asking with more detail on StackOverflow or on a forum. 

Thanks to Jon Skeet for the base list at: http://msmvps.com/blogs/jon_skeet/archive/2012/11/24/stack-overflow-question-checklist.aspx - and for posts like http://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx too

Wednesday, September 25, 2013

N=39 - CrossLight on Xamarin.iOS/MonoTouch (aka Project Chimp)

This video is a follow on from http://slodge.blogspot.co.uk/2013/06/n30-crosslight-aka-project-chimp-n1.html where I showed how to use the MvvmCross binding layer in Android without using the higher layers (the navigation service, the plugin loader, the thread dispatcher, etc).


In this video I quickly do the same thing for Xamarin.iOS.


The process is pretty simple:


1. Add references to the CrossCore and Binding assemblies for MvvmCross (in the video I use nuget CrossCore package - https://www.nuget.org/packages/MvvmCross.HotTuna.CrossCore/)

2. Add a small setup class and call it from your appdelegate start code



3. Add you ViewModel - and INotifyPropertyChanged will do

4. Adjust your ViewController so that it can do data-binding to an instance of your ViewModel



5. Run :)


The code for today is at: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-39-CrossLight-Touch


The video is:




For a full index of N+1 videos, see http://mvvmcross.wordpress.com

N=38 - More maps and more zombies

Today, I tried to extend the N=37 Maps Xamarin.iOS sample into 4 new directions:

  1. A draggable annotation that updates it's location in the ViewModel
  2. An ObservableCollection of annotations.
  3. A mechanism to update the map center from the ViewModel
  4. A mechanism to update the ViewModel from map panning



The code for this is on: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-38-Maps


The video is:



Disclaimer: I only tested on iOS6 - and there were a few animation details there that needed a little smoothing... I've not tested them on iOS5 or iOS7 yet - expect more there too!


For a full index of N+1 videos, see http://mvvmcross.wordpress.com

Thursday, September 19, 2013

N=37 - Maps and Zombies part 1 - N+1 Days of MvvmCross

After a slightly longer than planned summer break, I'm finally returning to these recordings. Sorry about the elongated break, but I'm back now, and hoping to cover some more advanced topics :)


To start with, I thought I'd try some mapping. This is going to take a few videos to get completed.... just easing back into this process.


First up:

  • we create just a PCL and an iOS project
  • we add an MKMapView view
  • we databind some annotations to the ViewModel

The video for this is:


I'm afraid I did get interrupted during the recording, so you might hear someone asking if I wanted a beer - but I didn't - I don't drink and screencast ;)


The code for this is in: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-37-Maps


The index of N+1's is on http://mvvmcross.wordpress.com, but we also have a copy on the wiki - https://github.com/slodge/MvvmCross/wiki

Sunday, September 15, 2013

Awesome issue hunting and fixing from @brianchance

Over the last coupe of months we've had some awesome fixes sent to us from Githubber Brian Chance

These have included a big project tidy up to help us remove "System.ServiceModel" references and an important fix for our MonoTouch.Dialog port - which has helped us work out some long-standing issues with StyledStringElement.

Small fixes and pulls like these are awesome - keeping on top of issues like this is really core to MvvmCross - it's awesomely important.

Brian - a huge thanks to you ... and a badge of awesomeness - thank you!


PullToAwesome - an awesome MvxUIRefreshControl from James Montemagno

Implementing Pull-To-Refresh in iOS is lovely and simple... and now with this gist from James Montemagno (@jamesmontemagno) databinding that Pull-To-Refresh is really simple too.

Read more about this on:

- James' blog - http://motzcod.es/post/59125989518/mvxuirefreshcontrol-for-mvvmcross
- the Gist - https://gist.github.com/jamesmontemagno/6323125

Simple, Beautiful... and Awesome... it earns James his first badge of awesomeness - thanks for the awesomeness :)




Shinobi Charting with MvvmCross applied - awesome from SammyD

SammyD - also known as @iwantmyrealname - recently posted an awesome blog post and an open source repo on how to combine the very sleek and sexy Shinobi charts with Mvvm on Xamarin.iOS.

You can read more about this on http://www.shinobicontrols.com/blog/posts/2013/09/04/mvvm-charting-with-shinobicharts-and-mvvmcross



It's an awesome read - with an awesome open source repo behind it. Thanks @iwantmyrealname - very well deserving of a badge of awesomeness - thanks!

 

An awesome plugin to allow integration with Azure Access Control - from the @CheeseBaron

Microsoft's Azure ACS provides big cloud identity services.

It's got a wide range of uses - it's useful for new apps wanting to integrate with Google, Facebook, and Live authentication and for companies wanting to authenticate with established Active Directory servers.

The great news is that @Cheesebaron has provided a MvvmCross plugin to allow your apps to integrate with it - he's built it for Xamarin.iOS, Xamarin.Droid and WindowsPhone - and he's made it available open source at https://github.com/Cheesebaron/Cheesebaron.MvxPlugins/tree/master/AzureAccessControl

This is, of course, AWESOME .... and it bags @Cheesebaron his 4th badge of awesomeness - thanks Tomasz for all the awesomesauce :)


Sunday, September 08, 2013

3.0.12 pushed to MvvmCross-Binaries (not quite on Nuget yet)

I've just pushed build 3.0.12 to https://github.com/slodge/MvvmCross-Binaries/

It will appear on Nuget when I can work out what's broken on https://nuget.codeplex.com/discussions/456158 (apparently this is a nuget.org problem - and should be fixed tomorrow)

This build is pretty similar to the 3.0.11-beta build that I know many of you have been using for the last week.

This is the first build to be linked against the new 'async' and 'PCL' Mono 3 based releases from Xamarin.

There seems to be some issues with the latest releases from Xamarin - especially concerning https://bugzilla.xamarin.com/show_bug.cgi?id=14520 - so other patches may follow soon.


Possible breaking changes in 3.0.12 are:
  • Updates for Xamarin PCL support - iOS apps must now use the Mono 'System.Windows' PCL shim and not the ones previously supplied by MvvmCross.

    This Mono 'System.Windows' assembly should be present in the 'Add Reference...|Assemblies|Framework' list after you have connected Visual Studio to your Mac and have synced the SDK. However, I have personally had some issues with this (sometimes it has asked me to sync every few minutes...)

    Using this Mono Shim may report in some 'warnings' about different strong-named System.Windows assemblies during linking from the MonoTouch compiler - but these warnings (so far) seem to result only in slightly slower link times.
  • Updates for Xamarin PCL support - all PCL projects should currently build as Profile 104 on both PC and Mac (previously we had to specify 'Profile1' for Mac support)
  • The default constructors in the MvvmCross Dialog port of StyledStringElement now match the main MonoTouch.Dialog implementations - this clears #402 and#328 but may effect any users currently relying on the current implementation (to workaround any problems, use the constructor which allows cell type to be specified)
 
Other noteworthy changes for MvvmCross in 3.0.12 are:

  • small changes to unify `Adapter` configuration across all Android list-based views (all can now be passed null in the constructor) - #390
  • small fix in Email plugin for empty cc field - #385
  • a new `IMvxViewModelByNameRegistry` interface which allows plugins to register ViewModels if they want to - #405
  • StyledStringElement Visible implemented - #403


As an aside... some of you may be wondering what happened to 3.0.11? It kind of got confused in the build process... so I decided to clean and build 3.0.12 instead - sorry!