Saturday, November 17, 2012

wp8: speech is off until your new language pack has been installed

If you see the error 'speech is off until your new language pack has been installed'

Then this might just be because you've switched your phone from one language to another.

To get over this problem...
  • go to Speech in Settings
  • tap on the language box
  • choose your language (even if it's your existing language)
  • you'll then be asked to download it.... (needs WiFi really)
  • after the download, the phone will need  a reboot...

The speech privacy policy was not accepted prior to attempting a speech recognition

If you are trying to use SpeechRecognition and you see this general Exception - "The speech privacy policy was not accepted prior to attempting a speech recognition" - or possibly you see the "The text associated with this error code could not be found."...

Then the answer is http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662934%28v=vs.105%29.aspx#BKMK_Handlingthespeechprivacypolicyerror

Basically - try pressing and holding the start key - then getting the user to accept the terms and conditions...

Also, in your own app... it seems like maybe you need to be sure you are requsting the speech recognition in an async call on the UI thread?

Some low light pictures taken with a Nokia 920

I took a Nokia 920 out for a run this morning.

It was a real Autumn day... rainy... overcast... gloomy...

Which made it perfect to test out the PureView floating lens in the 920 :)

These photos are just 'snaps' taken on the run... and the deer in Bushy Park weren't being at all friendly... but I'm definite that 'yes, the 920 has a quite nice camera!'













Friday, November 16, 2012

Aviva - Drive.... An MvvmCross Testimonial

Back at the end of the Summer I got this email through from a Solution Designer in Aviva - a very large UK Insurance company:

Thought you'd like to know that we are using MvvmCross in our RateMyDrive app that is currently being Beta tested: http://www.aviva.co.uk/ratemydrive/
There's been a fair amount of press about it, and it's even been on the telly:  http://www.bbc.co.uk/iplayer/episode/b01m9396/Click_18_08_2012/  (fast forward to 9:08)
So a big thank you for the major contribution your framework has made to this project. It has allowed us to share the complex algorithms for deriving the driver rating scores between Android, iOS and Console/Test apps. In fact 90% of the code is shared and easily testable.

This project is still ongoing - http://www.aviva.co.uk/drive - and I think the above quotation says everything you need to know about MvvmCross.... :)


If you've been using MvvmCross, and you have any feedback, then please do send it to me :)

Hackery and WitchCraft - First AutoViews running on MonoTouch too

Following on from the MonoDroid work, I've started pushing some MonoTouch changes now for AutoViews too...

And after only a few hours - mostly filled with Reflection swearing - I now have this list view:


and this Dialog view:


These screens generated from the exact same code and JSON as the Droid UIs in Another update on the Default UI work for MvvmCross....

There's still a lot of code to write... and lots of debugging to go...  especially when I move to release builds on real devices....

But so far so good :)

Thursday, November 15, 2012

Free icons for ASP.Net, WinRT and WP development...

These are some of the icon sets I've used in the past - generally Creative Commons - and always used with attribution.

For maps:
http://code.google.com/p/google-maps-icons/

For general use:
http://www.famfamfam.com/lab/icons/
http://code.google.com/p/fugue-icons-src/ - preview at: http://p.yusukekamiyamane.com/icons/preview/fugue.png

For WinRT/WP7
https://github.com/Templarian/WindowsIcons

- plus SyncFusion have a free set which is growing big now - http://www.syncfusion.com/downloads/metrostudio

- plus BootStrap from Twitter has some interesting icons built-in


Wednesday, November 14, 2012

Updated: Flurry Analytics in MonoDroid

This is a follow up to an earlier post on using Flurry Analytics in MonoTouch and MonoDroid: http://slodge.blogspot.co.uk/2012/04/using-flurry-analytics-from-monotouch.html

The community has spoken and one kind individual (I think it's this one) has contributed this gist back to the community with an extended Flurry API covered:



Excellent stuff - thanks "anonymous" :)

Lists in MvvmCross AutoView - first code :)

I've just completed the first stab at a List AutoView :)

This code still needs a little tinkering with - it will change as we go across to the other platforms, but a basic first pass is in this Gist:



