Archive for the ‘Development’ Category

Facebook and Twitter Integration with WordPress Blogs to help SEO

Tuesday, August 31st, 2010

Search Engine Optimisation through Social Media A while ago I posted a quick SEO overview guide, and that had a section on how Social Media played an important role.

While mentioning these topics at a high level, when it gets down to the nuts and bolts, it can be quite time consuming and effort laden in order to actually get stuff done. Any shortcuts that exists, really go a long way in helping cater to the whole gamut of requirements. So, I’m going to pick out at some of these topics and share my personal experiences with them to try and help out a little.

To start with – self hosted WordPress sites (which is what this is) are by far the best combination of ease and flexibility in my opinion. So if you’re going for a blogging platform, start with WordPress.

Then, the first step for your subsequent Twitter integration, is easy. The plugin you want is “TweetMeme“. You can search for it in the WordPress plugin directory, or you can simply download it from their site. Whichever one you choose, once it is installed and activated, it just works. Nothing else required.

To go slightly deeper, and integrate every blog post with your twitter account automatically, you can use FeedBurner. FeedBurner is quite self explanatory to set up, and only requires you to have a Twitter and a Google account to get it working. FeedBurner also has the added advantage of pinging several other blog services everytime it detects a post from you. So that helps in additional link building.

Moving onto Facebook – there’s a minefield of plugins for WordPress out there. There are some that throw everything into the plugin including the kitchen sink, but then they become horrendously annoying to configure and very bulky to load. I narrowed down my requirements to two things that Facebook is really useful for today – “Liking” stuff, and “Comments”. Both of these get entered as stories into profiles. So this does exactly what you want by hitting newsfeeds. Other features like linking to my Facebook “Notes”, or duplicating/synchronising content and comments between the two defeat the purpose of me having a website. So after much hunting, I have found two applications that sort out everything I need:

  1. Facebook Comments for WordPress by Graham Swan
  2. Facebook Like by Ahmed Hussein

They need a little bit of configuration in order to run properly, but they come with comprehensive HowTo guides. They do the fantastic job of seamlessly integrating your blog into people’s newsfeeds with minimal brain power.

Have you used or made any other plugins that you’ve found useful?

Share on Facebook

Installing the Android SDK on Ubuntu

Saturday, August 7th, 2010

Android Installing the Android SDK on my Ubuntu machine was a bit of a hassle this morning – especially given that I already had the Eclipse IDE installed from the repository! I was battling all morning with NullPointerExceptions for a reason that was previously unknown to me!

So in the event that this makes anyone’s life easier, I would recommend following these steps:

  1. Get Java1.6 from the repositories – either using synaptic, or apt-get to download it
  2. Open up a terminal window
  3. Type in sudo update-alternatives --config java
  4. Select the option in this list that points to Java 1.6 (or higher)
  5. Download the Android SDK for Ubuntu
  6. Unpack the tgz in a directory of your choice, and run “tools/android”
  7. Click “Available Packages” and refresh the repository
  8. Download the necessary SDK elements!

Doing in that sequence will save you a lot of headache. Of course afterwards you can pick up your preferred IDE – Android Dev recommends Eclipse – but not the eclipse from the repository. Instead you need to download the new(er) one from the eclipse website.

P.S. Thanks to LaiHiu for the entry graphic

Share on Facebook

Listing methods for all of your PHP objects for quick reference

Friday, July 23rd, 2010

