New Designs all around

new site designThe regular visitors to my website would have noticed the new website structure and design that I finally got together; to say that I am proud of my work would be understating the huge pride I have in my website.

Humbleness aside, I have not been the only website to recently update it’s design:

TheOpenSurgery an open source and tutorial based website by Jason Dugmore recently finished with updating a new layout and logo.

TechMongrel another technology based tutorial and review website by Matthew Vorster had a great monster logo addition.

And lastly NoBoxMedia an Ajax, DHTML and JavaScript site by Robin Pietersen finishes off my list of new website updates (the Noboxmedia website update coincides with a SEO competition which springleap.com is currently running).

All three website owners are colleges from my University days and I believe these are excellent examples of great websites, for content and design, to assist any developer in today’s chaos of information.

A special Thank-you to Robin Pietersen for introducing me and teaching me the basics of Adobe Photoshop; I wouldn’t have been able to put my current or past website designs together without the initial teachings I got from him.

Social Networking Images and Links

Getting your blog (and blog posts) out there into the Big Wide Internet can be difficult at the best of times, but trying to get people that do visit your website to help you out shouldn’t be.

Social Networking websites like Digg, Reddit, StumbleUpon and Facebook all have methods to allow their users to submit links to web pages that they find interesting, funny or just worth sharing. Allowing these users to quickly and easily add your blog post to their favorite website is a must for any blogger.

Below I have started making available the images I made for use on darwinshome (both the current size of 20px X 20px and the previous incarnation of 45px X 45px). Listed with the images are the links used to submit your website page to that Social Networking website.

This is not currently the full list of all the social networking websites available, as the weeks progress I will add more to the list until complete.
After a few weeks I will also design a wordpress plugin, to join the ranks of many like it out there, using the images and links listed.

[YOUR LINK URL] means the full URL of your blog post on yout website (eg: http://example.com/post/ )
[YOUR LINK TITLE] means the full title of the submitted page (eg: My Blog Post)

In alphabetical order:

Bloglines
Bloglines image small Bloglines image medium
http://www.bloglines.com/sub/[YOUR LINK URL]

De.licio.us
de.licio.us image small de.licio.us image medium
http://del.icio.us/post?url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Digg
Digg image small Digg image medium
http://digg.com/submit?phase=2&url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

facebook
facebook image small facebook image medium
http://www.facebook.com/share.php?u=[YOUR LINK URL]

furl
furl image small furl image medium
http://furl.net/storeIt.jsp?u=[YOUR LINK URL]&t=[YOUR LINK TITLE]

GoGuide
GoGuide image small GoGuide image medium
http://www.goguide.co.za/submit.php?url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Google Bookmarks
Google Bookmark image small Google Bookmark image medium

http://www.google.com/bookmarks/mark?op=edit&bkmk=[YOUR LINK URL]&title=[YOUR LINK TITLE]

ma.gnolia
magnolia image small magnolia image medium
http://ma.gnolia.com/bookmarklet/add?url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Muti
Muti image small Muti image medium
http://muti.co.za/submit?url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Newsvine
Newsvine image small Newsvine image medium
http://www.newsvine.com/_wine/save?u=[YOUR LINK URL]&h=[YOUR LINK TITLE]

Reddit
Reddit  image small Reddit image medium
http://reddit.com/submit?url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Sphere
Sphere image small Sphere image medium
http://www.sphere.com/search?q=sphereit:[YOUR LINK URL]&title=[YOUR LINK TITLE]

Squidoo
Squidoo image small Squidoo image medium
http://www.squidoo.com/lensmaster/bookmark?[YOUR LINK URL]

StumbleUpon
StumbleUpon image small StumbleUpon image medium
http://www.stumbleupon.com/submit?url=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Tailrank
Tailrank image small Tailrank image medium
http://tailrank.com/share/?link_href=[YOUR LINK URL]&title=[YOUR LINK TITLE]

Technorati
Technorati image small Technorati image medium
http://technorati.com/faves?add=[YOUR LINK URL]

Instructions for downloading single images:
Internet Explorer:
Right click on the image you want and select “Save Picture As…” to save the image you want.

Firefox and Safari:
Right click on the image you want and select “Save Image As…” to save the image you want.

Opera:
Right click on the image you want and select “Save image…” to save the image you want.

[EDIT 11/03/2008] – Added Sphere, Squidoo, ma.gnolia, Bloglines, Tailrank and furl

License and Copyright:
All trademarks and logos are the property of their respective owners.
Logo designs in their current format are licensed to Michael John Grove under the Creative Commons Attribution 2.5 South Africa License.
Should you be the owner of the original logo and wish your logo to be removed please contact me

JavaScript / XML based Country, State Selection Script

JavaScript Country Selection list[UPDATE] The download is no longer supported or updated and has been removed

UPDATE 26 January 2009: Fixed the XML file load Bug that was affecting Chrome and Safari 

Making use of my XML based Country and State/Province file I have put together a small script to populate two drop down lists with the complete Country and the selected countries Province or State list.

The code is ALL client-side based, so it will suffer from browsers without JavaScript enabled, but it is a very fast and light weight script to use if you want to quickly add a Country and State selection box to your registration forms. This script does not require any database to function.

Code Explanation:
The initial XML Parser script:

if (window.ActiveXObject) 
{
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
    xmlDoc.load("country_state.xml");
}
else if (document.implementation && 
document.implementation.createDocument) 
{
    var xmlhttp = new window.XMLHttpRequest();
    xmlhttp.open("GET","country_state.xml",false);
    xmlhttp.send(null);
    xmlDoc = xmlhttp.responseXML.documentElement;
}

xmlDoc.async=false;

xmlDoc.load("country_state.xml");

Internet Explorer has had a built in XML parser since version 5, but this parser opens XML files differently to other browsers (Firefox, Opera, etc), so to load an XML file you need to first check which browser is running on the client, For IE:

window.ActiveXObject

and a double check for other browsers:

document.implementation && 
document.implementation.createDocument

If IE exists, create an empty Microsoft XML document object:

xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
    xmlDoc.load("country_state.xml");

Or for Other browsers:

    var xmlhttp = new window.XMLHttpRequest();
    xmlhttp.open("GET","country_state.xml",false);
    xmlhttp.send(null);
    xmlDoc = xmlhttp.responseXML.documentElement;

Once the browser check is done it loads the XML document, from here on the code works the same in IE as in other browsers.

On a side note, there is an easy way to test that your XML file has been loaded correctly during development. Just add the document.write or alert function to return the number of nodes in the XML file (in my country_state XML example I would return the number of <country> nodes – with the expected result being 252):

document.write(xmlDoc.getElementsByTagName("country").length);

Once the XML file has loaded correctly, you can perform functions using the file. The next part of my code calls the fillCountryList() function that populates the first select box. I call the fillCountryList() function in my onload() event handler:
HTML:


JavaScript:

function fillCountryList ()
{
    var countryList = document.getElementById("cboCountry");

    for (var x = countryList.options.length-1; x >-1; x--)
    {
        countryList.options[x] = null;
    }
    var countryNames = xmlDoc.getElementsByTagName("country");
    var numberOfCountries = countryNames.length;

    for (var i=0; i<=numberOfCountries-1; i++)
    {
        var currentCountry =  countryNames[i].getAttribute("name");
        fillList(countryList,currentCountry,currentCountry);
    }
}

The fillCountryList() function identifies the first selection box with the specified ID (in my example cboCountry), the function then clears all current entries in the selection box. Clearing entries is good way to prevent duplicate information from being in your selection list prior to processing. On another side note, having VALID data in your selection box is an excellent way to still have your web page form display correctly if JavaScript is disabled on the client; this data can act as an alternative to the JavaScript data; an example of alternative data for the country selection box is listed.
Alternative HTML example:


The above code example is NOT a requirement, and my current example does not have any alternative data, but it can help your website to degrade well under different client environments.

The next part of the fillCountryList() function is getting the country names from loaded XML file:

var countryNames = xmlDoc.getElementsByTagName("country");

This will return an object collection for all nodes with the <country> tag to an array in the countryNames variable. A loop then processes the array and adds each country to the cboCountry select box using the fillList() function.

The state select box is only populated once a new country has been selected using the onChange event handler. Note: you should also be able to use the onClick event handler rather than the onChange event handler.

The fillStateList() function populates the States in the same way as the fillCountryList() function does, but first gets the selected countries array ID out of the country array before looping through THAT countries State/Province array therby filling the cboState select box with valid states.

Hopefully this code and explanation will assist beginners and experts alike. Download and enjoy.

This script has been tested under Firefox, Opera, and Internet Explorer 6 & Internet Explorer 7, Google Chrome and Safari 3.
Currently NOT working in Safari. Safari processes the “document. getElementsByTagName” function differently to other browsers, I will find a fix and release an updated version of the script soon.
UPDATE 26 January 2009: Fixed XML file load for Chrome and Safari :- Please drop me a line if you find any bugs that I may have missed.

Questions and comments are welcome.

License: Creative Commons Attribution 2.5 South Africa License.