My random rumblings

Something of everything and nothing at all

Count the number of rows in tables

declare @t table(id int primary key identity(1, 1), sql nvarchar(512), count int)
insert into @t(sql) select 'select @cOut = count(*) from [' + name + ']' from sys.tables
declare @i int = (select max(id) from @t)
while @i > 0
begin
 declare @s nvarchar(512) = (select sql from @t where id = @i)
 declare @c int
 exec sp_executeSQL @s, N'@cOut int output', @cOut = @c output
 update @t set count = @c where id = @i
 set @i = @i - 1
end
select * from @t

Robust Copy Example

robocopy "\\tsclient\C\Work\tmp\" C:\Deploy\Tools\ Debug.zip /z /ipg:25 /w:5

robocopy <source dir> <desitination dir> <files>
ipg: inter-packet gap - free bandwidth on slow lines
w: retry time out

Creating CPU usage

I have created the following PowerShell script to simulate a server using CPU

while(1 -eq 1) {for($i=0; $i -lt 5000; $i++) {} [System.Threading.Thread]::Sleep(1)}

Word Styles

Word References styles are stored in the following locations and are used in order from first:
  1. C:\users\<username>\AppData\Roaming\Microsoft\Bibliography
  2. C:\Program Files\Microsoft Office\Office 16\Bibliography
I suspect when the styles are copied to C:\Program Files\Microsoft Office\Office 16\Bibliography it is copied to the users folder.

Visio search stopped working

I have tried the following without knowing which resolved the issue.
  1. Deleted all the files C:\Users\<Current User>\Documents\My Shapes
  2. Removed the index and added the index again on the file in C:\Program Files\Microsoft Office\Office16\Visio Content\1033

Git throug visual studio

In the command line editor execute the following command

git config --global http.proxy http://username%40domain:password@proxyhost:port

Proverb

“From those whom we trust, comes a great caution” An Arabic proverb

Windows Time

The time of a Windows computer can be updated from time servers on the Internet as follow:

w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org" /syncfromflags:manual /reliable:yes /update