Posts

Solution: Display rotation stuck in windows and ctrl+alt+up key does not work (windows 10)

Problem : I accidentially pressed ctrl+alt+right key and my display rotation shifted 90 degrees. When I open Intel HD Graphics Control Panel (that caused this mess) to clear it, it says that it's in 0 degrees rotation mode, so I cannot change back. Pressing ctrl+alt+up key does not work either. Solution : Press start button or windows key, type display and enter windows own display settings. From here you can set your display back to landscape mode. Don't forget to disable hotkeys in Intel HD Graphics Control Panel.

Set gmail as default e-mail handler for mailto-links (Short answer)

Open Chrome Open Gmail in a tab Paste the following in the address bar of that tab javascript:navigator.registerProtocolHandler("mailto","https://mail.google.com/mail/?extsrc=mailto&url=%s","Gmail"); Click Allow

How capture screen on Samsung Galaxy S5 (short answer)

Press home button and power button at the same time and keep them pressed until you get sound/visual feedback.

How to benchmark my t-sql directly using dmv dm_exec_sessions

Tested on Sql Azure 11.0.9206.32 /* Get actual reads, writes and other nice to know stuff for benchmarking. Notice go statements which are crucial since stats seem to update by batch. */   go if   object_id ( 'tempdb..#stats' )   is   not   null   drop   table   #stats  select   getdate ( )   as   startTime , cpu_time , memory_usage , reads , writes , logical_reads , session_id   into   #stats   from   sys . dm_exec_sessions   a   where   session_id = @@spid go --do your magic stuff that need tuning go select      datediff ( ms , s2 . startTime , getdate ( ) )   as   ElapsedMs ,      s1 . cpu_time - s2 . cpu_time   as   cpu_time ,      s1 . memory_usage - s2 . memory_usage  ...

HierarchyId quick fun

--drop table dbo.Earth create   table   dbo . Earth    (      Id   hierarchyid   not   null ,      Path   as   Id . ToString ( ) ,      Data   varchar ( 500 ) ,      primary   key   clustered   ( id ) ) insert   dbo . Earth   ( id , data ) values    ( '/1/1/1/1/' , 'Monkey' ) ,    ( '/1/1/1/2/' , 'Horsey' ) ,    ( '/1/1/1/3/' , 'Piglet' ) ,    ( '/1/1/1/' , 'Mammal' ) ,    ( '/1/1/' , 'Animal' ) ,    ( '/1/1/2/' , 'Insect' ) ,    ( '/1/1/2/14/' , 'Ant' ) ,    ( '/1/2/' , 'Plant' ) ,    ( '/1/2/1/' , 'Tree' ) ,    ( '/1/2/1/1/' , 'Birch' ) ,    ( '/1/2/1/2/' , 'Oak' ) ,    ( '/1/' , 'Living stuff' ) ,    ( '/2/' , 'Moving stuff' ) ,    ( '/2/1/' , 'Cars' ) ,    ( ...

Zip all files in folder individually

This script will remove items after being zipped. Filename is appended .zip Create two files from code templates below then edit and execute zipfiles.cmd zipfiles.ps1 [CmdletBinding()] Param( [Parameter(Mandatory=$True,Position=1)] [string]$sourceFolderPath, [Parameter(Mandatory=$True,Position=2)] [string]$filePattern, [Parameter(Mandatory=$True,Position=3)] [string]$7zipExe ) $sourceFilePattern= $sourceFolderPath +"\" + $filepattern $files=get-childItem $sourceFilePattern $ErrorActionPreference = "Stop" if ($files) { foreach ($file in $files) { $zipFileName=$file.fullname+".zip" $programArgs = "a", "-tzip", $zipFileName , $file.fullname write-host $programArgs Invoke-Command -ScriptBlock { & $7zipExe $programArgs } remove-item $file } } zipfiles.cmd powershell -file .\zipfiles.ps1 "c:\FolderWithFiles\ManyTextFiles" "*.txt" "c:\progr...

Vital settings for Microsoft Office if you're a developer or technician

Microsoft Office (including Visio) is designed for novel writers. If you're a developer or technician, most "helpful" and "intelligent" features hinder or destroy your work.  Writing code examples, formulas or technical jargong is tedious. But can be easier if you follow these settings. General File / Options / Advanced / (smart cut and paste) Settings /  Uncheck "Adjust sentence and word spacing automatically" This prevents Office from inserting spaces in front of what you paste. The setting will also be used in Outlook even if there's no setting there. Disable auto-capitalize first character. (also for outlook) Prevents Office from destroying your code casing Options / Proofing / AutoCorrect options / AutoFormat as you type Uncheck "Straight Quotes" with "Smart Quotes" Uncheck Hyphens with dash This malforms any code pasted Excel Options / Advanced / Use system separators Change to . (per...