Richard's Blog

  • Forms Authentication in .NET Core (AKA Cookie Authentication)

    In .NET Core MVC you're encourages to use .NET Identity, but you don't have to. You can manage your own user identities and you use forms authentication which is now called Cookie Authentication (which is a better name really).

    You need to install the Microsoft.AspNetCore.Authentication.Cookies nuget package.

    There is some configuration that needs to go in startup.cs:

    public void ConfigureServices(IServiceCollection services)

    {

    services

    .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)

    .AddCookie(options => {

    options.AccessDeniedPath = "/ …

  • Don't be afraid of RCSI

    Enabling SQL Server RCSI

    RCSI is not something you get from typing too much, it's a setting in MS SQL Server that is disabled by default. Arguably it shouldn't be. It stands for Read Committed Snapshot Isolation and when enabled means that you can select data from the database with less risk of locks and also know that the data you're getting was accurate when you started the request.

    I enabled it after we we started to see a lot of failed transactions in the logs due to timeouts on requests for locked resources. The thing that confused me was the locks were being taken out for transactions that were only doing …

  • Fun with glass

    Glass duck made at Zoë's Leeds glass studio

    I went to visit my friend Zoë at her stained glass studio in Leeds. Zoë designs and makes beautiful stained glass windows and has done installations in Leeds and all over Yorkshire.

    She was running a glass fusing workshop teaching you how to design and make a glass placemat. My design is of a duck (I'm a bit obsessed with ducks at the moment, but I'll probably get over it). I spent some time getting my design right on paper first before tracing that onto the glass. There are two layers of glass that get melted together in the kiln. There are lots of options of which layer of glass you draw …

  • My Windows Services Panel

    Screenshot of My Windows Services Panel

    As a developer I have a lot of different types of Windows Services installed on my computer for the different projects I work on. Services like MS SQL Server Express, MS SQL Server, IIS, MSMQ and MySQL.

    I don't use all of them all of the time, but I would normally leave them running because I couldn't be bothered trawling through all of the services in Services Manager to stop and start them. Having them running all the time made my computer take longer to startup and I felt like it was slowing it down generally and stealing battery power.

    So I created My Windows Services Panel as a way to …

  • NHibernate Search String Dictionary Bridge

    NHibernate Search is an extension to NHibernate that uses Lucene to give you full text search using Lucene under the hood. It also makes using Lucene in your .NET app easier than using Lucene.NET directly.

    Lucene only indexes text on a document in a flat key-value structure. Bridges are used to turn properties on your indexed documents into text.

    NHibernate Search comes with bridges for common types such as enum, but you can also write your own. This is an example of a bridge that turns a Dictionary property on your indexed objects into a set of properties on the lucene document. It only …

  • iOS Screenshot sizes when submitting your app

    When submitting your awesome app to the iOS App Store you need to provide screenshots for all the iPhone/iPod/iPad screen sizes. In itunes connect they're labeled by the inch size of the screen, but this doesn't help you know which simulator to fire up. So, here's a handy table of all the portrait screen sizes:

    3.5 inch (4s) 640×960

    4 inch (5, 5s) 640×1136

    4.7 inch (6) 750×1334

    5.5 inch (6+) 1242×2208

    It's also worth knowing that although you can update your app description after submitting the app, you can only update your screenshots with a full new app version. So make sure you get them …

  • Sharing Resource Dictionaries in your Xamarin.Forms App

    The Xamarin.Forms Application base class has a Resources property that you can use to share a resource dictionary across all pages of your app. If your app was created before Xamarin.Forms 1.4 you'll need to make sure you update and make your main App class inherit from the new Application class.

    If you like to do everything in code rather than XAML then you can create a ResourceDictionary in the constructor of you App class:

    public class App : Application

    {

    public App()

    {

    Resources = new ResourceDictionary();

    Resources.Add("ForegroundThemeColor",

    new Color( …

  • Xamarin Forms at NDC London 2014

    If you're interested in finding out more about Xamarin Forms you may find the following interesting:

    Free eBook: Creating Mobile Apps with Xamarin.Forms by Charles Petzold (Preview edition)

    Video: Creating your first Xamarin.Forms App (Xamarin Evolve 2014)

    Video: Xamarin.Forms is Even Cooler Than You Think (Xamarin Evolve 2014)

    Video: XAML for Xamarin.Forms (Xamarin Evolve 2014)

    Video: Extending Xamarin.Forms with Custom Controls (Xamarin Evolve 2014)

  • Traction: If you build it they will come

    Photo of Traction book in a corn field

    Kevin Costner’s film ‘Field of Dreams’ is responsible for more startup failures than any other Holywood film ever created. In this film Ray Kinsella, a farmer played by Kevin Costner has a vision (AKA great idea), digs up his crop of corn and builds a baseball field in the middle of nowhere on the promise that ‘if he builds it, he will come’. Low and behold after some tense moments a famous dead baseball player turns up and eventually car loads of people turn up to watch baseball. So, it turns out, that if you build it, they will come. What the film fails to show (at least to my recollection), …

  • Leeds Sharpers at DDD North 2014

    Voting is now open for DDD North 2014, which is excitingly going to be in Leeds. There are a lot of good talks to vote for, but my biased opinion is that the following Leeds Sharpers should all have their talks voted for.

    Micro Services: conquer monoliths, before they own you - Kiran Singh

    BDD, Why you should be doing it - Richard Tasker

    Using Xamarin Forms to make a cross platform Agenda App - Richard Garside (AKA me)

    So look through all the proposed talks and vote now (voting now closed).