Using FileSystemWatcher Correctly (Part 1)

Using FileSystemWatcher Correctly (Part 1)

A FileSystemWatcher can monitor a file or folder for changes, so your PowerShell code can immediately be notified when new files are copied to a folder, or when files are deleted or changed. Example of Synchronous Monitoring Often, you find example code for...

Using FileSystemWatcher Correctly (Part 1)

Using Solid Alternatives for $MyInvocation

Lines like $MyInvocation.MyCommand.Definition can be useful to determine the folder in which the current script is stored, i.e. to access other resources located in the same folder. Easier Alternatives Since PowerShell 3 However, ever since PowerShell 3, there have...

Using Custom Styles in RAD Studio 10.3

Using Custom Styles in RAD Studio 10.3

How to Customize Your UI with FireMonkey Styles in RAD Studio 10.3 It’s very easy to customize your user interface using FireMonkey styles in RAD Studio 10.3. We’ve added all of the premium styles to GetIt (Tools > GetIt Package Manager > Styles) in 10.3. This...

Using FileSystemWatcher Correctly (Part 1)

Translating VBScript to PowerShell

Most old VBS scripts can be easily translated to PowerShell. The key command in VBS is “CreateObject” which lets you access system libraries. PowerShell translates “CreateObject” to “New-Object -ComObject”, yet the object model and member names stay the same: This VBS...

How to Find and Fix SQL Server Deadlocks

How to Find and Fix SQL Server Deadlocks

Introduction Locking is required for concurrent operations of relational databases to prevent data inconsistency and loss. However, locking impairs the performance of databases. Moreover, the locking process is often complicated. Deadlocks occur when concurrent...

Using FileSystemWatcher Correctly (Part 1)

Detecting WinPE

Running PowerShell in WinPE Environments PowerShell can run inside WinPE environments. If you’d like to detect whether your PowerShell script runs inside a WinPE environment, you can simply check whether a special registry key exists: function Test-WinPE { return...

Using FileSystemWatcher Correctly (Part 1)

Extract Specific Files from ZIP Archive

Starting with PowerShell 5, cmdlets like Extract-Archive can extract the content of ZIP files to disk. However, you can always extract only the entire archive. Extracting Specific Files Using .NET Methods If you’d rather like to extract individual files, you can...

Using FileSystemWatcher Correctly (Part 1)

Running CMD commands in PowerShell

PowerShell by default does not support the native cmd.exe command such as „dir“. Instead, it uses historic aliases called “dir” to point you to the closest PowerShell cmdlet: PS C:\> Get-Command -Name dir | ft -AutoSize CommandType Name Version Source -----------...

Using FileSystemWatcher Correctly (Part 1)

Progress Bar Timer

Use the PowerShell progress Bar Here is a simple example using the PowerShell progress bar. The code displays a progress bar counting down a break. Simply adjust the number of seconds you’d like to pause. You could use this example for displaying breaks in classes or...

Using FileSystemWatcher Correctly (Part 1)

Monitoring Master-Slave Replication in MySQL 8

MySQL 8 introduced a number of enhancements to improve both replication performance and the monitoring thereof. Improvements included more efficient replication of small updates on big JSON documents, the addition of Performance Schema tables for slave performance...

Using FileSystemWatcher Correctly (Part 1)

Understanding Script Block Logging (Part 1)

Beginning with PowerShell 5, the PowerShell engine starts to log executed commands and scripts. By default, only commands considered potentially harmful are logged. When you enable verbose logging, though, all executed code from all users on a given machine are...

Using FileSystemWatcher Correctly (Part 1)

Reading Event Logs Smart (Part 1)

When you query an event log with PowerShell, by default you get back a text message with the logged information. For example, if you’d like to know who logged on to your machine, you could use code like this (Administrator privileges required): Get-EventLog -LogName...

Setting up Basic Master-Slave Replication in MySQL 8

Setting up Basic Master-Slave Replication in MySQL 8

Since April 19th, when MySQL 8.0 became Generally Available (GA), the MySQL community has been abuzz with excitement over all of the new features and improvements. Many of new features were improvements to performance or monitoring, while others were specifically...

Using FileSystemWatcher Correctly (Part 1)

Turning Display Off Immediately

If you are about to launch a lengthy automation script, why not turn off the display right away instead of waiting for the screen saver timeout to kick in? Turns off your Display Immediate Here is a simple function that turns off your display immediately. Just move...

SHA Hash with C++Builder and Delphi

SHA Hash with C++Builder and Delphi

Fascination with Cryptographic Hash Functions I've always been fascinated by encryption & compression, but my favorite is probably the cryptographic hash function. A hash function is a one-way algorithm that takes an input of any size and always produces the same...

Using FileSystemWatcher Correctly (Part 1)

Improve MariaDB Performance using Query Profiling

Query profiling is a useful technique for analyzing the overall performance of a database. Considering that a single mid-to-large sized application can execute numerous queries each and every second, query profiling is an important part of database tuning, both as a...

1 7 8 9 10 11 16