Showing posts from March, 2018


First of all download your helm version.

To serve your chart locally

helm serve
Normally, your local repository will be here C:\Users\Jeremy\.helm\repository\local on Windows.

You can see that we have a folder call vistio.

To install this chart, simply run :-

helm install local/vistio

Why local? If you type  helm repo list , you can see that the "local" refers to a local repository.


Please note :- 
helm list repo is not the same as helm repo list , please make sure you type it correctly. 

Getting the right Powershell dependencies version.

Install-Module PowerShellGet -Force
Installing the Azure Resource Manager

Install-Module -Name AzureRM -AllowClobber
Loading your azure module

Import-Module -Name AzureRM

hosting .net core on windows 10 iis

I guess this must have been public knowledge by now. Oh wells sometimes I thought with .net core 2.0 plus, we would move pass the need to install ".net core web hosting bundle". I am not able to run or host .net core app on IIS. My app is running fine, when i start it with "dot net Appreport.dll"

Regardless if you're deploying to Prod or trying to run your app locally, as long as you are trying to run .net core app on IIS, install .net core.

Getting latest version

To get latest version of the window hosting bundle or other version, goto this page.

Select the Runtime version you desire and then, look for "Hosting Bundle".  Download accordingly.

iis manager missing

This is really insane but inetmgr is missing. and the fix is go to Windows Feature Add or Remove and then check - "IIS Management Console" as shown in diagram below.

golang app - running it on docker image.

This is a very simple approach to push your app into a docker image. First you need your Dockerfile which does all the hardwork for you, as shown below :-

Sample code can be found here.

If you want to run on kubernetes, the following yaml describe this deployment. Save this into a file called muxApp.yaml and then run kubectl apply -f deployment.yaml.

This is the service.yaml file by running "kubectl apply -f appservice.yaml"

Working with Helm charts

While working with Helm might be easy, it will be easier if you get access to a wealth collection of charts.

.netcore json configuration using appsettings.json.

Nuget package required for configuration

Microsoft.Extensions.Configuration (2.0.0)Microsoft.Extensions.Configuration.Json (2.0.0)Code that is required in your main() 
var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var configuration = builder.Build();

minikube : machine cannot be found or started

If you encounter issue running minikube start with a message "machine cannot be found", try the following command

minikube delete

minikube start

That should fix it. :)

main - best opening for key listening

This is the best loop to see if user keyed in and escape character or actual data : -

      Console.WriteLine("Press ESC to stop or enter valuation date: (2018-01-01)");
                while (!Console.KeyAvailable)
                    var valuationDate = Console.ReadLine();
                    Console.WriteLine(valuationDate + "entered");                 

            } while (Console.ReadKey(true).Key != ConsoleKey.Escape);

golang working with sql server

Golang ORM for Mssql server can be found here  (GORM) and here :-

Here is the code that i used to fetch data from a table called country which has just 2 columns which are :-

a) countryid

b) countryname

Here is the code that i used to access my sql server using GORM

Here is the code that i used to access my mssql server docker running on and database called PTS.

facebook fasttext for windows

Fasttext requires Vc++ redistributable in order to get it working on windows environment. To save you all the hassles, you can try download it from here.

lightgbm - simple race car example

Description of sample data

The sample data is pretty straight forward (intended to be that way). We have 3 main column which are:-

1. Horse power

2. Has Turbo

3. IsRaceCar - this is the label which basically conclusively tells us if this is a race car or not.

For example :-


3000,1,1 (race car)

The sample code for learning and predicting from this dataset  is shown below :-

typescript 2.8 - Conditional Type

Conditional Type

Which basically trying to say if  type A kinda like B type, then we can just use C type.

interface Car {
drive():void; } interfaceFerarriextendsCar { drivefaster():void; } // Foo becomes numbertypeFoo=Ferarri extendsCar ? number : string;

Learning flutter quick and dirty guide

I find it easier to go through :-

1. Widget catalog - to check out what are the widget available in flutter. Basically their capabilities.

2. Cook book - All the code you need to quickly spin out a UI element. Pretty limited but you get an idea.

3. Code labs - is so much better compare to "Writing your first app" write up.

Hope this helps.

flutter : no connected devices available / configure.

Please make sure you have clone flutter sdk from here

and run

flutter doctor --android-licenses

