Ubuntu Beginners Programming Challenge 9

The new Ubuntu Beginners Programming Challenge has been set :)

Here is the announcement on Ubuntu Forums.  It has been wonderful to see all the submissions so far.  It has been less than 24 hours since the challenge was announced and already several complete solutions in various languages have been posted.   Superb :D   Well done to everyone.

Here is my entry in PHP:

<?php
//Set Sum to 0
$sum = 0;
//Specify data file
$myFile = "data.txt";
$file_array = file($myFile);
//Read in the text file line by line
foreach ($file_array as $line){
    //Tidy up $line a bit because txt file
    $line = str_replace("\n", '', "$line");
    $line = str_replace("\r", '', "$line");
    //Sort out numbers and text
    if (is_numeric($line)) {
        //keep running total of numbers
        $sum = $sum + $line;
    }else{
        //Create seperate var containing only letters
        $data.= $line;
    }
}
if ($sum != 0){
    //Display running total if numbers present
    echo 'Sum = '.$sum."<br/>";
}
foreach (count_chars($data, 1) as $i => $val) {
    //Display count of each letter
    echo chr($i). ' = '.$val."<br/>";
}
?>
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Search Engine Optimization (SEO)

I have been trying to optimize this blog over the last few days,  so I thought I would share exactly what I have been upto :)

Well,  first off let me tell you that this is a WordPress Blog.  This is important because I used some WordPress plugins to help my site get discovered by the internet at large.

First plugin that is simply a must is:  Meta SEO Pack

It allows you to control the meta tags on your blog.   What is a meta tag?

Meta elements provide information about a given Web page, most often to help search engines categorize them correctly. They are inserted into the HTML document, but are often not directly visible to a user visiting the site.

They have been the focus of a field of marketing research known as search engine optimization (SEO), where different methods are explored to provide a user’s site with a higher ranking on search engines. In the mid to late 1990s, search engines were reliant on meta data to correctly classify a Web page and webmasters quickly learned the commercial significance of having the right meta element, as it frequently led to a high ranking in the search engines — and thus, high traffic to the website.

As search engine traffic achieved greater significance in online marketing plans, consultants were brought in who were well versed in how search engines perceive a website. These consultants used a variety of techniques (legitimate and otherwise) to improve ranking for their clients.

Meta elements have significantly less effect on search engine results pages today than they did in the 1990s and their utility has decreased dramatically as search engine robots have become more sophisticated. This is due in part to the nearly infinite re-occurrence (keyword stuffing) of meta elements and/or to attempts by unscrupulous website placement consultants to manipulate (spamdexing) or otherwise circumvent search engine ranking algorithms.

I mainly use it to control the Keywords and Description meta tags.  The keywords need a little tweaking, but generally by using them will see your page ranked higher  by the search engines.   With regards to a good investment of time,  I would say YES! It should take less than 30 minutes to setup.  On a time cost reward scale I think it is a pretty good return.  Important to note that as of September 2009 Google no longer uses Keywords in its page ranking engine.   The Description meta tag settings can be changed,  however I personally found that the default settings were fine.

The second plugin that is pretty important is:  Simple Google Sitemap

It creates a Sitemap for your blog.  What is a Sitemap?

Google introduced Google Sitemaps so web developers can publish lists of links from across their sites. The basic premise is that some sites have a large number of dynamic pages that are only available through the use of forms and user entries. The Sitemap files can then be used to indicate to a web crawler how such pages can be found. Google, Bing, Yahoo and Ask now jointly support the Sitemaps protocol.

Since Bing, Yahoo, Ask, and Google use the same protocol, having a Sitemap lets the four biggest search engines have the updated page information. Sitemaps do not guarantee all links will be crawled, and being crawled does not guarantee indexing. However, a Sitemap is still the best insurance for getting a search engine to learn about your entire site.

XML Sitemaps have replaced the older method of “submitting to search engines” by filling out a form on the search engine’s submission page. Now web developers submit a Sitemap directly, or wait for search engines to find it.

XML (extensible markup language) is much more precise than HTML coding. Errors are not tolerated, and so syntax must be exact. It is advised to use an XML syntax validator such as the free one found at: http://validator.w3.org

So,  yes its a pretty good thing to have on your site ;)   Simple-Sitemap generates this for you!  You do  not have to do anything to get this XML file.     Once the file has been created the sitemap can be submitted to Google here (under site configuration) and also to Yahoo here.  Please note that both Google and Yahoo will require you to authenticate that you own the site.  This can either be done by adding a certain meta tag to your home page or uploading a simple html file onto your server.  I opted to upload the file,  but either is fine. :)

Okay,  so all the SEO stuff is great,  but some pages I don’t want to be indexed.

