RSSAmplifier

Blog

Eliot Jones

Simple Blog

eliot-jones.comRSS feed ↗61 posts

Latest posts

Show me the information

Since I'm in an unhinged rant frame of mind I wanted to also rant about this tendency for 'minimalist' thinking in UX/UI. I'm going to blame Google and their Material UI for this, they should be blamed for most things, but the trend has become something of an accepted wisdom amongst UI designers. The idea is you keep the UI nice and 'clean' and only show the user the fields you believe are…

Cheese sandwich

If you are the type of person with Very Strong Opinions about the (negative) health and moral implications of plant-based 'meat' you are signalling that you are fundamentally intellectually incurious. You have an opinion you haven't taken the time to inspect and have adopted certainty without rigor. This is a picture of a cheese sandwich, I made it at home, it was ok : And this is the ingredients…

So you want to parse a PDF?

Suppose you have an appetite for tilting at windmills. Let's say you love pain. Well then why not write a PDF parser today? The ideal world: how the specification should work Conceptually parsing a PDF is fairly simple: First, locate the version header comment at the start of the file Next you need to locate the pointer to the cross-reference Then you can find all object offsets Finally you locate…

Laureles, Medellin swimming pools

Just a brief note to summarise the (non-hotel) swimming pool situation in the Laureles area of Medellin since it is not easy to find/understand all this information. There are 3 primary organisation types that are relevant: Inder. Run by the mayorality this sports department offers access to many different sports facilities for residents and visitors alike. Swimming can be accessed for free…

Writing Code for Fun and ... That's It

Supreme Commander: Forged Alliance is a real-time strategy (RTS) game released in 2007. It is also the last good RTS, and potentially game, ever. Despite this most gamers not realizing gaming reached a pinnacle in 2007 and has since descended into a mess of RPGification, Loot Boxes and bloom over-use have moved on to other games and more importantly other genres 1 . One need only look at the…

Blog Update

As this blog entered its tenth year it was desperately in need of a facelift. I had effectively stopped writing new posts because the overhead of remembering how to upload a new post each time was off-putting enough to stop me entirely. For that reason it has been updated with new - hopefully more consistent - CSS. In addition the code and posts are deployed on each commit by GitHub actions. This…

Visual Studio 2022 Debugger Freezes

Wow, blogging with any kind of regularity is hard I kind of hard I guess. Who knew? Anyway this was just a quick note for a problem I had recently. I found that my Visual Studio 2022 debugger would hang, freeze or become unresponsive intermittently. Prior to the last update the process would freeze completely, however even after updating it would freeze though the IDE itself would remain…

Attention Bubbles (Or Why Everything Happens So Much)

Like most side projects that devour hours of time and end up being entirely useless, this one started with a simple question: Can recessions be predicted by increased interest in news stories about recessions? The background behind this question -- and you'll have to forgive my complete ignorance of basically the entire field of economics -- is that recessions are a feature of capitalist…

Bezier Curve Bounding Boxes

One of the challenges for generating accurate character sizes in a PDF document I encountered while building PdfPig was working out the bounding box for a cubic Bezier curve. A cubic Bezier curve is defined by 4 points; the start, end and 2 control points. We can number the points for use in the formulae in this post: Start: P0 Control 1: P1 Control 2: P2 End: P3 This gives the formula for the…

Open and Create PNG Images in C#

I wanted a platform independent way to open and create PNG images in C#. BigGustave is a new library which provides a .NET Standard 2.0 compatible way of opening and creating PNG images. To open a png image you can pass either the bytes or the stream of the image to Png.Open and then retrieve the values for pixels at any location in the image: Png png =…

PdfPig Version 0.0.5

Today version 0.0.5 of PdfPig was released . This is the first version which includes the ability to create PDF documents in C#. There aren't many fully open source options around for both reading and writing PDF documents so the addition of PDF document creation to PdfPig is an exciting next step for the API. The actual design of document creation isn't finished yet and there's more work to be…

Sentence Boundary Detection in C#

Sentence Boundary Detection or Segmentation is the task of splitting an input passage of text into individual sentences. Since the period '.' character may be used in numbers, ellipses or names it's not enough to simply split by the period character. When I was researching ways to do this in C# I didn't find much in the way of properly open source libraries. A lot of the libraries I found for…

Using ConvNetSharp With Feature Based Data

