InnoSetup error the servicemanager is not available

This error happens with InnoSetup v6+ It is related to functions used to manage Windows services, such as: function OpenServiceManager() : HANDLE; begin if UsingWinNT() = true then begin Result := OpenSCManager(”,”,SC_MANAGER_ALL_ACCESS); if Result = 0 then MsgBox(‘the servicemanager is not available’, mbError, MB_OK) end else begin MsgBox(‘only nt based systems support services’, mbError, MB_OK) […]

InnoSetup disable DesktopIcon via command-line

First make sure you have a task named “desktopicon”: [Tasks] Name: desktopicon; Description: Create a &desktop icon; GroupDescription: "Additional icons:"; Flags: checkedonce[Tasks] Name: desktopicon; Description: Create a &desktop icon; GroupDescription: "Additional icons:"; Flags: checkedonce You may also have the desktop icon in the [Icon] section: [Icons] Name: {userdesktop}\YourApp; Filename: {app}\YourApp.exe; Tasks: desktopicon[Icons] Name: {userdesktop}\YourApp; Filename: […]

Get Laptop Battery DeviceID and Name via WMIC

Query the Win32_Battery class via WMIC from command-line: WMIC Path Win32_Battery get DeviceID,Name /format:listWMIC Path Win32_Battery get DeviceID,Name /format:list The output is like this: DeviceID= ASUSTeKASUS Battery Name=ASUS BatteryDeviceID= ASUSTeKASUS Battery Name=ASUS Battery

Download and Install OpenVPN Client on Windows 10

1) Download and install OpenVPN client from here: https://openvpn.net/community-downloads/ For example: OpenVPN-2.5.0-I601-amd64.msi * During installation it will download .NET Framework 4 * You will need to enable Windows Updates else .NET Framework 4 installation will fail 2) Download and install TAP-Windows drivers from here: https://build.openvpn.net/downloads/releases/latest/ For example: tap-windows-latest-stable.exe 3) Check that TAP-Windows has been successfully […]

How to List INPUT, FORWARD, OUTPUT Iptables Rules

To view INPUT, FORWARD, OUTPUT iptables rules just use: iptables -Siptables -S Here is an example output: -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A INPUT -i tun0 -j ACCEPT -A INPUT -i ens2 -p udp -m udp –dport 1194 -j ACCEPT -A FORWARD -i tun0 -o ens2 -j ACCEPT -A FORWARD -i […]

How to List All Iptables NAT Rules

Use this iptables command-line to view all NAT rules: iptables -t nat -Siptables -t nat -S Here is an example output: -P PREROUTING ACCEPT -P INPUT ACCEPT -P POSTROUTING ACCEPT -P OUTPUT ACCEPT -A POSTROUTING -s 10.8.0.0/24 -o ens2 -j MASQUERADE-P PREROUTING ACCEPT -P INPUT ACCEPT -P POSTROUTING ACCEPT -P OUTPUT ACCEPT -A POSTROUTING -s […]

Parse or Split FTP URL in Delphi XE using TIdURI

Given an FTP URL, you can parse it using TidURI: uses … IdFTP, IdFTPCommon, IdURI …   procedure TForm1.btnDownloadFileClick(Sender: TObject); var URL: string; Uri: TIdURI; begin URL := Trim(edURL.Text); Uri := TIdURI.Create(URL);   try IdFTP1.Host := Uri.Host;   if Uri.Port <> ” then IdFTP1.Port := StrToInt(Uri.Port) else IdFTP1.Port := 21;   IdFTP1.ConnectTimeout := 5000;   […]

How to Download a File via FTP in Delphi XE

A quick example to download a fila via FTP using Indy (IdFTP): uses … IdFTP, IdFTPCommon …   procedure TForm1.Button1Click(Sender: TObject); begin IdFTP1.Host := ‘test.rebex.net’; IdFTP1.Port := 21; IdFTP1.ConnectTimeout := 5000; IdFTP1.Username := ‘demo’; IdFTP1.Password := ‘password’; IdFTP1.TransferType := IdFTPCommon.TIdFTPTransferType.ftBinary; IdFTP1.Passive := True;   try IdFTP1.Connect; try IdFTP1.Get(‘/pub/example/pop3-browser.png’, ExtractFilePath(ParamStr(0)) + ‘pop3-browser.png’, True, False); finally IdFTP1.Disconnect; […]

Public FTP Server to Test Upload and Download

For anonymous FTP server you can use this: ftp://speedtest.tele2.net/ftp://speedtest.tele2.net/ For username:password FTP server you can use this: ftp://demo:password@test.rebex.net/ftp://demo:password@test.rebex.net/

How to Parse Command-Line Arguments in Bash

Need to parse command-line arguments in a bash script? Personally I always use this method: #!/bin/bash   while [[ "$#" -gt 0 ]]; do case $1 in -d|–deploy) deploy="$2"; shift ;; -u|–uglify) uglify=1 ;; *) echo "Unknown parameter passed: $1"; exit 1 ;; esac shift done   echo "Should deploy? $deploy" echo "Should uglify? $uglify"#!/bin/bash […]