Technology and More

Hexadecimal to Decimal Conversion Chart

Posted by: David Hill on

enter image description here

Reduce Umbraco Database Size

Posted by: David Hill on

Use this SQL to reduce the size of an Umbraco database:

DECLARE @createdDate Datetime = '2014-10-30'

DELETE FROM cmsPropertyData WHERE
    versionId NOT IN (SELECT versionId FROM cmsDocument WHERE updateDate > @createdDate OR published = 1 OR newest = 1) AND
    contentNodeId IN (SELECT DISTINCT nodeID FROM cmsDocument)
DELETE FROM cmsPreviewXml WHERE
    versionId NOT IN (SELECT versionId FROM cmsDocument WHERE updateDate > @createdDate OR published = 1 OR newest = 1) AND
    nodeId IN (SELECT DISTINCT nodeID FROM cmsDocument)
DELETE FROM cmsContentVersion WHERE
    versionId NOT IN (SELECT versionId FROM cmsDocument WHERE updateDate > @createdDate OR published = 1 OR newest = 1) AND
    ContentId  IN (SELECT DISTINCT nodeID FROM cmsDocument)
DELETE FROM cmsDocument WHERE
    versionId NOT IN (SELECT versionId FROM cmsDocument WHERE updateDate > @createdDate OR published = 1 OR newest = 1) AND
    nodeId IN (SELECT DISTINCT nodeID FROM cmsDocument)


USE [databaseName]
TRUNCATE TABLE [umbracoLog]

Then shrink the database.

Ye Olde ASCII Character Set

Posted by: David Hill on

This is from the old days. I'm posting it here for fun.

Change File Associations by File Type in Windows

Posted by: David Hill on

Control Panel

Search for "Default Programs"

Choose "Associate a file type or protocol with a specific program"

Edit: in Windows 10, Search for "Default app"; Select "Choose a default app for each type of file".

Windows Script Example: Find paths with too-long names

Posted by: David Hill on

Find paths with too-long names

Option Explicit

If WScript.Arguments.Count <> 2 Then
    WScript.Echo "Usage: " & WScript.ScriptName & " <path> <max length>"
    WScript.Quit
End If

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(WScript.Arguments(0)) = False Then
    WScript.Echo WScript.Arguments(0) & " - Invalid path or no such folder."
    WScript.Quit
End If

Dim oFolder : Set oFolder = fso.GetFolder(WScript.Arguments(0))
Dim iLength : iLength = CInt(WScript.Arguments(1))
Dim iCount : iCount = 0
WScript.Echo "Looking for paths longer than " & iLength & " characters in " & oFolder.Path >>WScript.Arguments(2)
On Error Resume Next
Call ScanFolder(oFolder)
On Error Goto 0
WScript.Echo "Found " & iCount & ".">>WScript.Arguments(2)
WScript.Quit
Sub ScanFolder(oScanFolder)
    Dim oFile : For Each oFile in oScanFolder.Files
        If Len(oFile.Path) > iLength Then
            WScript.Echo oFile.Path>>WScript.Arguments(2)
            iCount = iCount + 1
        End If
    Next
    For Each oFile in oScanFolder.SubFolders
        Call ScanFolder(oFile)
    Next
End Sub

Run Scripts on a Windows Computer

Posted by: David Hill on

Create vb script file in notepad

Name it x.vbs

Run it from a DOS command prompt with the following:

cscript x.vbs