ConvNetSharp which is descended from ConvNetJs is a library which enables you to use Neural Networks in .NET without the need to call out to other languages or services. ConvNetSharp also has GPU support which makes it a good option for training networks. Since much of the interest (and as a result the guides) around Neural Networks focuses on their utility in image analysis, it's slightly unclear…

Alpha Release of PdfPig

I'm very pleased to finally have reached the first alpha release of PdfPig (NuGet) . PdfPig (GitHub) is a library that reads text content from PDFs in C#. This will help users extract and index text from a PDF file using C#. The current version of the library provides access to the text and text positions in PDF documents. Motivation The library began as an effort to port PDFBox from Java to C# in…

Configuring SonarQube with GitLab and TeamCity

Introducing static analysis to a project can help inform code reviews and highlight areas of the code likely to cause errors as well as expose trends in code quality over time. The tradeoff is that there are often many false positives in a report which need to be investigated. When I configured SonarQube (6.4) to provide static analysis for our C# project we struggled to incorporate it into our…

Visual Studio 2017 Red Underline/Incorrect Highlights

There are a lot of answers on this topic but in order to aggregate the steps I usually follow for future reference I'm noting them in this blog post. There are few things more annoying than Intellisense going wobbly and flagging successfully compiling code with errors. Obviously the first step is to restart Visual Studio but if the problem persists you need to try something more. These steps are…

The Curious Case of the Null StringBuilder

Today was spent tracking down a very weird bug. In production we were seeing an important part of our document reading fail. We kept getting NullReferenceException s when calling AppendLine on a non-null StringBuilder. It didn't prevent us reading the document however the result would be significantly different to the same document on a local instance of our program. It only started occurring…

ASP.NET Core Identity Using PostgreSQL

Following on from my much older posts about using ASP.NET Identity 2 to manage user accounts in MVC 4 sites, today I needed to use Identity on an ASP.NET Core MVC site. As with previous versions, the current Identity library for .NET Core 1.1 uses Entity Framework out-the-box. Luckily it's much easier to change this behaviour for the simplest register/log-in flow. Install Firstly you need to get…

White Automation

I've spent a few days getting very in-depth with White for WPF UI automation so in order to store the information while it's still fresh in my mind I am writing a blog post. White is a framework for automating interactions with desktop Windows applications. It is built on top of the UIAutomation library which is part of the .NET framework. The project is currently not very active on GitHub but…

How it works: Selenium

I've done quite a bit of work with Selenium on and off, mainly for browser automation tests. There are many high quality official libraries for Selenium covering a range of languages. It's an amazing technology and a real joy to work with; however sometimes stuff can go wrong and it's useful to know what's going on under the hood in order to debug where the problem lies. For this reason I present…

Writing a custom debug visualizer for Visual Studio 2015

Often at work I'll be debugging some incredibly complex logic with lists that can be hundreds, if not thousands, of items long. While the ability to inspect these lists using the normal debugging tools is useful, it gets annoying trying to scroll to the 700th item in a list and then accidentally moving the mouse focus away and having to start again. For this reason I wanted to look into the…

Reading from a COM port

I was recently researching how to read from a COM (Serial) port in order to communicate with an old embedded system. If you're not familiar with them that's one of these: C# provides the SerialPort class for just this purpose which is hugely helpful. However there's one problem with this class which is that it's just not... very good. I didn't know about this but this post by Ben Voigt should…

New Site

I've not been able to find time to blog at all since starting my new job in March, working at a startup means learning a lot but also working long hours! Almost a year and a half after first blogging about vNext/.NET core I've finally written my first (almost) functional program in it. I've changed this blog from a horrible mess of PHP to a nice MVC6 site running on an Ubuntu server using .NET…

Run tests task for Elixir in Visual Studio Code

In order to learn Linux I'm biting off more than I can chew by trying to learn Elixir at the same time. From the available code editors for Linux I'm using Visual Studio Code . Visual Studio Code has the ability to configure custom tasks. To get to the custom task configuration you can use the command palette with Ctrl + Shift + P and type Tasks: Configure Task Runner . This will open…

Git for beginners

Out of the different Source Control options Git is definitely the one most worth learning, however, it's also one of the most confusing. With that in mind I'm going to add to the crowded market of "Git beginners" tutorials. Hopefully given that I can still remember the struggle of learning it and that my current level of understanding probably rates as "simpleton" this will be a useful tutorial.…

Fixie Data Driven tests

