Dec 18, 2017

Problems with Azure Data Factory Samba File System sink

I recently had some trouble using a Linux system as a sink in Azure Data Factory.  The Samba destination was on a Linux server in a different domain than the Windows server.

I had tricked the Copy Wizard into using a simple username without domain by adding a local user with the same username as the Samba user.  But although the Copy Wizard could browse the destination folders, when the pipeline started copying an error was thrown "A specified logon session does not exist. It may already have been terminated".

The fix was to create the LinkedService via the JSON file with the Samba server IP as the username domain:


{
    "name": "Destination-File-SambaFileSystem",
    "properties": {
        "hubName": "mydatafactory_hub",
        "type": "OnPremisesFileServer",
        "typeProperties": {
            "host": "\\\\10.25.64.11\\datadir",
            "gatewayName": "IntegrationRuntime-SambaGateway",
            "userId": "10.25.64.11\\sambauser",
            "password": "aPlaintextPassword"
        }
    }
}


Error opening workflows with SharePoint Designer 2013

If you get either of these errors opening a workflow in SharePoint Designer 2013:

"Windows Workflow Foundation, part of .NET Framework 3.0, must be installed to use this feature" or "Server-side activities have been updated. You need to restart SPD to use the updated version of activities"

The solution:

  1. Update your SharePoint Designer to SP1.
  2. Install the Visual Studio 2005 Extensions for .NET Framework 3.0 WWF (only available on CNET):  http://download.cnet.com/Visual-Studio-2005-Extensions-for-NET-Framework-3-0-Windows-Workflow-Foundation/3000-2383_4-75452399.html
  3. Copy all files from a known working SharePoint Designer installation folder: C:\Users\MYUSER\AppData\Local\Microsoft\WebsiteCache\MYSITE\15.0.0.4963 to the same folder on the broken SPD installation.
  4. Restart SharePoint Designer

Jun 28, 2017

How to get started using a hand plane for beginners

I love power tools because I don't have a lot of time to spend in the shop on my projects.  But I've never been satisfied with how my hand-held power planer left hard-to-remove lines in my surfaces.  So I decided to try hand planing because the woodworking masters swear by it.

Day 1:  bad, mostly due to inexperience.  I had blisters, had barely flattened any surfaces and couldn't imagine finishing all the other oak faces of my table with a hand plane.  I considered trying to plane with my table saw but it didn't sound like a good idea.

Day 2:  immensely better after several changes to my tools and technique and actually enjoyable as the hand plane quickly planed down pieces that seemed impossible the day before.


Here's how to get started for absolute newbies like myself.

Step 1: Buy a Stanley Nº 4 Bench plane or similar (about 2 inches wide and 10 inches long) with a single blade that can be sharpened.  And a sharpening stone and contraption to hold the blade close to 30º.

Step 2:  Prepare your outfit.  Put on shoes with good grip because all torso-powered movements need a stable leg base.  Maybe gloves to avoid blisters and getting (less) sweat on your workpiece.

Step 3: Prepare your workspace.  Your workpiece cannot move while you're planing.  If you don't have a heavy, stable workbench, butt the workpiece against a wall with a protective cloth and put cement blocks or sacks against the legs of your lightweight worktable.

Step 4:  Sharpen your plane blade to katana level.  Even if your plane is brand new, the blade is probably not sharp enough for working due to several reasons (transport, insurance, legal).  Disassemble your plane completely to get the blade out and test its sharpness against a piece of paper or thin plastic sheet.  If it doesn't slice with a very light touch, it's not sharp enough.  Basically, if it can't go through paper, there's no way it's going through solid wood.

Spend five minutes sharpening your blade, trying various techniques.  When your blade can slice through your test sheet like butter, you're ready.  Resharpen after every hour or two hours of planing.

Step 5: Wax the bottom of the plane.  Using ski wax or another gliding wax (not sticky surf wax), lightly wax the bottom of the plane.

Step 6:  Start planing.  Adjust the plane blade until it just grazes the wood and then turn it a bit more until it pulls out nice carvings.  Notice how smooth your plane is after a fresh sharpening and waxing.  It should always be like this.

Step 7:  Try planing in different directions (with grain, against grain, cross grain, diagonally) to understand how the plane and wood react.

Enjoy your new tool and skill!

Aug 30, 2016

CORS with IIS

I've struggled quite a bit to get CORS working with an .NET web application hosted by IIS, but finally got it working with Windows authentication.

Here are the necessary requirements:

  1. The application pool must be running in Integrated mode, not Classic mode.
  2. You have to add a simple  HTTP module to your web service C# code to respond to the OPTIONS call without authentication: 
  3. public class CORSModule : IHttpModule
    {
        public void Dispose() { }
     
        public void Init(HttpApplication context)
        {
            context.PreSendRequestHeaders += delegate
            {
                if (context.Request.HttpMethod == "OPTIONS")
                {
                    var response = context.Response;
                    response.StatusCode = (int)HttpStatusCode.OK;
                }
            };
        }
    }
     
  4. You need to add these Header lines to the web.config:
  5. <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     <system.webServer>
      <httpProtocol>
         <customHeaders>
            <add name="Access-Control-Allow-Origin" value="https://myserver" />
            <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
            <add name="Access-Control-Allow-Headers" value="Accept,Authorization,Content-Type,SOAPAction,X-RequestDigest" />
     <add name="Access-Control-Request-Headers" value="Content-Type,Authorization,Accept,SOAPAction,X-Requested-With" />
            <add name="Access-Control-Allow-Credentials" value="true" />
          </customHeaders>
        </httpProtocol>
      <modules>
        <add name="CORSModule" type="CORSModule" />
      </modules>
      </system.webServer>
    </configuration>
    </configuration>
     
  6. You need to add the "WithCredentials: true" to your JavaScript Ajax call to pass the Windows credentials if you're using Windows authentication.

Jun 17, 2016

SharePoint BCS: External content type not available for creating External List

I recently created a simple external content type for a WCF service in SharePoint 2013, but though I could create an external column that worked perfectly, the type was not available as an external list.

My problem was that I had added a PageNumber filter for the Finder (Read list items operation) to limit the items returned and activate pagination.

It seems External Lists do not support this and upon removing the filter from the operation, my content type was now available. This does work for SQL based external types.

Jan 25, 2016

Azure web app won't download my file because of the mimetype

If you have a non-standard file without a common mimetype (eg. dwg files for AutoCAD), Azure Web App sites won't serve them and instead give a 404 error.

This is a policy decision dating back to IIS 6.0.

The fix is simply adding the unknown mimetype to the web.config for the Azure Web App: https://www.iis.net/configreference/system.webserver/staticcontent/mimemap

For example:

<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".dwg" mimeType="application/acad" />
      </staticContent>
   </system.webServer>
</configuration>
 

Broken connection between Jetpack and Wordpress.com

I had a problem with another blog I maintain in a hosted WordPress installation that uses the Jetpack plugin for statistics and other services.  Upon upgrading some modules, the Jetpack plugin lost the connection to Wordpress.com and restoring the database didn't help.  I didn't know the username or email associated with the WordPress.com account and panic began to set in.

In desperation, I contacted Wordpress support and they informed me that I could simply create a new Wordpress.com account and if I connect it to the same domain, all the site information would be maintained, as all data is stored with the domain identity.

It worked like a charm!  Phew!!