Five Ways to Boost Drupal’s Performance

Published on Jul 21, 2014   //  Development, Web Development

Drupal is a widely used and highly regarded content management system. At a time when every website owner is trying to squeeze a bit more speed out of their website, and reduce load times for users, the tips below will help you do just that.

We compiled these tips so that they address a variety of ways to help you increase site performance; these options are all easy to implement, and will keep your website in tip-top shape!

  1. Disable Drupal’s built-in Statistics module. The Statistics module writes data to your database on every hit, causing unnecessary resource usage. Opt for using an external analytics solution instead.
  2. Use an external cache service like CloudFlare, or Incapsula. Both services have free plans that include website performance enhancements and are easy to deploy.
  3. If you have pages that include images below the fold — news articles, blog posts, or slideshows — use a module that will load images only when a visitor actually views it. Modules like Image Lazyloader and Lazyload will help you here.
  4. Compress your Javascript and CSS files by using modules like Advanced CSS/JS Aggregation or Speedy.
  5. Disable and delete modules your Drupal site is no longer using. If you are not sure which modules your site is no longer using, or have a hard time determining which are no longer in use, try the Missing Module module.

We would love to hear your comments and feedback on how the tips above worked for you.

Web Development: Cross Browser Testing

Published on Jan 13, 2010   //  Development

Web Development

As you’ll quickly discover, not all browsers render equally. Due to differing implementations (opinions) on the (X)HTML/CSS specifications, one browser may display your content as expected, while another may not. As such, web developers are forced to test their websites in multiple browsers (and even multiple operating systems).

However, don’t rush out and start installing multiple browsers and operating system virtual machines just yet. There is a way to get a general idea of how your website looks in other browsers/operating systems. There are two web tools that allow us to get screenshots of our website rendered by a specified browser.

The first is Adobe BrowserLab. This service, by Adobe, can provide us with screenshots from Internet Explorer 6/7/8 (Windows XP), Firefox 2.0/3.0/3.5 (Windows XP), Chrome 3.0 (Windows XP), Safari 3.0/4.0 (OS X) and Firefox 2.0/3.0/3.5 (OS X). These browsers support Javascript and Flash, and even allow you to specify a delay to wait before taking the screenshot (to compensate for any animations or Javascript executing). BrowserLabs provides quick delivery of screenshots and easy comparision of screenshots with multi-views and rulers. An Adobe account required to use BrowserLabs.

Browsershots is another such service. Browsershots gives you a greater selection of browsers and more control over them. Providing almost every browser made in the last 25 years and their various versions. Browsershots allows you to specify your preferred screen size, colour depth and Javascript/Java/Flash version or disable. Browsershots’ screenshot delivery is slower than BrowserLab’s and those screenshots may not always be full-length.

Now that you can view your website in multiple browsers, across multiple operating systems, you can start the gruelling task of tweaking your code to conform to all browsers.

Moving Beyond SSH: Secure Delete

Published on Jan 12, 2010   //  Development
Off

Moving Beyond SSH

If you’re storing any confidential information on your server (or you’re just paranoid) you may need to securely delete it at some point. Let’s face it, you don’t want those plans for converting lead into gold to get into the wrong hands. Don’t fret though, your alchemy plans will be non-recoverable after running the shred tool.

This tool allows you to overwrite a file with random data (ones and zeros) a configurable number of times. This command line tool has the following syntax:

shred [OPTIONS] filename

The most common options you’ll use are as follows:

-n – The number of times you want to overwrite the file with random data. The United States Government defines 7 as the standard.
-u – Remove the file after overwriting (otherwise the file will still exists, just full of random data instead).
-z – Overwrite the data once more, this time just with zeros. This tries to make it less obvious that a file was overwritten.
-v – Verbose output (show progress).
-f – Forces permissions to allow writing. Likely not necessary in most scenarios.

For example, if you wanted to remove alchemy.pdf, you would use the following command (7 passes):

shred -n 7 -u -z -v alchemy.pdf

Which would output the following:

shred: alchemy.pdf: pass 1/8 (random)...
shred: alchemy.pdf: pass 2/8 (555555)...
shred: alchemy.pdf: pass 3/8 (aaaaaa)...
shred: alchemy.pdf: pass 4/8 (random)...
shred: alchemy.pdf: pass 5/8 (ffffff)...
shred: alchemy.pdf: pass 6/8 (000000)...
shred: alchemy.pdf: pass 7/8 (random)...
shred: alchemy.pdf: pass 8/8 (000000)...
shred: alchemy.pdf: removing
shred: alchemy.pdf: renamed to 00000000000
shred: 00000000000: renamed to 0000000000
shred: 0000000000: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: alchemy.pdf: removed

Now you can be rest assured that nobody will know why you buy so much lead.

WordPress Development: Managing Plugins through Subversion

Published on Jan 5, 2010   //  Development

WordPress Development

WordPress has included the functionality to allow you to update plugins automatically since version 2.7. This works well for most setups, but what if you want a little more control over the upgrade process. Maybe you want to see the code changes between your version and the new version and merge any code changes you have made?

The answer is to install and upgrade your plugins with SVN, through the command line. Every plugin hosted in the official WordPress Plugin Repository has a Subversion repository which stores the plugin’s files. We can use these repositories to “check out” the files into our wp-content/plugins folder. Once the files have been downloaded to your plugin directory, you can then activate it in your WordPress administration panel.