I tend to spend all my coding time nowadays plagued with guilt. I try to be a good developer and refactor the code, after running the tests, after writing the code, after running the tests, after writing the tests. But in the interests of getting any code written at all, I end up skipping between one and all of these steps (generally not the writing code part). If this sounds like you, I cannot…

Automated web UI testing using Selenium with Python

Legacy applications are a fact of life in software development. However well a piece of software starts and no matter how much care is taken to document it, as people leave and new people are assigned to look after it, knowledge about what the software does or how it's meant to work is lost. For older code which was written before a time of TDD and testable architecture this creates a fear of…

PostHaste

I haven't blogged in a while, simply because I've not thought of any interesting topics to blog about, hopefully something will come along sooner or later! In the meantime I'm promoting my little Visual Studio extension, PostHaste . This extension aims to make sending code to hastebin (it's like a good version of PasteBin) from inside Visual Studio easier. Not that it could be much easier but it…

MVC postback for users without JavaScript - Post 2

Posts in this series: Post 1 Post 2 So far we have created a form which performs a postback to the server to add more input fields to the same page. We have encountered an issue with MVC seeming to cache partial views (or at least the values inside them). Step 4 Step 4 attempts to fix the caching of the selected value field. I spent hours looking for a way to stop MVC caching partial views, which…

MVC postback for users without JavaScript - Post 1

Posts in this series: Post 1 Post 2 Despite only around 1.2% of users having JavaScript disabled there is still a requirement to develop sites which work for users who have JavaScript turned off, especially sites which provide government services. The UK's Government Digital Services (GDS) require that a site works without JavaScript and is then enhanced using JavaScript. This causes all sorts of…

Core CLR and System.Xml

If you need to use some package which is dependent on System.Xml with Core CLR / DNX Core you simply add the Nuget package System.Xml.XmlDocument rather than referencing the GAC System.Xml. This allows you to keep your code in Core CLR friendly mode.

Visual Studio 2015 and Gulp

Having played around with the Visual Studio 2015 preview a bit I've tried to learn how Gulp integrates with the Web Application project. Gulp seems like one of those many, many, constantly appearing JavaScript libraries with names like YamahaPotplantSaucepan.js which are impossible to keep up with. However since it takes the place of the Bundle config it's important to be able to achieve a basic…

SpecFlow looking for When instead of Given step

When writing some automation tests using Selenium with SpecFlow recently I was faced with an odd error: No matching step definition found for the step. Use the following code to create one: [When(@"I add a new dog")] public void WhenIAddANewDog() { ScenarioContext.Current.Pending(); } The suggested code was using a [When("My Scenario")] step despite the feature file declaring it as a Given :…

3-tier CQRS using Web API as a command/query bus

We recently started using CQRS on a project to provide a new web application to manage a complicated permit process. The CQRS pattern combined with a proper domain model seemed like a good fit for the business logic. Midway through development of our 2 tier solution (Web <-> Database) we were asked to instead asked to develop a 3 tier solution (Web <-> Api <-> Database) to avoid exposing the…

Fun with Nuget

I recently finished the first release of my 2nd Nuget package which provides a class to convert an ADO.Net DataTable to a list of objects. This is the result of an effort to create a library for the conversion technique outlined in this post . I've also created a Nuget package to help out with MVC 5 Radio Buttons located here . This post summarises some things I learned from creating these Nuget…

Entity Framework 6 Enums with String column

I recently watched Jimmy Bogard's excellent NDC presentation on Domain models to learn about how to implement a real world domain model. One of the things Jimmy does in his presentation is to refactor his enum to use a base class allowing far more expressive enums with custom behaviour There are a few versions of this custom enum base class around but I'm going to be using this one . Annoyingly…

FakeItEasy Heisenbugs

Update: the problem has been solved in version 2.0.0 of FakeItEasy. I was recently facing an issue where my FakeItEasy tests were sometimes randomly failing. I'm specifying that it was the FakeItEasy tests because I managed to isolate to the failures to 2 tests which were using: var thing = A.Fake<IInterface>(); The FakeItEasy fake would sometimes ignore the specified setup, such as: A.CallTo(()…

Dependency Injection Containers - Cheat Sheet

There are a lot of articles out there that describe both Dependency Injection and Inversion of Control . The purpose of this one is to serve as a quick reference for the things I keep forgetting because configuring a DI container is something I do so infrequently. This is a very simple guide showing the easiest scenarios and the simplest syntax. It walks through the same 3 steps: 1. Create…

