CodersBarn.com
The ASP.NET Community Blog

The Future SEO Concerns of a Web Devigner

January 30, 2010 12:01 by agrace

SEO The last thing I ever wanted to be was an SEO snake oil salesman. But as an ASP.NET Web Devigner (Devigner = Developer + Designer), it's not something that I tend to ignore. I recently took on a project to improve the SEO of our local Tourism website. I'm not going to delve into the project details here, but suffice to say that a project like this can offer much insight in normal times but I probably couldn't have picked a worse time to decide on SEO strategies for a website. The last few months have seen radical shifts in SEO priorites in general, and Google's algorithms in particular. Don't forget: SERPs (Search Engine Result Pages) now return real-time results from social networking sites such as Twitter - more on the implications of this below.

Against this backdrop, I decided on an initial analysis of the site using the new IIS SEO Toolikit - get this tool and use it! This identified about 650 no-no's so I spent a week eliminating these one by one and wrote some code to take care of the meta tags and the like. The most important decision I made was to agree with the client to monitor the site for SEO hits, good or bad, for the coming six months. It behooves any contractor to take this course when they know in advance that they may not know anything at all!

IIS Toolkit

Google had no choice but to find some way to reduce the amount of spam clogging its data centers and apply some qualititative heuristic to measure the relevance of sites.  So, they recently re-wrote their entire algorithm (codename "Caffeine") which caused no end of panic among the SEO heads! To this end, page rank seems to be playing a much smaller part than ever before. And whatever small part it is playing will be very much influenced by a site's performance. In fact, performance is going to figure heavily in how well a site fares with Google overall. I can see myself getting more involved in this since it is going to effect clients' pocket books in a very discernible way - my prediction for 2010!

WHAT'S GOING TO MATTER

* Personalization
Search If you're signed in or not, Google can use your search history to tweak the relevance of your own searches. Signed in, you can opt to turn it on or off. Signed out, a cookie records your search history for 180 days. I'm not a big fan of this because I want my results to be the natural consequence of my ability to creatively grep precisely what it is I'm looking for. But that's just me and I can readily see how this step is necessary for Google to provide "meaningful" results to people. Personalization lends even more credence to the diminishing importance of page rank.

* Conversions
This is the number of successful transactions divided by the number of total unique visitors. Think of an E-Commerce site where you can use advanced Google Analytics tools to measure conversion rate formula as the number of sales divided by the total number of unique visitors. Check out Google's Conversion University.

* Universal Search
Remember, that search results now include video, images, blogs, books. I have been running some tests for the blog results and my impression is that the big sites with large traffic are just getting stronger. Even entering the title of my blog (The ASP.NET Community Blog), does not show me in the first ten pages of results! I've seen other developers complaining of a lack of transparency - but then again, we're talking about search algorithms which are as tightly guarded as a duck's arse and that's watertight. No surprise there, but it's still unsettling because the cause and effect of SEO tweaks seems to be even less predictable now.

THE REAL IMPLICATIONS

1) Sites with basic SEO errors will be penalized.

2) Sites with poor performance will be penalized. If you stop and think about it, there must be a huge increase in the amount of content that Google has to index in light of real-time results pouring into their data centers every second. Something has to give. Check out the peformance of your site using the Google-recommended WebPageTest application.

kick it on DotNetKicks.com


Tags: ,
Categories: Google | SEO
Actions: E-mail | Permalink | Comments (5) | Comment RSSRSS comment feed

Twitter - Saving your Tweets

December 19, 2009 20:44 by agrace

Follow me on Twitter In my ever ending search for a tool/technology to manage my inflow of information from the Web, I opened a Twitter account that could also act as a set of pseudo-bookmarks. My IE8 and Firefox bookmarks already stretch to the floor when expanded. Plus, I'm convinced that there must be some unknown aspect of HCI that dictates that once something is saved as a bookmark, it is never opened again. Bookmarks drop downs are about as user-friendly as crotch rot. I've looked at Evernote and OneNote, the latter being the most promising to date. I plan to take another look at the products from Microsoft Live Labs.

Recently, I passed the 700 tweet mark and decided to archive what I had. But how? I gleaned the following tidbits from "Twitter Tips, Tricks, and Tweets" by Paul McFedries - founder and CEO of Mashable. You can save a local copy of your tweets by entering the following URL in your browser:

http://twitter.com/statuses/user_timeline/account.xml?count=n

where account = your account name, and
n = number of tweets


Tweets XML

This will open n number of your tweets to date in XML in your browser. From here, you can import your saved XML file into Excel 2007 as follows:

1) In Excel, click on the Data tab

2) Data -> From Other Data Sources - From XML Data Import

3) Click a cell where you want to import the data to

4) Save as, using the id of the last tweet

Save Tweets

Tweets URL

The reason I include the last Tweet id# is to make it easy to archive next time, starting where I left off and using the following syntax:

