Setting up an avatar for your WordPress blog

I’m pretty new to WordPress; the older versions of this site used a custom application I wrote using .NET which I just didn’t have time to maintain anymore. I started porting over all my posts and comments and noticed it always shows my profile as the default “unknown” icon.

First step to fix this is to sign up here at Gravatar. You create a profile using your email as your unique identifier and upload the picture to use. After you do that, you can verify access which allows the blog to display this picture of you. You go to Edit My Profile > Verify Services, then pick “WordPress” and click add. Put your blog URL and the credentials to login and that will do it.

Just one last note: you’ll need to have XML RPC support enabled for this to work (you may have gotten an error in step above if it’s not enabled). You can enable support in WordPress under Settings > Writing > Remote Publishing. Here’s a link to a great article by Go Daddy that explains what enabling XML RPC support does.

Google Accounts is a joke

For being a huge corporation, some things about Google are pretty embarrassing. I originally had a Gmail account and decided I wanted to have a custom email using my domain name. Google offers a service called Google Apps that allows you to do that. Cool.

I signed up for Google Apps. I found out quickly that you can’t transfer most of your products. I was able to transfer the pictures from my Picasa collection, but that’s about it. I had to recreate my Analytics account, my AdSense account, my YouTube account, and more. This was a pain in the ass, but I stuck in there and did it anyways.

Later, I cancelled my Google Apps service in favor of using Go Daddy’s Hosted Exchange product. I love Outlook and Exchange, a lot more than Gmail. I was able to migrate all my data over quickly. A few days after I cancelled my Google Apps service, my entire Google account was wiped clean. What the hell? I thought it would have only removed my Gmail, Calendar, and Google Docs access; apps that are provided by Google Apps.

So after all my woes, here is what I’ve discovered. There are 3 types of accounts:
1) Google account not tied to a Gmail account
2) Google account tied to a Gmail account
3) Google account tied to a Google Apps service

If you have a Gmail account and you want to change your Google Accounts email, you’re screwed; it’s not possible to change the email associated to your account. If you’re a Google Apps user and decide to cancel the service, you’ll have your Google account(s) removed, even though it doesn’t say it will do that. If you have a Google account using a custom domain and then you decide to register with Google Apps, you’ll cause a Google Accounts conflict to happen which has to be fixed by their support team.

What’s funny is that I did an interview with Google a few months ago. Not because I was pursuing a job, but because a recruiter found me on LinkedIn and had sent me a few emails. I love my job at Go Daddy, but I figured I would at least do the phone interview, just for the experience. The person who did the interview (interestingly enough) was a person who worked on the Google Accounts product. Just like I anticipated, I was asked silly academic questions which I’ll admit, I didn’t do the best job answering. The interviewer was pretty upset because I didn’t answer the questions like a full time student would answer them and basically ended the interview 30 minutes in.

Now, a few months later, I have this Google Accounts experience described above. No wonder their products have huge flaws with them. They have a bunch of employees who are more interested in Academia than delivering a product that people want and love.

Editing your PHP settings with Go Daddy Web Hosting

I have a Windows Web Hosting account through Go Daddy and I recently installed the Coppermine image gallery program using Go Daddy Hosting Connection. When I started to upload pictures, the Coppermine program was running out of memory while doing batch adds. This meant it wouldn’t create thumbnails and ultimately wouldn’t add my pictures.

Since Coppermine uses PHP, we need to increase the memory usage allowed. To do this, we need to edit the php.ini file. This file contains all the settings that Go Daddy web servers will consider when running PHP for your account. Please note, the below procedure is for Windows with PHP 5; if you have another installation, please see this article.

First, let’s output the php.ini file. Here’s a sample script you can create and put your root directory. Name the file test.php and upload it to your FTP root.
<? system("type c:\\cgi\\php5\\php.ini"); ?>

Execute that script by loading it up in your web browser. It should now output the full php.ini that Go Daddy uses by default. Save that to disk and open it up in your favorite text editor.

In that file, search for “Resource Limits” and you’ll find a section like this:
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing ...
max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 32M ; Maximum amount of memory a script may consume (128MB)

I just had to bump up my memory_limit from 32M to 64M. After you make that change, save the file as “php5.ini” and upload it to your FTP root.

That did the trick and I was able to upload pictures no problem. If you do all of the above and it doesn’t work, try logging into your HCC and recycling your application pool.

ASP.NET resources

I haven’t done a lot of .NET since back in the good old 2.0 days.

The jobs I held right after graduating from college were extremely heavy on .NET and MS SQL technologies. I joined Intel in 2005, about a year before the .NET 3 framework was released (with the WCF, WWF, WPF, etc). At Intel I mostly worked with COM technologies; C++ and VBScript. I got to do some .NET development, but it was pretty limited.

I joined Go Daddy in 2008 where I mostly did C++ and PHP on Linux. I really enjoyed it but when I got the chance to switch teams at the end of 2010, I was really excited. All of the code for my new team is in C#/.NET. Since then, I’ve been digging in and figuring out all the new features I’ve missed out on.