Open Reference BookWhen managing or developing object orientated programming sites in PHP, I find that I frequently forget the names of methods that belong to classes. Even though I try to have a standard naming format – my memory still seems to fail :-(
So rather than run phpDocs over my objects continually, I knocked together this quick script to list all the methods in all my objects (I store all my objects in one directory). I call this file “_methodList.php” and keep it only on the development server. Here’s the code!
$dirpath = "/path/to/objects";
$dh = opendir($dirpath);
while (false !== ($file = readdir($dh))) {
//Don't list subdirectories
if (!is_dir("$dirpath/$file")) {
//only grab PHP files
if ((substr($file, -3)=="php")&&($file!="_methodList.php")){
echo $file."<br/>\n";
require_once($file);
$methArr = get_class_methods(substr($file, 0, -4));
if (sizeof($methArr) > 0){
foreach ($methArr as $method){
echo "-> ".$method."<br/>\n";
}
}
echo "<br/>";
}
}
}
closedir($dh);

Thanks to Honou for the opening graphic!

Share on Facebook

Iterating through class constants in PHP

Friday, June 18th, 2010

I was breaking my head trying to figure out the best way to reference a particular set of constants in one of my objects so that I didnt’t unncessarily need to create a new database table. Fortunately, I found this thread about looping through class constants using reflectors.

As a summary, it can be done in a very small amount of code:
class test{
const CONSTANT = 'foo';
}
$t = new test;
$r = new ReflectionObject($t);
print_r($r->getConstants());

With the appropriate naming convention – everything else is easy!

Thanks to jpadie.

Share on Facebook

Tutorial on Creating Dynamic JavaScript Widgets for Third Party Sites

Tuesday, June 15th, 2010

One of the things I get asked a lot about are the JavaScript widgets that I make, that can be installed on third party websites. The VenueMirror VenueSearch widget at the top of this page is an example of this. The search bar is actually loaded through a JavaScript call that pulls the information from another server. This technique for loading content onto third party websites is not unusual, but it seems there are too few tutorials out there about how to do this. Firstly though – one must question why indeed you would do this.

(more…)

Share on Facebook

Creating Line Graphs in JPEG Format through PHP

Tuesday, May 25th, 2010

A while ago I wrote about making use of information collected by websites – I find graphs a great way to do this. And while there are lots of great graphing objects, or tools available today, it can be a hectic scene to try and find a free one that you want for basic use. So quick modifications to existing code can sometimes be exactly what you need! Below is the code that was used to create the graphs seen in that previous post.
(more…)

Share on Facebook

Useful Currency Information by Accident

Wednesday, May 12th, 2010

Pennies and Pounds If you run a website, have you ever noticed how much data it accumulates? Usually, quite by accident as well… I was poking through some old parts of the VenueMirror website today and stumbled across a feature that I had totally forgotten we had implemented. It is of course one of those features that the code makes use of everyday, but it has become so inherent that it gets taken for granted!

There is a need for our system to perform currency conversions as transactions can take place across multiple currencies, and so currency updater was created to provide live exchange rates. Our currency updater is quietly used by our currency and transaction objects, and so once built there’s very little need for us to even think about how it works! Essentially it collects the latest currency conversion rates and builds a currency table for the whole system to use. In the process though, it has collected historical currency data.

So I thought it would be interesting to render this data into charts that show how exchange rates fluctuate. I built a quick bit of PHP to take daily spot rates out of the data at 11.30am and see how they compared to the previous days! The images below are dynamic PHP images, and should show you exchange rates for ten days started from 25 days before yesterday!




The script takes parameters that allows it to be customised on how many data points it shows, which currencies it compares, and how many days into the past it should end. Tomorrow, I’ll post the source to the graphing code, and the tutorials that are available online for you to get more information from.

Cheers,
K
P.S: Thanks to Mukumbura for the opening photo!

Share on Facebook

Sending HTML composite email in PHP using objects!

Tuesday, May 4th, 2010

Photo of an American MailboxHave you ever tried to send HTML email using PHP? Sending plaintext email is quite straight forward and easy, and if you have the energy to write your own functions, sending HTML email can be pretty simple too. Half the problem is writing functions that can be ported around to different projects quickly and easily.

PHP Objects made this much easier to do, and since then I’ve been swapping objects in and out of various different parts of the code, and across different applications. I realised the other day that the one I make the most use of is my mail message object. So I thought I would open it up in the event that you also found it useful! (more…)

Share on Facebook