Html, CSS finally come of age?

Attended a really inspirational talk, perhaps HTML/CSS will now be about design rather than weighed down by JavaScript libraries and polyfills?

Jen Simmons CSS Grid

 

SQL Server with external drives – pending recovery

When you are developing a SQL Server database you might want to use External Storage devices. Beware of a couple of slight gotchas. When you restart your machine SQL Server may start before the drives become available. If this happens SQL Server will mark the database as ‘pending recovery’. To get out of this situation just restart the SQL Server instance and select ‘refresh’ the database node in SQL Management Studio. A second, related problem, is that the drives may not be assigned the same drive letter, this will again result in ‘pending recovery’. If you cannot remember the drive letter you assigned you can run the following against the system database;

select [name], physical_name from sys.master_files

If you now have an incorrectly assigned drive letter, the best solution is to open the disk management tool where you can right-click and assign the original drive letter back.

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>