To “.me”, or not to “.me”, that is the question…

Location HTTPEver since I decided to expand my online presence, I thought the best step would be to have a better domain name. My current domain name is around twenty-nine characters in length. Ouch! So I was determined to find another name that was shorter and easier to remember.

Ever since “.me” top level domain (TLD) came out, I snapped up “surinder.me”, partly because all other domains with my first name were gone (you know who you are!) and the “.me” extension seemed to fulfil what I wanted my website to focus on. ME! Having said that, I would have loved to get a “.com” domain, but I guess that’s what happens when you enter the online world so late.

I was ready to move over all my content to “surinder.me” until one on my techy friends told me that things are still undecided when it comes to “.me” TLD’s in general. Originally, the “.me” extension was assigned to Montenegro’s locale only. But it’s fast gained traction over the years due to it’s simplicity and wide range of possible domain names. Even companies such as Microsoft, Facebook, Wordpress and Samsung rushed to register their “.me” domains. Hence the reason why I decided to get one.

Companies seem to be using “.me” extensions for either URL shortening services or redirects to partner sites with “.com” extensions. It doesn’t fill me with much confidence when “.me” extensions are used this way. Google’s software engineer, Matt Cutts wrote a reassuring post on his Google+ profile earlier this year by stating:

“…regardless of the top-level domain (TLD). Google will attempt to rank new TLDs appropriately, but I don't expect a new TLD to get any kind of initial preference over .com…If you want to register an entirely new TLD for other reasons, that's your choice, but you shouldn't register a TLD in the mistaken belief that you'll get some sort of boost in search engine rankings.”

This should put all my “.me” fears to rest…right? Well it’s nice to know Google won’t penalise a site based on an extension. In the world of web, a search optimised site is king (as it should be). It’s nice that Google have given “.me” (as a country extension) global status given the nature of how its been used of late. But if you check Google’s Geotargetable Domains article, the text in brackets worries me.

Google’s Webmaster Tools Geotargetable Domains

I get the feeling you can’t go wrong with a “.com” domain providing you can find something meaningful to your cause. Steps are being made in the right direction for gccTLD’s. For example, Webmaster Tools gives you the option to geographically target your “.me” site. However, I can’t find anything concrete to alleviate my concerns in the long-run.

So where does this leave me? Well, we’ll just have to find out if my future domain contains a .me extension. Smile

The Ridiculous Price of A Domain

I’ve been looking for a suitable replacement domain name for a while now and even making purchases that has some reference to my name. Since I’m not having much luck with new registrations, I decided to snoop around for domains that are up for sale. Lo and behold I found my ideal second-hand “.com” domain: surinder.com. However, there’s a catch…

Currently “surinder.com” sales price is £5000! Whaaaa!!!!!?????

Ridiculous price for surinder.com

I know Surinder is a really cool name and damn right popular with the ladies, but seriously £5000. Even I wouldn’t have the audacity to sell my domain for that much (offers will be accepted though :-) ).

When reading numerous articles on how domain names are valued, it seems to evolve around the sum of the domains generic value and the value of its traffic. So its not exactly clear cut. I highly recommend reading this post on “How To Value a Domain Name”, it has some really useful information.

HTTrack - Website Copier

One of my colleagues pointed my to a really useful tool called HTTrack, that has the ability to download a website from the internet to a local directory by simply copying and pasting the site URL of your choice.

I found this tool helpful when working on an existing site where I was unable to 100% recreate the files and directory structure within my local development environment. For example, you could be developing a new micro-site for an existing online site you may not currently have in your local environment.

HTTrack has the ability to build recursively all directories, images and other files from the server to your computer. What’s even better, HTTrack arranges the original site's relative link-structure.

My First PowerShell Script - Moving Files From One Directory to Another

Microsoft’s new command-line tool, PowerShell has been out for quite a few years now and I thought today will be the day I would start using it. I needed to write a script that would move n number of files from one directory to another. This job seemed a perfect fit for PowerShell.

#Get 'n' number of files
$FileLimit = 10 

#Destination for files
$DropDirectory = "C:\Drop\"

