- SQL script to update records in table row-by-row by using cursorThe MS SQL script below can be used to update records in a table row-by-row by using a cursor.
- Git how to find all commits where string was mentionedYou can use the following Git commands to find commits where a string was added/modified/deleted. This can be helpful to find commits where a certain method was added, modified, deleted or usages were added/deleted. 1. Find commits where method was mentioned. Powershell script (for Windows)
- Generate self-signed SSL certificate on Windows Server with PowershellUse the Powershell command below to generate a self-signed SSL certificate on a Windows Server 2019+. Make sure you run the Powershell Window as Administrator. Step 1: Generate self-signed certificate with one CN name. The command below generates the SSL certificate and automatically imports it to the local machine certificates in this folder: “Local Computer\Personal\Certificates”.… Continue reading Generate self-signed SSL certificate on Windows Server with Powershell
- Fix maxJsonLength error in ASP.NET MVC 4 applicationsAre you running into the following error in a ASP.NET Framework 4.x MVC project, and have already tried changing the max response values in web.config? Error: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. Solution: If you are using the Json()… Continue reading Fix maxJsonLength error in ASP.NET MVC 4 applications
- Linux display SSL cert of website from command lineIf you want to display details of an SSL certificate that is returned by a website from the Linux commandline, you can use this command. 1. Install required packages In order to use the command below, the “openssl” package is required. You can install this package with this command: Or with yum: 2. Execute command-line… Continue reading Linux display SSL cert of website from command line
- Git how to fix error “failed to connect timeout” while HTTPS from browser worksAre you running into issues when communicating through Git with a remote and the connection timing out, while accessing the Git server via HTTPS from your browser works? Read on. 1. Troubleshooting issue While doing a Git fetc/pull/push you might see the following error: First check if you are able to access your remote Git… Continue reading Git how to fix error “failed to connect timeout” while HTTPS from browser works
- How to fix RDP clipboard which is no longer workingAre you having a Windows Remote Desktop session open, but unable to copy and paste text between your host machine and the remote desktop? Below might be a possible fix. RdpClip.exe process When you are connected to a Windows machine via Remote Desktop, a utility tool called “rdpclip.exe” is started on the remote machine. This… Continue reading How to fix RDP clipboard which is no longer working
- How to fix React Native Android error: Duplicate class kotlin.text.jdk8Issue: When building a react native app for Android, you might suddenly come across the following error. This error might be caused by a mix-up of different plugins that you use. In my case it suddenly showed up after I implemented a plugin for an InAppBrowser support. Fix error by adding dependency constraint In order… Continue reading How to fix React Native Android error: Duplicate class kotlin.text.jdk8
- Java get all enabled TLS cipher suites on Windows via PowershellA Java installation by default supports various TLS ciphers for Java applications that use HTTPS / SSL. Some of these TLS ciphers are marked as “vulnerable” and should not be used in production environments for security. Examples of this are TLS 1.0 and TLS 1.1 ciphers, which are deemed no longer secure and should not… Continue reading Java get all enabled TLS cipher suites on Windows via Powershell
- Quickly compare two CSV files with PowershellYou can use Powershell to quickly compare two CSV files, and to see which records exist in file A, but not in file B (or vice versa). We will use the two CSV files below as an example. Note: it is required that records in both files are sorted. File1.csv record1 record2 record3 record4 record5… Continue reading Quickly compare two CSV files with Powershell
- Linux how to find installed package name of Java and remove itThe tip below applies to systems that use the “dnf” package manager, e.g. RedHat 8 and AlmaLinux. 1. Find installed package based on wildcard name You can use the following command to search all of the installed packages based on a wildcard name. For example, if we wish to find the package name that provides… Continue reading Linux how to find installed package name of Java and remove it
- Send email via PowershellIf you want to send an email via Powershell, e.g. to test if a local SMTP server is able to receive incoming email, you can use the following Powershell command: Replace the example values in the command above to the credentials used in your situation: -SmtpServer Servername (DNS) or IP address of the server which… Continue reading Send email via Powershell
- How to fix Windows Service logon tab options greyed out with GMSA accountIf you have configured a Windows Service to run under a GMSA (Group Managed Service Account), then it is possible that you will run into the problem that the “log on” tab options will be greyed out, rendering you unable to change the service account for this Windows Service. 1. Change managedaccount flag to “false”… Continue reading How to fix Windows Service logon tab options greyed out with GMSA account
- Powershell how to get SID of AD userYou can use the following simple Powershell command to get the SID of an Active Directory user: This will give the following output: Retrieve the SID from this line: I hope this helped you!
- Powershell export and import installed Windows Server roles and featuresYou can use the Powershell snippet below to simply export all installed Windows Server Roles and features from a Windows 2019 Server. You can save the roles in a CSV files, and with the second command you are able to automatically install all the exported roles and features to another Windows Server. This is an… Continue reading Powershell export and import installed Windows Server roles and features
- Powershell get list of AD users / groupsUse the snippet below to get a list of all AD groups that a certain username is member of. Replace “[username]” with the correct username. Execute this command in a new Powershell window. Get groups of user You should get the following response: Get users in a group This command fetches all AD users in… Continue reading Powershell get list of AD users / groups
- Test RPC ports via PowershellWould you like to test whether one server can talk to another server via the (default) RPC ports? There is a very handy Powershell script that can do this. 1. Powershell script You can use the below script to verify if the network ports are opened and one machine can connect to the other one.… Continue reading Test RPC ports via Powershell
- How to check ADLDS replication status with custom host/portIf you want to check the replication status of an ADLDS (Active Directory Lightweight Directory Services) instance, you can use the command repadmin. By default all commands issued to repadmin will use the default LDAP ports (389/636). If your ADLDS instance uses different ports, you can add a parameter to the repadmin command. 1. Check… Continue reading How to check ADLDS replication status with custom host/port
- How to permanently remove a sensitive file in Git from historyIf you have committed a sensitive file in Git by mistake, for example a file containing a password, you can choose to remove this file from Git (and rewrite history). NOTE: only do this if you know what you’re doing. Rewriting history in Git is usually considered a bad-practice, especially if you are collaborating with… Continue reading How to permanently remove a sensitive file in Git from history
- How to install Java 11 Amazon Corretto on RedHat 8 / CentOS 8 / AlmaLinux 8To install Java 11 (Amazon Corretto) on RHEL8 machines, you can run the following commands: After running the above commands, check if Java 11 is successfully installed: That’s it!
- Powershell check if an AD Group Managed Service account (GMSA) is correctly installed on Windows ServerIf you wish to check if a Windows Group Managed Service Account (GMSA) is correctly installed (and available for use) on a Windows machine, you can do the following. Open a new Powershell Window First make sure that the Active Directory Powershell feature is enabled on the server. Do this by issuing this command: Afterwards,… Continue reading Powershell check if an AD Group Managed Service account (GMSA) is correctly installed on Windows Server
- How to use Tensorflow ONNX model in C# ML .NET for object detectionThis is part 2 in the tutorial series on how to train a Tensorflow 2.x object detection model and use it in C# ML.NET. I advise you to read part 1 first if you haven’t already. 1. Introduction I created a Visual Studio 2022 .NET 6.0 solution which contains all of the example code to… Continue reading How to use Tensorflow ONNX model in C# ML .NET for object detection
- How to fix TensorFlow library was compiled to use SSE4.1 instructions, but these aren’t available on your machine. AbortedDo you get the following error while trying to use TensorFlow on a Linux virtual machine? This might be caused by your CPU that is unsupported. If you are running TensorFlow in a virtual machine, then check how your virtual CPU is configured (what type). Do this by typing the following in your Linux terminal:… Continue reading How to fix TensorFlow library was compiled to use SSE4.1 instructions, but these aren’t available on your machine. Aborted
- How to fix Ubuntu Failed to fetch http://security.ubuntu.com/ubuntu/pool/main…Do you get an error like the following when you are trying to download a package via apt-get? Solution The issue most likely has to do with that the Ubuntu package repositories have become outdated. Try the following: After this command has successfully executed, try the original apt-get command again. If it still doesn’t work,… Continue reading How to fix Ubuntu Failed to fetch http://security.ubuntu.com/ubuntu/pool/main…
- How to delete all commits in a Git repository and replace it with a single “initial commit”If you have an existing Git repository with multiple commits (history) in it, and you would like to replace all the history with just a single commit, here’s how to do it: NOTE: only do this if you know what you’re doing. Rewriting history in Git is usually considered a bad-practice, especially if you are… Continue reading How to delete all commits in a Git repository and replace it with a single “initial commit”
- Train a Tensorflow 2.7 object detection model on Ubuntu 20.04 and convert it to ONNXWelcome to this tutorial. Here you will learn how to train a Tensorflow 2.x model for object localization and detection, how to convert this trained model to ONNX format and how then to use it in C# ML.NET to do detections on images. 1. Hardware requirements For this tutorial we will use a clean Ubuntu… Continue reading Train a Tensorflow 2.7 object detection model on Ubuntu 20.04 and convert it to ONNX
- MSSQL find objects with missing dependenciesYou can use the below query snippet to list objects in a database that use dependencies which are missing. For example stored procedures that require a certain table/view which doesn’t exist (anymore). This script can help you to clean up old/deprecated/obsolete database objects.
- Powershell how to automate Windows Server Backup tasksIf you would like to automate your Windows Server Backup workflows, you can use the following Powershell snippet. 1. Install Windows feature (if not already installed) Firstly check if the Windows Server Backup feature is installed on the Windows Server machine. The easiest way is to execute the following statement in a Powershell Window which… Continue reading Powershell how to automate Windows Server Backup tasks
- Powershell check if .NET executable is x86 or x64Do you want to check if a (.NET) assembly has been built for x86 or x64? You can do this via the following Powershell snippet. Simple run the following command in a Powershell window: In the output above you should look for this line: In this case this assembly is built for 64-bit platforms (AMD64).… Continue reading Powershell check if .NET executable is x86 or x64
- Powershell copy files from directory excluding certain extensionsIn Powershell you can use the pipe symbol “|” to chain certain commands together. This enables you to make powerful scripts. One example how you can use this is to recursively copy files from one location to another, but exclude certain files based on the filename or extension. Example 1: copy all files from one… Continue reading Powershell copy files from directory excluding certain extensions
- Powershell open a new file explorer window in a specific locationIn order to open a new file explorer window in a specific location from Powershell, you can use the following very simple command in a Powershell script: This can come in handy in certain cases. For example if you are making a script that places files in a certain location, and you then want the… Continue reading Powershell open a new file explorer window in a specific location
- Linux find and remove files older than N daysFind files older than N days If you wish to find and delete certain files that are older than a certain amount of days, you can use this snippet: What this does is it finds all files matching the filter /path/to/files-beginning-with* that have been created more than 5 days ago. You can change the “+5”… Continue reading Linux find and remove files older than N days
- Linux add custom logrotate configurationOn Linux logrotate is a package that is used to automatically rotate logfiles on a set interval. This can be done on a daily basis, or when the log file exceeds a certain filesize. Rotating logs means that a logfile is automatically truncated preventing it from growing indefinitely. Example logrotate conf file for Kibana Logrotate… Continue reading Linux add custom logrotate configuration
- Linux find top n largest folders/filesIf you wish to find the largest folders/files in a specific directory, you can use the following commands. 1. Find largest folders For example to find the largest 20 directories in the /var/log directory, use this: 2. Find largest files Alternatively, if you wish to find the largest 20 individual files in the /var/log directory,… Continue reading Linux find top n largest folders/files
- Convert .pfx to separate certificate and private key fileSSL certificates generated/exported via Windows are usually in the .pfx format. However some applications such as Linux or Java based applications require the certificate and private key to be in separate files. With the commands below you can export the individual parts from the .pfx file. 1. Export certificate and private key from .pfx with… Continue reading Convert .pfx to separate certificate and private key file
- Powershell pass arguments to scriptIf you wish to call a Powershell script with a certain argument (e.g. a directory), you can do so with the following example: Snippet: add expected argument to script Providing the argument Typing manually when prompted by calling script If you now call the script from the command line with the code above, you should… Continue reading Powershell pass arguments to script
- Powershell connect with remote computerWith Powershell you are able to connect to remote computers and execute statements. For example this allows you to start and stop IIS on a remote webserver, install/uninstall Windows Services when deploying new software and more. Snippet: connect to a remote computer Remote execute examples Below you will find a few examples of things to… Continue reading Powershell connect with remote computer
- Linux disable TLS 1.0 and TLS 1.1 on NginxIf you are using Nginx on Linux and wish to disable certain TLS protocols like TLS 1.0 and TLS 1.1, you can do so as follows: 1. Change Nginx config Open up the following file in your favorite editor (e.g. nano): Somewhere in this file, look for the following line which starts with “ssl_protocols”: In… Continue reading Linux disable TLS 1.0 and TLS 1.1 on Nginx
- Linux how to check if webserver supports TLS 1.0/1.1/1.2/1.3As of the time of writing, TLS 1.0 and 1.1 are not deemed safe anymore and prone to man-in-the-middle attacks. It is recommended to only support TLS 1.2+. On Linux you can check if your webserver accepts TLS 1.0 or TLS 1.1 via the following command: Check TLS 1.0 / 1.1 / 1.2 / 1.3… Continue reading Linux how to check if webserver supports TLS 1.0/1.1/1.2/1.3
- Telnet equivalent in Powershell to test if port is reachablePowershell doesn’t come with telnet by default, however you can use the following command to quickly connect to a TCP server in a Powershell window. 1. Test-NetConnection The simplest option is to use the command “Test-NetConnection”. With this command you can specify a computername (or IP address) and port to check if a connection can… Continue reading Telnet equivalent in Powershell to test if port is reachable
- How to fix Git error: unable to get local issuer certificate on WindowsIf you use Git on Windows (either via command-line or a GUI), you might run into the following error: Read on in order to fix this.. Problem and cause When you encounter the error above on Windows machines, it is most often caused by the SSL backend config option. The SSL backend defines at which… Continue reading How to fix Git error: unable to get local issuer certificate on Windows
- Powershell script run as administrator / elevated mode checkIf you created a Powershell script which needs administrator permissions, and you try to run it as a normal user (e.g. when simply double clicking the .ps1 file), you might see errors such as “Access denied”. To fix this, you will need to run the Powershell script as Administrator. However this usually means you need… Continue reading Powershell script run as administrator / elevated mode check
- Powershell error: the file is not digitally signed. You cannot run this…If you are trying to run a custom Powershell (.ps1) script, you might see the following error: This problem is caused by the default Execution-Policy which prevents you from running custom Powershell scripts. Solution: change execution policy To fix this, open up a Powershell prompt as an Administrator: Then in the Powershell prompt, enter the… Continue reading Powershell error: the file is not digitally signed. You cannot run this…
- Fix unexpected end of file bug with Drush on RHEL8/CentOS 8 / AlmaLinuxIf you are using Drush (the command line tool for Drupal), you might come across this error on certain Linux distributions: This error is caused by an incompatibility between Drush and the Linux distribution used. Drush will still be functional, however these error messages will clutter your console. In order to fix this, you can… Continue reading Fix unexpected end of file bug with Drush on RHEL8/CentOS 8 / AlmaLinux
- How to auto refresh page contents in C# Blazor server appDeveloping web apps with Blazor technology has a lot of benefits. One of the biggest benefits is being able to use C# for both front-end and backend, simplifying the toolkit for creating rich web apps. When you are using plain server-side rendered HTML, one would usually be required to use Javascript for making AJAX calls… Continue reading How to auto refresh page contents in C# Blazor server app
- Extract frames from MP4 video with OpenCV in C# .NET framework 5.0In order to convert a .MP4 video to images (.png) for every frame, you can use the OpenCV library, which is compatible with .NET framework 5.0. 1. Create new Console App First create a new Console App project in Visual Studio. Select “.NET 5.0” as Framework. 2. Install OpenCvSharp 4.x via NuGet When your project… Continue reading Extract frames from MP4 video with OpenCV in C# .NET framework 5.0
- A network-related or instance-specific error occured SQL server 2019If you have just installed Microsoft SQL server 2019 and are having issues connecting to it from other machines, read here for a possible solution. If you see the following error, read on: 1. Problem Usually, when installing SQL server, not everything is configured for remote access out-of-the-box. This means you need to make a… Continue reading A network-related or instance-specific error occured SQL server 2019
- How to join a Ubuntu 20.04 machine to a Windows AD domainDo you want to be able to login to your Ubuntu machines with AD users and apply Active Directory authentication? Read here how. 1. Install required packages Login to your Ubuntu machine via SSH. First we will need to install some packages. You can issue the following command to install everything we need: 2. Update… Continue reading How to join a Ubuntu 20.04 machine to a Windows AD domain
- Install Proxmox qemu-guest-agent on Ubuntu 20.04In this tutorial I will show you how to install the qemu-guest-agent package on Ubuntu 20.04. 1. What is qemu-guest-agent? The qemu-guest-agent is a helper daemon, which is installed in a guest VM. It is used to exchange information between the host and guest, and to execute commands in the guest machine. For example, when… Continue reading Install Proxmox qemu-guest-agent on Ubuntu 20.04
- How to fix “ERROR: the certificate of … is not trusted” on RHEL 8 / CentOS 8 /AlmaLinux 8Every operating system (and most browsers) have their own local list of trusted Certificate Authorities (CA). If a SSL certificate is issued by one of the CA’s in this list the SSL certificate will be validated. However if you try to access a website of which the SSL certificate is NOT issued by a known… Continue reading How to fix “ERROR: the certificate of … is not trusted” on RHEL 8 / CentOS 8 /AlmaLinux 8
- Install daemonize on RHEL 8 / CentOS 8 / AlmaLinux 8Sometimes when installing a package on Linux you will come across the following error: The error reads the following: 1. Cause The cause of this error is that the daemonize package is required, but it cannot be found in the repositories available on the system. Thus it throws the error that you see above. Daemonize… Continue reading Install daemonize on RHEL 8 / CentOS 8 / AlmaLinux 8
- Install Drush for Drupal 7.x on DirectAdminIf you want to install Drush for Drupal 7.x on DirectAdmin (CentOS 8, RHEL 8 / AlmaLinux), you came to the right place. 1. Install dependencies Login via SSH to the server and execute the following commands to install Git and download Composer. 2. Download Drush via Git Use Git to checkout the version of… Continue reading Install Drush for Drupal 7.x on DirectAdmin
- Call to undefined function mailparse_msg_create()If you get the following error message in PHP, it means the mailparse PHP extension is missing. 1. Install mailparse via PECL You can install the mailparse extension via PECL, using the following command: Note: if you get an error saying /bin/sh: re2c: command not found then look over here for the solution on how… Continue reading Call to undefined function mailparse_msg_create()
- Install re2c on RHEL8 / CentOS 8 / AlmaLinuxYou can get the following error during steps which are dependent on re2c, for example while executing the make command. If you get an error like the one above, read here how to install it on RHEL / CentOS 8 or AlmaLinux. 1. Find and download the .rpm for re2c First, download the RPM for… Continue reading Install re2c on RHEL8 / CentOS 8 / AlmaLinux
- Linux cp yes to allWhen you try to copy files or folders in Linux using the “cp” command, and the location already contains a file with the same filename, it can ask you whether you want to overwrite the old file: Normally you enter “y” or “n” here, but this message will pop up for every file you are… Continue reading Linux cp yes to all
- How to enable PHP proc_open on DirectAdminBy default, a new installation of DirectAdmin will be configured with the so called “PHP safe mode” enabled. This is a default security feature which disables the use of certain commands such as “proc_open”. This results in the following error messages: In order to enable the proc_open command you need to disable the PHP safe… Continue reading How to enable PHP proc_open on DirectAdmin
- How to delete files with Powershell1. Delete a folder and everything in it With Powershell you can easily delete folders and files with the command line. Use the snippet below to first check if the folder exists, and if it does, delete it. Note: it is always a good practice to check if the folder exists before trying to delete… Continue reading How to delete files with Powershell
Browse per category
- .NET Framework (5)
- Active Directory (5)
- ADLDS (1)
- AlmaLinux (6)
- Artificial Intelligence (1)
- Bash (1)
- Blazor (1)
- C# (4)
- CentOS 8 (6)
- DirectAdmin (1)
- Drupal 7.x (2)
- Drush (1)
- Git (5)
- Java (2)
- Logrotate (1)
- Microsoft SQL server (3)
- Mobile Apps (1)
- Nginx (1)
- OpenCV (1)
- OpenSSL (2)
- PHP (3)
- Powershell (20)
- File operations (2)
- Proxmox VE (2)
- React Native (1)
- RHEL8 (6)
- RPC (1)
- TensorFlow (3)
- Ubuntu (5)
- UNIX Shell (9)
- Windows (5)