Check to ensure you have install the following :-

Android SDK, Android SDK Platform-Tools, and Android SDK Build-Tools, Images are installed

Then from the toolbar make sure you set to a "device", in my case Nexus 6 API P emulator. This will fire it up and once it is up and running, click on the play button.

It is a bit weird but .......that's how it works. 

Flutter package repository

Flutter package repository can be found here.

Flutter : unable to locate development device

Face this issue trying to run Flutter using Android studio. This simple means you need to configure your platform tools.  Go to File->Project Structure->Configure your Platform Sdk as shown below :- Try to set to Android 27 (or as recent version of Android SDK as you could).

Then fire away. Once you have it configure, your application bar - Flutter Hot Reload -> Should be enabled.

That's a big

EF Core 2.0.1 - Entity framework migration specific update - minus out initial database update

Wow, this title is pretty long.

Let's say you already have an existing database and right now you wanted to use EF Core to help migrate specific DML updates to your target database - which could be creating a new View or creating additional table minus out the initial database structure.

Note : Sometimes when you do an upgrade, you might get error message saying "your database has already been updated".

All rite, to be honest, you ca't do specific migration, example you can say "apply ABC Migration".

It is all based on the migration class that you've setup in your project,  meaning you get to type "Update-Database" without any parameter.

Anyways, please setup your project and all in the required EF nugets.

Next create the following class.

Then you specific what needs to be done. In this case, we are creating a view called "AppTesrtView".

Goto "package manager console" and then run "Update-Database". Please note y…

EF core hosting database migration on a separate project.

Project is available on Github.

Create a NEW project and then ensure you have installed all the nuget packages. The next important task that you need to do is to add a reference to your DbContext entities, if you have it separately from the main project

In your Startup.cs please ensure you have the following codes (which links directly to "Alphacert.Acc.Ods.Entities.Migrations".

services.AddDbContextPool(o => o.UseSqlServer(connectionString, x => x.MigrationsAssembly("Alphacert.Acc.Ods.Entities.Migrations")))

Using MsgPack in your core webapi

MsgPack (here) is reportedly faster then msgpack-cli in terms of performance. To get your excited, check out the diagram below :-

Yes, it is ridiculously fast and beat protobuf in many ways. I was gonna put on my hardworking cap and write up some formatters but this way is easier to do :-

Client code 

Client side code to de-serialized it.


Install it through nuget using the following command :-

Install-Package WebApiContrib.Core.Formatter.MessagePack -Version 2.0.0

Next, you gotta decorate your objects with the correct attributes.

And then somewhere in your controller, you can serialize your object as bytes and push it through using code below :-

Anaconda3 - Getting the environment installation of your library packages

How do you get the path where all your "pip install" packages are stored?

Fire up your python shell and run the following command :-

import os; print(os.path.dirname(os.__file__) + '/site-packages')

For me, i get the following output :-


Where CNTK is my current active environment and all the goodies that comes with it.

EF core using views

To access database view using DbContext, you just need to :

1. POCO - Create your POCO using code shown below. Please note that you need to match exactly the POCO to your views but not necessary all the fields. Let's say you have 10 fields but you can just defined 3 that is of interest to you :

2. Add your DbSet - You need to open up your DBContext and add in your DbSet Manually.

  public virtual DbSet VwValuations { get; set; }

3.OnModelCreating - in your DbContext, add your valuations data as shown below :

The data type used depends on your view.

That should be all the changes you need to make.

Cannot access a disposed object in ASP.NET Core working with DbContext

Bump into this error and found out the reason you cannot spin up a task to run a injected DbContext which normally injected by WebAPI dependency injection of a DbContext.


Create your dbcontext manually using code below (instead of using DbContext passed in the controller)

WebAPI support for File based Partial Content 206

Image core support for partial content is far out easier than i imagine. For example, if your application delivering a huge file, 100 Megabytes for example. then you might want to request these data as chunks

Some notes : this only works for File result and not with JSON which might fetch some data from the table. For example, you have a huge json (about 2M) and defining range 30-1000 will not change returned data.

Sample controller to handle partial content :- Yeap this is all you need.

Next, fire up your post and and you can see some of the results that i'm getting. Oh before anything else, please ensure you place a large txt file a folder.

As you can see from Postman. i create a request with Range : 30 - 1000 and the response is shown here too.

A couple of things to notice :-

Return result is 206. (Http Partial Content) 

Content-Length is 2500 ( which is the total file size we have) 

EF Net Core does not support nvarchar

I got this problem earlier today and i could swore it only happens for .net core 2.0. The message looks something like this :-

Data type 'nvarchar' is not supported in this form" after scaffolding from database 

After my model is binded or built, it throws this exception. I change

entity.Property(e => e.Comments).HasColumnName("Comments").HasColumnType("nvarchar");// No size specifier to


What is CNTK dynamic axis?

CNTK has static and dynamic axis. Static axis remains the same throughout the whole life cycle of the model. Dynamic axis has the following characteristics :-

a) varies from instance to instance
b) typically unknown
c) maybe ordered.

