Outlook stuck with ‘Processing’?

Outlook 2016 has an all to frequent problem where it gets stuck on the splash screen saying, ‘processing’. The simplest solution is to stop outlook and Start->Run; Outlook /safe

Then after it starts, close it down and reopen and it should be fine. Seriously…I know.

 

Quick way to drop all tables and schema from SQL Server

I was about to leap into sp_foreach or even uglier SQL Execute when I discovered that you can right-click on the database->generate scripts. Then in the advanced options you can select DROP only. Easy.

 

Waiting for async delegate

Sometimes you want to create a task that you want to start as async but you want to track its status at a later date. The problem is that a task created this way will appear to have completed, and you’ll never know if it faulted or not. One solution is use a Func and  Unwrap the resulting task.


t = Task.Factory.StartNew(new Func(async () =>

{

while (true)

{

await Task.Delay(1000);

throw new ArgumentNullException();

}

value = 1;

})).Unwrap();

Edit – Whilst the above does have its uses, it’s better to use;

t = Task.Run(async () =>

Task.Run accepts Func and does the unwrapping for you.

The fastest way to get a table row count in SQL Server

While variations on select (xyz) from table all work, they all suffer from searching/scanning data and the overheads that incurs. The best mechanism I have found is;

EXEC sp_spaceused N'<schema>.<table name>’;

 

Remote desktop to a Service Fabric Node

Another in my series of, “oh how do you do that again?”

  1. Grab your Service Fabric (SF) address; e.g. http://mydomain.northeurope.cloudapp.azure.com
  2. Open the explorer and find the node that contains the service you want to examine
  3. Open Remote Desktop and use the address from (1) but, now for the easy to forget bit, use the port number of 3389 + the node Id. E.g. for node 2, 3391
  4. Use the Admin user name/password you used to create the SF in the first place and you should be now be on that machine

Setting the default Connection Limit

Every time I want to set this I can never remember what it’s called, so I’m posting it.

ServicePointManager.DefaultConnectionLimit

Powershell telnet alternative

Just a quick note that you can use a Powershell cmdlet to test a network connection;

Test-NetConnection -ComputerName <name> -Port <port>

 

The mystery of when to add that extra property path junk

This is a note post since I know I will want to come back to this again;

From: http://stackoverflow.com/questions/4640573/round-brackets-in-xaml-syntax

The parentheses indicate that this property in a PropertyPath should be constructed using a partial qualification. It can use an XML namespace to find the type with an appropriate mapping. The ownerType searches types that a XAML processor has access to, through the XmlnsDefinitionAttribute declarations in each assembly. Most applications have the default XML namespace mapped to the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace, so a prefix is usually only necessary for custom types or types otherwise outside that namespace. propertyName must resolve to be the name of a property existing on the ownerType. This syntax is generally used for one of the following cases:

  • The path is specified in XAML that is in a style or template that does not have a specified Target Type. A qualified usage is generally not valid for cases other than this, because in non-style, non-template cases, the property exists on an instance, not a type.
  • The property is an attached property.
  • You are binding to a static property.

 

 

Trick to see if you have a soft Steering Wheel in use

I’m sure there are some people that love the soft Steering Wheel. But sometimes, very rarely, they cause a problem when you are trying to arrange your page. One little trick you could use is to utilize the fact that the Bottom App Bar will be pushed up the screen to make room for the Steering Wheel. If we can compare the top position of the App Bar then we can assume that the Steering Wheel is in play;

GeneralTransform bottomAppBarTransform = this.TransformToVisual(this.BottomCommandBar);

Point appBarPosition = bottomAppBarTransform.TransformPoint(new Point(0, 0));

var pageHeight = this.ActualHeight;
var appbarHeight = this.BottomCommandBar.ActualHeight;

if (pageHeight - Math.Abs(appBarPosition.Y) > appbarHeight)
{
      // Hello Steering Wheel
}

Hopefully someone out there will reply with a, “no just use this simple API”. That would be nice.

The data area passed to a system call is too small

Got caught out with this nice error today; The data area passed to a system call is too small

I was creating a file and writing some text to it. The problem was that although the file was writing to disk correctly I couldn’t write any contents to it. Turns out it was because the full path file length was 256. Given that as soon as you write to iso store the path has already consumed ~100 chars you have to be really tight with your allowed app-relative paths. Should also be filed under, ‘why OS, why only 256!’