Category Archives: Uncategorized

Cannot modify header information – headers already sent

Here you will find various solutions to fix this PHP error message: Cannot modify header information – headers already sentCannot modify header information – headers already sent Solution 1 – UTF-8 without BOM Make sure the file encoding format of all PHP files is UTF-8 without BOM. You can use Notepad++ to convert the encoding […]

Send Transactional Email with SendGrid in PHP

SendGrid is the most popular transactional email service with a FREE plan: Email Delivery Service | SendGrid You can download the official SendGrid PHP library here: https://github.com/sendgrid/sendgrid-php Here is a simple function used to send an email: function sendgrid_send($from_name, $from_email, $to_email, $subject, $content_html) { require "path/to/sendgrid-php/sendgrid-php.php"; $from = new SendGrid\Email($from_name, $from_email); $to = new SendGrid\Email("", […]

Send Email with PHPMailer using SMTP

PHPMailer is the most popular PHP email sending library: https://github.com/PHPMailer/PHPMailer Here is a simple function used to send an email using SMTP: function phpmailer_send($subject, $from_name, $from_email, $message, $to) { require_once ‘path/to/php-mailer/PHPMailerAutoload.php’; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->SMTPDebug = 0; $mail->SMTPSecure = "ssl";   // Example ssl0.ovh.net $mail->Host = "YOUR_SMTP_HOST_ADDRESS";   $mail->Port = […]

jQuery simple alert message that fades out after N seconds

Sample code to show an alert message and remove it (fade out) after N seconds. This is the code to insert inside script tag: $(document).ready(function () { window.setTimeout(function() { $(".alert-message-simple").fadeTo(1500, 0).slideUp(500, function(){ $(this).remove(); }); }, 4000);   });$(document).ready(function () { window.setTimeout(function() { $(".alert-message-simple").fadeTo(1500, 0).slideUp(500, function(){ $(this).remove(); }); }, 4000); }); And then you can write […]

Edit /etc/hosts on Mac OSX

Open Finder and from the Finder’s menu bar, select Go > Go to Folder, then type: /private/etc/hosts/private/etc/hosts A new Finder window will open and your Mac’s hosts file will be selected. Now just copy the file hosts to your Desktop and edit it from there. Then when done, just copy it back to /private/etc/ and […]

IP anonymization with analytics.js – Google Analytics

You can anonymize user’s IP with analytics.js Google Analytics like this: (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘GA_TRACKING_ID’, ‘auto’); ga(‘send’, ‘pageview’); ga(‘set’, ‘anonymizeIp’, true); </script> (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘GA_TRACKING_ID’, ‘auto’); ga(‘send’, ‘pageview’); ga(‘set’, ‘anonymizeIp’, true); </script> This code indicates the user’s IP is anonymized: ga(‘set’, ‘anonymizeIp’, true);ga(‘set’, ‘anonymizeIp’, true); Make sure to […]

IP anonymization with gtag.js – Google Analytics

You can anonymize user’s IP with Global site tag (gtag.js) like this: <!– Global site tag (gtag.js) – Google Analytics –> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date());   gtag(‘config’, ‘GA_TRACKING_ID’, { ‘anonymize_ip’: true }); </script><!– Global site tag (gtag.js) – Google Analytics –> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> <script> […]

Disable Affiliate Links (VGLNK) on Disqus

Disqus is the internet’s favorite comment plug-in that helps publishers increase engagement and build loyal audiences. It is free and is used by million of websites. However, recently we noticed an issue with their “Affiliate Links” option that was causing any text similar to a domain name (i.e abcdef.com) to be hyperlinked with this HTML […]

Delphi Scrollbox with Black Background on Windows XP

Problem: Delphi Scrollbox is completely black on Windows XP. Some Win XP users may experience strange behaviors with Scrollbar\Scrollbox. In particular they may see the background in black, example: To fix this issue just set ParentBackground to True on the Scroll component. If that still doesn’t work, try to put the Scrollbox inside a TPanel. […]

Simulate Multiple Monitors in VMWare guest

You can have one large host window with multiple monitors in the guest: 1) Power off the VM then go to VM > Settings > Hardware > Display 2) Select “Specify monitor settings”, and set “Number of monitors” to 2 or more. 3) Uncheck Autofit Guest by going to Edit > Preferences > Display. * […]