Showing 11-15 of 16 items.

Resetting Child Folder and File Permissions Recursively in Windows using PowerShell

We have a QNAP NAS that is used to store archived work by client and job. Somehow the permissions for these files and folders (over 3 million files, approx 30TB!) were corrupted and required resetting.

The quick method was to write two simple PowerShell scripts, the first takes ownership of the folders and files and then the second script resets the inherited permissions.

Adding Google Analytics 4 to your Yii Web Application

I have an advanced Yii2 web application with two environments; production and development. And I want to monitor the activity of our frontend website using Google Analytics.

Google Analytics 4 (GA4) has been around for a few years and will be replacing Universal Analytics (UA) on 1st July 2023, so this article looks at how we can add a GA4 site tag to our Yii2 frontend web application.

Using Yii2 Bootstrap Alerts with JavaScript

In Yii we can create alerts on our page using Yii::$app->session->setFlash('success', 'Record successfully created');. This line would normally be found in your controller, say after a record has successfully saved. But what if you want to display an alert after your JavaScript has processed an AJAX request?

Eliminating Math Errors in JavaScript

Find a calculator and enter 0.105 * 11305, press the equals symbol and the result returned will be 1,187.025. Rounding this result to two decimal places will give us 1,187.03.

Now enter this formula into your web console (0.105 * 11305) and strangely our JavaScript returns the result 1187.0249999999999. Rounding this value to two decimal places and we have a different answer of 1,187.02!!!

Adding Line Numbers to your Markdown Code Blocks

I want my Markdown code blocks on my blog website to include line numbers, but once again the internet had many plausible solutions that either did not work or did not include suitable explanations. The good news is I came across PRISM, a simple solution that uses a lightweight JavaScript and CSS file that allows you to add line numbers plus other features.