EF7 Table Mapping Exception

Note: This blog post relates to a library undergoing development and as such the information is likely to become outdated. Even with Database First through the EDMX gone in Entity Framework 7 it's still possible to work with existing databases . While trying this out with one of my databases I ran into the following Exception: <Message>An error has occurred.</Message> <ExceptionMessage>Invalid…

C# Async for Slugs

Fun fact for you dear reader, I've not been programming for long, my degree was in Chemistry and though I taught myself a little programming during my degree I was mainly focused on Chemistry. This means I've been programming professionally for less time than C# 5 has been released. This is why I've found tutorials so far for the Async/Await features in C# 5 (Net 4.5) to be a little lacking, they…

ASP NET MVC - Model Create With List of Model

This post runs through how to create a form for creating a model with a list of child models using MVC 5 and Razor. I've been rather quiet on the blogging front lately, I've been working on getting my MVC 5 quiz application up and running on Azure, it's here if anyone wants to give it a go. One thing I wanted to do while working on the site was allow for a model to be created along with a list of…

ASP.NET Identity 2.0 Tutorial - Password Reset and Roles

Given how much you all enjoyed the previous tutorial, i.e. not at all, I thought I'd write a follow up post. As promised this blog post extends the basic system we created in the main tutorial to add roles and a password reset function. I won't show how to setup the emails for password reset because I'm too lazy to fill in the form for a free SendGrid account, however plugging emails in should be…

ASP.NET Identity 2.0 Tutorial - EF Free (Post 2)

Note: This is the second post in a 2 post tutorial on implementing Identity 2.0 without using EF, for post 1 go here . Now we have our User and UserStore classes we can change the UserManager and SignInManager our application uses. These classes are in the App_Start/IdentityConfig.cs file. I split the classes out to their own files, ApplicationUserManager.cs and ApplicationSignInManager.cs…

ASP.NET Identity 2.0 Tutorial - Entity Framework Free

So in this post I detailed how to use Asp Identity with Entity Framework Database First. However when I started a new MVC project and tried to follow the steps nothing worked. ASP Identity 2.0 has ruined everything by introducing many breaking changes. This post will guide you on how to setup Identity 2.0 without Entity Framework. The original post was a lot longer but I've tried to cut down a lot…

Minify Json using JSON.NET

In my current project I'm using Json stored in the SQL Server database to replicate the storage capability of the browser Session but allowing the data to persist on the user reloading/leaving the page. One of the challenges is to store the serialized object in as few characters as possible while preserving meaning. Without touching the settings, Json.Net stores the strings without extraneous…

Simple Introduction to MVC Ajax (Post 3)

Now we have partial views loading forms using Ajax and we can call controller methods using Ajax it's time to put everything together. We're going to start with a blank scenario to make it easier to follow. This makes this a very long post but it puts together everything we learned. Code files I managed to coerce PHP into creating a new route on my website. You can see the full code for the…

Simple Introduction to MVC Ajax (ASP.NET MVC 5)

The jQuery Ajax built into ASP.NET MVC is very powerful but it's hard to know exactly where to start. This tutorial is a result of a few hours investigation so it's written from the point of view of a beginner. I intend to upload code samples at some point but I need to add a code hosting feature to my website. Setting up our test environment We're going to use a very simple example to work with…

Simple Introduction to MVC Ajax (Post 2)

So far we have seen how to add a very simple ActionLink and attach actions. Now let's load a PartialView using Ajax. Also we want to load a partial view with a different model into our page. Getting a Partial View using ActionLink We're going to deal with an object a Dog could "own", so we create a collar class. Let's accessorize our dog with some fabulous collars / add an ActionLink to the…

Error Creating a DACPAC in Visual Studio 2013 from SQL Server 2014

Working on projects in your spare time is great because you're free to pursue every little diversion; it means you make no real progress with your actual project but you learn a lot. When I had to add a column to one of my database tables I decided to investigate creating a DACPAC (1). A DACPAC allows you to turn your existing database into a database project in Visual Studio which means your…

ASP.NET Identity 1.0 - Database First

Note: This tutorial applies to Identity 1.0 which is the previous version of ASP.NET Identity. I have a newer post on the same subject here If you've read my previous posts you probably know I'm working on some EF Database first stuff, this seems to be the least popular way to use EF but to me seems like a common business use-case for it. The MVC template in Visual Studio comes with the new…