Two button shutdown for Surface Pro

Just had severe issues getting my Surface Pro 3 to boot into windows. It got stuck on the Surface splash and didn’t budge from there. Tried forcing it to shut down by holding down the power-button and restarting, but didn’t help. What did help was to do a two button shutdown, which I didn’t realize was a thing…

  1. Press and hold the power button for 30 seconds.
  2. Press and hold the volume up button and the power button for at least 15 seconds.
  3. Wait 10 seconds
  4. Press the power button normally, and hope it boots properly this time…

Step #2 seems to be the key, and ignore any sort of screen flashes or such while you hold the buttons down.

Also, by the way, if you simply hold the volume up button down and press the power button normally, you will get a boot menu, which I also didn’t know about until today…

Source: Surface turns on, but Windows won’t start

PHP: Authorization header missing on Apache

I’m using a simple PHP cross-domain-proxy to be able to do some Javascript requests towards an API on a different domain. Worked great, until I needed to do basic authentication. I set the appropriate header to be passed through, 'Authorization': 'Basic ' + btoa(username+':'+password), but in the proxy script, that header had vanished.

Turns out it was Apache stripping it away. Don’t know if it’s because of security or because Apache thinks that, hey, I’m the one dealing with this stuff so no point sending it to the script. Anyways, seems you can get it back by doing the following in an .htaccess file:

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

Now the header is passed through to the API successfully and I’m no longer getting 401 Unauthorized back 🙂

IIS: Redirect HTTP to HTTPS

To cleanly redirect HTTP to HTTPS with IIS, first install the URL Rewrite module, and then add the following to your web.config. Also remember to have bindings defined for your site for both HTTPS(443) and HTTP(80).

        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />

Source: StackOverflow

SQL Server evaluation license expiration date

Running the following SQL should give you how many days left until your evaluation license runs out. Also tried adding a calculation of when that date is. Either way, beware of off-by-one errors…

sp_configure 'show advanced options', 1;

sp_configure 'Agent XPs', 1;

DECLARE @daysleft INT
DECLARE @instancename sysname
SELECT @instancename = CONVERT(sysname, SERVERPROPERTY('InstanceName'))
EXEC @daysleft = xp_qv '2715127595', @instancename
    DATEADD(dd, @daysleft, CONVERT(DATE, getdate())) 'Expiration date',
    @daysleft 'Days left'

Source: When will my SQL Server Evaluation Edition expire?

With a hint of Social Ineptitude