http://twitter.com/statuses/user_timeline/account.xml?since_id=6839319097


If you look at the Excel sheet you will see that the last tweet had an ID of 6839319097. This will download an XML version of all my tweets since then. Now I have a proper archive of my tweets that I can search on :-)

From here, you might want to take a look at the TweetSharp API - a complete .NET library allowing you to build Twitter applications in C# and .NET 3.5. I've started reading a great book on the topic: "Professional Twitter Development with Examples in .NET 3.5" by Daniel Crenna.

kick it on DotNetKicks.com


Tags:
Categories: twitter
Actions: E-mail | Permalink | Comments (8) | Comment RSSRSS comment feed

Install SharePoint 2010 on Windows 2008

November 21, 2009 12:21 by agrace

Follow me on Twitter Two weeks ago I decided to prep my development VMWare Workstation in anticipation of the yet-to-be-announced SharePoint 2010 beta 2 release. After some futile attempts at installing W2K8 server, I realized that it was time to upgrade my VM software from version 6 to 7. After forking out the $99 (well worth it IMHO), I encountered the first hurdle when attempting to create the VM: my machine was not "VT enabled"... Apparently my host machine, which is a HP dt5000 desktop with 8GB of RAM and two quad cores wasn't up to the task :-O VT stands for Virtualization Technology and it's basically the processor equivalent of a V8 Dodge Challenger.

Some machines are VT-capable but are not VT-enabled when shipped. It's pretty common for laptops not to have this enabled. I called HP Support and ended up re-booting my machine and updating the BIOS to enable VT-Threading. Not so long ago, PC support technicians would respond to such a request with "do it but keep a fire extinguisher handy"...

Here are my machine specs...

Intel Core2 Quad CPU Q9450 2.66GHz 4 cores
Bios: American Megatrends 5.16 6/19/2008
Vista Ultimate 6.0.6002 SP2 Build 6002


...and the steps to perform this task - steps should be similar irrespective of the machine:

1. Turn off the PC and then again turn on the PC
2. After you get the HP logo screen immediately keep tapping the f10 key after the HP logo screen to enter in to BIOS set up screen
3. In the BIOS set up screen select the “Power” tab
4. Under the Power tab you will find the option “Virtualization Technology”
5. You need to enable it and then press f10 key on the keyboard to save and exit
6. Re-start machine


From the moment PDC09 began, the blogosphere has been alight with posts about installing this beta, so I'm not going to give overly-detailed instructions. Instead, I want to focus in on the gotchas that can make this an unpleasant experience for non-admin devs like myself. I'm also providing the links you need at the end of this post.

Developer in Admin Role As I write, I have just (successfully) re-created the install of SharePoint on my VM for the third time, in an efort to get this right. Previous attempts resulted in various errors, which though unforseen, were still my fault. One tip: I use VirtualCloneDrive to mount my ISO (DVD) images when creating VMs and it works on 64-bit. I also use ClamWin Anti-Virus for 64-bit. Create a strong password for your (admin) account with a mix of at least capital and small letter and numbers - you'll see why in a bit.

After the OS is installed, if you start getting license activation errors in the log, go to Start -> Control Panel and click on the "Change Product Key" link. When prompted, enter your valid licensed product key and the product activation will complete successfully.

You may also want to install the KB 971831 hotfix which "provides a method to support the token authentication without transport security or message encryption in WCF is available for the .NET Framework 3.5 SP1."

Now it's time to install SQL Server 2008 - 2005 will work also but involves different patches:

Script to open SQL Server ports:
http://support.microsoft.com/default.aspx/kb/968872

SQL Server 2008 SP1:
http://www.microsoft.com/downloads/details.aspx?familyid=66AB3DBB-BF3E-4F46-9559-CCC6A4F9DC19&displaylang=en

CU2 for SP1:
http://support.microsoft.com/kb/970315

Add your admin account in SSMS and grant permissions for the following roles:

* securityadmin fixed server role
* dbcreator fixed server role

Important: If you plan to run Windows PowerShell cmdlets that affect a database, this account must be a member of the db_owner fixed database role for the database.

Next, grab Powershell 2.0 and install it. The SharePoint Pre-Requisites checker failed on this for me several times because of the older version of Powershell being present.

Install Menu

Next install SharePoint 2010. When the SharePoint Server 2010 menu appears, first click on the "Install software prerequisites" link. After this successfully completes, click on the link to actually install SharePoint Server. Choose Server Farm and Complete from the wizard menu options. This is the part that catches most people. The terminology here leaves a lot to be desired and I'm surprised that it's still being used in this version - <rant>they let the marketing assholes rename almost everything else so why stop there?</rant>

Important: Do not run the Products and Technologies Configuration Wizard after the wizard completes.

Install Type