$PickupDirectory = Get-ChildItem -Path "C:\Pickup\"

$Counter = 0
foreach ($file in $PickupDirectory)
{
    if ($Counter -ne $FileLimit)
    {
        $Destination = $DropDirectory+$file.Name

        Write-Host $file.FullName #Output file fullname to screen
        Write-Host $Destination   #Output Full Destination path to screen
        
        Move-Item $file.FullName -destination $Destination
        $Counter++
    }  
}

From the get go, I was really impressed with the flexibility of the scripting language. This is where command line fails. It is sufficient for simple tasks but not so much for complex jobs.

As you can see from the code above, I can implement complex operations that supports variables, conditional statements, loops (while, do, for, and foreach), and that’s just the start. I don’t know why I hadn’t used PowerShell sooner. If I didn’t have the option to use PowerShell, I would have probably created a C# service or executable to do the exact same thing. Time saver!

Since PowerShell is built on the .NET Framework, Windows PowerShell helps control and automate the administration of the operating system and applications that run on Windows. So if you are a C# programmer, you should feel comfortable in writing PowerShell scripts. All you need to be aware of is syntax differences when declaring variables and keywords.

To end with, I will quote an amusing forum post I found when researching the difference between good ol’ Command Prompt and PowerShell:

PowerShell has a default blue background and Command Prompt has a default black background.”

Beginner’s Guide To Using Google Plus .NET API Part 1: Profile Data

Google has always impressed me with the quality of their API libraries allowing us to interface with their products in a somewhat straight-forward manner. In the past, I’ve used a couple of Google’s API’s for implementing YouTube video’s or Checkout merchant within my own sites. What makes life even easier is that the API’s are available in my native programming framework - .NET.

Google were quite slow in launching an official API upon Google Plus’s initial release and even though unofficial API’s were available, I thought it would be best to wait until an official release was made. I’ve been playing around with Google’s .NET API for a couple weeks now and only just had the time to blog about it.

I am hoping to make this beginners guide a three part series:

  1. Profile Data
  2. User Posts
  3. User’s +1’s

So let’s get to it!

Today, I shall be showing you the basic API principles to get you started in retrieving data from your own Google+ profile.

Prerequisites

Before we can start thinking about coding our page to retrieve profile information, it’s a requirement to register your application by going to: https://code.google.com/apis/console. Providing you already have an account with Google (and who hasn’t?), this shouldn’t be a problem. If you don’t see the page (below), a new API Project needs to be created.

Google Plus API - Console

Only the Client ID, Client Secret and API Key will be used in our code allowing us to carry our API requests from our custom application.

Next, download the Google Plus .NET Client. My own preference is to use the Binary release containing compiled .NET Google Client API and all dll's for all supported services.

Building A Custom Profile Page

  1. Create a new Visual Studio Web Application.
  2. Unzip the Binary Zip file containing all Google service DLL’s. Find and reference the following DLL’s in your project:
  3. Google.Apis.dll
  4. Google.Apis.Authentication.OAuth2.dll
  5. Google.Apis.Plus.v1.dll
  6. Copy and paste the following front-end HTML code:
<h2>
    About Me
</h2>
<br />
<table>
    <tr>
        <td valign="top">
            <asp:Image ID="ProfileImage" runat="server"></asp:Image>
        </td>
        <td valign="top">
            <strong>Name:</strong> <asp:Label ID="DisplayName" runat="server"></asp:Label>
            <br /><br />
            <strong>About Me:</strong> <asp:Label ID="AboutMe" runat="server"></asp:Label>
            <br />
            <strong>Gender:</strong> <asp:Label ID="Gender" runat="server"></asp:Label>
            <br /><br />
            <strong>Education/Employment:</strong> <asp:Literal ID="Work" runat="server"></asp:Literal>
        </td>
    </tr>
    <tr>
        <td colspan="2" valign="middle">
            <asp:HyperLink ID="GotoProfileButton" runat="server">Go to my Google+ profile</asp:HyperLink>
        </td>
    </tr>
</table>
  1. Copy and paste the following C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Plus.v1;
using Google.Apis.Plus.v1.Data;