Next up MonoTouch, and then WP and WinRT

Then back to Droid for Tab UIs too :)

Question: Should we try to shorten/simplify some of the MvvmCross class names?

I've done a few demos lately where I've had to write code live...

Doing this has made me pause and think when it comes to writing down names like: MvxBindableLinearLayout

These names seem overly verbose... e.g. wouldn't MvxLinearLayout do just as well?

Some of the names are unavoidable - e.g. MvxBindingTouchTableViewController inherits from MvxTouchTableViewController - but even these could be shortened to remove the Touch part of the name (the namespace already gives us that).

And then... of course... another question is whether Mvx should stay in place as a prefix? It is useful in places to know when you are using an MvvmCross class... but it's not very pretty and can make the code less readable.

There's nothing planned on this in the very short term, but what do people think?
  • Should we go on a big clean through the naming?
  • Should we try to shorten some names?
  • Should we try to remove the Mvx prefix?
  • Should we just focus on getting more code and better code (e.g. tests) in place?
Interested to hear any thoughts people have. Please feel free to leave comments here if you have any

Stuart

P.S. The main class name which made me pause and think on this topic was MvxActionBasedBindableTableViewSource - it's a good descriptive name, but something like MvxFuncTableViewSource might be easier on the eye ?

Sunday, November 11, 2012

More work on AutoViews for MvvmCross

I've been looking some more at the AutoView code.

In addition to hand-crafted Json, I'm looking at the idea of allowing users to provide a simple description within each ViewModel.

I initially started this by looking at using Attributes, but now I'm moving more towards getting the user to provide descriptive methods, like the one below. This code is now working on Droid - but some refactoring is still needed to properly integrate it and to make it really beautiful.

SSL problems with Microsoft Azure Mobile Services on Mono for Android (MonoDroid)

My main test Android device - a SIM-unlocked Galaxy Note upgraded to ICS - doesn't like any 'Microsoft Secure Server Authority' certificates. e.g. it doesn't like Hotmail.com or Live.com.

This is a problem if you try to use Azure Mobile Services - because https connections to a service like https://mydemoservice.azure-mobile.net will result in an AggregateException within which (several layers deep) will be a MobileServiceInvalidOperationException with a message saying just 'Send Failure' (derived from ServiceFilterResponseStatus SendFailure)

If anyone else encounters this issue... then below is some hacky code I transplanted from an old demo project. It seems to work.... but could probably be improved to work with just Microsoft Secure Server Authority messages.

This code hacks the ServicePointManager to allow it to accept all HTTPS/SSL addresses regardless of whether or not the certificate is trusted. Don't use this in your banking apps please :)

Saturday, November 10, 2012

Resources from Azure Mobile Services talk - MonoTouch and MonoDroid

I'm just pushing some resources for the Mvvm Azure Mobile Services sample shown at #SixStepsAzure yesterday to: https://github.com/slodge/azure-mobile-services

I'm afraid there's not too much info on this demo available yet and I've only included MonoTouch and MonoDroid code - there is a little in the readme.md... but generally I'll need to get together with @AzureCoder to sort out more - I don't know how he did the server side wizardry :)

Azure to Wp/MonoDroid/MonoTouch - Video of my MvvmCross Talk

Here's a talk I gave yesterday at #SixStepsAzure here in London:



Slidedeck is:



And this is what one of the audience said:




Love the honesty of that feedback :)

Friday, November 09, 2012

The request could not be completed (Send failure)

Update: see http://slodge.blogspot.co.uk/2012/11/ssl-problems-with-microsoft-azure.html


I've been playing with Azure Mobile Services on Mono for Android (and on MonoTouch too).

One thing that stumped me for a little while was a problem where I just couldn't talk to the server - all calls would fail with:

The request could not be completed (Send failure)

Eventually I worked out that:
  1. Make sure you've got INTERNET permissions in your app Manifest
  2. Make sure you are using http and not https for the service address

I'm not sure why https is not currently working - must be some SSL/certificate-level error?

Tuesday, November 06, 2012

Another update on the Default UI work for MvvmCross....

We've made more steady progress on the Default UI work.

