This is a small script which was created about a year ago after a trip to Dominos where a few of my friends (Maths Degree Students) and I noticed Dominos claim on the number of combinations possible with their pizza toppings, naturally we all wanted to prove/disprove the figure… and along the way the Domino’s Pizza Chooser was born. Put simply it generates a random pizza combination using both Size, Base, Sauce and Toppings. Give it a whirl!
Author: Dan
Top 5 Tips for making your site faster!
Speed is vital for modern websites, particularly those which deals with e-commerce, every ms (millisecond) counts, and it all adds up and is a big turn off for prospective customers.
Recently I optimised the site of my UK Web Hosting business XDnet.co.uk before I started work the site was, well abysmal when it comes to speed. The Pingdom putting it at 14-16 seconds, slower than 90%+ of sites according to Pingdom, before the page fully loaded with some basic optimisation techniques and a little bit of work I’ve gotten this down to 1.67 seconds.
1. Minify it!
Compressing your code down is one of the simplest ways to gain a few precious milliseconds and it’s dead easy as there are plenty of tools you can use to compress your CSS and Javscript files.
Javascript:
www.minifyjavascript.com is a nice simple tool to use, simply copy and paste your JS file into the box and hit compress and it will squeeze it down to as small as possible.
CSS:
www.minifycss.com/css-compressor/ is a fantastic tool with loads of useful settings to help manage the way it compresses the CSS to ensure efficiency and even improves your CSS code!
Note: With both JS and CSS compression you should ALWAYS ensure you keep a uncompressed copy for future changes. It’s a good idea to simply save the compressed versions as <filename>.min.css as this will help you easily identify the versions in future.
2. Combine, Merge, Reduce!
Combining your CSS and Javascript files into as few files as possible can have a big impact on speed as it can massively reduce the number of requests you need to make and cuts out all of the DNS lookup, connect & wait time involved in making requests.
In most cases combining CSS & Javascript is fairly simple, but you do need to be careful that it doesn’t cause any oddities in the way your site renders, as you may find that placing a block of CSS before another causes a different output than expected because 1 overrides the other – Just give things a good check over and test it out just incase!
3. Content Delivery Network (CDN) static content
CDNs can be useful, but should be used with care, they aren’t a magic solution and can in-fact slow down your site if you don’t use a good CDN service.
Personally I snapped up a free TB of data with MaxCDN during their speedawareness month and have been testing that out, the results in speed improvements do vary depending on your location as in some cases it is a few ms faster when delivered directly from the server, but overall on a global scale it does improve the average speed.
Ideally you want to be serving all static CSS, JS and Images over CDN for the best results. This can also help with other slow-down factors such as paralleled downloads across hostnames.
4. Parallelize Downloads across hostnames/domains
As specified in HTTP 1.1 browsers have a limit on the number of concurrent connections they make to hostnames, this generally seems to vary between 2 and 20.
This often means if you have a lot of files on the same hostname/domain e.g. mysite.com/images/ then the browser will connect to the first X items to download, and the rest have to wait for the first batch to finish before they can start. By spreading the files across multiple hostnames, such as cdn.mysite.com/images/file.png and cdn2.mysite.com/images/otherfile.png – this can help speed things up by allowing for more objects to download in parallel. This method does have limitations, and should be tested as the DNS lookup time can counteract the benefits so it’s worth checking.
Learn more from the Google Speed docs.
5. Your code sucks. Fix it.
A big time suck for my site was a few poor coding choices which caused unnecessary wait time while PHP did it’s thing to generate the page. The killer was lookup requests grabbing the latest tweet & blog posts to display.
These were adding 5 seconds+ for most page loads – very simply moved these to the client side using some nifty Javascript so that they are loaded after the page has begun rendering.
There are also numerous other ways to optimise your code but it’s important to give everything an eye over it’s often surprising just how much basic code improvements can improve your site speed.
Hope these tips have helped, if they have or if you have any more tips please leave a comment below, or tweet me @dansgalaxy
How to secure a cPanel server against BEAST attacks
Last year a previously theoretical attack surfaced which can allow TLS security to be manipulated and weakened, it’s a simple attack and one which a simple configuration change can patch. Learn more about the BEAST attack on TLS here.
To patch Apache in cPanel is a simple 2 step process.
Step 1:
Login to WHM and navigate to: Service Configuration -> Apache Configuration -> Global Configuration
Here select the custom option for “SSL Cipher Suite” and enter the following:
ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH
Click Save, then click, Rebuild Configuration and Restart Apache to compile the config change.
Step 2:
In WHM navigate to: Service Configuration -> Apache Configuration -> Include Editor
Select “All Versions” under the “Pre VirtualHost Include” section.
In the text box enter the following:
SSLHonorCipherOrder On
Click Update, then Restart Apache.
Your cPanel server should now be patched against the BEAST TLS attack, you can verify this using a security checking tool such as SSLLabs.
Tools: Pingdom Probe IPs
Pingdom helpfully offer a RSS feed of their monitoring nodes (https://www.pingdom.com/rss/probe_servers.xml) unfortunately, it’s messy, poorly constructed and not simple to extract a nice list of IPs out of so you can add them to your firewalls.
I created a simple script which extracts the IPs from this XML feed and present a list of IPs in both plain-text and HTML.
The output can easily be copied into the allow list in your firewall configuration and the list is updated real-time from Pingdom themselves!
Plain Text: https://scripts.dan.cloud/pingdom/probe_ips.php
HTML: https://scripts.dan.cloud/pingdom/probe_ips.php?html
HTML Output (in iframe):
Coming soon: WHMCS Scheduler
Often when running a web hosting business you find you want to make changes such as price or even configurations at a specific time, and sitting at the PC 24/7 isn’t always the best option.
I’ve been developing the “WHMCS Scheduler” which enables me to easily schedule database changes, which are then executed by minutely cron.
At the moment I am looking at having “Add” types, Domain Price change, Product Price change and “raw” db change.
The module isn’t quite ready for release yet as I am looking at making the add forms much prettier (as you can see it’s a quite ugly). I’m also looking to add a lot more features to enable web hosts to easily configure and manage changes, and making it all much more user-friendly.
Any comments on this, or suggestions PLEASE leave in the comments or contact me directly as it will all help make the first released version awesome. 🙂
I Really Hate It When.com
I was developing this site for my college IT project. It is designed to follow “Web 2.0” principles and is designed to incorporate a lot of AJAX functionality, creating smooth user interaction with the backend of the system.
VPS247 Server Module
This was my first public module for WHMCS, the VPS247 Module enables easy integration with the vps247.com VPS platform and enables complete control over the Virtual Machines to enables easy provisioning and management of your customers VMs.
This module includes a huge variety of features and really takes advantage of the VPS247 API, and even uses some not yet documented API functionality to provide an great tool for resellers and other hosts wishing to utilise the platform.
For more details please see WHMCSExtra.com
XDnet.co.uk
XDnet Web Services is one of my businesses, I developed the site, with some external support for minor graphical work.
The site includes numerous functionality and the billing/ordering/client system and also the blog has been integrated into the site design providing a consistent professional image throughout.
Hello DanRodgers.pro
Welcome to my new home on the web, DanRodgers.pro!
With a brand new domain and an awesome new design I hope this site can properly showcase my projects past and present, while providing a central hub for all things Dan.
I will be doing my best to keep the blog updated with the projects I am currently working on as well as details on new releases and some useful code snippets, scripts and other interesting stuff. Watch this space.
Dan
Caption Fixer – WordPress Plugin
Caption Fixer is a simple WordPress Plugin which removes the 10px margin which the WordPress Core automatically adds to [caption].
In the next release I will be adding the ability for the user to define a custom margin instead of simply removing it.
Check out the plugin in the WordPress repository – http://wordpress.org/extend/plugins/captionfixer/
If you find this plugin useful, why not Buy me a coffee?
Caption Fixer is a simple WordPress Plugin which removes the 10px margin which the WordPress Core automatically adds to image captions.
http://wordpress.org/extend/plugins/captionfixer/