namespace GooglePlusAPITest
{
    public partial class About : System.Web.UI.Page
    {
        private string ProfileID = "100405991313749888253"; // My public Profile ID
        private string GoogleIdentifier = "<GoogleIdentifier>";
        private string GoogleSecret = "<GoogleSecret>";
        private string GoogleKey = "<GoogleKey>";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
                GetGooglePlusProfile();
        }

        private void GetGooglePlusProfile()
        {
            var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);
            provider.ClientIdentifier = GoogleIdentifier;
            provider.ClientSecret = GoogleSecret;

            var service = new PlusService();
            service.Key = GoogleKey;

            var profile = service.People.Get(ProfileID).Fetch();

            // Profile Name
            DisplayName.Text = profile.DisplayName;

            //About me
            AboutMe.Text = profile.AboutMe;

            //Gender
            Gender.Text = profile.Gender;

            // Profile Image
            ProfileImage.ImageUrl = profile.Image.Url;

            // Education/Employment
            StringBuilder workHTML = new StringBuilder();

            workHTML.Append("<ul>");

            foreach (Person.OrganizationsData work in profile.Organizations.ToList())
            {
                workHTML.AppendFormat("<li>{0} ({1})", work.Title, work.Name);
            }

            workHTML.Append("</ul>");

            Work.Text = workHTML.ToString();

            //Link to Google+ profile
            GotoProfileButton.NavigateUrl = profile.Url;            
        }
    }
}

Once completed, the page should resemble something like this:

Google Plus Profile Page

I think you can all agree this example was pretty straight-forward. We are simply using the people.get method which translates into the following HTTP request:

https://www.googleapis.com/plus/v1/people/100405991313749888253?key=APIKey

Unless you really want to display my profile information on your site (who wouldn’t!), you can keep the code as it is. But you have the flexibility to change the “ProfileID” variable to an ID of your own choice. To find your Profile ID, read: How Do I Find My Google Plus User ID?.

Why I Think Rooting Is The Only Future for Android…

Android Rooted…if you want a true Android experience.

When thinking of all the Android smartphones I’ve purchased in the past, they all inherit a common bad trait. Each user interface is different, causing a somewhat inconsistent experience when moving onto different Android handsets. This isn’t an issue for the bog standard phone user. However, when a phone is promoted to be running on Android, you expect there to be no difference.

Currently, we have the following variations of Android:

  • SenseUI
  • TouchWiz
  • MotoBlur
  • LG TouchMax

We can all agree the first version of Android was not exactly a pretty sight. Thus, phone manufacturers took it upon themselves from day one to push Android to the limit. In most cases they got it right but there were others who fell short.

Android 4.0 was supposed to be a turning point and instil the original vision Google intended to have in their operating system. Providing great design, functionality and innovation. Even though Android 4.0 is widely available, it will sadly never see the light of day. Well that is, in its true form. A good example of this is the recent Android 4.0 update released for Samsung Galaxy S2 owners. You’d be forgiven not to notice any change after upgrading due to the TouchWiz interface.

The only option is to root. This is the “root” I plan on taking in the future (you see what I did there!). Android has a great modding community who like me care what version of Android that runs on their phone. Generally, you will find that an unadulterated version of Android runs far better than its custom-skinned counterparts. It just seems a shame the lengths we have to go through to get the version of Android of our choosing.

So it looks like custom UI’s are here to stay. Obviously handset makers think they can offer something Android cannot and this will not be changing anytime soon. To me, simply using a stock version of Android seems like a win-win situation for both the end-user and handset makers. Handset makers can spend less time in porting upcoming versions and spend more time and money innovating their hardware. Just leave software development to the professionals.

For a platform that has so much potential, this has to be the main sticking point. Phil Nickinson’s article, “Dear Molly Rants: Let's talk about Android 'fragmentation' ..." sums it all up quite nicely:

Google is constantly updating the Android code. Anyone can go get it. Problem is the smartphone…Android itself is not the problem here. It can, however, be the solution.

CheckBoxList RepeatLayout - How Did I Miss That???

The thing that annoys me when using ASP.NET controls is the amount of cluttered HTML that gets generated. It sometimes reminds of my early web development days when Dreamweaver was the development tool of choice. That was a long time ago!

CheckBoxList

By default when using a Checkbox or Radio button list, the following markup is generated:

<table id="MainContent_TestCheckList">
    <tbody>
            <tr>
                <td>
                    <input type="checkbox" value="1" name="ctl00$MainContent$TestCheckList$0" id="MainContent_TestCheckList_0"><label for="MainContent_TestCheckList_0">Item 1</label>
                </td>
                <td>
                    <input type="checkbox" value="2" name="ctl00$MainContent$TestCheckList$1" id="MainContent_TestCheckList_1"><label for="MainContent_TestCheckList_1">Item 2</label>
                </td>
                <td>
                    <input type="checkbox" value="3" name="ctl00$MainContent$TestCheckList$2" id="MainContent_TestCheckList_2"><label for="MainContent_TestCheckList_2">Item 3</label>
                </td>
                <td>
                    <input type="checkbox" value="4" name="ctl00$MainContent$TestCheckList$3" id="MainContent_TestCheckList_3"><label for="MainContent_TestCheckList_3">Item 4</label>
                </td>
            </tr>
    </tbody>
</table>

Yuck!

Thankfully, this control contains a property called “RepeatLayout” that gives us the option to render our list of checkboxes or radio buttons in a much nicer way.

Flow

Rendered within a <span> container.

<span id="MainContent_TestCheckList">
    <input type="checkbox" value="1" name="ctl00$MainContent$TestCheckList$0" id="MainContent_TestCheckList_0"><label for="MainContent_TestCheckList_0">Item 1</label>
    <input type="checkbox" value="2" name="ctl00$MainContent$TestCheckList$1" id="MainContent_TestCheckList_1"><label for="MainContent_TestCheckList_1">Item 2</label>
    <input type="checkbox" value="3" name="ctl00$MainContent$TestCheckList$2" id="MainContent_TestCheckList_2"><label for="MainContent_TestCheckList_2">Item 3</label>
    <input type="checkbox" value="4" name="ctl00$MainContent$TestCheckList$3" id="MainContent_TestCheckList_3"><label for="MainContent_TestCheckList_3">Item 4</label>
</span>

OrderedList or UnorderedList

Rendered within a <ul> (unordered list) or <ol> (ordered list). Note: Multi-column layouts (RepeatColumns attribute) are not supported when using this option.

<ul id="MainContent_TestCheckList">
    <li><input type="checkbox" value="1" name="ctl00$MainContent$TestCheckList$0" id="MainContent_TestCheckList_0"><label for="MainContent_TestCheckList_0">Item 1</label></li>
    <li><input type="checkbox" value="2" name="ctl00$MainContent$TestCheckList$1" id="MainContent_TestCheckList_1"><label for="MainContent_TestCheckList_1">Item 2</label></li>
    <li><input type="checkbox" value="3" name="ctl00$MainContent$TestCheckList$2" id="MainContent_TestCheckList_2"><label for="MainContent_TestCheckList_2">Item 3</label></li>
    <li><input type="checkbox" value="4" name="ctl00$MainContent$TestCheckList$3" id="MainContent_TestCheckList_3"><label for="MainContent_TestCheckList_3">Item 4</label></li>
</ul>

Table

We won’t be using this option.

Retrieve A Single YouTube Video in .NET

Back in 2009 I wrote a simple web application to output all videos uploaded from a user’s channel. Luckily, hardly anything has changed. Now you only need to register for a Developer Key and state an Application Name. You are no longer required to provide a Client ID.

This time round, I needed to output data onto my page from a single YouTube entry when a user pastes the URL of a YouTube video in one of my form fields.

using System;
using System.Linq;
using System.Text;
using Google.GData;
using Google.YouTube;
using Google.GData.Client;

namespace MyProject.Helpers.Common
{
    public class YouTubeHelper
    {
        private static string YouTubeDeveloperKey = WebConfigurationManager.AppSettings["YouTubeDeveloperKey"].ToString();
        private static string YouTubeAppName = WebConfigurationManager.AppSettings["YouTubeAppName"].ToString();