We've now got the MvvmCross CustomerManagement demo (borrowed originally from MonoCross) completely rendering from JSON.


So, that's:
  • the front page screen (a List)
  • the details screen (a Dialog)
  • the edit and new screens (a Dialog)
  • a menu on each screen.

To do this, currently we're using JSON files loaded using convention rules from the Assets folder:



However, we want to move this to a set of conventions and/or attributes based on the ViewModels themselves. This is coming...

And then we'll look at porting this back to MonoTouch and MonoTouch.Dialog too...

And then also coming, is WP.Dialog - see @runegri's fork of MonoDroid Dialog at https://github.com/runegri/Android.Dialog

There's a lot of code to tidy up - but will post more details and some demo code soon!

How to make a PIG UDF (beginners guide for C# engineers)

I got asked to create a UDF in Java... this is what I did :)





Any questions? Try http://jabbr.net/#/rooms/HDInsight

For the Apache PIG UDF documents try Try http://pig.apache.org/docs/r0.8.1/udf.html

Monday, November 05, 2012

Thank you JetBrains for free Resharper open source licensing

Just a quick word of thanks.

JetBrains provide Reshaper for free for me to use on MvvmCross: http://www.jetbrains.com/resharper/

Thank you, JetBrains!

If you are a C# dev and you haven't tried a tool like Resharper then you are wasting your own time - simple as that. In addition to the free 7.0 license above, I've also paid my own money (wow) for a license - and it paid for itself within a day.

MvvmCross at BUILD 2012 - Create Cross Platform App using Portable Class Libraries

Daniel Plaisted's talk introduced and extended the MvvmCross Twitter sample at BUILD

For his full talk, see:




For more info, see http://channel9.msdn.com/Events/Build/2012/3-004

Daniel's blog is on: http://blogs.msdn.com/b/dsplaisted/

Sunday, November 04, 2012

Combining TinyMessenger with MvvmCross to provide "StartViewModelForResult" type behavior

See http://www.gregshackles.com/2012/11/returning-results-from-view-models-in-mvvmcross/

A sample from @gshackles

https://gist.github.com/f20d5f444234c78ca81a

Basically this pattern allows you to write a flow like:

- navigate from a parent viewModel to a child ViewModel
- the child viewModel collects some user input
- the user then presses OK
- a message is sent back from the child ViewModel  to the parent
- the child view then closes

We think there might be one very minor issues in this pattern - to do with some tombstoning edge cases - but for most apps this should work really well - and it has a nice test harness too!

Some Useful MvvmCross Links...

Key posts from http://slodge.blogspot.com and key http://stackoverflow.com/questions/tagged/mvvmcross questions and answers

Portable Class Libraries

Portable Class Library problems - "defined in an assembly that is not referenced" http://stackoverflow.com/questions/13197546/mvvmcross-vnext-observablecolletion-is-defined-in-an-assembly-that-is-not-refer
Working around the profile1-only problem in Mono builds - http://slodge.blogspot.co.uk/2012/10/mvvm-monotouch-back-up-and-running.html
More on PCL setup for MonoTouch/MonoDroid - http://slodge.blogspot.co.uk/2012/09/mvvmcross-vnext-portable-class.html
Xamarin reported bugs that @slodge is involved with - mostly PCL - https://bugzilla.xamarin.com/buglist.cgi?email2=me%40slodge.com&emailassigned_to2=1&emailcc2=1&emailreporter2=1&emailtype2=substring&list_id=33065&query_format=advanced&order=bug_id%20DESC&query_based_on=

General

Experiences and Limitations - http://stackoverflow.com/questions/10224376/mvvmcross-experiences-hindsight-limitations
Getting Help - http://slodge.blogspot.co.uk/2012/10/how-to-ask-questions-about-mvvmcross.html
Setting up a fork - basic GitHub steps - http://slodge.blogspot.co.uk/2012/09/heres-how-i-setup-fork.html

Navigation and Architecture

