.Net System.DateTime.Ticks has 10,000,000 ticks per second and starts from 0:00:00 UTC on 1 January 0001, in the Gregorian calendar. To get this number in SQL is quite complex but here is a shortcut:
This select statement calculates the .Net ticks in SQL and is accurate to the nearest second.
This is how I constructed the formula, first I got the ticks up to 2000 from powershell as follows:
Then I calculate the difference in seconds since 2000 and the current date and multiply the number of seconds with 10 million to get it into ticks.
Windows sometimes restart even when there is a user logged in. This can be remedied with the following registry edits. The attached file contains these edits.
Powershell has a few complications when finding the path where the current script is executing. Especially if you are running it from ISE or directly on the shell. This function helps to get the most reliable path.
The command to create a new self signed certificate is as follows:
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname customer1-test.cloudapp.net
PowerShell doesn't automatically offer to trust a remote server as many SSH clients does instead you have to go through a number of manual steps to be able to connect to an Azure remote server. After configuring your VM in Azure, its powershell will be configured with a self signed cerificate for the external Azure URL. To be able to connect to this with PowerShell remoting, you must install the certificate into the local computer's trusted root certificates store.
You can see which certificates is conneted on your computer using:
netsh http show sslcert
Here's a script which extracts a certificate from a port, save it as a file called DownloadCertAndImportRoot.ps1 on and then attempts to import it into the certificate store.
#Import the certificate into the root certificate store
You can use Chrome or Firefox to download the certificate and then user Windows Explorer or MMC to import it into the certificate store. This only works if you are not using any insecure ports which will be blocked by these browsers...
Open PowerShell and run the following command to confirm that it is failing:
Test-WsMan -Port 5986 -UseSSL YourServerUrl.cloudapp.net
You should get an error stating:
The SSL certificate is signed by an unknown certificate authority.
Now open the server url in chorme:
Access and download the certificate to your local disk.
Right-click the certificate and install it into the trusted root store.
Try the PowerShell command again, it should work now.
I wanted incremental build numbers from VisualStudio online when automatically building and deploying to Google play store.
The build process file creates the buildnumber in the first line:
The $(Rev:xxx) defines the build number. When a build is completed, if nothing else in the build number has changed, the Rev integer value is incremented by one.
Although I could not find any documentation, it seems the Rev number has the following format:
rr formats it like ## so:
$(Rev:.r) is formatted as .1
$(Rev:.rr) is formatted as .01
$(Rev:rr) is formatted as 01
Warning: This trips the Knox warranty void flag.
Download and extract the following files:
Power off your Android device.
Put the Galaxy Note Pro 12.2 LTE SM-P905 in Download Mode by pressing and holding down the Home, Volume Down buttons while pressing the Power button. A warning screen will come up; press Volume Up button to enter Download Mode. If you get a recovery menu instead, check that you are pressing the volume down button and not the volume up button.
Run Odin3 v3.09.exe as an Administrator because Admin privileges is required to complete the process smoothly
Connect your device to your PC using USB cable. You will see an “Added!!” massage in Odin’s message box.
Click the AP Button, and select that CF-Auto-Root-viennalte-viennaltexx-smp905.tar.md5 file
In Odin window, ensure only Auto Reboot and F. Reset Time checkboxes are selected.
Double check everything in Step 8 & 9 above. When satisfied click the START button to begin the flashing process.
Your device will restart and it is complete when you see a PASS message with green background in the left-most box at the very top of the Odin. You can now unplug the USB cable to disconnect your device from computer.
If it worked, go to http://www.chainfire.eu/ and make a big donation for their work.
This VBA script will save the text from one column (O) into a file for which the name is taken from column (K).
Surprisingly this method, which opens and closes a file for each row of the sheet is much faster than the method I describe here, which tells Excel to save sheets to file as csv. I presume the overhead is due to Excel having to serialise the sheets to CSV format.
Today I wanted to save every sheet in an Excel workbook as a CSV file, the headings of each sheet is removed first.I got help from the following sources:
Here's the code:
Today I wanted to copy the values from every sheet in one workbook into a new workbook with only the values. Here is what worked for me eventually:
The purpose of this is to save every sheet in a workbook as a CSV file.
The URLs where I found advice were in no order of preference:
1-10 of 33