onsdag 7 december 2016

Change password in nested remote desktop connections

Rdp says: "The user account's password has expired. ..."
You say: "Whaat?!"
Solution: in Rdp-nr1/VM -> On-Screen Keyboard -> (mot rdp nr2) ctrl+del+end -> change pwd -> change user-name -> make the change

Sources:
http://serverfault.com/questions/57222/how-to-send-ctrlaltdel-using-remote-desktop/149030#149030
http://www.sealingtech.org/how-to-change-password-in-a-nested-rdp-session/

fredag 1 april 2016

Javascript split and indexOf


var location1= ((location.href).split('?')[0]).split('/').pop();
------------------------------------------------------------------------------
var indexStart = elem.docIcon.indexOf("http");//grabbing the url
var indexEnd = elem.docIcon.indexOf("jpg");//grabbing the url
indexEnd += 3;//grabbing the url
var docIcon = elem.docIcon.substring(indexStart, indexEnd);//setting the url
------------------------------------------------------------------------------

tisdag 23 februari 2016

WCF stuff


Calling one WCF service from another
https://social.msdn.microsoft.com/Forums/vstudio/en-US/017fa465-5873-45b3-a12a-6228bf4a7cc6/remote-server-returns-405-error-when-calling-a-webhttp-service-from-within-another-webhttp-service?forum=wcf
http://tdoks.blogspot.se/2009/06/calling-one-wcf-service-from-another.html
http://rgoarchitects.com/wiki/pmwiki.php?n=Main.WcfGotcha
-
Implementing CORS support in WCF
https://blogs.msdn.microsoft.com/carlosfigueira/2012/05/14/implementing-cors-support-in-wcf/
https://jamesheppinstall.wordpress.com/2012/08/12/restful-web-services-with-windows-communication-foundation/
-
Locking with ConcurrencyMode.Multiple
http://stackoverflow.com/questions/7375311/aspnetcompatibilityenabled-true
-
<serviceHostingEnvironment>
https://msdn.microsoft.com/en-us/library/ms731336%28v=vs.110%29.aspx
-
Deploying an Internet Information Services-Hosted WCF Service
https://msdn.microsoft.com/en-us/library/aa751792%28v=vs.110%29.aspx
Cannot get WCF Data Services samples to run
http://stackoverflow.com/questions/25087756/cannot-get-wcf-data-services-samples-to-run
The remote server returned an error: (405) Method Not Allowed
https://social.msdn.microsoft.com/Forums/vstudio/en-US/95bdf2fa-3e2d-489d-8873-31f0da816577/deploying-wcf-service-in-iis?forum=wcf

CSS always on top, And some code

CSS always on top,
"Ensure position is on your element and set the z-index to a value higher than the elements you want to cover."
http://stackoverflow.com/questions/21386306/css-always-on-top

A really good Fiddle http://jsfiddle.net/raving/0mLzseby/

And some code

element {
    position: fixed;
    z-index: 999;
}
function sticky_relocate() {
    var window_top = $(window).scrollTop();
    //var offset = jQuery(this).css('offset');
    var div_top = $('#sticky-anchor').offset().top;
    if (window_top > div_top) {
        $('#sticky').addClass('stick');
        $('#sticky').removeClass('cheating');
    } else {
        $('#sticky').removeClass('stick');
        $('#sticky').addClass('cheating');
    }
}

$(function () {
    var mystyle = '<style> #sticky {right: 270px;    padding: 0.5ex;    width: 80px;height:150px;    background-color: #333;    color: #fff;    font-size: 2em;    border-radius: 0.5ex;}#sticky.cheating {position: fixed; z-index: 10000;} #sticky.stick {    position: fixed;    top: 0;    z-index: 10000;    border-radius: 0 0 0.5em 0.5em;</style>}'
    $('head').prepend(mystyle);

    var anchorStick = ''+
    '<div id="sticky-anchor"></div> <div id="sticky" style"position: fixed; right: 0px;">'+
        '<div class="gov_weixin_share" style="top: 156px; right: 359px;">' +
            '<div class="closeBtn" style="font-size:12px;text-align:right;height:15px;padding-top:1px;">' +
               '<img src="http://www.gov.cn/govweb/xhtml/images/public/close140403.gif" style="cursor:pointer;"/>' +
            '</div>' +
            '<div class="gov_wx fixed" style="font-size:12px;text-align:right;height:15px;padding-top:5px;"><img src="http://www.gov.cn/govweb/xhtml/images/public/public_weixin.jpg">' +
               '<p>中国政府网<br><a href="http://www.gov.cn/foot/2014-02/18/content_2611908.htm" target="_blank">微博、微信</a></p> ' +
            '</div> ' +
        '</div> ' +
    '</div>';
 
    $('#content').prepend(anchorStick);
    $(window).scroll(sticky_relocate);
    sticky_relocate();
    $(".closeBtn").click(function(){$("#sticky").hide()});
});


torsdag 18 februari 2016

Supporting Multiple IIS Site Bindings

Supporting Multiple IIS Site Bindings
https://msdn.microsoft.com/en-us/library/ee358763%28v=vs.110%29.aspx

In webconfig of .svc
  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>

fredag 5 februari 2016

Sorting an array of objects in Javascript


var mySortArray = [];

mySortArray.push({orderNr:internalOrder,content:anyText});

mySortArray.sort(function(a, b){
var orderNrA = a.orderNr;
var orderNrB = b.orderNr;
if(orderNrA === null){
return 1;
}
else if(orderNrB === null){
return -1;
}
if(orderNrA < orderNrB){
return -1
}
else if(orderNrA > orderNrB){
return 1
}
return 0
});

More info: http://www.javascriptkit.com/javatutors/arraysort2.shtml

VirtualBox Fullscreen and Shared Clipboard

VirtualBox Fullscreen
While you have your guest OS running select "install guest additions" from the Devices menu (top bar in window for guest OS).
Reboot when prompted and when it comes back up host + F (right Ctrl+F) should take it to full screen.

Shared Clipboard
Devices -> Shared Clipboard -> Bidirectional

torsdag 21 januari 2016

Image Renditions

Image Renditions
[mysite]/_layouts/15/ImageRenditionSettings.aspx

onsdag 13 januari 2016

Javascript sleep function

function sleepFor( sleepDuration ){
    //alert();
    var now = new Date().getTime();
    while(new Date().getTime() < now + sleepDuration){ /* do nothing */ }
}

sleepFor(2000);

Source: http://stackoverflow.com/questions/951021/what-do-i-do-if-i-want-a-javascript-version-of-sleep

Change Site MasterPage

Change Site MasterPage

Your-site/_layouts/15/ChangeSiteMasterPage.aspx