Passing in variables to ViewModels - http://stackoverflow.com/questions/10192505/passing-on-variables-from-viewmodel-to-another-view-mvvmcross
MethodAccessException - http://stackoverflow.com/questions/10227237/methodaccessexception-when-passing-variables-from-viewmodel-to-viewmodel-on-wp7
Providing different views for iPhone and iPad - http://stackoverflow.com/questions/10297260/mvvmcross-sharing-viewmodels-for-multiple-views
Replacing the default ViewModelLocator - http://stackoverflow.com/questions/10411735/how-to-replace-mvxdefaultviewmodellocator-in-mvvmcross-application
Passing in Services as constructor parameters - http://stackoverflow.com/questions/10511853/constructor-in-viewmodel
Problems in release mode only - http://stackoverflow.com/questions/11973993/mvxexception-in-release-mode-for-android
Hunting for memory leaks - http://stackoverflow.com/questions/12494804/helping-the-gc-in-mono-droid-using-mvvmcross
One pattern for error reporting - http://stackoverflow.com/questions/10411352/what-is-the-suggested-way-to-handle-exceptions-during-in-a-mvvmcross-application and also at http://stackoverflow.com/questions/11053535/alerts-or-popups-in-mvvmcross
Changes to IoC in vNext - http://slodge.blogspot.co.uk/2012/10/changes-to-ioc-in-vnext.html

Testing

Testing ViewModels - http://slodge.blogspot.co.uk/2012/10/testing-viewmodels-in-mvvmcross.html

Binding

JSON Binding introduction - http://stackoverflow.com/questions/10688603/how-do-i-bind-multiple-properties-in-an-android-layout-element
Custom Favorites Button Binding - http://stackoverflow.com/questions/10495137/mvvmcross-bindings-in-android Custom binding for text color - http://stackoverflow.com/questions/10700445/in-mvvmcross-how-do-i-do-custom-bind-properties
Binding MonoTouch UIViewController member variables - http://stackoverflow.com/questions/10929779/monotouch-mvvmcross-binding-to-instance-variables
Two way bindings for integers - http://stackoverflow.com/questions/11231624/mvvmcross-monotouch-c-sharp-binding-int-property-mode-twoway
Binding doesn't work on a real device - http://stackoverflow.com/questions/11349864/mvvmcross-monotouch-fail-to-bind-properties-on-a-real-ipad-but-it-works-on-th
Custom binding for a Touch event - http://stackoverflow.com/questions/11815893/mvvmcross-touch-command-binding-in-android
ListItem Property Binding - http://stackoverflow.com/questions/12825121/binding-a-property-to-a-mvxbindablelistview-in-android
Displaying images - http://stackoverflow.com/questions/12876406/how-to-bind-an-image-src-to-resource-drawable-image-with-mvvmcross and http://stackoverflow.com/questions/12925056/binding-to-path-imageview-in-mvvmcross-for-monodroid-android
What do I do without CommandParameters? http://stackoverflow.com/questions/12892672/mvvmcross-vnext-monodroid-commandparameter-similar-to-wp7
Why doesn't Touch work - http://stackoverflow.com/questions/12950879/mvvmcross-button-command-binding-not-firing
Working around ICommand CanExecute problems - http://stackoverflow.com/questions/12951733/how-to-use-canexecute-with-mvvmcross
Debugging binding problems - http://stackoverflow.com/questions/12973594/mvxbinderror-10-40-exception-thrown-during-the-view-binding

Droid

