Posts

Free Space in SQL Files

Howard

Ever wanted to know how to view available space in your database files? This script will give you the answer.

Uncomment out the last line to just view the log file.

sql
SELECT * FROM users WHERE age > 30;

USE HDNet
GO

SELECT 
    @@Servername AS instance_name,
    sd.name AS db_name, 
    sd.recovery_model_desc AS recovery_model,
    sdf.physical_name AS filename,
    sdf.name AS logical_name,
    (FILEPROPERTY(sdf.name, 'IsPrimaryFile')) AS primary_file,
    (FILEPROPERTY(sdf.name, 'IsLogFile')) AS is_log_file,
    CONVERT(DECIMAL(10,2), size/128.0/1024)AS size_GB,
    CONVERT(DECIMAL(10,2), FILEPROPERTY(sdf.name, 'SpaceUsed')/128.0/1024) AS space_used,
    CONVERT(DECIMAL(10,2), size/128.0/1024-(FILEPROPERTY(sdf.name, 'SpaceUsed')/128.0/1024)) AS space_availabile,
    CONVERT(DECIMAL(10,2), (FILEPROPERTY(sdf.name, 'SpaceUsed')/(size/128.0))/128.0*100) AS pct_used,
    sd.log_reuse_wait_desc
FROM sys.database_files AS sdf
CROSS APPLY
(
    SELECT * FROM sys.databases AS sdf
    WHERE name = DB_NAME()
) AS sd








--WHERE (FILEPROPERTY(sdf.name, 'IsLogFile')) = 1

test

Howard

space here

sql
SELECT * FROM users WHERE age > 30;

USE HDNet
GO

SELECT 
    @@Servername AS instance_name,
    sd.name AS db_name, 
    sd.recovery_model_desc AS recovery_model,
    sdf.physical_name AS filename,
    sdf.name AS logical_name,
    (FILEPROPERTY(sdf.name, 'IsPrimaryFile')) AS primary_file,
    (FILEPROPERTY(sdf.name, 'IsLogFile')) AS is_log_file,
    CONVERT(DECIMAL(10,2), size/128.0/1024)AS size_GB,
    CONVERT(DECIMAL(10,2), FILEPROPERTY(sdf.name, 'SpaceUsed')/128.0/1024) AS space_used,
    CONVERT(DECIMAL(10,2), size/128.0/1024-(FILEPROPERTY(sdf.name, 'SpaceUsed')/128.0/1024)) AS space_availabile,
    CONVERT(DECIMAL(10,2), (FILEPROPERTY(sdf.name, 'SpaceUsed')/(size/128.0))/128.0*100) AS pct_used,
    sd.log_reuse_wait_desc
FROM sys.database_files AS sdf
CROSS APPLY
(
    SELECT * FROM sys.databases AS sdf
    WHERE name = DB_NAME()
) AS sd










--WHERE (FILEPROPERTY(sdf.name, 'IsLogFile')) = 1

Hugo + GitHub + Cloudflare Pages

Howard

Introduction

I previously managed a blog hosted on a WordPress installation running on Amazon Lightsail. While the setup worked well, maintaining WordPress required significant effort—keeping it updated, securing the installation, and managing comments. Looking for a more efficient and low-cost solution, I began exploring static site generators like Jekyll and Hugo, alongside free or inexpensive hosting options.

I chose Cloudflare Pages as my hosting platform because it allowed me to deploy directly from a private GitHub repository—something not all free hosting solutions support. I was already using Cloudflare for DNS management, so keeping everything within the same ecosystem made sense. As for the static site generator, I opted for Hugo largely out of personal preference. It’s fast, easy to set up, and doesn’t require the Ruby toolchain that Jekyll depends on..

Basic HTML Elements

The main purpose of this article is to make sure that all basic HTML Elements are decorated with CSS so as to not miss any possible elements when creating new themes for Hugo.

Headings

Let’s start with all possible headings. The HTML <h1><h6> elements represent six levels of section headings. <h1> is the highest section level and <h6> is the lowest.

(Hu)go Template Primer

(Hu)go Template Primer

Hugo uses the excellent Go html/template library for its template engine. It is an extremely lightweight engine that provides a very small amount of logic. In our experience that it is just the right amount of logic to be able to create a good static website. If you have used other template systems from different languages or frameworks you will find a lot of similarities in Go templates.

Getting Started with Hugo

Step 1. Install Hugo

Go to Hugo releases and download the appropriate version for your OS and architecture.

Save it somewhere specific as we will be using it in the next step.

More complete instructions are available at Install Hugo

Step 2. Build the Docs

Hugo has its own example site which happens to also be the documentation site you are reading right now.