I found a lot of great resources when I was looking at all the new features of .NET 4.
Click here for a blog entry with a TON of info about .NET 4
Click here for an article which summarizes the new .NET 4 Base Class Library
Click here for an article about new releases, including the ASP.NET MVC 3 framework
Click here to check out a Search Engine Optimization tool

Of all those links above, the one I’d recommend the most is the last one (the Search Engine Optimization tool). This tool is awesome. You enter the landing page URL and it’ll crawl and download your entire site. After it’s done that, It’ll examine what was downloaded for issues.

It breaks problems it finds into categories. For example, it’ll find any pages you forgot to put a title or description. It’ll also help find broken links.

Most of what the tool does is what’s described in the Google document I linked to in a previous article about optimizing your website (It had a couple tips about getting started; like using Google Analytics and different kinds of webmaster tools).
Click here to check out my previous article about optimizing your website

However, having the tool readily available (which takes about 30 seconds or less to run against my website) is great. It saves everything it finds so you can run it multiple times and visibly see the progress you’re making. No matter how good a job you do, you’re going to miss something (and this’ll help you find it).

I recently upgraded to .NET 4 on my Go Daddy account and I’ve really been liking it.
Click here to read about my .NET 4 migration experience

One of the features I am starting to fall in love with (which I hated when it first came out) is LINQ. This is such a great query language. My favorite part so far is dealing with XML using LINQ. My co-worker showed me this sweet tool called LINQPad. It has a lot of great LINQ examples and works similar to Query Analyzer for MS SQL.
Click here to check out LINQPad

That’s all for now, time to get some sleep!

Getting the assembly version in ASP.NET

I typically update the .NET assembly for this website by hand whenever I have a new major release and I’d like to be able to get the version.

Unlike a Windows Forms application, there is no Application.ProductVersion. I Googled for answers and it looked like I needed to do this:
using System.Reflection;
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();

However, that causes a SecurityException to be thrown. I’m running my website at Go Daddy in a shared hosting environment and the permissions are limited.