With the 2010 version we cannot automatically run everything with a local account. This is retarded because in most cases people do not want to set up AD and DC for a simple dev VM. Luckily, there is a workaround with Powershell - just follow the simple steps and use the strong password we created earlier, when prompted.

Now we can run the Products Configuration Wizard from the Start menu and use our local account when prompted for such info by the wizard. On completion, you will be presented with the Farm Configuration Wizard - take the dummies option (default) and you will be led by the reins to the complete setup of your site collection and top level home site. This is a huge improvement over the 2007 version. What's even better is that with the introduction of the new Service Application Architecture we no longer have to go through the process of creating the now deprecated Shared Services Provider (SSP).

Home Page
 

Next task will be to install VS 2010 Ultimate and SharePoint Designer 2007...

UPDATE - 12-12-2009:

I have since been re-building my machine and I would like to point out something that I missed the first time around: before manually installing Powershell 2.0, you have to uninstall the 1.0 version that comes with the OS. You can do this by clicking on the 'Remove Feature' link in Server Manager.

kick it on DotNetKicks.com


DropDownList, DataBinding and RequiredValidator

October 17, 2009 10:40 by agrace

I recently had a DropDownList being pre-populated from a database. I also wanted to insert "Select" at the top of the list and make it a required field. Googling this yielded much misinformation for what turned out to be pretty simple to solve in the end.

Say you have a DDL like this:

<asp:DropDownList id="testDDL" runat="server">
    <asp:ListItem Text="Select"></asp:ListItem>
</asp:DropDownList>


If we try to populate this DropDownList from a database with the values 1,2 and 3, and then try and add a RequiredFieldValidator, that validator will not fire.

Some people resort to creating a CustomValidator and/or JavaScript here. This is not necessary. We need to take a step back here and re-phrase the problem: We already have data in our list in the shape of the "Select" item. We now want to append data from the database. A quick search of the MSDN documentation leads to the AppendDataBoundItems property for the DropDownList.

From the documentation: "The AppendDataBoundItems property allows you to add items to the ListControl object before data binding occurs. After data binding, the items collection contains both the items from the data source and the previously added items." The italics are mine...

We can use the InitialValue of the RequiredFieldValidator in conjunction with the AppendDataBoundItems property of the DropDownList to arrive at a working solution:

<asp:DropDownList id="testDDL" AppendDataBoundItems="true" runat="server">
    <asp:ListItem Text="Select"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="salaryReqVal" ControlToValidate="salaryDDL"
    ErrorMessage="*" Display="dynamic" InitialValue="Select"
        runat="server"></asp:RequiredFieldValidator>


kick it on DotNetKicks.com


Tags:
Categories: ASP.NET
Actions: E-mail | Permalink | Comments (4) | Comment RSSRSS comment feed

Input String was not in a Correct Format

August 16, 2009 09:42 by agrace
Incorrect Format

Here's the scenario: I'm building a basic 3-layer Web application for a client with business and data layers. Queries are performed in stored procedures, just basic ADO.NET. The table I am attempting to insert a record into has a range a field types such as strings, ints, decimals, etc.

If the user is entering integer or decimal values via texboxes, which is usually the case, then you have to expect either no data or a string of possibly mal-formed data. You must filter out the mal-formed data with validation and/or convert the resulting input data to the expected database type.

If you have a database field called SquareFeet of type int and you attempt to insert the following in your code-behind insert method, you will probably see this error:

// Results in error message
AddSomething(int squareFeet)
{
    Convert.ToInt32(SquareFeetTxtBox.Text.Trim());   
}


You must be careful if you are trying to fetch, say, an int or decimal as input:

// Correct way if SquareFeet field is an int
int squareFeet
if (int.TryParse(squareFeetTxt.Text.Trim(), out squareFeet))
    squareFeet = Convert.ToInt32(squareFeetTxt.Text.Trim());
else
     squareFeet = 0;
// Now insert the value as part of the record


// Correct way if SquareFeet field is a decimal
int squareFeet
if (decimal.TryParse(squareFeetTxt.Text.Trim(), out squareFeet))
    squareFeet = Convert.ToDecimal(squareFeetTxt.Text.Trim());
else
     squareFeet = 0.0m;
// Now insert the value as part of the record


References

Refer to these links for the differences between Convert.ToInt, int.Parse and Int.TryParse:
http://dotnetperls.com/int-parse-conversion
http://dotnetperls.com/int-tryparse

Refer to this link for an explanation of the 0.0m decimal syntax:
http://msdn.microsoft.com/en-us/library/364x0z75(VS.80).aspx

Moral of the Story
If you are learning any language, your first priority must be to understand the types thoroughly. Resist the temptation to gloss over the grammar just to get to the fancy stuff! :-)

kick it on DotNetKicks.com


Tags: , ,
Categories: ASP.NET | C#
Actions: E-mail | Permalink | Comments (8) | Comment RSSRSS comment feed