Shawn Cicoria - CedarLogic

Perspectives and Observations on Technology

Recent Posts

Sponsors

Tags

General





Community

Email Notifications

Blogs I Read

Archives

Other

Use OpenDNS

PDF Search Handler fix

Adobe keeps breaking my PDF search.  WHY WHY WHY…

 

reg ADD HKCR\.pdf\PersistentHandler /d {1AA9BF05-9A97-48c1-BA28-D9DCE795E93C} /f

Running the AspNet vNext MVC sample direct from Docker

In the post

Using the Docker client from Windows and getting AspNet vNext running in a Docker Container you had to step through downloading GO, building the docker.exe, etc.

I’ve updated the GitHub repo adding the hacked version of the Docker.exe along with their LICENSE.

And the whole thing has been published to the Docker hub registry.

So, all you need to do is run the following (assuming you have a Docker host running):

docker run -d -t -p 8080:5004 cicorias/dockermvcsample2

This will get you a running AspNet vNext on Linux and a Sample MVC app.

Note that temporary workaround in the approach is TAR all the files 1st – and use that in the Dockerfile.

https://github.com/cicorias/dockerMvcSample

https://registry.hub.docker.com/u/cicorias/dockermvcsample2/

Posted: 11-24-2014 8:51 AM by cicorias | with no comments
Filed under: , , ,
Using the Docker client from Windows and getting AspNet vNext running in a Docker Container

Update: 2014-11-24 – Added links to HOWTO build Docker on Windows from Ahmet.

As Docker progress as a native application on Windows, and Asp.NET progresses direct from Microsoft for running on Linux, I wanted to see how far I could get using what’s out there today. While there are some challenges, there are a couple of simple steps that you can use to get around some initial blockers.

There are known issues in the Docker Windows implementation [Github pull request 9113] – specifically, the use of Path separators – in that in Linux we have ‘/’ and in Windows it’s ‘\’. While GO has a constant for this, the Docker client and server are not handling this platform translation just yet. The trick for this is just TAR up your directory first, then use the ADD Dockerfile command which can handle TAR files natively.

The other key change is downgrading the VERSION number so the client matches the Boot2Docker versions.  While I didn’t see any API changes that would impact this other than the version number.

Here’s an image of it running on a Docker host container (running on Hyper-V Windows 8.1).  Getting here was a bit challenging, but worth it Smile

github repo here: https://github.com/cicorias/dockerMvcSample

 

image

 

Here are the general steps that I followed:

Follow boot2docker on Hyper-V setup steps

In the post here you can use that to get Docker via Boot2Docker running in HyperV. Again, all you need is a Docker host, but if you want to be all HyperV this is a way to do it.

Modify Docker client version ‘server 1.15’ (HACK)

Ahmet goes through the HOWTO on building the Docker client – here: https://ahmetalpbalkan.com/blog/compiling-docker-cli-on-windows/.

GO is from here: https://golang.org/

