Hello,
I've Just Launched a New Website, Solely Focused on Free UK Competitions.
Please Check it out and Let Me Know What You Think? Thanks.
Free UK Competitions You can Enter Now Online!
All the Best, Andy
Director at https://sotondigital.com/ - Here's one of the websites I created. This website solely focuses on Free UK Competitions: https://freeukcompetitions.com/ Experience in a range of direct and digital marketing techniques. Google AdWords Certified and I hold a BA(Hons) Business & Finance degree (2:1).
Friday, 22 November 2019
Monday, 26 November 2018
How to Clear Error & Access Logs on Ubuntu 16.04 Apache Server
Here is an example of the terminal commands to clear error logs and access logs. Remember to update the file paths to the location of your error/access log/s.
Original Article Posted On: https://andycorby.com/clear-error-access-logs-ubuntu-16-04/
sudo bash -c ‘echo > /var/www/html/logs/error.log’sudo bash -c ‘echo > /var/www/html/logs/access.log’
Original Article Posted On: https://andycorby.com/clear-error-access-logs-ubuntu-16-04/
Some Programming Best Practices for Productivity
Here are some of my thoughts on programming best practices to improve productivity.
YAGNI: “You Ain’t Gonna Need It”. Don’t write code that you think you might need in the future but don’t need yet. This is coding for imaginary future use cases and the code could become dead code or need rewriting because the future use case could turn out to work differently from how you imagined it.
Comments & Console Logs: When comments are used they should be used to explain why the code is there, not what it’s doing as that can be read in the code itself. Blocks of commented code shouldn’t exist in productions releases. This is also true for testing console log statements which should not make it to production releases.
Testing: Test all changes. Only if there is a very good reason should code be left untested. Lack of time is not a good reason and can end up costing more time. Possible good reasons include: genuinely un-testable (in any meaningful way), impossible to hit in practice, or covered elsewhere in a test. Code without tests is a liability.
Code is the Enemy: Code can go wrong and it needs maintenance, so try to write less code, delete code, and don’t write code you don’t need.
Write Defensively: Always think about what can go wrong, what will happen on invalid input, and what might fail, this will help you catch many bugs before they happen.
DRY: “Don’t Repeat Yourself”. If the same code is being repeated multiple times consider putting it in a reusable function. This is more important in production files and not as important in test files, keeping code and what could go wrong in the production environment to a minimum.
Correct VS Speed: Make code correct first and fast second. The top priority is to write code that works and has been confirmed with test. The second priority is the performance and speed of the code (within reason, provided it is not excessively slow code which will cause issues).
Standard Format: It is good to have a standard format (use of indentation, spaces, blank lines, comments) all developers on a project work to, in order to help improve fast readability and help reduce development time.
Original Article Posted On: https://andycorby.com/some-programming-best-practices-for-productivity/
YAGNI: “You Ain’t Gonna Need It”. Don’t write code that you think you might need in the future but don’t need yet. This is coding for imaginary future use cases and the code could become dead code or need rewriting because the future use case could turn out to work differently from how you imagined it.
Comments & Console Logs: When comments are used they should be used to explain why the code is there, not what it’s doing as that can be read in the code itself. Blocks of commented code shouldn’t exist in productions releases. This is also true for testing console log statements which should not make it to production releases.
Testing: Test all changes. Only if there is a very good reason should code be left untested. Lack of time is not a good reason and can end up costing more time. Possible good reasons include: genuinely un-testable (in any meaningful way), impossible to hit in practice, or covered elsewhere in a test. Code without tests is a liability.
Code is the Enemy: Code can go wrong and it needs maintenance, so try to write less code, delete code, and don’t write code you don’t need.
Write Defensively: Always think about what can go wrong, what will happen on invalid input, and what might fail, this will help you catch many bugs before they happen.
DRY: “Don’t Repeat Yourself”. If the same code is being repeated multiple times consider putting it in a reusable function. This is more important in production files and not as important in test files, keeping code and what could go wrong in the production environment to a minimum.
Correct VS Speed: Make code correct first and fast second. The top priority is to write code that works and has been confirmed with test. The second priority is the performance and speed of the code (within reason, provided it is not excessively slow code which will cause issues).
Standard Format: It is good to have a standard format (use of indentation, spaces, blank lines, comments) all developers on a project work to, in order to help improve fast readability and help reduce development time.
Original Article Posted On: https://andycorby.com/some-programming-best-practices-for-productivity/
The Great Firewall of China – SSL Certificates
When Search Engine Optimising a Chinese website for the main Chinese search engine Baidu, there are benefits to having a .cn domain name and having a server located within the Great Firewall of China.
From what I understand the Chinese government censors web pages by intercepting the connection between a server and the end user. If a web page does not pass their censorship then the page could be edited or not displayed to the user.
Whilst having an SSL certificate protects users data it can stop the Chinese government from censoring individual web pages so if a page does not pass censorship then a whole website may be blocked. Therefore, you may want to consider your SSL set up carefully and whether you will force HTTPS when setting up a server within the Great Firewall of China.
Useful Article: https://jpgamboa.com/ssl-usage-china/
Original Article Posted On: https://andycorby.com/the-great-firewall-of-china-ssl-certificates/
From what I understand the Chinese government censors web pages by intercepting the connection between a server and the end user. If a web page does not pass their censorship then the page could be edited or not displayed to the user.
Whilst having an SSL certificate protects users data it can stop the Chinese government from censoring individual web pages so if a page does not pass censorship then a whole website may be blocked. Therefore, you may want to consider your SSL set up carefully and whether you will force HTTPS when setting up a server within the Great Firewall of China.
Useful Article: https://jpgamboa.com/ssl-usage-china/
Original Article Posted On: https://andycorby.com/the-great-firewall-of-china-ssl-certificates/
Free Website Optimisation Tools
Here is a list of some free useful Google website optimisation/analysis tools:
Here are some further free useful website optimisation/analysis tools:
Original Article Posted On: https://andycorby.com/free-website-optimisation-tools/
- Google Analytics
- Webmaster Tools
- Mobile Friendly Test
- AMP (Accelerated Mobile Page) Test
- Page Speed Insights
- Structured Data Testing
- Open-source Apache and Nginx Server Modules to automatically optimize your site
Here are some further free useful website optimisation/analysis tools:
Original Article Posted On: https://andycorby.com/free-website-optimisation-tools/
How to Set Time Zone on Ubuntu 16.04 Apache Server
Here we’ll cover how to set the default time zone on your Ubuntu 16.04 Apache Server.
First, open your php.ini file (found within the /etc/ directory) in a plain text editor, your file path could vary but here are a couple of example of possible file paths:
Find the following line in the php.ini file. If there’s a semi-colon at the start of this line then remove the semi-colon to uncomment this.
Set date.timezone equal to your continent and main city, a list of all available time zones can be found at http://php.net/manual/en/timezones.php
For Example:
Save your php.ini file and then restart Apache using the following command in terminal:
Original Article Posted On: https://andycorby.com/set-time-zone-ubuntu-16-04-apache-server/
First, open your php.ini file (found within the /etc/ directory) in a plain text editor, your file path could vary but here are a couple of example of possible file paths:
/etc/php/7.0/apache2/php.ini/etc/php.ini
Find the following line in the php.ini file. If there’s a semi-colon at the start of this line then remove the semi-colon to uncomment this.
date.timezone =
Set date.timezone equal to your continent and main city, a list of all available time zones can be found at http://php.net/manual/en/timezones.php
For Example:
date.timezone = Europe/London
Save your php.ini file and then restart Apache using the following command in terminal:
service apache2 restart
Original Article Posted On: https://andycorby.com/set-time-zone-ubuntu-16-04-apache-server/
How to Install a Free LetsEncrypt SSL Certificate on Ubuntu 16.04 Apache Server
Here are the terminal commands to set up a free LetsEncrypt SSL certificate on Ubuntu 16.04 Apache server.
First run these commands in terminal:
Now you will be able to install multiple free LetsEncrypt SSL certificates by running the following terminal command for each of the domains on your server, replacing example.com with the domain you want an SSL certificate for.
If you want to force HTTPS then don’t forgot to update the .htaccess file for each website your want to force HTTPS on.
It’s also worth noting that when installing multiple LetsEncrypt SSL certificates on a server you may need to edit the following file manually to ensure each of the domains is included in this file. I’ve found when installing multiple LetsEncrypt SSL certificates on the same server it can overwrite the first entry in this file.
Useful Resources
First run these commands in terminal:
sudo apt-get updatesudo apt-get install software-properties-commonsudo add-apt-repository ppa:certbot/certbotsudo apt-get updatesudo apt-get install python-certbot-apache
Now you will be able to install multiple free LetsEncrypt SSL certificates by running the following terminal command for each of the domains on your server, replacing example.com with the domain you want an SSL certificate for.
sudo certbot –apache -d example.com -d www.example.com
If you want to force HTTPS then don’t forgot to update the .htaccess file for each website your want to force HTTPS on.
It’s also worth noting that when installing multiple LetsEncrypt SSL certificates on a server you may need to edit the following file manually to ensure each of the domains is included in this file. I’ve found when installing multiple LetsEncrypt SSL certificates on the same server it can overwrite the first entry in this file.
/etc/apache2/sites-available/000-default-le-ssl.config
Useful Resources
- https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04
- https://certbot.eff.org/all-instructions/#ubuntu-16-04-xenial-apache
Original Article Posted On: https://andycorby.com/install-letsencrypt-ssl-certificate-ubuntu-16-04/
Subscribe to:
Posts (Atom)
