Feb 12, 2019

RePost: Visual Studio productivity tips

https://docs.microsoft.com/en-us/visualstudio/ide/visual-studio-2017-for-dotnet-developers?utm_source=VisualStudio&utm_medium=aspnet-getstarted&utm_campaign=VisualStudio&view=vs-2017

Feb 8, 2019

RePost: Git concepts

Very good point about Git architecture.

https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch

Git was designed to support a more distributed model with no need for a central repository (though you can certainly use one if you like). Also git was designed so that the client and the "server" don't need to be online at the same time. Git was designed so that people on an unreliable link could exchange code via email, even. It is possible to work completely disconnected and burn a CD to exchange code via git.
In order to support this model git maintains a local repository with your code and also an additional local repository that mirrors the state of the remote repository. By keeping a copy of the remote repository locally, git can figure out the changes needed even when the remote repository is not reachable. Later when you need to send the changes to someone else, git can transfer them as a set of changes from a point in time known to the remote repository.
git fetch is the command that says "bring my local copy of the remote repository up to date."
git pull says "bring the changes in the remote repository to where I keep my own code."
Normally git pull does this by doing a git fetch to bring the local copy of the remote repository up to date, and then merging the changes into your own code repository and possibly your working copy.
The take away is to keep in mind that there are often at least three copies of a project on your workstation. One copy is your own repository with your own commit history. The second copy is your working copy where you are editing and building. The third copy is your local "cached" copy of a remote repository.

Dec 17, 2018

Javascript OOP - Example of inheritance with closure (module pattern)

//This is just wrapper function! Not a constructor! It's sole purpose is to provide
//closure for hiding private members. Module?
function Vehicle(type, registration){
//Private members
var defaultType = 'car';
var calcRegistration = function (registration){
return registration ? 'REG-'+registration : 'REG-UNKNOWN';
}
//(Public) Constructor
function Vehicle(type, registration){
this.Type = type || defaultType;
this.Registration = calcRegistration(registration);
}
//Public method
Vehicle.prototype.DumpData = function(){
console.log(this.Type,' ',this.Registration);
}
//object instantiation using constructor and provided params
return new Vehicle(type, registration);
}
function Bus(type, registration, passengers){
function Bus(type, registration, passengers){
//Call base constructor with params
Vehicle.call(this,type,registration);
this.Passengers = passengers;
this.Driver = "";
}
//Inherit methods from prototype of Parent
Bus.prototype = new Vehicle(type, registration, passengers);
//Revert to child constructor
Bus.prototype.constructor = Bus;
//Create new method on child prototype
//Note! Parent method DumpData is inheried/exists on child->prototype->prototoype
Bus.prototype.AssignDriver = function(){
if (this.Passengers>30)
{
this.Driver= "Jack";
}
else
{
this.Driver = "Jenny";
}
}
return new Bus(type, registration, passengers);
}

//new is not needed since Bus function is used to create instance.
var cityBus = new Bus('bus','ZZX23-1',10);
cityBus.AssignDriver();
console.log(cityBus);
var fordTransit = Vehicle('van','');
console.log(fordTransit);
fordTransit.DumpData();

Nov 6, 2018

JavaScript - How to get request url parts (segments)

 Extracting url parts:

var urlParts = window.location.pathname.split('/');
var lastSegment = urlParts.pop() || urlParts.pop();

window.location.href = window.location.pathname.replace(lastSegment, myQueryPath);

Oct 26, 2018

RePost: .NET Architecture guides - DDD, CQRS, Clean, Onion etc.



Set of really good (and free) e-books related to modern and distributed architectures:

Here is a interesting component to investigate (by the author of Automapper):



Here is a list of recommended code samples to look and digest:

Metrics:
https://www.app-metrics.io/






Oct 19, 2018

ASP.NET Core 2.1 - NuGet - Blocked by project issue - AspnetCore.App

Some NuGet packages are added by default as part of framework.

https://docs.microsoft.com/en-us/nuget/tools/package-manager-ui#updating-a-package

For example : Microsoft.ASPNetCore.App.

If you get error that you can not update them to newest version with something like:
"Blocked by project. Update SDK"
; this could help.

Opet CSPROJ file and manually add this line under <PropertyGroup>:

<RuntimeFrameworkVersion>2.1.4</RuntimeFrameworkVersion>