Author: andersmalmgren

Client – server event aggregation with React

I implemented my client/server event aggregation library in Vue yesterday and thought it was time for React. I must say React is alot different from Vue, and since I come from Knockout Vue was very easy to adopt. Though after som fiddling I got the hang of it. 😀

(more…)

Client – server event aggregation with Vue

I have ment to look into Vue for a long time. Finally I took my time and fell in love right away. The simplicity and modularity is just great. I also saw how easy you can extend it so I decided to implement a plugin for my SignalR event aggregation library.

(more…)

Client – server event aggregation with SignalR ASP.NET Core

Event aggregation is really a pattern i like, there is something elegant about firing events and subscribers can listen to them without knowing who fired them. This creates decoupled domains both in backends and frontends. Back in 2013, at my customer of that time we saw an increasing demand for pub / sub and immediate update. We fired events on the backend event bus and in the frontend we had SignalR Hubs that picked up the events and forwarded them to the clients. This caused duplicated and similar code both on the client and on the web server. I decided to create an abstraction layer between SignalR and the event aggregator. The result is a library called SignalR.EventAggregatorProxy

It has now been ported to support ASP.NET Core, this article will focus on the changes, for the orginal article go here.

(more…)

Pathfinding and environmental awareness

We’ve produced a very short devlog about the pathfinding / environmental awareness part of the AI development process for Virtual Warfighter. It describes how we’ve solved the problem of allowing AI soldiers to make different pathfinding choices, more intelligent than just take the shortest path.

We will probably expand upon this in the future by describing more, such as how to make the AI avoid exposed routes in favor of more concealed ones, if possible.

All this is part of the work being done for our upcoming coop game mode.

visualstudio.com changes UI daily

Whats going on with vs.com? We use it for issue tracking, version control and as a general CI platform. They literary change the UI every week and even daily. It’s very frustrating that you can not be granted to learn the UI and become efficient with it before they change it partially or entirely.

Microsoft, if you read this, continuous delivery is great but changing the UI at this rate is not productive for anyone.

</rant over>

Z-Wave – A system architects view

I’ve been looking into smart home systems lately. Z-Wave seemed like a popular choice and I liked the possible scenarios you could achieve with it. So I have played around with it for a few days now, and my final verdict on it, looking through my system architect eyes is that the entire thing must been developed by hackers, at least the software stack. Let me tell you why… (more…)

Virtual Warfighter

We have been working on a product of our own for the past months, a game for the OpenVR platform (HTC Vive, etc). The game will release this Friday, please check it out here!

http://store.steampowered.com/app/517020

Also I might once in a while write game/VR related blogs here, but its still mainly a blog about enterprise business code bases.

SQL CE and namespaces

We use SQL CE in our unit test project to test our EF6 queries. This works pretty well and Code first setup makes sure each test gets a fresh CE database to work with.

We ran into a problem where two EF types had the same table name but inside different schemas. CE does not support schemas and this resulted in naming conflicts when setting up database. My solution was to create a little convention.

public class BakeSchemaIntoTableNameConvention : IStoreModelConvention<EntityType>
{
    public void Apply(EntityType item, DbModel model)
    {
        var entitySet = model.StoreModel.Container.EntitySets.Single(es => es.ElementType == item);
        entitySet.Table = $"{entitySet.Schema}_{entitySet.Table}";
    }
}

It bakes the schema into the table name like dbo_MyTable. You add the convention like.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.Conventions.Add<BakeSchemaIntoTableNameConvention>();

    modelBuilder.Configurations.AddFromAssembly(typeof (MyContext).Assembly);
}

You do not want to add this for production code so what I did was create a public event on the context. And call it from the OnModelCreating method.

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    ModelCreating?.Invoke(this, modelBuilder);

    modelBuilder.Configurations.AddFromAssembly(typeof (MyContext).Assembly);
}

Call it from your Unittest project like.

ctx.ModelCreating += (s, e) => e.Conventions.Add<BakeSchemaIntoTableNameConvention>();

Microsoft.Rest.ServiceClient opt out retry

If you use Swagger generated REST proxies then you have probably come across the pretty new Microsoft.Rest namespace and namely the abstract class ServiceClient. I noticed a strange behavior when using clients that subclass this base class. The default behavior for this class is to retry when a 500 status code is returned.
I can not understand the reason for this being Opt out, its obvious a feature like this should be Opt in. So keep in mind when using this class you must always call SetRetryPolicy to disable the retry strategy.

var service = new MyService(uri, credentials);
service.SetRetryPolicy(new RetryPolicy(new HttpStatusCodeErrorDetectionStrategy(), 0));