Powershell Core reference and handy stuff

Note: “$_” is used to refer to the “current object” which is passed to foreach in the loop. And $_.name is the “name” property of the current object in the loop. Use a list of item PIPED to a bash command  – Echo $list_of_items | xargs -L1 bash -c ‘<some bash command’ Example: az group […]

Ubuntu Linux – Handy stuff

Update all packaged :  $ sudo apt-get update Upgrade all packages: $ sudo apt-get upgrade What’s my Machine name and Linux Version $ > hostname $ > cat /etc/os-release What’s my Private IP $ > hostname -i $ > hostname -I |'{print $1}’ $ > ip route get 1.2.3.4 | awk ‘{print $7}’ What’s my […]

DevOps Practice

Azure Pipelines – Integration with Github, Build pull requests prior to merge, Run tests, Deploy for any platform (Ubuntu, Mac, Windows). See more … (Azure Devops server 2019 can be used as Cloud hosted or setup On-Prem. The azure pipeline build yaml is checked in with your source code so your build process/tasks etc are […]

SOLID Principles

Single Responsibility Principle: A class should be limited to a single responsibility. There should be one and only one reason to change a class. Supported by Object Composition (Composites), Strategy/Template Pattern etc. Key guidelines clearly defined boundaries as to where a piece of functionality is “implemented”; information-hiding in components that protect the integrity of data; […]

Creating Bootstrap datepicker

View <form> <input type=”text” id=”pickADate” data-bind=”value: dataModel().pickADate” class=”datepicker form-control” readonly name=”pickADate”​ /> <!– id, name can be anything. class is important –> <script>require[”…., “bootstrap-datepicker”, “bootstrap-datepickerGB”​], function(….,datepicker, datePickerGb) {                     moment.locale(“en-gb”); // Set Locale for moment (aka moment.locale(“en-gb”)) var vm.mydateDate = moment(data.MyDateDate).format(“L”); // we get dd/mm/yyyy $(‘.datepicker’).datepicker({ language: […]

Model binding Enum back to Object

Whe passing data from client (ko data back to MVC) where the object is an Enum of say 2 values. We need to either setup a Model Binder for that or take a shortcut ​as follows: <checkbox data-bind=”checked: viewModel.myStatus”> Enum MyStatus {Complete=1, NotStarted=0} And if myStatus is of type MyStatus then, we can say in ajax before […]