        //Get YouTube video
        public static Video YouTubeVideoEntry(string videoID)
        {
            YouTubeRequestSettings settings = new YouTubeRequestSettings(YouTubeAppName, YouTubeDeveloperKey);
            YouTubeRequest request = new YouTubeRequest(settings);

            //Link to the feed we wish to read from
            string feedUrl = String.Format("http://gdata.youtube.com/feeds/api/videos/{0}", videoID);

            Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl));

            return videoFeed.Entries.SingleOrDefault();
        }

        //Extract the YouTube ID from the web address.
        public static string GetVideoID(string videoUrl)
        {
            Uri tempUri = new Uri(videoUrl); 

            string sQuery = tempUri.Query;

            return System.Web.HttpUtility.ParseQueryString(sQuery).Get("v");
        }

        //Get required YouTube video information
        public static YouTubeDetail GetVideoInformation(string url)
        {
            Video v = YouTubeVideoEntry(GetVideoID(url));

            //Pass required YouTube information to custom class called YouTubeDetail
            YouTubeDetail vDetail = new YouTubeDetail();
            vDetail.ID = v.VideoId;
            vDetail.Title = v.Title;
            vDetail.Description = v.Description;

            return vDetail;
        }
    }
}

Hopefully, my “YouTubeHelper” class is easy to follow. All you need to use is the “GetVideoInformation()” method by simply passing a page link to where your YouTube video resides. At the moment only full YouTube URL’s are accepted not the short URL (http://youtu.be/).

Finally! Google Shows My Profile Information In Search Results

Ever since Google+ came along, I noticed website authors were getting their picture displayed next to article’s they’ve written in Google searches. Not to be left out of this trend, I decided I would attempt to get my ugly-mug displayed next to all my authored content as well.

Having carried out almost all of Google’s requirements through minor HTML modifications and verifying my Google+ account is linked to this blog, it’s finally happened!

Author information in search results

You may find that it can take some time for authorship information to appear in search results. I carried out all necessary steps back in January 2012. So it’s taken a good 3 months to get picked up. I am sure times will vary depending on the popularity of your site and the number of authored content it contains.

Here are the four basic things I did to get my mug-shot in Google’s search results:

  1. Make sure your Google+ profile has a recognisable headshot photo of high quality.
  2. Link your site to your Google+ account by adding a badge.
  3. Verify your Google+ account with an email address containing your domain address.
  4. Add a link to your site in the “Contributor” box in your Google+ profile.

Small Issue With “CMSPreferredCulture” Cookie When Working On A Multilingual Kentico Site Within A Development Environment

I've been playing around with creating multilingual sites in Kentico (version 5.5R2). One of (the many) Kentico strengths is being able to configure an existing site installation to cater for multi-lingual support in a straight-forward manner.

I came across a perplexing problem when trying to view both of my multilingual sites within the same browser. In my development environment I created two domain aliases and sites in IIS:

  1. Danish – http://172.16.1.28:8010
  2. British – http://172.16.1.28:8011

As you can see, I differentiate between two of my site cultures by the port number.

Kentico Domain Aliases

I could only view one version of the site on both URL’s. This was all due to a cookie that gets created on first site visit and stores the “CMSPreferredCulture” based on the domain name excluding the port number. For those who aren’t aware, “CMSPreferredCulture” simply contains a localisation code for the site. You might be thinking: What’s the big deal?

Kentico CMSPreferredCulture Cookie

Well an issue only occurs when you are developing and testing the multi-lingual setup within a local environment and don’t have access to a range of unique domains. I thought that I could use the different port numbers in my environment to distinguish between the different site cultures.

I was wrong. Kentico only uses the domain name and excludes any port  numbers. If you need to view different culture versions of your site at the same time, you will need to view them in different browsers.

A small thing like this can cause some bewilderment for a Kentico novice. It sure bewildered me. You would expect to have the ability to view different versions of a site based on the domain aliases setup in Kentico.

If anyone can suggest a work-around. Please leave a comment.