Archive for the ‘web development’ Category

Mysql db commands

May 5th, 2012 Comments off

Dump ALL MySQL Databases

mysqldump –user=XXXXXXXX –password=XXXXXXX -A > /PATH/TO/DUMPFILE.SQL

Dump Individual or Multiple MySQL Databases

mysqldump –user=XXXXXXXX –password=XXXXXXX –databases DB_NAME1 DB_NAME2 DB_NAME3 > /PATH/TO/DUMPFILE.SQL

Dump only certain tables from a MySQL Database

mysqldump –user=XXXXXXXX –password=XXXXXXXX –databases DB_NAME –tables TABLE_NAME > /PATH/TO/DUMPFILE.SQL

make dumps compatible with the old MySQL version, add the following switch:


Put Myqsl database back

mysql –verbose –user=XXXXXXXX –password=XXXXXXXX DB_NAME < /PATH/TO/DUMPFILE.SQL

Categories: web development Tags:

PHP 5.1 date(): getdate(): and assorted Time Zone errors

January 31st, 2011 No comments

Ok So you have your Apache server WIth PHP installed and you keep getting this error on your sites

date(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘GMT/0.0/no DST’ instead


getdate(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘GMT/0.0/no DST’ instead

It turns out your shiny new server set up has changed if your using PHP 5.1 or greater you now need to tell php what time zone to use.

Rather than editing all your sites / scripts just update your .htaccess with

php_value date.timezone Europe/London

You can also set the default time zone in your php.ini file if you have access / the script should revert to UTC or GMt as it used to be but you will get the E_warning as above.

replacing Europe/London with the appropriate time zone for your server see full list:

Categories: Latest, web development Tags: , ,

How to order posts by number of Facebook Likes

November 10th, 2010 No comments

I was recently asked to produce a facebook “like” page where by the website owner could add entries and visitors could like those entries via facebook. The entries could then be displayed in order of most likes. see

Afetr a brief discussion the cient told me they have used wordpress before and where comfortable using it, so hey lets build the site for wordpress.

First off we need somewhere to store our number of facebook likes against the post so add the following to functions.php

function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, '_my_key', '0', true);
add_action('publish_page', 'add_custom_field_automatically');
add_action('publish_post', 'add_custom_field_automatically');

This will automatically add a custom field called _my_key to any new posts with a default value of “0” the reason for the _ before my_key is to hide the custom field from the post editor.

Next you’ll need to add the facebook like button to your code no use adding the button from you have to write your own add this code where you want the button to appear inside the Post loop:

<div class="fb_like_div"></div>

Next we need to check how many likes we have against each post and update the custom field we created at the beginning “_my_key”.
This code is for Satndard Permalinks e.g p?=123.
For nice permalinks use the code underneath!
You can add this to your header.php file:

global $wp_query;
$Magic_no = $wp_query-&gt;post-&gt;ID;

$data = file_get_contents(''.bloginfo('url').'?p='. $Magic_no);

$json = $data;

$obj = json_decode($json);
$like_no = $obj-&gt;{'shares'};
$meta_values = get_post_meta($Magic_no, '_my_key', true);
//$meta_values = 1;
//if ($like_no == '2') {
//echo $meta_values;
if ($like_no == $meta_values) {

} else if (empty($meta_values)) {
add_post_meta($Magic_no, '_my_key', $like_no, true);
update_post_meta($Magic_no, '_my_key', $like_no, false);

} else {
update_post_meta($Magic_no, '_my_key', $like_no, false);


Code for nice permalinks:

global $wp_query;
$Magic_no = get_permalink();
$Magic_no_postid = $wp_query-&gt;post-&gt;ID;
//echo get_permalink();
$data = file_get_contents(''. $Magic_no);

$json = $data;

$obj = json_decode($json);
$like_no = $obj-&gt;{'shares'};
$meta_values = get_post_meta($Magic_no_postid, '_my_key', true);
//$meta_values = 1;
//if ($like_no == '2') {
//   echo "Number of Likes".$meta_values;
if ($like_no == $meta_values) {

} else if (empty($meta_values)) {
add_post_meta($Magic_no_postid , '_my_key', $like_no, true);
update_post_meta($Magic_no_postid , '_my_key', $like_no, false);

} else {
update_post_meta($Magic_no_postid, '_my_key', $like_no, false);


Now to display the posts Create a new page template and add this betwee the get_header and get_posts:

<!--?php<br /--> $featuredPosts1 = new WP_Query();
while ($featuredPosts1-&gt;have_posts()) : $featuredPosts1-&gt;the_post(); ?&gt;
<div id="list_wrapp_inner"><a href="&lt;?php the_permalink(); ?&gt;">
<div id="list_wrapp_1_storycontent"><!--?php the_content(); ?--></div>
</a><a href="&lt;?php the_permalink(); ?&gt;"></a>
<div class="fb_like_div"></div>
<!--?php endwhile; ?-->
Categories: web development, Wordpress Tags:

iOS 4.1 and 4.2

October 22nd, 2010 No comments

iOS 4.1 is available for download from apple so get your iPhones, iPods, and iPads updated.

iOS 4.2 is available as of November 2010 I’ll be writing about that soon also.

As well as the usual bug fixes iOS 4.1 also has some brand new features!

A new Camera App

A new button that turns on HDR mode.

Take great photos that capture a wider range of light intensity using the new high dynamic range (HDR) setting on iPhone 4, which automatically combines multiple exposures into a single HDR image.

The restriction on uploading High Def video directly from the iPhone has been removed.

Upload HD video to YouTube and MobileMe from your iPhone 4.

The addition of game center.

iOS 4 introduces the Game Center app. An out-of-the-box social gaming network for iPhone 4 and iPod touch.1 Invite friends to join. Then totally crush them. Take a look at how your score ranks among your friends and other players of each game. Compare game achievements with your friends. Get matched up and put together a select group of friends to play. Or choose to automatically go up against people you don’t know in a multiplayer game. Read More here >>

Face Time.

FaceTime is just another way iOS 4 seamlessly integrates hardware and software to make every iPhone feature as easy to use as it is groundbreaking. Now when you wish your friends could be there, they actually can be. With just a few taps, you can see your friends and family while you talk to them — iPhone 4 to iPhone 4 or new iPod touch over Wi-Fi.

Watch a cut down Keynote here:

If you have a spare two hours watch it in full:

Categories: web development Tags: , , , ,

It’s here Or maybe not Html5

October 21st, 2010 No comments

So Html5 isn’t due for release untill 2022 but sites like facebook are already using it?

Html5 is till being developed by the web Hypertext Application technology working group, and developemnt is still currently at “Working Draft – Last Call” the second of five total recommendation levels.

The basics are safari, Chrome, Firefox and no Internet Explorer (version 9) are using Html 5 on an increasing level and these technologies are being adopted by an increasing number of sites so we could argue Html 5 is here already albeit in Beta.

What can I do with Html5 that I couldn’t do before with Html 4 and some plugins?

Thats just it you don’t need the plugins,

But if the plugins are available why not just use them?

As plug ins are not set by an independent body as an industry standard they will not necessarily be available on all platforms, and in the case of Flash and Divx they can be very hardware intensive regularly causing crashes on lower spec machines.

So what is available with Html5 and where can I see some examples?

The biggest changes are media markup tags such as <audio>, <video>, and <canvas>.

We can see the audio tag in use here: Note you’ll want to get a html5 browser such as safari or chrome, opened to enjoy these examples.

The video tag has been adopted by Youtube, BBC iPlayer, and vimeo.

The canvas tag is at work, with gmail, and scribd.

So you lke wat you hear?

Here’s some of the best examples on the web currently of html5.

This site is using it all <canvas>, <audio>, and <video>

I like what I see how do I learn how?

Here are the latest tutorials from Html 5 Rocks .com

RSS Content

Categories: web development Tags:

Server Technology

October 8th, 2010 No comments

I’ve often found cause to complain at the slow uptake of the latest serevr technologies when working on different projects.

I take it all back…

9 hours into re-compiling Apache and php on Mac os X server.

Categories: web development Tags: