20 March 2010

Detecting handset type in WAP websites

Mobile Phone
The supposedly standard method of retrieving a handset's capability is through UAPROF (see UAPROF on Wikipedia). Very simply put a mobile phone should send through identifying information when it retrieves a website. However, UAPROF is entirely voluntary and there are several problems associated with relying on it.

Along comes WURFL, which touts itself as a free option to consider when looking to identify the capabilities of your visitors browsers. There are of course paid options to help you identify mobile phones visiting your site (such as device atlas), but why pay for a service when you can get it free?

At first glance WURFL looked very promising. It has an active project on Sourceforge and a set of API's for PHP, JAVA, and others.

One immediate problem I encountered was that the current release revision (1.1.r2) of the WURFL API is buggy. Well that's not fair for me to say actually- the API works perfectly, it's just the example code that doesn't work

A quick look at their source code revealed that the release version forgets to include a reference to a class library. Fixing that allowed the demo code to run, and generate the next series of errors.

I then realized that there is a marked lack of documentation. They do have a user forum that has the ominously unfriendly warning "Don't post if you don't know what you are doing. *YOU MAY BE BANNED INSTANTLY!!!!!* If your question reveals that you lack basic web programming skills, you will be banned instantly". To further emphasise the point they place this in bold and require administrator approval of your account before you can post a question.

Given the lack of documentation and unfriendly user forums I would have liked their example code to work.

I decided to rather use an older version of the code and downloaded version 1.1r1. I had my application up and running in about 30 minutes using this code.

So the short story is:
1) Download the latest WURFL and patch files (here)
2) Download the older copy of the new WURFL API (here)

Remember to point your main file setting in wurfl-config.php to the zip of the WURFL XML. This reminder will make more sense to you once you unpack the files from 1 and 2.

07 March 2010

Should I do reciprocal linking on my site?

Reciprocal links are touch and go for a few reasons.

The reason that incoming links are good is that search engines think your site is worthwhile if humans are linking to it. In other words, if a webmaster reviews your content and links to it then your content must be good (thinks the search engine).

So people actively started to try and build links, to make search engines think that their content is good.

The only thing is that search engines hate it when you do things just to optimize your site for search engines. Optimize your site for users, while making it easy for search engines to see what it's about (this is where the bold, italics, page title and headings come in)

Search engines see reciprocal links as a distortion. The webmaster is not linking to you because your content is good, they're only linking to you because they're getting something in return (a link to their site, or even money). If you have a page of links that link to sites that are linking to you a search engine is going to realize that none of those links actually mean anything. They're going to think that you're trying SEO "tricks".

Google specifically warns against "excessive" reciprocal linking, but doesn't quantify this. So if you find a nice juicy site that insists on a reciprocal link then fine - give them a link from an article. Never create a page of reciprocal links to a whole bunch of worthless sites that are irrelevant, or have low page rank. Think how easy it would be for a search engine to spot this.

Google puts this a whole lot better than I can (in their Guidelines for Webmasters) when they say "make pages primarily for users, not for search engines. ... Don't participate in link schemes designed to increase your site's ranking or PageRank."

They expand on this when defining link schemes.

Two better alternatives to reciprocal linking are to use link bait and to submit your site to RSS aggregators. Don't go rushing off to build hundreds of reciprocal links to other sites. Rather spend your energy building your site into a great resource that people will want to visit (and link to).

By the way, to report a site that is using link spam you can use the Google tool: http://goo.gl/linkspam . If you can use this tool, then your competitors can use it on you too.

06 March 2010

A SEO letter to a new webmaster

Dear Webmaster,

First off, I want to demystify search engine optimization. I've read so many blogs and books by specialists and it seems that most SEO specialists are actually marketing themselves rather than dispensing the very core knowledge that is required.

There is really only one page whose opinion I trust and that is the official Google Guidelines for Webmasters (find it here - http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=35769 ). Make sure that you read this page and ask me any questions that will clarify your understanding of it. If anybody tells you to do something other than what is written on this page be very careful.

Yes - there are "tricks" in SEO. But think about it - Google hires teams of incredibly clever people (read Matt Cutts academic profile if you don't believe me). What are the chances that Google is going to be tricked for very long? Very slim. And Google punishes sites that have tricked it in the past. So avoid using SEO "tricks" and focus on building a sustainable strategy. The site I optimized, has retained it's #1 position for over a year now - simply because I followed the Google guidelines and some extra stuff that I'll explain here.

Next, ask yourself how does Google make money? It makes money by selling advertising. It gets people to click its adverts by attracting them to its search engine. How does it attract people to its search engine? By providing the most relevant results.

So, how do you make life easier for Google? Provide useful information that people will want to read. This leads to the mantra that you will hear all the time : "Content is King".

Google wants to help people find useful information. If you provide useful information Google will help people find your site. This is the most simple rule of SEO and I'm surprised it isn't drilled into people's skulls.

So to recap:
1) Read http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=35769 carefully and study it
2) Add content to your site regularly

Right - lets focus on your content. We need to be able to help Google realize that your site is valuable and what information it has.

We do this in a few ways:

