creating container using docker http api with port configuration (ExposedPorts and PortBindings)

I was trying to create docker container using http REST service with the option to configure port bindings. The documentation is great but somehow doesn't work as when we post, it has to be really specific / small json footprint is required.

So I use postman for this and post to the following url. I am spinning up a container called MyContainer


You probably will be able to create the container but might not get port bindings to work correctly.

Here are the json that works, after so many tries. I would try to post only those stuff you required to make the change.

docker REST api

To enable docker REST API (essentially all computer that has docker installed, you can open up to the world via REST Api)

Just do a

"docker version", you can see that we have API version 1.35 installed.

 Version:       17.12.1-ce
 API version:   1.35
 Go version:    go1.10.1
 Git commit:    7390fc6
 Built: Wed Apr 18 01:23:11 2018
 OS/Arch:       linux/amd64

Then exposed your docker REST API via tcp using the following command :- 
sudo docker -H tcp://
You're ready to interact with it. 

azure storage account requires shared access signature

In azure it is not sufficient to create your own storage account, you need to add "shared access signature to it. And then use this settings and append it your file url.

It will look like this, anything appended to intro.mp3 are your shared access key.

Go to Home->Storage Account -> somestorage -> Then you will be able to find "shared access signature" &ss=bfqt&srt=sco&sp=rwdlacup&se=2019-01-17T14:07:02Z&st=2019-01-17T06:07:02Z &spr=https,http&sig=ij2IGonmAQnp4inkHDRIRiHMFXf1kiZRD7p6IR3sHD0%3D

'Microsoft.AspNetCore.Mvc.Core, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.AspNetCore.Mvc.Core' with identity 'Microsoft.AspNetCore.Mvc.Core, Version=, Culture=neutral

Bump into this error and i wasn't able to upgrade the version using vs2017.

If you would like to target specific version, you are better off using the following settings


If you want a quick solution the setting this to a single project will upgrade rest of the projects, adding the following solve it for me

React native - Creating circular play button

In this example, i will show you how to create a circular border around play button as shown below :-

The setup is pretty basic :-

The trick is use backgroundColor as white.
BorderWidh is 2. Then you will get the effect shown above.

git checkout, reset and revert

git revert - undo a commit by creating a new commit.

git reset - change the HEAD index without modifying the file if you choose - soft reset. If it is hard reset it is the same.

git checkout - basically goes to a commit and change the file content too.

always merge on a 'throw away branch'

For example, here we wanted git to merge master to development branch to prevent us from making our master branch dirty.

So its always good to resolve conflict on a throw away branch before merging back to master.

(on branch development)$ git merge master (resolve any merge conflicts if there are any) git checkout master git merge development (there won't be any conflicts now)

Typescript mixin and how to use it.

Declaring mixin in typescript

typeConstructor<T = {}> = new (...args: any[]) =>T;
functionHandler<BaseTypeextendsConstructor>(TargetType: BaseType) { returnclassextendsTargetType { isActivated = false; }; }
classUser { name = "" }
consti = Handler(User); constidec = newi

installing python3 on macOs

To install python3
brew install python3

To install pip on macOS
sudo python -m ensurepip

Using timer to keep on running until certain condition are met

Here is a simple Rx.Net timer example which keeps on pinging a service url until a condition are met. In this case, if status is running. I think there are many ways to do it. :-

Example to call it :-

git revert specific file

this is by far one of the most important command in git and i need to have to here.

c5f567 is the commit number

-- file1/to/restore  is the file u would like to revert for commit above.

git checkout c5f567 -- file1/to/restore file2/to/restore

Dotnetcore webpi dependencies injection

Think this is something i have forgotten over and over again, doing dependencies injection in Dotnet core webapi service.

All i have to to do look for this method and add whatever services that i'm going to be using :-

publicvoidConfigureServices(IServiceCollection services) { services.Configure(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddScoped();// OperationService depends on each of the other Operation types.

What's the deal with

a) AddSingleton -> Create a single instance of object to be shared across session. The controller or services use same instance.

b) AddScoped -> Pass the same object if it is the same session

c) AddTransient -> Different object created and pass into controller and services

Controller action not being hit in Dotnet core based app

Debugging tips

a) Check your project sdk - this is a good thing to do in case you just converted your dll or console based application to a webapi based application.

Originally it might look like this

The correct settings :-

b) route - check your route in your controller.

react native element - removing border from your list

In your list control, you have something like this to render your list (gridbox).

This might give you a listbox with some border.

If you want to hide all those border, change your ListItem style to as follows -

<ListItemcontainerStyle={styles.listItemStyle} />

listItemStyle : { borderBottomColor:'transparent' , borderBottomWidth:0 }

Then all your borders in List Item will be removed. core - core library

Can't believe it, but these are all the nuget package you need to start building your webapi project.

This will allow you to do all the dirty stuff like


Or start hosting it locally on your command prompt.

C# - Program does not contain a static - Main method for entry point

When working with Async method, you often bump into the following issues. Not all code are made 'async'.

There are 2 workarounds which are shown here.

publicstaticvoid Main(string[] args) {     MyProgram(args).RunAsync().GetAwaiter().GetResult(); }
Or with code below which does not return result (void operation)

publicstaticvoid Main(string[] args) { BuildWebHost(args).RunAsync().Wait(); }
If you're just going to return Task, you can do this 

 public async Task ProvisionService(RequestType requestType)
            return await Task.FromResult("ok");

Formatting react-native view like a flexbox

View component is a critical component in react native. Mastering how to style it and its child component are crucial being a react native developer.

Here is a guide to understand and work with flex-box.

To give you an example, in react with the following codes.

It basically lines up your view as shown below :-