Using Tabs/TabActivity - http://stackoverflow.com/questions/10243672/how-to-use-a-monodroid-tabactivity-using-mvvmcross-framework
AutoComplete - http://stackoverflow.com/questions/10550829/autocomplete-mvvm-and-java-castings-without-using-java-lang-object-on-viewmodel
Removing the splash screen - http://stackoverflow.com/questions/10584385/how-do-i-initialize-the-mvvmcross-framework-without-a-splash-activity
Handling Back - http://stackoverflow.com/questions/10621593/monodroid-mvvmcross-handle-back-button-pressed-on-a-tabhost
I want a simple View without a ViewModel - http://stackoverflow.com/questions/10684174/navigate-to-a-view-without-viewmodel-in-mvvmcross
Fragment support - current not done - http://stackoverflow.com/questions/10698638/mvvmcross-viewtyperesolver-doesnt-resolve-tag-fragment-or-custom-type
Using custom Intents - http://stackoverflow.com/questions/12564272/making-mono-cross-platform-support-for-task-intent
Why won't my project include the MvxBindingAttributes.xml file - http://stackoverflow.com/questions/12596553/attributes-from-mvxbindingattributes-are-not-added-with-mvvmcross
Using ICommands within ListItems - http://stackoverflow.com/questions/12682082/mvvmcross-changing-viewmodel-within-a-mvxbindablelistview
Receiving broadcast actions - http://stackoverflow.com/questions/12687149/where-to-listen-for-broadcast-action-with-mvvmcross
Displaying Selection - http://stackoverflow.com/questions/12738516/does-mvvmcross-have-a-way-to-change-the-selector-when-clicking-imagebutton-on-li
Using custom controls in XML - http://stackoverflow.com/questions/12934654/how-to-create-views-actions-listener-for-mvxitemtemplate
Responding to checkbox changes - http://stackoverflow.com/questions/13120574/mvvmcross-vnext-checkbox-checkedchange-event-to-a-command-with-monodroid
Integrating a custom Activity - http://stackoverflow.com/questions/13201174/insert-a-monogame-view-inside-mvvmcross-monodroid-activity

Touch

Modal presentation (and custom presenters) - http://stackoverflow.com/questions/10512853/how-do-i-specify-a-view-to-be-pushed-as-modal-in-mvvmcross
Using Tabs/UITabBarController - http://stackoverflow.com/questions/10981985/mvvmcross-monotouch-uitabbarcontroller-cant-access-navigation-bar
Customising the Navigation Bar (UINavigationController) - http://stackoverflow.com/questions/11011218/mvvmcross-uinavigationcontroller-customise-navigationbar
Modal Views - with a UINavigationController - http://stackoverflow.com/questions/11037119/mvvmcross-using-a-modal-viewcontroller-from-a-tab
Displaying multiple modal views - http://stackoverflow.com/questions/11041605/why-does-mvxmodalsupporttouchviewpresenter-in-mvvmcross-only-support-one-modal-v
Using a DateTimeElement in MT.Dialog - http://stackoverflow.com/questions/11105125/mvvmcross-null-exception-when-using-datetimeelement-in-monotouch-dialog
How to do a "combobox"/Uipickerview in Touch http://stackoverflow.com/questions/12160239/mvvmcross-binding-lists-in-monotouch (also see https://github.com/slodge/MvvmCross/pull/25)
Problems with MT.D Element redrawing - http://stackoverflow.com/questions/12249758/mvvmcross-twoway-bindings-with-monotouch-dialog

WP7/WP8

Intercepting Back key presses - http://stackoverflow.com/questions/10515990/wp7-mvvmcross-detect-requestclose-or-backkeypressed-inside-viewmodels
Using live tiles - http://stackoverflow.com/questions/11566460/mvvmcross-and-wp7-secondary-tile

Services

Getting Location - http://stackoverflow.com/questions/10317025/monodroid-locationmanager-requestlocationupdates-gives-java-lang-illegalargument
Distance between 2 points - http://stackoverflow.com/questions/10331836/finding-the-distance-between-two-geo-locations-when-using-the-mvvmcross-framewor
Why no speed and bearing :( - http://stackoverflow.com/questions/11582345/why-is-mvvmcross-mvxgeolocationwatcher-not-returning-speed-or-bearing
Integrating VideoView from Xamarin.Mobile - http://stackoverflow.com/questions/13016103/mvvmcross-vnext-monodroid-use-a-videoview-inside-a-plugin

Plugins

How to write a Conventional plugin - http://stackoverflow.com/questions/12842727/mvvmcross-conventional-plugin-bypass
How to inject platform specific services - http://stackoverflow.com/questions/12564272/making-mono-cross-platform-support-for-task-intent
Another introduction to Conventional plugins - http://stackoverflow.com/questions/12931618/mvvmcross-vnext-merge-plugins-with-monodroid

"Simple Projects"

Multiple View/ViewModel sample - http://stackoverflow.com/questions/10430481/how-do-i-use-multiple-viewmodels-with-simple-binding