META tags.
Although the "keywords" tag is not so important install a Joomla module that will write it for you automatically. There might be some search engines that use it, and there might one day be a resurgance. Plus it requires no effort to do.
2) Your description tag is sometimes used by the search engine in its results page. Make sure that your description tag is unique for each page and summarizes the content.
3) The TITLE tag is essential. Use keywords from your page in your page titles. Make every page title unique.

Use keywords in headings in your text.

Bold and emphasis
Use bold and italics (emphasis) on keywords in your text. Do this once per paragraph.

Images can have an "ALT tag". Make sure that you right-click an image, click properties, and see it's ALT tag. This will be displayed to blind readers, and search engines use it as a clue to find out what the picture is about.

A keyword should actually be called a key phrase since it can consist of several words. "Key phrases" are easier to target than key words. For example: "Drug rehab in Pretoria" is easier to target than "Drug rehab" because it is a narrower market.

Use modifying words to target key phrases so "affordable drug rehab", "luxury drug rehab", "drug rehab in cape town", "best private drug rehab" will be target keyphrases/keywords.

Decide what a page is about and choose two or three keywords for that page. Use them at a rate of about 5% in your content, headings, title, meta tags, and picture ALT tags. Don't use your keyphrase over and over again just to try and impress search engines.

Under no circumstances stuff keywords into META tags, headings, or your page content. Don't make your content sound unnatural in order to stuff keywords in.

Focus your page content
When you add a page decide in advance what search phrase people will be typing in on the search engine. Use this exact phrase a few times in your article. Answer the question that people are asking.

I like to link to other pages about similar issues. I'm not to fussy about marking these links "nofollow" (some people will talk about this). I think it adds value to my readers if they can find more information from my page. Just make them target="_blank" so that people can come back to your site. Never link to bad sites (anything you would be ashamed to show your mom, your wife/husband, your boss, or a court of law is a bad site).

Regular content updates
Don't add 50 pages in one day, rather write 1 article per day for 50 days in a row. Keep your content additions regular and even. Keep adding valuable content. Aim to have at least a few hundred targetting your specific area of expertise on your site. When you reach about 500 articles you will find that you start doing really well on search engines.

* Get people to link to your site. Find the industry experts and ask them to link to you. Show them the useful information you have and how it can benefit their readers.
* Do not do link exchanges (also called reciprocal links) where somebody links to you in exchange for you linking to them.
* Do NOT pay for links (!)
* It is better to have a few high quality links than hundreds of irrelevant links. Get links from sites with a high page rank. Install the Google Toolbar into your browser to be able to see a sites page rank.
* Register on forums related to your industry. Put your site in your signature and post to these forums. Ask the moderators if they give "dofollow" links - these forums will be better for you to post on.
* Ask your suppliers to link to you.
* Find out who is linking to your competitors and approach them for links (do a Google search like this ---> link:yourcompetitorssite.com )
* Try getting a DMOZ link, but don't sweat if you can't. I'm personally surprised that search engines trust it so much, given the slow turnaround on the site.

Add a sitemap module to your site.

Search Engine Optimization is hard work, not magic. Good luck!

05 March 2010

Changing background color in SMIL

I've been working on a gateway system that will help a WASP to accept MMS requests and pass them on to the network for delivery to a mobile handset. For some reason the original designers of the gateway decided not to allow service consumers the ability to upload SMIL directly. Rather, an XML is POSTed to a webservice. The XML is then parsed into SMIL and handed to the network provider in a nice SOAP wrapper.

Why is this a problem? Well it means that only the gateway only supports a subset of SMIL. So in order to make a slide look the way that our client wants it to look we have to modify the gateway code to allow text colours and backgrounds to change.

Another problem I've had is that there seem to be very few SMIL tutorials online. When I'm learning a new language I usually pick up what I need by asking Google. Unfortunately even the mighty search engine draws a blank, provides hopelessly outdated pages, or documents like the technical specifications which I don't have time to wade through.

One useful SMIL tutorial I found was the one provided by the folks who bring you Real player. They were one of the early adopters of SMIL technology and seem to be fairly heavily invested in providing Real Player for the mobile market. Their SMIL tutorial is at least up to date, easy to read, and transfer well to open source development. Of course their player is proprietary and so isn't supported by Ambulant player (an open source SMIL 3.0 compliant player).

The MMS gateway that I'm working on was written in C# about a year and a half ago (I'm guessing). The SMIL code it produces is definitely version 1.0, which wasn't even a full W3C standard. It was only since the release of SMIL 2.0 that it has become a recommendation, which has now been superceded by SMIL 3.0. I found a useful summary of changes between two of these versions (here), but can't find a cheat sheet for version 3.0. As soon as I do I will update this post with it.

I worked out that although the gateway is sending a version 2.0 header it is parsing incoming XML into version 1.0 tags. Instead of properly parsing the incoming color parameters it had a hardcoded value setting all slides to black and white. Since the project is due immediately I decided to rather "cheat" instead of fixing the gateway to parse correctly. I wrote a small PHP image editing class that simply writes whatever text I send it on top of a background image. I then base64_encode the image and send that as normal jpeg image content in my slide. This worked first time.

SMIL defaults the and areas to a uniform black, while regions and subregions are set to be transparent. To change the background colour in SMIL 2.0 you set the backgroundColor attribute (in SMIL 1.0 you would use background-color ).