Assign a value to a variable and show it on output $ someVar = “hello world!” $ echo $someVar Assign a command into a variable and run it $ someVar = “ps -a” $ $someVar (runs the command contained in the string) Find command’s actual path which ls –> shows /usr/bin/ls […]
Author: p k
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; […]
Welcome to my blog!
This is where I’ll be sharing my thoughts on topics that matter to me. Who knows… I might even share pictures, videos and links to other interesting stuff. If I catch your interest, let me hear from you.
Renaming Project or Solution , Multiple Classes Error
When renaming a project, ensure to empty the /bin/ folder within the project for a clean rebuild. Old DLL’s from previous builds could cause failures in resolving Controller names as 2 or more instances of the same controller would be found under 2 diff namespaces. Easiest way: Right click solution -> Clean Solution and then Rebuild. […]
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: […]
Posting KnockOut Form data (3 mechanisms)
// MyFormController/PostMyForm // $.ajax({ // Method 1 url: “MyForm/MyForm”, method: “POST”, data: self.dataModel(), […]
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 […]