Posts

Its the little things...

In the history of C# we have been spoiled by every version having excellent new language features in. We had Generics, Linq, Tasks, async/await which were massive hitters and transformed the way we worked and wrote code. C#7 however I found has given us lots of little improvements that make things smoother and easier which has been great. One feature I hadn't really used yet though was the new Pattern Matching , this wasn't because I hadn't wanted to but more I hadn't seen a time to really use it. That was until tonight. A year or so ago I had a scenario where I had to take a base type and then1 return the appropiate mobile view to render. Prior to Pattern Matching I ended up with something like: if (value is HoldingPage) return new LoadingView(); } var listingPage = value as ListingPage; if (listingPage != null) { return new ListingView(listingPage); } Tonight I needed to add a new view into this code and decided it needed tidying up. Pattern Matching...

Fixing a Quirky "Xamarin.Forms ListView Bug" That Led Me Back to Basics And How Most Bugs Are Written By Users!

Image
For the last two evenings I've been chasing what seemed a random bug. The crux of it came down to scrolling large lists within a ListView, 1000's of items, which were grouped, would muddle up the items and often duplicate an item a couple of times. An example output: First page of results: Test 1 Test 2 Test 3 Test 4 Test 5 Test 6 Test 7 Test 8 Test 9 Test 10 Test 11 Test 12 The second page would then render: Test 13 Test 14 Test 1 Test 15 Test 16 Test 4 Test 17 Test 18 Test 19 Test 20 Test 6 At first glance this looked like a random error. I considered that maybe my list parsing code (the app takes HTML and makes in easier to use) but my unit tests checked out. So I went over these again with a toothcomb. All checked out. Next I considered the code that grouped the items, again unit tests all good, toothcomb said still good. So I sat pondering. Was there something similar about all of the duplicated items. There was, they were all items that...

A First Foray into Alexa Skills Using AWS Lambda's with C#

Image
Tonight I decided to try out something new that I had been meaning to for a while rather than continue poking around on my app. Since Alexa's release I've been itching to play with it, I decided whilst I was learning one thing why not learn three things so decided to use AWS Lambdas with .Net Core as well. I've used AWS extensively with work but never used Lambdas although I was aware of them and knew they were similar to Azure Functions,  Ben Godwin 's show on .Net Rocks also convinced me it was time to give them a proper look. .Net Core I've also played with and had some great training from the .Net Core guys at NDC London from this year but I've never published anything. Tonight this was all going to change :) A quick note before I continue, I'm writing this as I go so a few things might feel disjointed but hopefully it will all make sense. First Steps - 1st Hour In order to get going I set my self up a personal Amazon account, you can go do...

Xamarin iOS for Simulator and Screenshots

Image
I love the Xamarin iOS Simulator for Windows , much easier than VNC'n to my Mac or having to constantly use my iPhone when I'm only playing around with UI and stuff. It has all the features you'd expect like show/hide keyboard, home button, rotate, trigger call etc. It also has capture screenshot which would be super handy. Tonight I needed to take a few screenshots so got trigger happy with the screenshot button but.... I couldn't find where they went! To cut a long story short I ended up using Process Monitor to find where the files were being written and it turns out they go to a Xamarin\iOS Simulator folder within your pictures folder. I never use mine on my development machine so didn't even consider checking there. So two tip Pro Tips: Xamarin iOS Simulator for Windows Screenshots goto: C:\Users\{username}\Xamarin\iOS Simulator Not sure where files are or whats using them... Don't forget about Process Monitor

HTML 5 Web Capture Quirks

Image
Today I've been playing around with HTML 5 Web Camera capture and for the most part its been quite easy. HTML5Rocks has a good intro post  which covers many things. Now it came to testing and everything worked as expected in Chrome and Firefox however in Microsoft Edge (We all test in MS Edge don't we.... ) I found an odd behavior.  I'm being quite lazy and wanting a 640 x 480px image, so 4:3 aspect ratio which I then take a smaller portion from. Below is what it looks like in Chrome: However in Edge I was getting: Originally my source was just: navigator.getUserMedia({video:true}, (stream) => { So I decided to add explicit constraints: var constraints = { video: { width: 640, height: 480, } }; navigator.getUserMedia(constraints, (stream) => { However the results were still the same. I then started digging around any Edge documentation I could fin...

Experiences from using existing projects within VS2015

I've been using VS2015 since an early preview at home but now it's launched I've been trialling it with many of our solutions within work trying to iron out any associated pain before we upgrade every developer (that hasn't already ;)). One thing I've noticed across a few of our web projects that's caught a few people out is an issue with the new version of IIS Express, and actually if we ever got to deploying to IIS 10. For many of our web projects we have added additional mimeTypes via the web.config to allow IIS to serve up woff2 files, previously you would have done this via:  <system.webServer>     <staticContent>         <mimeMap fileExtension=".woff2"mimeType="application/font-woff2" />      </staticContent>  </system.webServer> However IIS 10, and therefore IIS Express 10, now handles this mimeType automatically. When you run your existing projects via VS2015 you will find all of your we...

Developing a Microsoft Band App Using Windows Universal Apps i.e Windows 10

Last week I finally picked myself up a Microsoft Band and instantly started thinking about potential app ideas and that's where they were left, as thoughts :) However unfortunately I also got knocked off my bike last week and ended up with a fractured elbow (at least this is all it was). Today I finally got my sling off and have been given a ton of Physio exercises so I can actually get my arm moving properly again, at the moment it sucks. These Physio exercises have to be done every hour in order to ensure I regain full mobility of my arm but it's kind of a drag to remember. I started by simply using the Band's Countdown App to remind me to do these, but whilst traveling this afternoon I thought of writing an App that not only reminded me to do these exercises but also logged and could display how many iterations of the exercises I performed and how fast etc. Needless to say tonight I started playing with the Band SDK and decided to start a series of blog posts that outlin...