Web Development Posts

Setting up a Linode VPS

I have been on the hunt for a new host for a while now and, after many recommendations, decided to give Linode a go. Linode is a cloud based VPS provider. You get root SSH access and set everything up for yourself, with the exception of the Linux distribution, which can be installed with one click.

Subversion Branching and Merging for Sprints

On my current project, we create a branch at the beginning of each sprint and maintain a clean trunk. All code from the sprint is committed to the sprint branch. At the end of the sprint, we merge the sprint branch into trunk (assuming it passes QA). This is pretty much the same setup as feature branches. Here are a few notes and snippets for this type of setup.

Count of duplicate values in MySQL table

A client is using the Drupal node title module and, as part of an SEO review, I want to see how many duplicate meta titles there are.

PHP max_execution_time error with Drupal and XAMPP

I recently had a problem where PHP was timing out at 60 seconds when running a Drupal site using XAMPP on Windows (yeah I know, Windows and XAMPP sucks). I tried changing my php.ini file to 240 seconds, but it made no difference, it would still time out at 60 seconds. Here are the steps I made to fix this issue.

Open a link in a new window using jQuery

There are times when you pay want to force links to open in a new window. It could be to open terms and conditions, adverts or external links. Please note that some believe that you should never force a link to open in a new window as that decision should be left to the user. I will not debate this here, but rather explain how to do it should the need arise.

HTML table row click-able with link

You can not make a table row click-able using HTML alone. By click-able, I mean nesting an entire row inside an anchor tag

To move the contents of a directory to a parent directory, first navigate to the child directory and then run the command snippet below.

Setting the display property to inline is an alternative to setting the float property to left.

Using float left is a popular way to make a list horizontal. It tends to have less problems then the alternative, which is using display: inline.

This snippet will add jQuery that is hosted by Google.

This snippet will get the filename from the url. The filename is the last part of the URL from the last trailing slash. For example, if the URL is http://www.example.com/dir/file.html then
file.html is the file name.

It even has a watermark is an online gallery of interesting business cards. If you are stuck for inspiration for your next business card, check it out. If you have an amazing business card yourself, you can submit it to inspire others.

Smashing Magazine's excellent competition for creating a resume (CV) for a fictional web designer. The result is a collection of beautifully presented CV's. Great inspiration for the next time you need to update your CV!

It is a good idea to block access to .svn directories if you are using Subversion. Otherwise, anyone can read the files. Add the following snippet to your .htaccess file (in root directory of the website).

Example usage - if a field is a varchar and you need to sort by a number. It will sort it alpabetically, instead of numerically. Type casting will convert it to an altenative data type.

Here is an example of how to select some data from a table on one database and insert into a table of a different database. I am assuming that you are using the same mysql connection.

The MySQL USE command is used to select the appropriate database at the appropriate time. database1 is where the data is being selected from and database2 is where it is inserted to.

 

Modify an existing column to make it auto increment.

Backup a database from cron. Add the following to the cron tab.

Add new user to MySQL database. First, log into the MySQL console, and then run the following command, replacing databasename, username and password.

This is the command to restore a MySQL database.

To restore it on a local computer, follow this process:
1) Open the command line (Windows, Linux or Mac)
2) cd (change directory) to the directory where the mysql.exe is located. This is likely to be in a bin directory. For example, with WAMPserver, mysql.exe is located here:
c:\wamp\bin\mysql\mysql5.0.45\bin

Learn how to write custom Drupal modules

Does Drupal module development make your head explode and drive you crazy?

Why not learn from someone who has paved the way instead?

Sign up to Master Drupal 7 Module Development.

Hello!!

I am Blair Wadman and this is where I write about Drupal, PHP, CSS etc

Stuff

Syndicate

Syndicate content

© Blair Wadman
2005 - 2011