How to RDP into an Azure Cloud Services (classic) VMs

See the image.  First you need to click on Remote Desktop and configure RDP to be enabled and create an account with an expiration.  It’s a good practice to have the account expire sooner than later if you are only going to be doing work for a short period of time.

After creating an account, then you need to click on Overview and select the instance you want to remote into.  You will then get a “Connect” button in the upper right hand corner, which will download a temporary RDP profile for you to use.  Just launch it and it will open up the RDP client and start the connection process.


Using Knockout to databind a date to a date picker and time picker

Here is just a basic proof of concept I worked up for a project where we wanted to use an HTML5 timeselector, which requires the time values to be formatted in a specific way, and also deals with some of the odd Daylight Savings Time issues based on the date component.

This example requires jquery, knockout and moment.

<input data-bind=”datepicker: myDate” />
<input data-bind=”timepicker: myDate” type=”time” />
<hr />
<button data-bind=”click: setToCurrentDate”>Set To Current Date</button>
<button data-bind=”click: showCurrentDateTime”>Show current date</button>
<hr />


ko.bindingHandlers.datepicker = {
     init: function (element, valueAccessor, allBindingsAccessor) {
         var $el = $(element);

        //initialize datepicker with some optional options
         var options = allBindingsAccessor().datepickerOptions || {};

        //handle the field changing
         ko.utils.registerEventHandler(element, “change”, function () {
             var observable = valueAccessor();
             var oldDate = observable();
               var newDate = $el.datepicker(“getDate”);
             var newDate = new Date(newDate.toLocaleDateString() + ” ” + oldDate.toLocaleTimeString());

        //handle disposal (if KO removes by the template binding)
         ko.utils.domNodeDisposal.addDisposeCallback(element, function () {

     update: function (element, valueAccessor) {
     var d = viewModel.myDate();
     if (d!=null) alert(d);
         var value = ko.utils.unwrapObservable(valueAccessor()),
             $el = $(element),
             current = $el.datepicker(“getDate”);
         if (value – current !== 0) {
             $el.datepicker(“setDate”, value);

ko.bindingHandlers.timepicker = {
     init: function (element, valueAccessor, allBindingsAccessor) {
         // Get the value of the value binding
         var value = valueAccessor();
         var thisElement = $(element);
         console.log(‘The value of the element should be here – ‘, value());
         // If the value is not a valid moment in time,
         //handle the field changing
         ko.utils.registerEventHandler(element, “change”, function () {
             var observable = valueAccessor();
             console.log(‘observable – ‘, observable());
         var tzdstOffset = (observable().getTimezoneOffset() + (moment(observable()).isDST() ? 60 : 0));
         var adjustedTime = new Date($(element)[0].valueAsDate.getTime() + (tzdstOffset * 60 * 1000));
             var adjustedDate = observable();
     update: function (element, valueAccessor, allBindingsAccessor) {
         var value = ko.utils.unwrapObservable(valueAccessor());
         var thisElement = $(element);
         console.log(‘Value updating to -‘, value);
         var thisMoment = new moment(value).format(‘HH:mm’);
         //console.log(‘Value updating to -‘, thisMoment);
         console.log(‘This is the element – ‘, thisMoment);
         thisElement[0].value = thisMoment;
         console.log(‘This is the element – ‘, thisElement);

function showCurrentDateTime()

var viewModel = {
     //myDate: ko.observable(new Date(“12/01/2013 8:00 AM”)),
     myDate: ko.observable(new Date(“2017-08-09T04:23:30.8295065-02:00”)),
     setToCurrentDate: function () {
         this.myDate(new Date());


Removing files from git that match the gitignore file


Recently a developer accidentally committed and pushed a metric-ton of binary files into our repo that were supposed to be ignored by the gitignore file.

After a bunch of work trying different options I came across a solution.  We used the Git Bash (on windows) and ran the following:

git ls-files -i -z –exclude-from=.gitignore | xargs -0 git rm –cache

This effectively told git to remove all files that matched the ignore list.  It’s not perfect, but it saved us a ton of time removing files from a hundred different folders.

Getting hibernation working on Lenovo 100S

I have a Lenovo 100S but no matter what I tried I couldn’t find how to get hibernation as an option.

When researching the problem it seemed some people with a similar problem were able to get hibernation working by opening an admin command prompt and running:

powercfg.exe /hibernate off

However after doing that I didn’t see any change, and furthermore when running:

powercfg -a

it said “The hiberfile does not support hibernation”

Doing more research I found that the likely reason was that for some reason the hibernation file was too small. Running:

powercfg -h -size 100%

caused the hibernation file to grow significantly, and after a reboot I had “Hibernate after” options on the sleep menu.