Sounds like a minibatch

Taken directly from Microsoft website :-

To make this more concrete, let’s consider two examples. First, let’s see how a minibatch of short video clips is represented in CNTK. Suppose that the video clips are all 640x480 in resolution and they are shot in color which is typically encoded with three channels. This means that our minibatch has three static axes of length 640, 480, and 3 respectively. It also has two dynamic axes: the length of the video and the minibatch axis. So a minibatch of 16 videos each of which is 240 frames long would be represented as a 16 x 240 x 3 x 640 x 480 tensor.

Dynamic axis in this case are video length (240 frames) and a total of 16 videos.

kubernetes dashbboard

Kubernetes dashboard is a UI driven approach to view and get us working with Kubernetes fasters.

Accessing the dashboard run :-

kubectl proxy

And you might get : Starting to serve on

So browse to : localhost:8001/ui

The nice dashboard of Kubernetes appears.

That's it.

kubernetes working with deployments : quick and easy

Do your deployment 

kubectl run connectcd --image=kepung/dotnetapp-prod --port=5050

Check your deployment is deployed 

kubectl get deployments

Get the pods spin up by your deployments and look for the labels :-

kubectl describe deployment/connectcd

kubectl get pods -l run=connectcd

NAME                         READY     STATUS    RESTARTS   AGE
connectcd-545c87f8d8-j4fsv   1/1       Running   0          27s

connectcd-545c87f8d8-j4fsv is our pods

Get all the pods in all namespace

kubectl get pods --all-namespaces

elastic search docker image that works

It has been challenging to find the images that works for ELK stack. Finally settle with the following images from elastic co version 6.2.2

Elastic Search

run the following image to get elastic search

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node"

Then browse to the following site :-



Kubernetes 101 - Basic stuff

When working with Kubernetes there are a few stuff that we need to be aware of,

1. images are often download from registry that lies somewhere in the cloud

2. kubernetes are organized into namespace. "default" namespace is the default. If you type kubectl get pods, you will get pods listed under this namespace by default.

webapi versioning the easy way

Turn out that doing webapi service versioning is relatively easy in core. First off, please install the following nuget package :-

Install-Package Microsoft.AspNetCore.Mvc.Versioning -Version 2.0.0

Next up, is to organize your controllers into folders. I prefer to use folder (namespace) as a way to do it, so i can have the same controller name versioned differently, as shown below :-

--->V1-->Controller-->HelloController(version 1)

-->V2 -->Controller-->HelloController (version 2)

Next we just need to decorate our HelloController with the proper attribute.

Version 1 Controller.

Version 2 Controller

webapi logging - log level

Just to clarify, if you set log level to Debug ( LogLevel = 1) then your logging will shows any log above it.

Here is the definition for log level,

 Trace = 0,
 Debug = 1,
 Information = 2,
 Warning = 3,
 Error = 4,
 Critical = 5,
 None = 6

Given we define LogLevel = Debug, any logs value bigger than 1 will appear.
If you want to scale down details of your logging, try setting your log level higher to Warning, for example.

You might want to change your logging method call too.

CNTK - Simple linear regression

The following are sample code to create a linear regression to work with car data.

CNTK : Different mini-batch size detected

Size of your test data and train data differs. Try making it the same before running your code again.

angular2 - working with reactiveform with json data

I guess one of the best way to debug angular reactive form issue is with the following code. Gives an interactive view of what user is adding into the form.

<pstyle="width:800px">Form value: {{ personForm.value | json }}</p>

Number to words typescript implementations

Here is a modified copy of a code that converts number to words.