Here’s how I solved the problem:
using System.Reflection;
Type t = typeof(*pick any class that's in the assembly you want the version of*);
AssemblyName an = new AssemblyName(Assembly.GetAssembly(t).FullName);
string version = an.Version.ToString();

Some examples that I found use Assembly.GetExecutingAssembly(), but I found that this doesn’t work. It’ll compile, but always returns back 0.0.0.0 as the version. That’s why you’ll have to use Assembly.GetAssembly() and provide a type as shown above.

Upgrading your Go Daddy account to .NET 4.0

Right now this website is written in .NET and I’ve only recently decided to try to upgrade it. About 6 months ago, I did an upgrade which brought me from IIS 6 to IIS 7. I had to migrate my database to SQL Server 2005 to accommodate the upgrade but it worked. Behind the scenes, Go Daddy migrates your account to another box which is running Windows Server 2008 and IIS 7.

Now that I’m on IIS 7, I’d like to upgrade my .NET support to .NET 4.0. I recently bought a great book called C# 4.0 in a Nutshell: The Definitive Reference and after skimming through it, I’d like to start using some of the new .NET 4 features.

Go Daddy has full support for .NET framework 4, but only if it’s a Grid account. The Grid technology basically scales your website by copying the virtual directory content to other boxes and providing load balancing. It’s free to upgrade to a grid account, so here’s how you do it!

Sign into your Go Daddy account. In the “My Account” screen, pull up “Web Hosting” under your products. It should look like this:

In the above picture, you’ll notice I highlighted my account with a red box. Click that hyperlink (the part that has the box around it). It’ll bring up some billing options.

Once you click, it’ll pull up billing options that look like the above picture. Once that comes up, go to the “Edit Account Details” tab. Under the plan drop down, you’ll be able to change your account to a Grid account. Non-grid accounts are called classic.

Once that change is made, it’ll take some time for it to go through. When I changed to grid, it took about 2 hours to be processed. Behind the scenes, it’s copying your information over to a server built for the Grid technology.

Once you’re migrated, you’ll want to launch the Hosting Control Center (this is the product I work on). In the “My Account” screen, you can click the “Launch” button to bring up the control center:

Once this is up, you can click “Settings” and it’ll show the icons just like the picture above. To enable .NET 4, you’re going to want to click the icon “Add-On Languages”.

That will bring you to this screen. Here, simply pick “ASP 4.0″ and click “Continue”.

Problems I ran into (and what I did to fix them)
My upgrade didn’t happen without issue. The problems that came up were really easy to work through, though.

The first thing you’re going to want to check are your directory permissions. I noticed when I got migrated that it reset all of my writable directories (for example, logs).

After that, I had to work through 2 issues with IIS. First issue was that I was getting a 500 error. My web.config was still using the old IIS 6 way of displaying errors, so I had to update it to use the new IIS 7 way out outputting errors. Here’s what that looks like:

<configuration>
 <system.webServer>
  <httpErrors errorMode="Detailed" />
  <asp scriptErrorSentToBrowser="true" />
 </system.webServer>
 <system.web>
  <customErrors mode="Off" />
  <compilation debug="true" />
 </system.web>
</configuration>

After that was done, I could see there was a problem with one of my custom http modules (I’m running my application in integrated pipeline mode). I wrote a simple module to work like Apache’s mod_redirect. It’s used to canonicalize my URLs to one final URL ( for example, brianclifton.com instead of brianclifton.com/ ). It also redirects old content.

I had to remove the module from the <system.web> section. I already had the new entry in <system.webServer> (I guess .NET 2/3/3.5 let both entries co-exist). Here’s what my new entry looks like:

<system.webServer>
 <modules runAllManagedModulesForAllRequests="true">
  <add name="UrlRedirector" preCondition="" type="BrianClifton.UrlRedirector"/>
 </modules>
<system.webServer>

After that change, the site loaded up great!

I only ran into one more problem, which happened when I was trying to write this article. Because I have to enter HTML into the blog entry, ASP.NET freaked out because it could have unsafe content in the text. Even though I had a page directive specifying ValidateRequest=”false”, I had to make another web.config entry under the <system.web> section…

<httpRuntime requestValidationMode="2.0" />

That did the trick and it’s been running great since!

Optimizing your website

I’ve found that making a website can be an endless process. Exactly when are you done? No matter how much thought you put into a design or many ideas you have, your website will end up evolving into something completely different over time.

Whatever shape or form your website starts to take, there are always ways to make your website better. You might be thinking… What do you mean better? By better, I mean easier for someone to stumble upon your website, use it, and find whatever they were looking for. Best of all, you don’t need any artistic or design skills to make your website better.

I only started looking at improving my website a few months ago. After digging in and using some free tools, I’ve gotten a lot more traffic and made my website a lot better.

Integrate Google Analytics into your website
It’s important to find out who visits your website so that you can try to provide the kind of stuff they want to see. Google Analytics is a great way to collect this info and it’s really easy to add to your webpages.

Open this link in a new tab or window:
http://www.google.com/analytics/

When you go there, it wants you to sign in using a Google account. If you don’t have one already, sign up for one (it takes less than a minute). After you login, you can create a new analytics account. You only need to provide Google with a few items:
* Your website’s URL ( e.g. http://brianclifton.com )
* Account name for this site (e.g. My Website )
* Your name ( e.g. Bubba Smith )
* Your country (e.g. United States )

After that, just agree to the end user license and you’re ready to begin. The next screen has some HTML you can copy and paste into your webpages. This is the actual tracking code (what talks Google Analytics).

Open up the HTML for your webpage. You can paste the code into the area shown below:
<html>
  <body>
    <h1>Welcome</h1>
    <div>Hello and welcome to my website</div>
    <!-- paste the snippet below this line -->

    <!-- paste the snippet above this line -->
  </body>
</html>

Pasting the snippet they provide you into that area is all you have to do (make sure to put it on all your webpages). Once it’s in place, you can login and view a ton of information. Here are a couple cool examples of data you will have access to after you integrate with Google Analytics:
* Which country or state people viewing your site are from. Is your site popular in Japan? Find out!
* How many unique visitors come to your website ( by day / week / month )
* How people found your website ( Google searches, links from another site, etc )
* Which web browsers people are using

Sign up for webmaster tools (Bing, Google, Yahoo)
Each major search engine has a webmaster area. I would highly recommend signing up for this. For example, here are the two I am signed up with:
http://www.bing.com/webmaster/
http://www.google.com/webmasters/

Once you sign up for a webmaster site, you have to validate that you own the webpage by placing a meta tag in your HTML. It looks something like this:
<meta name="google-site-verification" content="ddffddsfasdfasdfasdf" />

Once that’s in place, you can verify your site and it’ll start collecting information for you. For example, you’ll be able to see:
* Crawler information for the search engine’s bot (errors, stats, etc )
* Popular keywords your site has
* What searches found your site
* View what the search bot sees when it parses your webpages

There’s also links to help documents that can help you get the most out of your website. I recommend looking at any documentation you can get your hands on if it will help get traffic. I only listed Google and Bing above, but I would recommend checking out Yahoo’s webmaster also.

Read the Google search engine optimization document
This is a really good document. You can download it from here:
http://googlewebmastercentral.blogspot.com/2008/11/googles-seo-starter-guide.html

This document covers a lot of the fundamentals of optimizing your site for search engines. More important than that though, I think the document really helps provide guidelines for making a good website.Some of the topics it covers that will help you make your website better include:
* Use the title tag to give each webpage a unique and meaningful title
* Use the meta description tag to describe a webpage
* Use lowercase for URLs and webpage names
* Pick easy to remember URLs (e.g. Stay away from www.website.com/zz4872/TEST/abc.aspx?OBJECTID=234&P=32)
* Use a robots.txt
* Have a sitemap.xml and submit it to every search engine

Conclusion
The info above has probably given you some really good food for thought. If you have any questions or need help, leave a comment on here or email me and I’ll help you figure things out.