Something’s you do want easily accessible on the web.  For example you may have a directory where you keep testing files.  You can stop Google and Co ,  so don’t panic!  You will need to create a robots.txt file and upload it to the root directory of your site.  Thankfully tools are available to help you with this.  I suggest using the Google Webmaster services.

Once you are logged in you should see a menu on the left.  Click on: Site configuration.  This will display a few other options.  The one we are interested in is Crawler access.  You should then see the option to generate robots.txt.  This will tool will allow you to create your file and block certain directories from indexed :)   Once you have the file simply upload it to the root directory of your website.  Simple as that :)   Not only will this stop Google,  but also the other major search engines.

Related Article: Setting Up Google Analytics.  This will allow you to see how your SEO is faring.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

The Fizzy and The Still – Mark Knopfler

Something nice and slow on a Sunday

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Ubuntu 9.10 Mac 0SX Theme

As mentioned yesterday I have been working on a new theme for one of my Ubuntu installations.   As you can tell I am going for a Mac look.  Opinions welcomed.  Any thoughts on how to improve the look also valued  :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Il Faut Du Temps Au Temps

In a French kind of mood.  Enjoy :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

The Week

Hmm,  its been a few days since I last posted anything.  I’ve been busy. :)

This week has been a little trying at work to be honest.  Short summary:

Monday:  More work on that blasted image crop for an online magazine.

Tuesday:  Continued the work on the image crop.  Started worrying about crop exceeding boundary of the page

Wednesday:  More work on the image crop.  Focussed on multi-page crop

Thursday:  Started working with the cropped image. What exactly do we want to do with it.  In this case an option to download.  Looking to include email functionality when I have a minute.

In short, I’ll be glad when this feature is boxed off.   I am getting sick of looking at the math now.  Hehe :)

As mentioned last week I have been able to get Lucid Lynx to boot.   Sadly I cannot commit to an installation as it does not recognise my wifi.  Some debugging to do.    I don’t know how hard I will try to get it going as the OS is still an alpha release.

Tonight I have no plans.  Usually end up in a pub,   but not overly bothered if its a quiet night in.   I might continue my work on a new look for my desktop.  Going for a Mac look.   I should post a screen shot tomorrow :)    Nearly done,  just one or two little issues with desktop icons to resolve.

This Saturday I don’t really have any plans.  I plan to hide away from the world.  I suspect that this is going to end in failure.    Looking to try and finish my DVD / CD editing.  :)   I might also start packing my stuff for my trip to Paris next week.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Lucid Lynx Alpha 2 Boots!

Hooray :D

I have managed to get Lucid Lynx to boot in Virtual Box in a Live CD environment.   To be honest it looks very similar to Karmic (shock).  So far its been okay,  though I would say that I am yet to be “wowed”.    A quick glance at the pre-installed applications shows some differences.  Namely the lack of several games.  The games seem to have been replaced with something new called gbrainy.  Its actually quite a good brain trainer game :)

Lucid Lynx Alpha 2

At some point this week I shall probably install it properly and see what its like.   I was involved with testing Karmic UNR last year and I am looking forward to finding bugs with this release.  Expect an update on this at some point during the coming week on how the installation goes.

I downloaded the alpha from here if you would like to try it out for yourself :)

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Beethoven – Moonlight Sonata

I have been listening to classical music on and off today.  This is one of my favourites.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Song Saturday

Its Saturday.  Today has been good so far.  I have cycled to the gym (and back) for a 2 hour game of badminton.  I only lost a couple of games so I am really happy with the way it went.   I was going to go back to the gym later for a swim,  but I am feeling a little peaky for some reason.   I don’t think going for a swim would do me any good today.

So instead I am now having a day at  home.   Currently I am copying a few live concert DVDs onto my laptop.  I also plan to play with the media a little and extract the audio.  Once I have done that I will have to put on CD :D   Gosh, I have such “big ideas” .  Laugh out loud.

I have also got to fix  my bicycle pump this afternoon.  Silly rubber tube seems to have perished in the cold.  New tube needed methinks :)    I shall dwell on this job over a cuppa tea.  I might get motivated and do it in the next couple of hours…

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon

Million Faces

Oh the phone you know it never stops
It’s the last thing I hear at night
And the first thing in the morning
And as I let it start to burn my head
You slowly creep into bed
And I’m done talking

You say you know how I’m feeling?
I just need to try to settle down

Oh a million faces pass my way
Oh they’re all the same
Nothing seems to change anytime I look around
Oh who knows just what the future holds
All I want to know is if it’s with you

Tired as hell and falling up the stairs
Filled with a thousand cares as you walk out from the bedroom
Though it feels like all the fire has gone
You just turn me on

We’re distracted by the hard times
The troubles that we make
Let us throw them in the ocean
Let it wash our cares away

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Identi.ca
  • Live
  • MySpace
  • Twitter
  • Yahoo! Bookmarks
  • Reddit
  • StumbleUpon