Thursday, March 11, 2021

Cloud-native Architecture

Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach.

These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil.

The Cloud Native Computing Foundation seeks to drive adoption of this paradigm by fostering and sustaining an ecosystem of open source, vendor-neutral projects. We democratize state-of-the-art patterns to make these innovations accessible for everyone.


Traits of a cloud-native architecture:
  • Self-healing
  • cost efficient
  • easy to update 
  1. Design for automation
  2. Favor stateless over statefull applications
  3. Favor Managed Services
  4. Practice defense in depth
  5. Evolutionary Architecture


Sunday, August 25, 2019

Micro8ks on windows

Running Micro8ks on a windows machine
  • Install Multipass:
  • From Powershell:
    • multipass launch -n microk8s-vm -m 4g -d 40g ubuntu
    • multipass list
    • multipass exec microk8s-vm  -- sudo snap install microk8s --classic
    • multipass connect microk8s-vm

Tuesday, January 29, 2019

Check GDPR Compliancy in SQL Server with Dynamic Masking and Encryption

SELECT AS schema_name, AS table_name, AS column_name, AS type_name,
       COALESCE(IT.value, N'') AS information_type,
       COALESCE(SL.value, N'') AS sensitivity_label,
          COALESCE(mc.is_masked, '0') as IsMasked,
          ISNULL(c.encryption_type, 0) as IsEncrypted
FROM sys.schemas AS S
    JOIN sys.tables AS T
        ON T.schema_id = S.schema_id
    JOIN sys.columns AS C
        ON C.object_id = T.object_id
    JOIN sys.types AS TY
        ON TY.user_type_id = C.user_type_id
    LEFT OUTER JOIN sys.extended_properties AS IT
        ON IT.major_id = C.object_id
           AND IT.minor_id = C.column_id
           AND = 'sys_information_type_name'
    LEFT OUTER JOIN sys.extended_properties AS SL
        ON SL.major_id = C.object_id
           AND SL.minor_id = C.column_id
           AND = 'sys_sensitivity_label_name'
       LEFT OUTER JOIN sys.masked_columns as mc
             ON mc.object_id = t.object_id
             AND mc.column_id = c.column_id
where it.value is not null

Wednesday, May 10, 2017

Why using { } even for single line if else statemens in C#

If programmers at Apple had simply followed a couple of the rules in the Embedded C Coding Standard, they could have prevented the very serious `Gotofail` SSL bug from entering the iOS and OS X operating systems. Here’s a look at the programming mistakes involved and the easy-to-follow coding standard rules that could have easily prevent the bug.

Wednesday, June 01, 2016

Converting unix epoch to datetime in streaming analytics

sample input:
        "Key": "Dryer_Sensor",
        "State": "0.8",
        "Timestamp": "1464782405968",
        "Site": "Bir57",
        "EventProcessedUtcTime": "2016-06-01T13:24:49.4517020Z",
        "PartitionId": 0,
        "EventEnqueuedUtcTime": "2016-06-01T12:00:06.4520000Z",
        "IoTHub": {
            "MessageId": "7e6d0379d85046f295c0cdaeaabe25d8",
            "CorrelationId": null,
            "ConnectionDeviceId": "openhab",
            "ConnectionDeviceGenerationId": "635957210185596241",
            "EnqueuedTime": "0001-01-01T00:00:00.0000000",
            "StreamId": null

 query: DATEADD(millisecond, CAST([Timestamp] as bigint), '1970-01-01T00:00:00Z') as timeFromString

this will result in  '1970-01-03T07:09:18.032Z' which is wrong!

you can correct this by modifying the input so its strips the quotes from the epoch

        "Key": "Dryer_Sensor",
        "State": "0.8",
        "Timestamp": "1464782405968",
        "epochtime": 1464782405968,
        "Site": "Bir57",
        "EventProcessedUtcTime": "2016-06-01T13:24:49.4517020Z",
        "PartitionId": 0,
        "EventEnqueuedUtcTime": "2016-06-01T12:00:06.4520000Z",
        "IoTHub": {
            "MessageId": "7e6d0379d85046f295c0cdaeaabe25d8",
            "CorrelationId": null,
            "ConnectionDeviceId": "openhab",
            "ConnectionDeviceGenerationId": "635957210185596241",
            "EnqueuedTime": "0001-01-01T00:00:00.0000000",
            "StreamId": null

and modifying the query so it omits the cast (where the bug resides):  DATEADD(millisecond, epochtime, '1970-01-01T00:00:00Z') as time

this will result in the expected result: 2016-06-01T12:00:05.968Z

Friday, April 08, 2016

Registering a device in Azure IoT Hub

Using Node.js

npm install -g iothub-explorer@latest
iothub-explorer <connection string> create MyDevice


Using Device Explorer

See: azure iot sdk on github

Friday, February 26, 2016

Installing Z-Wave Stick Gen 5 on Windows IoT Core

I am currently fiddling around with Windows 10 IoT Core on a raspberry Pi. I wanted to use Z-Wave to be able to control a Fibaro Wall Plug (

But I could not find the Z-Stick that was on the supported hardware list of windows iot core

so I bought a Z-Wave Aeon Labs Z-Stick USB Controller - Gen5.

the following steps will explain how to get it working for windows iot core

Step 1
Download the drivers here:

step 2
Connect to tou you raspberry e.g. \\freyr\c$\Data\Users\Administrator\Documents
and unzip and copy the drivers

step 3
connect using powershell

[freyr]: PS C:\Data\Users\Administrator\Documents>

freyr]: PS C:\Data\Users\Administrator\Documents> dir

    Directory: C:\Data\Users\Administrator\Documents

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        8/24/2015   8:34 PM           8424
-a----        8/24/2015   8:34 PM            710 uzb.inf

[freyr]: PS C:\Data\Users\Administrator\Documents> devcon dp_add .\uzb.inf


Driver package 'oem0.inf' added.
[freyr]: PS C:\Data\Users\Administrator\Documents>

[freyr]: PS C:\Data\Users\Administrator\Documents> devcon status usb*


    Name: USB Serial Device
    Driver is running.


Thursday, March 05, 2015

About CQS, CQRS and Event Sourcing

Seems to be a lot of confusion going on about these terms. The below extract form Greg Young explains it all:
Many people have been getting confused over what CQRS is. They look at CQRS as being an architecture; it is not. CQRS is a very simple pattern that enables many opportunities for architecture that may otherwise not exist. CQRS is not eventual consistency, it is not eventing, it is not messaging, it is not having separated models for reading and writing, nor is it using event sourcing. I want to take a few paragraphs to describe first exactly what CQRS is and then how it relates to other patterns.