Once you have found a plugin that you would like to install in the plugin repository, take note of its URL slug. We’ll need this for determining the URL of the Subversion repository. For example, the WP Super Cache plugin (http://wordpress.org/extend/plugins/wp-super-cache/) has a URL slug of wp-super-cache (the last part of the URL). The root of the plugin’s SVN repositories is located at: http://plugins.svn.wordpress.org/. You simply append a plugin’s URL slug to the end of this URL, and you will have the location of its repository.

Now that we have the Subversion repository, we need to figure out where the latest version of the plugin is stored. A Subversion repository typically has three directories in its root: branches, tags and trunk. Normally, active plugin development is done under trunk, while tags contain directories of stable releases. Branches may contain directories that encase older-than-trunk development releases. Typically, under this system, you could check out the highest number under tags to download the most recent version. However, not all developers follow this “standard”. Some may only have their plugin under trunk, and only “check in” release ready code. To find out which system the developer is using, open the readme.txt file under trunk. Under the first section in that file, look for a line that starts with “Stable tag”. If you find this line, you can get the latest stable release by “checking out” that number from the tags directory. If this line doesn’t exist, you can assume that the trunk directory contains the stable version of the plugin, and that you should “check out” trunk.

As for actually “checking out” these plugins, you’ll first need to SSH into your server and `cd` into your wp-content/plugins file. You can then run a command such as the following:

svn co http://plugins.svn.wordpress.org/wp-super-cache/tags/0.9.8/ wp-super-cache

Which would load the WP Super Cache plugin files into a directory named “wp-super-cache”. You can then head to your WordPress administration panel and activate the plugins.

When it comes time to upgrade a plugin, it’s a similar process. If you previously checked out a tag (run `svn info` if you don’t remember), just find the latest version number to determine the new Subversion URL. For example, if WP Super Cache 0.9.9 were to be released, I could upgrade to it by `cd`ing into its directory and running:

svn sw http://plugins.svn.wordpress.org/wp-super-cache/tags/0.9.9/

Which will switch the working repository to the new version of the plugin, merging the changes into your current files.

If you checked out from trunk before, you can just run the following to update:

svn up

If you plan on making custom modifications to plugins you install, managing them via Subversion is the best route to take. You’ll be able to view the differences (run `svn help diff` for details on this) and have Subversion merge them together automatically. Not to mention, you’ll also enjoy faster installs and upgrades.

Everything PHP: Multiple Table Joins

Published on Dec 30, 2009   //  Development

Everything PHP

Continuing our series on MySQL table joins, today we’ll be taking a look at how to join multiple tables together. You may need to join multiple tables when you have data spread across multiple tables with reference points relating them.

The syntax for joining multiple tables versus two tables is similar. You may even recognize some of the operators from previous articles. First, let’s have a look at a two table join:

[sql]SELECT * FROM table1 JOIN table2 ON table1.id = table2.id[/sql]

With a multi-table join, we will need a field in the “joining tables” that will relate to a field in the initial table. These matching fields do not need to be the same for each “joining table”. Now, let’s take a look at our feature presentation:

[sql]SELECT * FROM table1 JOIN (table2, table3, table4) ON table1.id = table2.id AND table1.name = table3.name AND table1.email = table4.email[/sql]

There is no hard limit on the number of tables you can join; however, there is a practical limit. If you’re joining more than ten tables together, you may want to look at alternate methods, such as multiple queries. If you’re joining more than ten tables constantly in one application, your data may be spread across too many tables, and you may want to look at combining some of them.

Next week we’ll be going over the different types of joins (left, right, outer, inner, natural).

Tip: If you have phpMyAdmin installed on your server, you can easily run SQL queries by selecting a database and going to the “SQL” tab at the top of the page.

Web Development: Programming Software

Published on Dec 15, 2009   //  Development

Web Development

Basic text editors were likely your initial choice for writing your programming in. Default operating system programs such as Notepad (on Windows) and TextEdit (on Mac OS X) work great for programming. Their minimalistic feature set and interface won’t get in your way and let’s you get straight to the point of the programs: writing. Unfortunately, their main strength, minimalism, it also their main weakness.

Notepad and TextEdit just don’t provide the features that can make programming faster and more pleasant. Features such as syntax highlighting, line numbering and code completion can all make programming just a little bit easier (and easier on the eyes). Below is a list of code editors and any outstanding features.

Notepad++ (Windows)
Tabbed documents, macros, auto-completion API. Open source (GPL). Free.

jEdit (Java based – Windows, Linux, Mac)
Macros, tabbed documents, code folding, location markers, session persistance, plugin manager. Open source (GPL). Free.

Programmers Notepad (Windows)
Code folding, project support, text clips. Free.

TextWrangler (Mac)
“Grep-format” searching, file differencing, FTP support, document sidebar. Free.

Coda (Mac)
Projects, text clips, auto-completion, file differencing, FTP support, Subversion integration, HTML/CSS preview, “drag and drop” grep searching, live collaboration. $99

Dreamweaver (Windows, Mac)
Mostly point and click web design software, however it does include a code editor. Notable features: built-in FTP, Subversion integration, live-view (for HTML/CSS), code completion. $399.

Obviously we’re just scratching the surface with this list (and the listed features). What’s your favourite code editor, and why?

Page 1 of 4212345...102030...Last »