Archive for the ‘Programming’ Category

Updating Large Datasets in MySQL

I’ve been building a PHP script to import an XML file every 24 hours into a MySQL database using a CRON job.
The table contains almost 150,000 rows of data, each with a unique ID (primary key).

Read more on Updating Large Datasets in MySQL…

The new “Press Enter to Submit” Facebook Comments System

Today Facebook rolled out a change to their comments system.

The “Submit” button is now missing, and pressing the “Enter” key no longer adds a new line, it submits the comment.

Read more on The new “Press Enter to Submit” Facebook Comments System…

How to Add Up/Down Swipe Functionality to Sencha Touch

Whilst working with the Sencha Touch mobile JS framework, I was disappointed to find that it only handles left/right swiping.

The application I’m working on requires swiping up/down/left/right to navigate, so I needed to add this functionality to the code. It was simple enough to hack the Sencha Touch JS file, but this would have prevented me from upgrading as future versions are released.

Read more on How to Add Up/Down Swipe Functionality to Sencha Touch…

How to send mail from a Google Apps Group/List

If you use Google Apps for your domain, sometimes you have a “group” setup, such as info@yourdomain.com.

Mail sent to info@yourdomain.com is then forwarded to the members of the group, such as chris@yourdomain.com.

Read more on How to send mail from a Google Apps Group/List…

How to Remove Font Styles in TinyMCE

I use TinyMCE Editor on several of my projects, and I regularly have a problem with my users pasting content from Microsoft Word etc.

This means that I usually end up with multiple ugly font styles on the page that don’t match.

Read more on How to Remove Font Styles in TinyMCE…

How to add an “Invite” tab to a Facebook Page

I was asked today how to add a tab to a Facebook Page to allow your fans to suggest the page to their friends.

Here’s the code:

<fb:request-form method="GET" type="YOUR PAGE" invite="true" content="DESCRIBE YOUR PAGE">
<fb:req-choice url="http://www.facebook.com/YOURPAGE" label="Check out!" />
<fb:multi-friend-selector actiontext="Tell your friends about YOUR PAGE" rows="5" cols="3" showborder="false" />
</fb:request-form>

Obviously you’ll need to add the new Static FBML tab to your page first, I won’t explain how to do this.

Read more on How to add an “Invite” tab to a Facebook Page…

Why I’m ditching vBulletin for IP.Board

My website Blues Brothers Central has had a forum since early 2004. Initially I wrote my own basic forum, but it became clearly soon afterwards that it needed something more powerful.

Read more on Why I’m ditching vBulletin for IP.Board…

PHP Variable Preparation Function for MySQL

This is a handy PHP function I wrote to prepare values for insertion into a MySQL database.

For example, if you prefer to use arrays of data and have a function automatically join them together:

$data = array();
$data['field1'] = 'value1';
$data['field2'] = 'value2';
$sql = build_sql_insert('table',$data);
// Returns INSERT INTO `table` (`field1`, `field2`) VALUES ('value1', 'value2');
$sql = build_sql_update('table',27,$data);
// Returns UPDATE `table` SET `field1`='value1', `field2`='value2' WHERE `id` = 27 LIMIT 1;

Read more on PHP Variable Preparation Function for MySQL…

A Plea on Behalf of Web Developers Everywhere!

Why are there still so many people using Internet Explorer 6? It was released in 2001, since then IE7 and IE8 have been released. Windows Update has provided updates for the browser, doesn’t anyone update their operating system?

Read more on A Plea on Behalf of Web Developers Everywhere!…

How to import a large SQL file into MySQL

As a PHP/MySQL developer I’m regularly having to download backups of my databases, and occasionally I have to import them back into MySQL.

The problem is that phpMyAdmin has a file size limit for uploading an SQL file (usually 8MB, depending on your server configuration). Some MySQL backup files are in the hundreds of MegaBytes!

Read more on How to import a large SQL file into MySQL…

Powered by WordPress