Category Archives: Uncategorized

Double Opt-in Email Newsletter Made Right (by Yoast)

1) The “Subscribe to Newsletter” call-to-action: 2) The “Wait for Confirmation Email” web page: 3) The “Confirm Your Subscription” email message: 4) The “Thank You for Subscribing” web page:

Delphi URLEncode like PHP

Example URLEncode() function converted from PHP to Delphi: function URLEncode(const aData: AnsiString): AnsiString; const Chars: Array [0..18] of AnsiChar = (#$25, #$21, #$2A, #$27, #$28, #$29, #$3B, #$3A, #$40, #$26, #$3D, #$2B, #$24, #$2C, #$2F, #$3F, #$23, #$5B, #$5D); var sData: String; i1: DWORD; begin sData := String(aData); for i1 := Low(Chars) to High(Chars) do […]

Make Your Domain Emails Not Spoofeable

Simple steps to make your domain emails not spoofeable: 1) Add a TXT record (SPF): v=spf1 a mx ~allv=spf1 a mx ~all Or use include: to include specific hosts or IPs, example: v=spf1 include:mx.ovh.com include:ip4:1.2.3.0/21 ~allv=spf1 include:mx.ovh.com include:ip4:1.2.3.0/21 ~all 2) Add a TXT record (DMARC): v=DMARC1; p=quarantine; pct=100; rua=mailto:support@yourdomain.com; ruf=mailto:support@yourdomain.comv=DMARC1; p=quarantine; pct=100; rua=mailto:support@yourdomain.com; ruf=mailto:support@yourdomain.com Or […]

Example PHP Script to Receive and Return JSON Data

Here is an example PHP script used to receive and return JSON data: @header(‘Content-Type: application/json; charset=utf-8’);   $json = file_get_contents(‘php://input’);   $array = json_decode($json, true);   $username = $array[‘username’];   $password = $array[‘password’];   $result = array();   $result[‘status’] = "OK";   echo json_encode($result);@header(‘Content-Type: application/json; charset=utf-8’); $json = file_get_contents(‘php://input’); $array = json_decode($json, true); $username = […]

Delphi HTTP POST JSON Example

Here is an example to POST JSON data with Delphi 10: Reference: https://stackoverflow.com/a/24042633 Add these libraries in your uses: idSSLopenSSL, idHttp, JsonidSSLopenSSL, idHttp, Json Here is the example code to POST JSON data: procedure TForm1.Button1Click(Sender: TObject); var JsonStr: string; sResponse: string; JsonToSend: TStringStream; HTTP1: TidHTTP; F: TJSONObject; begin Button1.Enabled := False; memoResponse.Lines.Clear; memoRequest.Lines.Clear;   F […]

How to Send (POST) JSON Data with PHP cURL

Example PHP code to send (via HTTP POST) JSON data to an URL: $data = array( "username" => "admin", "password" => "password", );   $curl = curl_init("https://api.website.com/v1/auth/login/"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLINFO_HEADER_OUT, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($curl, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’); $output = curl_exec($curl); curl_close($curl);   print_r(json_decode($output));$data = array( "username" => "admin", "password" […]

PCRE Fnmatch() PHP Function for Wildcard String Match

PHP function fnmatch() has 4096 characters limit: Warning: fnmatch(): Filename exceeds the maximum allowed length of 4096 charactersWarning: fnmatch(): Filename exceeds the maximum allowed length of 4096 characters To avoid these limits we can use a PCRE-like fnmatch() function: https://www.php.net/manual/en/function.fnmatch.php#100207 Here is a modified PHP code found in the php.net website: if (!function_exists(‘fnmatch’)) { define(‘FNM_PATHNAME’, […]

Delphi XE Add Icons and Images as Resources

First Click on Project -> Resources and Images: Then just click on “Add” to add an icon or image: For icons, make sure to use all UPPERCASE characters. Here is an example to use a icon resource in the trayicon: procedure TForm1.Button4Click(Sender: TObject); begin TrayIcon1.Visible := False; TrayIcon1.Icon.LoadFromResourceName(hInstance, ‘ICON1’); TrayIcon1.Visible := True; end;procedure TForm1.Button4Click(Sender: TObject); […]

Delphi XE Change System Tray Icon with TTrayIcon (No Blurry)

You can change system tray icon by using TTrayIcon and TImageList: procedure TForm1.Button4Click(Sender: TObject); begin TrayIcon1.IconIndex := 0; end;   procedure TForm1.Button5Click(Sender: TObject); begin TrayIcon1.IconIndex := 1; end;procedure TForm1.Button4Click(Sender: TObject); begin TrayIcon1.IconIndex := 0; end; procedure TForm1.Button5Click(Sender: TObject); begin TrayIcon1.IconIndex := 1; end; However this seems to add a blurry effect on the icon (not […]

Install Latest NVIDIA Drivers for Windows 10

Open this URL in your browser: https://www.nvidia.com/Download/index.aspx?lang=en-us Enter your NVIDIA graphic card details and click the Search button. BONUS TIP: If you are a creative or business and not a gamer, select: Download Type = Studio Driver (SD) These drivers focuses on stability and wuality.