Category Archives: rand()

My iMac First World Problem

I love my iMac, seriously love it. One of the most expensive things I’ve ever bought (it was top spec!) and also one of the absolute best things too but one thing that I think has been over looked by it was the position of the headphone jack, in the back of the screen.

Sure its probably not a massive problem if you have headphones with a long cable but aren’t they all relatively the same size? Anyway. This does my head in; the cable comes from the back of the screen, falls over the keyboard or is in the way of the mouse and it makes me rage quit so hard!

RAGE
Continue reading

My iPad Mini Review

I bought one, it looks exactly like the one picture above. Its amazing, buy one. In fact, buy two. They are that good!

A wee refresh

Not sure if I like it….

Migrate Expression Engine to WordPress

I was recently asked to migrate an Expression Engine install over to WordPress, naively I said yes and thought “there’ll be an app for that”. There are a bunch of blog posts about it, all which make you do crazy amounts of things to get it work and I don’t know anything about Expression Engine so the best thing to do was a database export/import.

The code I’ve created below uses a good amount of custom fields, both in EE ( i think ) and in WP to manage the data in a logical way, but if you have half an idea of what you are doing you should be able to read the code and figure it out :)

[php]
## SELECT THE WEBLOGS FROM EE
$exp_q = mysql_query(“SELECT * FROM `exp_weblog_data` WHERE `weblog_id` = ‘4’ ORDER BY `entry_id` ASC”);
while($exp = mysql_fetch_array($exp_q)):

## SELECT THE EXTRA DATA FROM THIS OTHER FIELD
$exp_extra_q = mysql_query(“SELECT * FROM `exp_weblog_titles` WHERE `entry_id` = ‘”.$exp[‘entry_id’].”‘ AND `weblog_id` = ‘4’”);
$exp_extra = mysql_fetch_array($exp_extra_q);

// ORDER ALL THE FIELDS
// $exp[‘field_id_5’] // EVENT SUMMARY
// $exp[‘field_id_6’] // EVENT DESCRIPTION
// $exp[‘field_id_7’] // EVENT LOCATION
// $exp[‘field_id_10’] // EVENT IMAGE
// $exp[‘field_id_11’] // EVENT TIME
// $exp[‘field_id_12’] // EVENT IMAGE CAPTION

// $exp_extra[‘title’] // TITLE
// $exp_extra[‘url_title’] // URL – i don’t think ill use this though… well no, i might as well, saves some processing work.

## PULL OUT THE FEATURED IMAGE FILE NAME
$ft_img = explode(‘1}’, $exp[‘field_id_10’]);
$ft_img = explode(‘”‘, $ft_img[1]);

## FORMAT THE LOCATION LINK
$link_name = explode(‘”‘, $exp[‘field_id_7’]);
$link_name = explode(‘”‘, $link_name[1]);
$link = explode(‘”:’, $exp[‘field_id_7’]);
$link = explode(‘,’, $link[1]);
$remain = explode(‘,’, $exp[‘field_id_7’]);

////////
$location = ‘‘.$link_name[0].’, ‘.$remain[1].”;
////////

## INSERT POST INTO WORDPRESS
mysql_query(“INSERT INTO `wp_posts` (
`post_author`,
`post_date`,
`post_date_gmt`,
`post_content`,
`post_title`,
`post_excerpt`,
`post_status`,
`comment_status`,
`ping_status`,
`post_password`,
`post_name`,
`to_ping`,
`pinged`,
`post_modified`,
`post_modified_gmt`,
`post_content_filtered`,
`post_parent`,
`guid`,
`menu_order`,
`post_type`,
`post_mime_type`,
`comment_count`) VALUES(
‘1’,
‘2012-09-05 20:15:14’,
‘2012-09-05 20:15:14’,
‘”.$exp[‘field_id_6’].”‘,
‘”.$exp_extra[‘title’].”‘,
‘”.$exp[‘field_id_5’].”‘,
‘publish’,
‘open’,
‘open’,
”,
‘”.$exp_extra[‘url_title’].”‘,
”,
”,
‘2012-09-05 20:15:14’,
‘2012-09-05 20:15:14’,
”,
‘0’,
”,
‘0’,
‘events’,
”,
‘0’
)”);

## SAVE THIS
$POST_ID = mysql_insert_id();

## INSERT THE CUSTOM FIELDS
mysql_query(“INSERT INTO `wp_postmeta` (
`post_id`,
`meta_key`,
`meta_value`) VALUES (
‘”.$POST_ID.”‘,
‘event_location’,
‘”.$location.”‘)”);

mysql_query(“INSERT INTO `wp_postmeta` (
`post_id`,
`meta_key`,
`meta_value`) VALUES (
‘”.$POST_ID.”‘,
‘_event_location’,
‘field_5047b43381d78’)”);

mysql_query(“INSERT INTO `wp_postmeta` (
`post_id`,
`meta_key`,
`meta_value`) VALUES (
‘”.$POST_ID.”‘,
‘event_time’,
‘”.$exp[‘field_id_11’].”‘)”);

mysql_query(“INSERT INTO `wp_postmeta` (
`post_id`,
`meta_key`,
`meta_value`) VALUES (
‘”.$POST_ID.”‘,
‘_event_time’,
‘field_5047b433821a7’)”);

## INSERT IMAGE INTO POSTS FEATURED IMAGE
mysql_query(“INSERT INTO `wp_posts` (
`post_author`,
`post_date`,
`post_date_gmt`,
`post_content`,
`post_title`,
`post_excerpt`,
`post_status`,
`comment_status`,
`ping_status`,
`post_password`,
`post_name`,
`to_ping`,
`pinged`,
`post_modified`,
`post_modified_gmt`,
`post_content_filtered`,
`post_parent`,
`guid`,
`menu_order`,
`post_type`,
`post_mime_type`,
`comment_count`) VALUES(
‘1’,
‘2012-09-05 20:15:14’,
‘2012-09-05 20:15:14’,
”,
‘”.$exp[‘field_id_12’].”‘,
”,
‘inherit’,
‘open’,
‘open’,
”,
‘”.$exp[‘field_id_12’].”‘,
”,
”,
‘2012-09-05 20:15:14’,
‘2012-09-05 20:15:14’,
”,
‘”.$POST_ID.”‘,
‘http://spin.ecko.cc/wp-content/uploads/2012/09/”.$ft_img[0].”‘,
‘0’,
‘attachment’,
‘image/jpeg’,
‘0’
)”);

## LINK IT TOGETHER IN THE POST_META
mysql_query(“INSERT INTO `wp_postmeta` (
`post_id`,
`meta_key`,
`meta_value`) VALUES(
‘”.$POST_ID.”‘,
‘_wp_attached_file’,
‘2012/09/”.$ft_img[0].”‘)”);

## AND SPIT OUT ONCE DONE….
echo ‘‘.$i.’, —> ‘.$exp_extra[‘title’].’
‘;

endwhile;
[/php]

WordPress for iOS 3.1

20120809-110445 PM.jpg

Matt mentioned these updates in State of the Word 2012 and its just been released. It’s pretty amazing now!