Follow the steps to install GO, then clone the Docker git repo – and make a small change to the version number so you’ll be able to attach with the Native client (which is being built against the dev branch from Docker’s Github repo. The Boot2Docker server is still at the prior version.  See the comments in the pull request above where some folks have indicates similar approach.

C:\gopath\src\github.com\docker\docker\api\common.go
const (
	APIVERSION        version.Version = "1.15"

Build Docker client with GO

Once you have the docker.exe built, you can put it away safely and kill the repo if you want.

Turn off TLS if you like a simple command line

I turn off TLS for development.  see https://github.com/boot2docker/boot2docker/blob/master/README.md

“disable it by adding DOCKER_TLS=no to your/var/lib/boot2docker/profile file on the persistent partition inside the Boot2Docker virtual machine (use boot2docker ssh sudo vi /var/lib/boot2docker/profile).”

if you don’t turn it off, you can use TLS and just copy over to your Windows machien the following files then reference them from the ‘docker’ command line or set the environment variables.

If using TLS ‘steal’ the following files from your boot2docker host

The following files sit on the Docker host in /var/lib/boot2docker

  • cert.pem
  • key.pem
  • ca.pem

image

If you need to SSH into the Docker image:

ssh docker@192.168.1.165

Password: tcuser

 

Run docker client to verify access to your Docker host

Using the Docker client that you built from the GO source (and the hacked version #)

If you set an environment variable, you can avoid passing command line parms each time.

Note that the non-secure port is 2375 by default, and the secure port is 2376.

E:\gitrepos\dockerAspNet>set dock
DOCKER_HOST=tcp://192.168.1.165:2375

If you’re running via TLS, you can use the Certificate files that are located on the Server and mentioned above:

docker --tls --tlscert="e:\\temp\\docker\\cert.pem" --tlskey="e:\\temp\\docker\\key.pem" --tlscacert="e:\\temp\\docker\\ca.pem" ps

Getting ASP.NET vNext running

Now for the fun part.

First, grab (clone) the github repo at:

git clone https://github.com/aspnet/Home.git

Tar files into 1 archive

Then in the ./samples/HelloMvc directory using a tool (such as 7-zip) to ‘tar’ up all the files so you have a ‘HelloMvc.tar’ file. This step is needed until the Docker client/daemon properly addresses File Separator differences between Windows and Linux.

Create a ‘Dockerfile’ with the following:

FROM microsoft/aspnet
# copy the contents of the local directory to /app/ on the image
ADD HelloMvc.tar /app/

RUN ls -l
# set the working directory for subsequent commands
WORKDIR app
RUN ls -l
# fetch the NuGet dependencies for our application
RUN kpm restore
# set the working directory for subsequent commands
# expose TCP port 5004 from container
EXPOSE 5004
# Configure the image as an executable
# When the image starts it will execute the “k web” command
# effectively starting our web application
# (listening on port 5004 by default)
ENTRYPOINT ["k", "kestrel"]

Once this is done the directory should look like this:

image

Build the Docker package

Now, from the root of the repo (./dockerAspNet/samples in my example) execute the following:

docker build -t myapp samples/HelloMvc

At this point, you should see Asp.NET and all the supporting dependencies fly by in the build interactive console. It will take a bit a time the first time as it will install the ‘microsoft/aspnet’ docker package too. Once that is done, future updates will be faster just for you’re package.

After a bit, you should see something like the following. 

SNAGHTML2041d3e

 

Startup the Container

Now we’re ready to start our MVC app on ASP.NET in our Docker Container on Linux!!!!

docker run -d -t -p 8080:5004 myapp

image

Navigate to your IP address of your Linux instance:

As Martha Stewart would say – “It’s a good thing…”

image

Posted: 11-23-2014 2:46 PM by cicorias | with no comments
Filed under: , , , ,
Useful Machine Learning and HDInsight / Hadoop Links Posts and Information

Updates:

  • Initial Post: 2014-11-17

As many ramp up on Microsoft Azure Machine Learning, I wanted to start keeping a succinct list of many of the articles, blogs, videos, posts, etc. that have shown to be helpful in conveying the essence of the general practice of Machine Learning as well as the implementation within Microsoft Azure.

Machine Learning Center

http://azure.microsoft.com/en-us/documentation/services/machine-learning/

R Programming

R for Beginners by Emmanuel Paradis

http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf

Introductory Statistics with R (Statistics and Computing), Peter Dalgaard

http://amzn.com/0387954759 

R Succinctly, Barton Poulson, Syncfusion
http://bit.ly/1pzxbJi

http://www.syncfusion.com/resources/techportal/ebookconfirm/rsuccinctly/sitevisitors%20-%20www.onlineprogrammingbooks.com

An Introduction to Statistical Learning, with Applications in R, Gareth James, Daniela Witten, Trevor Hastie and Robert Tibshirani

http://www-bcf.usc.edu/~gareth/ISL/

Papers

Analyzing Customer Churn using Microsoft Azure Machine Learning

http://azure.microsoft.com/en-us/documentation/articles/machine-learning-azure-ml-customer-churn-scenario/

Tutorials

Develop a predictive solution with Azure Machine Learning

http://azure.microsoft.com/en-us/documentation/articles/machine-learning-walkthrough-develop-predictive-solution/

Create a simple experiment in Azure Machine Learning Studio

http://azure.microsoft.com/en-us/documentation/articles/machine-learning-create-experiment/

Videos

Instructional Azure Machine Learning videos

http://azure.microsoft.com/en-us/documentation/videos/index/?services=machine-learning

Tools / Scripts

Creates a cluster with specified configuration.
DESCRIPTION
Creates a HDInsight cluster configured with one storage account and default metastores. If storage account or container are not specified they are created
automatically under the same name as the one provided for cluster. If ClusterSize is not specified it defaults to create small cluster with 2 nodes.
User is prompted for credentials to use to provision the cluster.

During the provisioning operation which usually takes around 15 minutes the script monitors status and reports when cluster is transitioning through the
provisioning states.

https://github.com/Azure/azure-sdk-tools-samples/blob/master/solutions/big-data/New-HDInsightCluster.ps1

Blog Posts

Benjamin Guinebertière (from Microsoft France) has a great blog that covers quite a few scenarios that many encounter when ramping and using Microsoft Azure Machine Learning

http://blogs.msdn.com/b/benjguin/

Azure Automation: What is running on my subscriptions - Benjamin Guinebertière

Remember you pay for what you use; ensure you keep track of these in-use clusters. In fact, the goal is to provision only when needed. Take a look at Kerrb for a commercial option to help you manage your spend: http://www.kerrb.com/

http://blogs.msdn.com/b/benjguin/archive/2014/07/24/azure-automation-what-is-running-on-my-subscriptions.aspx

Sample code: create an HDInsight cluster, run job, remove the cluster - Benjamin Guinebertière

Again, we want to keep our data in Blobs (or other persistence) then hydrate the cluster, process, save off our results, then kill the cluster.

http://blogs.msdn.com/b/benjguin/archive/2014/07/24/sample-code-create-an-hdinsight-cluster-run-job-remove-the-cluster.aspx

How to upload an R package to Azure Machine Learning - Benjamin Guinebertière

Adding R scripts and packages can be achieved through this method.

http://blogs.msdn.com/b/benjguin/archive/2014/09/24/how-to-upload-an-r-package-to-azure-machine-learning.aspx

How to retrieve R data visualization from Azure Machine Learning - Benjamin Guinebertière

R is a great point of extensibility. Here we see how to visualize the R output (images) that could be run as part of your R script.

http://blogs.msdn.com/b/benjguin/archive/2014/10/24/how-to-retrieve-r-data-visualization-from-azure-machine-learning.aspx

Carl Nolan’s blog is also a great resource – much more than just ramblings: http://blogs.msdn.com/b/carlnol/

Managing Your HDInsight Cluster using PowerShell – Update - Carl Nolan

http://blogs.msdn.com/b/carlnol/archive/2013/12/16/managing-your-hdinsight-cluster-using-powershell-update.aspx

Managing Your HDInsight Cluster and .Net Job Submissions using PowerShell - Carl Nolan

http://blogs.msdn.com/b/carlnol/archive/2013/12/02/managing-your-hdinsight-cluster-and-net-job-submissions.aspx

Hadoop .Net HDFS File Access – Carl Nolan

http://blogs.msdn.com/b/carlnol/archive/2013/02/08/hdinsight-net-hdfs-file-access.aspx

Books

There is a book on Azure ML due out this week (2014-11-19)

Predictive Analytics with Microsoft Azure Machine Learning: Build and Deploy Actionable Solutions in Minutes, Valentine Fontama, Roger Barga, Wee Hyong Tok, ISBN-13: 978-1484204467 ISBN-10: 1484204468 Edition: 1st

http://amzn.com/1484204468

FAQ

Microsoft Azure Machine Learning Frequently Asked Questions (FAQ)

http://azure.microsoft.com/en-us/documentation/articles/machine-learning-faq/

Pricing

Machine Learning Preview Pricing Details

http://azure.microsoft.com/en-us/pricing/details/machine-learning/

Data Factory

http://azure.microsoft.com/en-us/documentation/articles/data-factory-introduction/

SharePoint 2013 Fixing WCAG F38 Failure–Images without ALT tags–using a Control Adapter–Display Templates

The WCAG (Web Content Accessibility Guidelines) provide a baseline for accessibility standards so various tools, such as screen readers, can provide a reasonable experience for those with accessibility challenges.

With regards to images, the guideline provides that all Image tabs <img…> should probably (I say probably here for various reasons) have an ALT tag.

In the case of filler images, or “decorative” that isn’t representative of content, according to F38 here: They should have an empty ALT tag – thus ‘alt=””’.

F38: Failure of Success Criterion 1.1.1 due to not marking up decorative images in HTML in a way that allows assistive technology to ignore them

The above reference specifically states for validation:

Tests

Procedure

For any img element that is used for purely decorative content:

  1. Check whether the element has no role attribute or has a role attribute value that is not "presentation".

  2. Check whether the element has no alt attribute or has an alt attribute with a value that is not null.

Expected Results
  • If step #1 is true and if step #2 is true, this failure condition applies and content fails the Success Criterion.

 

How this Applies to SharePoint 2013

In SharePoint 2013, if using Display Templates, the generation of the master page is done by the Design Manager “parts”.

Inside of HTML version of the master pages, you will see the following:

    <body>
        <!--SPM:<SharePoint:ImageLink runat="server"  />-->

This will translate to just using the ImageLink SharePoint Web Control, and will emit the following:

        <div id="imgPrefetch" style="display:none">
<img src="/_layouts/15/images/favicon.ico?rev=23" />
<img src="/_layouts/15/images/spcommon.png?rev=23" />
<img src="/_layouts/15/images/spcommon.png?rev=23" />
<img src="/_layouts/15/images/siteIcon.png?rev=23" />

So, we need to “add” an alt=”” tag to this “block” of HTML.

To do this, we can utilize a ControlAdapter – which is a Web Forms based concept, that allows interception at Render time for the control. In the past, ControlAdapters were used in SharePoint 2007 to provide all the rewriting of HTML Tables to more CSS friendly versions – ultimately at the time to help with the WCAG needs.

ControlAdapter

ControlAdapter on MSDN

The main part of the control adapter to do this re-rendering is within the Render statement.  Below are the primary methods that will do this rendering and fixup of the IMG tags:

 

namespace ImageLinkControlAdapter.Code
{
    public class ImageLinkAdapter : ControlAdapter
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            /// First we get the control's planned HTML that is emmitted...
            using (StringWriter baseStringWriter = new StringWriter())
            using (HtmlTextWriter baseWriter = new HtmlTextWriter(baseStringWriter))
            {
                base.Render(baseWriter);
                baseWriter.Flush();
                baseWriter.Close();
                /// Now we have an HTML element...
                string baseHtml = baseStringWriter.ToString();
                /// now fixit up...
                writer.Write(RebuildImgTag(baseHtml));
            }
        }


        internal string RebuildImgTag(string existingTagHtml)
        {
            var pattern = @"<img\s[^>]*>";
            var rv = Regex.Replace(existingTagHtml, pattern, this.InsertAlt);
            
            return rv;

        }

        internal string InsertAlt(Match match)
        {
            return this.InsertAlt(match.ToString());
        }

        internal string InsertAlt(string existingTag)
        {
            if (!existingTag.StartsWith("<img", StringComparison.InvariantCultureIgnoreCase))
                return existingTag;

            if (existingTag.Contains("alt=", StringComparison.InvariantCultureIgnoreCase))
                return existingTag;

            var insertPoint = existingTag.IndexOf("/>");
            var rv = existingTag.Insert(insertPoint, "alt=\"\"");
            return rv;
        }

    }

    internal static class StringExtensions
    {
        public static bool Contains(this string source, string toCheck, StringComparison comp)
        {
            return source.IndexOf(toCheck, comp) >= 0;
        }
    }

 

Finally, the full Visual Studio 2013 Solution and source is located here:

https://github.com/cicorias/SharePoint-ImageLink-WCAG-Control-Adapter

As a bonus, there’s a Feature Receiver that will deploy the *.browser file to the Web Application’s App_Browsers directory as well.

 

Links

http://www.w3.org/WAI/intro/wcag

https://github.com/cicorias/SharePoint-ImageLink-WCAG-Control-Adapter

Why you should never say “Turn ON Intranet Settings” in Internet Explorer IE

I recently checked into a hotel – connected to their guest wireless – and I start noticing odd things with some websites.

UPDATE: corrected title to conform to the message – thanks Mark…

If you’ve ever seen the following:

NEVER say “Turn on Intranet Settings”.

In my case, the hotel’s wireless (specifically their DHCP server) was returning a WPAD (Browser Proxy Autoconfiguration) with the following:

function FindProxyForURL(url, host)
{
  return "DIRECT";
}

Which for IE that means ALL sites will be mapped to the Intranet Zone automatically IF you’ve “Turned ON Intranet Settings”.  This is bad, bad, bad.

That means IE runs in Unprotected Mode for ALL internet sites.

If you have responded “incorrectly” – then you can reset it to auto as follows:

image

Finally, if you want to see the message where IE WOULD HAVE mapped the zone to Intranet you can turn back on the warning via regedit:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"WarnOnIntranet"=dword:00000001

See http://blogs.msdn.com/b/ieinternals/archive/2012/06/05/the-local-intranet-security-zone.aspx  for more information

Getting Docker Running on Hyper-V 8.1/ 2012 R2

Running Docker locally on a Windows machine is generally not an issue; unless you've committed to using Hyper-V. Since the Docker install for Windows relies on Sun's Oracle's Virtual Box, you can't have both running (Hyper-V and Virtual Box).

There are ways to disable Hyper-V for a boot session (via bcdedit for example – here). However, I'd just like to run in Hyper-V.

Thankfully, Chris Swan has a nice post on getting started, using the Boot2Docker ISO, and setting up the data disk (via a differencing disks) so you can just re-use this config in future Docker instances. You can also see some of the details on the boot2docker requirements for naming of the data disk, username and password for SSH, etc. here:

Basic Steps

Download ISO – from github https://github.com/steeve/boot2docker/releases

Create the VM and just use the ISO for bootup – we'll add the disk in a moment

We'll create the VM as a Generation 1 – we need the legacy adapters etc. as the version of CoreOS used won't recognize the other adapter types.

Simple Settings:

Memory Size: 1,204 MB

Network Connection: Choose an interface that has Internet access and DHCP assignable addresses for ease:

 

Next, postpone the setup of the Hard Disk as we're going to setup a differencing disk and we'd like some control over the IDE adapter / Port to use.

 

 

Once you're done with the 'New Virtual Machine' Wizard, hop into settings for the VM

Modify the DVD settings to point to the ISO image that you downloaded above:

Boot the VM for the First Time

All goes right, you should see in the VM console the 'bootdocker' loader information, and eventually the linux prompt

Start a SSH session with your VM (if desired)

To get the IP address of the VM, run ifconfig eth0 to see the default adapter. You should get an address that is hopefully on the Network interface/LAN that you chose. This has to be accessible from your host OS if you want to use SSH – in fact, it also needs access to the internet in order to get to the Docker HUB for downloading images.

 

I use "github" Windows tools (which in turn sets up the 'poshgit' tools, etc.) so I can just run a SSH session from PowerShell. https://windows.github.com/

Initiate the connection normally with SSH

ssh docker@<IP.address>

Note that the default username / password is : docker / tcuser - see the section on SSH at https://github.com/boot2docker/boot2docker for more information.

Setup the Virtual Disk

Shutdown the VM.

The next step is following what Chris Swan did in his post – which is to setup the VHD – run through the initialization, then make a differencing disk based off of that VHD, then swap out the configuration settings on the VM to use the Differencing disk instead of the base.

Boot the VM again

Once it's started, choose SSH or the console to perform the disk preparation

Partition the drive

The steps below are slightly different than Chris' post – but are:

  1. Dump out the partition table just to be sure
    1. cat /proc/partions (if you chose IDE 0 / PORT 0 then it should be /dev/sda)
  2. run fdisk
    1. sudo fdisk /dev/sda
  3. Choose 'extended'
  4. Select partition '1'
  5. Choose the defaults for the first and last cylinder
  6. Once that is done, commit with the 'w' command

Setup the file system

The naming convention of the disk is also specified on the boot2docker github page – but it has to be 'boot2docker-data'

Next, format the drive with:

sudo mkfs.ext4 -L boot2docker-data /dev/sda

 

Note that you will be warned about formatting the entire device, and not a partition. For now, I just went with the above.

Create the Differencing Disk

Shut down the VM again

Go back into the Virtual Machine Wizard. Select the settings for the VM, then go to the Disk settings and create a "New Virtual Disk".

Make sure when prompted, you choose the "base" image you created before, but when you're done, your "Differencing" disk should be what's listed in the Hard Disk path for the Controller/Location as below.

Boot the VM – 3rd time

I think it's the 3rd time – don't remember at this point…

Now we're ready to "run" something. We'll use the same image that Chris posted about, just because it's a cool tool (Node-RED - http://nodered.org/)

Access the image either through the console or via SSH

Do a 'docker run' specifying to download the image if needed (-d) as it's won't be in the image local library.

docker run –d –p 1880:1880 cpswan/node-red

 

If all is working, then you should see the image and all it's dependencies downloading – with the container – and at the end, docker launches the process.

Checkout if the Differencing disk is working

The "before" size

The "after" size – note the increase of the Differencing disl.

Launch the Application

Note that the port mapping is using the same port 1880 (Nat'd).

You should get the 'Node-Red' home page, which is the designer surface.

I quickly imported a simple "hello world" from the flows http://flows.nodered.org/flow/8069baf59dcb258bb2bd

 

 

Issues with OneDrive for business and Document Cache–Don’t mix C2R and MSI installs

With the latest updates to Office, an issue that rears it’s ugly head if you’ve mixed both C2R and MSI installs of any Office product (2013).  That means Office, Visio, Project, SharePoint designer, and OneDrive for Business Sync Client.

 

If you get into this mess, try to uninstall all the C2R or MSI – then get them all consistent;

 

#1 – can’t mix click-to-run and MSI installs on the same machine:

If any are mixed, you need to uninstall.

To start fresh:

1. Run http://support.microsoft.com/kb/2739501

a. Both MSI then C2R

2. Run ROIScan to ensure nothing is left:

a. http://gallery.technet.microsoft.com/office/68b80aba-130d-4ad4-aa45-832b1ee49602

3. Once you’re all clean:

a. C2R

i. Use the https://portal.office.com/OLS/MySoftware.aspx

ii. SharePoint designer is under “Tools”

iii. Visio is there if your org has a license..

b. MSI

i. Get them all in FULL downloads from MSDN, or wherever you obtain your installs from

# for internal, step #1 – in toolbox there is OffScrub

SharePoint 2013 Farm in Less than an Hour–New Azure Portal and Azure Templates

Soon, you’ll be able to author your own templates, but as of today, you can provision an 3 Machine SharePoint 2013 Farm – have it running in less than 1 hour with just a few clicks.

For details take a look here:

SharePoint Server Farm at http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-sharepoint-farm-azure-preview/
SharePoint Server Farm Configuration Details at http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-sharepoint-farm-config-azure-preview/

Now, for some fun…

First, navigate to the new portal at http://portal.azure.com

Once there, choose “New”.

There you’ll get the new experience for Template based provisioning.  Click on “Show Everything” to see the full Gallery of Microsoft and non-Microsoft templates.

image

After choosing a SP Farm, you set a few global settings, or you can choose to modify the template choices, like Machine size (A5 vs. A4, etc.).  Even account names, etc.

I chose the easy route.

image

 

After a bit, and if you chose to “Add to Start Board” you’ll see your farm provisioning notifications, and eventually your finished Farm Tile.

image

 

image

The following shows the individual VM status (I shut mine down to save some $).  But easy enough to restart when I need it.

Remember, that while it’s COLD you only pay for the actual non-zero’s bits in the Page Blobs for the VHD storage. So, a 60 GB disk really only may be using 5 GB etc.

image

Posted: 07-14-2014 6:31 AM by cicorias | with no comments
Filed under: ,
Disabling HyperV on Surface Pro 3 So Connected Standby will work or not work–depending on your mood

If you’re received your SP3 and you enabled HyperV you may have noticed that Connected Standby (new to x64) will then be disabled.

You’ll get this is you install Visual Studio 2013 with the Windows Phone emulator support in VS2013.

First step is to give you an option to “boot” or “restart” Windows in a mode with HyperV on or off so connected standby will “not work” or “work” (opposite of HyperV setting").

Set HyperV as Default

C:\WINDOWS\system32>Bcdedit /copy {default} /d "HyperVisor Off"
The entry was successfully copied to {22393409-9568-11e2-be59-3c970e7cc5fa}.

C:\WINDOWS\system32>bcdedit /set {22393409-9568-11e2-be59-3c970e7cc5fa} hypervisorlaunchtype off
The operation completed successfully.

Courtesy of Scott Hanselman – an easy UI way to restart your machine in your Choice.

http://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx

In order to access the new boot menu, I select Settings (Windows Key + C) then Power, and Restart but hold down shift on the keyboard while clicking Restart with the mouse.

Note that the “Other Operating System” will be the one that just got copied.

Comparing Hash of downloaded Files with PowerShell

I can’t claim 99% of this – main credit to : http://www.tinyint.com/index.php/2011/09/14/get-an-md5-or-sha1-checksum-with-powershell/

Param (
        [string]$File=$(throw("You must specify a filename to get the checksum of.")),
        [string]$ProvidedHash,
        [ValidateSet("sha1","md5")]
        [string]$Algorithm=("sha1")
        
)

function Get-Checksum
{
    Param (
        [string]$File=$(throw("You must specify a filename to get the checksum of.")),
        [ValidateSet("sha1","md5")]
        [string]$Algorithm=("sha1")
        
    )

    $fs = new-object System.IO.FileStream $File, “Open”, “Read”, “Read”;
    $algo = [type]"System.Security.Cryptography.$Algorithm"
	$crypto = $algo::Create()
    $hash = [BitConverter]::ToString($crypto.ComputeHash($fs)).Replace("-", "")
    $fs.Close()
    return $hash
}

$calchash = Get-Checksum $File $Algorithm $ProvidedHash

if ( $calchash -eq $ProvidedHash ) {
    Write-Host "hash match" -ForegroundColor Green;
}
else {
    Write-Host "hash doesn't match" -ForegroundColor Red
    write-host "Provided:" $ProvidedHash "Calculated: " $calchash
}
WOPI Host Sample has been updated…

The solution and project have been updated to MVC5, and Web API 2.  In addition, editing PowerPoint (PPTX), and Excel files has been added.  Word Editing is not part of the solution. Also, PDF viewing is enabled.

The latest Solution and information is up on Code.MSDN:

http://code.msdn.microsoft.com/Building-an-Office-Web-f98650d6

And also here: http://cicoria.com/downloads/CL-OwaWopiNetFx45MVC520140131.zip 

The old post is here:

http://cicoria.com/cs1/blogs/cedarlogic/archive/2013/07/22/building-an-office-web-apps-owa-wopi-host.aspx

Fiddler and Direct Access

Fiddler puts some stuff in the registry that breaks Direct Access.

The following will cleanup after Fiddler runs

reg delete HKLM\SYSTEM\CurrentControlSet\Services\iphlpsvc\Parameters\ProxyMgr /va /f

Updating email address for SharePoint online users if they’re a Live / Microsoft Account…

If you have a SharePoint online ()365) site, and you invite users that logon with a “Microsoft Account”, those users won’t be able to receive email.  Things such as alerts won’t work.

However, you can run the code below and it will parse out all users that are “invitees” and part of the Microsoft account structure (Live.com) and just update their email, based upon what their Microsoft Account email address is.

Note: use this at your own risk.  This makes use of logon via Forms/Claims that is part of the solution here:

Remote Authentication in SharePoint Online Using the Client Object Model

http://code.msdn.microsoft.com/Remote-Authentication-in-b7b6f43c

Full solution is here: Solution

namespace ConsoleApplication1
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            if (args.Length < 1) { Console.WriteLine("SP_Ctx <url>"); return; }
            string targetSite = args[0];
            using (ClientContext ctx = ClaimClientContext.GetAuthenticatedContext(targetSite))
            {
                if (ctx != null)
                {
                    ctx.Load(ctx.Web,
                        website => website.SiteUsers,
                        website => website.SiteUserInfoList); // Query for Web

                    ctx.ExecuteQuery(); // Execute
                    ListSiteUsers(ctx);
                }
            }
            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }

        static void ListSiteUsers(ClientContext ctx)
        {
            var users = ctx.Web.SiteUsers.AsQueryable();

            foreach (var user in users)
            {
                ctx.Load(user, u => u.UserId);
                ctx.ExecuteQuery();
                if (user.UserId == null)
                {
                    string[] parts = user.LoginName.Split('|');
                    if (parts.Length == 3 && parts[1].Equals("membership", StringComparison.InvariantCultureIgnoreCase))
                        UpdateUser(ctx, user, parts[2]);
                }

            }
        }

        static void UpdateUser(ClientContext ctx, User user, string liveId)
        {
            string[] parts = liveId.Split('#');

            var email = parts[1];

            Console.WriteLine("user: {0}  email: {1}", user.LoginName, email);
            var userToUpdate = ctx.Web.SiteUsers.GetByLoginName(user.LoginName);
            user.Context.ExecuteQuery();
            if (null != userToUpdate)
            {
                userToUpdate.Email = email;
                userToUpdate.Update();
                ctx.ExecuteQuery();
            }
            else
                Console.WriteLine("User was null: {0}", user.LoginName);
        }

    }
}
Why it doesn’t take an army to build a usable web site…

We should hopefully learn a lesson from how http://healthcare.gov was build vs. http://www.thehealthsherpa.com/

http://www.ihealthbeat.org/articles/2013/11/12/sf-programmers-build-bare-bones-federal-exchange-site-alternative

For too long, the idea of throwing commodity developers and large quantities of them at a problem has some believing that you can achieve good quality and results faster and better. Far from the truth. Building software is still a craft. It takes commitment, experience, and trial and error. And lots of practice.

More Posts Next page »