PageRank tool walkthrough
I’ve added a video on YouTube to walkthrough using the PageRank checking DLL you can download from my website.
(by the way, there is no audio).
If you enjoyed this post, make sure you subscribe to my RSS feed!
YourShack Social Launch
To celebrate our move to Picadilly and the launch of our new website we thought we’d through a social for our people. Get the info and get down there.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Google Maps, UK Postcodes and GeoCoding
Going back a few years I downloaded a UK postcode database that mapped Outcodes (the first part of the postcode) to approximate Lat/Long co-ordinates. When used correctly you could use the data to find which postcodes were closest (distance matching) or simply the distance between two places by comparing the Lat/Long co-ordinates with a bit of maths. The main drawback was the need for a database that was only accurate to within a few km - no good for showing actual locations on a map or for local services - as the co-ordinates returned were for the centre of the Outcode.
Nowadays however Google’s geocoding service allow you to calculate distances between two addresses or postcodes effortlessly. You can then plot these directly onto a Google map and best of all, it’s all free to use.
My latest project provided an opportunity to make use of this facility. I had initially intended to use UpMyStreet or Google Local Search to furnish the information my client needed. Upon inspection however, neither service had a comprehensive enough list of local services.
The decision was made to go back a step and manually enter what the client deemed the most important local landmarks or services. This was done simply by providing a postcode or partial address and from this I was able to provide the distance to the service and plot it on a map.
There are many useful applications for this and I’ll be adding some of these facilities to this website over the next few weeks I hope. As I add facilities I’ll be sure to add source code to demonstrate how simple these operations have now become.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Using the PageRank DLL in your applications (VB.NET)
To complete this walkthrough you’ll need to download the PageRank DLL. This is included in the PageRank Checker download on the downloads page.
Extract the ZIP file. The DLL file is in the path: GetPageRank.zip\PageRank\bin\Debug
Make a note of the path as you’ll need it later.
Start by opening up Visual Studio (or Developer Express etc) and creating a new project of type: Windows Application.
Then add the following controls to the main form:
Label: Text = “Website URL”
Label: Text = “Google PageRank:”
Label: Name = “lblResult” and Text = “-”
Textbox: Name = “txtURL”
Button: Name = “btnGo” and Text = “GO”
The next step is to add a reference to the DLL into your project. Generally you would right-click on the Project in the Solution Explorer and select “Add Reference”.
When the dialog box eventually opens up, select the “Browse” tab and find the DLL file which should be called “PageRank.dll”, then click OK.
OK, double-click on the button you’ve labelled “GO” which will create an event handler for the button’s OnClick event.
I’ve provided the code in C# and VB.Net
Directions for C#
Add the following line to the top of the file:
using PageRank;
Then inside the event handler:
TGooglePR prCheck = new TGooglePR(); lblResult.Text = prCheck.ReturnPageRank(txtURL.Text);
and you’re done.
Directions for VB.Net
Add the following line to the top of the file:
Imports PageRank
Then inside the event handler:
Dim prCheck As New TGooglePR() lblResult.Text = prCheck.ReturnPageRank(txtURL.Text)
and you’re done.
Just run the project and enter a full URL in the textbox before clicking on “GO”. The Google PageRank will be shown in the label within a second or so.
Enjoy.
Plus I’ve done a video walthrough in C# and posted it on YouTube: http://www.youtube.com/watch?v=F9MgNVmJnro
If you enjoyed this post, make sure you subscribe to my RSS feed!
The Project Location is Not Trusted
Ever got this dialog box: "the project location is not trusted" ??
Yeah me too. A recent change in network infrastructure and folder-redirection caused this issue to surface.
The way around it is well documented but sometimes there are other factors to consider.
First, take a look at Microsoft’s fix for this: The Project Location is Not Trusted Dialog Box
Then if you still have a problem like I did, check the location is not in your Trusted sites list in IE (thanks to the following page: http://discuss.joelonsoftware.com/default.asp?dotnet.12.334487.2
I know the author of that page didn’t solve all his problems but removing the network location from my Trusted Sites list sorted out my problem straight away.
AR
If you enjoyed this post, make sure you subscribe to my RSS feed!
IRPStackSize Registry Fix for “Not enough server storage space available to process this command”
I haven’t updated my website much lately - guess I’ve been really busy at work. I’m currently working on some Server 2003 projects and have been playing around with Group Policy, roaming profiles and redirected folders.
These are not new subjects to me but as I tend to do more development work nowadays, it usually means long periods between server work and the things you don’t do every day fall out of your memory.
I had a real grapple with what I initially thought was permissions issues the other day but turned out to be caused by poor allocation in Server 2003 by default.
The situation arose when I was trying to get client machines to create and update roaming profiles (all done in a test environment before going live). The actual error condition was “Not enough server storage space available to process this command” and after trawling about I found the fix to be something going back to Windows NT times and a resistry hack to enable or increase the IRPStackSize. Updated the registry and the problem was solved.
The fix is available here: IRPStackSize Registry Fix
AR
If you enjoyed this post, make sure you subscribe to my RSS feed!
Effect of HTTP 403-6 Error on Google
A few days ago I discovered through Google Webmaster Tools that some of my sites were unreachable by Google. In particular Google reported my homepage as unreachable and many of my sub-pages returned the same 403-6 error.
After checking my website both with various browsers and response grabbers located around the world I determined that the problem was definately not with the way I had designed the website or configured the hosting.
The HTTP 403-6 error means that an incoming request has been denied (Forbidden) because the IP address is banned or rejected in some way. Initially I tried to determine if this was because of some response error on my part; this was not the case.
I checked my server logs and could see the same errors showing up on every request that came from the GoogleBot (incidentally all requests were on the same IP). I notified my hosting provider and eventually the problem was rectified and the IP address used by GoogleBot at that point in time was unblocked.
I re-submitted my sitemaps and shortly afterwards the errors started to disappear from Google’s Webmaster Tools portal. I hoped that I had got to the root of the problem in time.
The next day while routinely checking websites I discovered that the homepages had disappeared from Google’s search results. Initially I thought that the sites had dropped on their keyword matches but “site:URL” checks showed the actual pages had been dropped.
It has taken 2-3 days for these pages to reappear in the search results and I am still waiting for some pages to come back in. Personally I found the timing to be very bad as I am trying to build Google’s confidence in my websites.
This all points to one of my main tips for SEO. It doesn’t matter about anything else if Google etc cannot see your website. Choose your hosting company carefully.
AR
If you enjoyed this post, make sure you subscribe to my RSS feed!
Generate XML sitemap for Google
There are many sites that deal with returning a Google sitemap from .NET pages. Most of these need you to adjust the IIS settings (yes this is about Windows hosting).
There are also some that deal with creating a sitemap on-the-fly from the web.sitemap file in your project but here I’ve included the code to return an XML sitemap that conforms to the Sitemap protocol that you can submit to Google without modifying IIS - something that should interest those of you who are on shared hosting.
The ZIP download is available at the bottom of this article.
Basically if you create a blank ASPX page and clear out all the HTML elements from the ASPX page you will just be left with the <% @Page %> definition. Below is an example of the only line that needs to be in the front file (.ASPX).
For your purposes, just add the ContentType=”text/xml” section. It may NOT be necessary once you read through the page-behind code, but I’ve left it in as it doesn’t hurt.
Example:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="XMLSiteMap.aspx.cs" Inherits="XMLSiteMap" ContentType="text/xml" %>
Next you will need to put the GSiteMap.cs file in your App_Code folder.
In the page-behind code, you can then simply call the class and all the work is done for you. The code uses the filesystem (whether it is running locally or on a remote server) to generate the sitemap. It will also return the correct protocol type (http or https) and the port number if not on port 80.
I have used this method before the generate an XML file in the filesystem but since my hosting provider doesn’t allow ASPNET to write to the root directory of the site, returning the sitemap on-the-fly is the only truely automated method for this.
In the page-behind’s On_Load event:
protected void Page_Load(object sender, EventArgs e){GSitemap _siteMap = new GSitemap();_siteMap.ProcessRequestFS(Context);}
This simply passes the current HTTPContext to the sitemapping class allowing it to replace the Response with your pure XML sitemap.
I won’t go into the full code at this point because you can read through it yourself from the download. It’s worth pointing out the following however:
private string[] _Allowed_Extensions = { “.aspx”, “.php”, “.asp”, “.htm”, “.html”, “.txt”, “.doc”, “.pdf”, “.jpg”, “.gif”, “.xml” };private string[] _Restricted_Directories = { “App_Data”, “App_Code”, “admin” };
1. Put any extensions you want to be indexed in the “Allowed Extensions” array.
2. Put any directories you don’t want indexed in the “Restricted Directories” array.
Where the code pulls a list of files from each directory I initially used a file pattern, ie:
"*." + Extention
but found that some files were being indexed twice - this is because of a flaw in the framework that will return .ASPX files when you ask for .ASP files. For this reason I re-worked the code. It’s less efficient this way but it’s guaranteed to work.
The call to “ProcessRequestFS” iteratively goes through each directory adding files to the sitemap. If a directory is blocked by the “Restricted Directories” array then all sub-directories of that Directory are also blocked.
You can see an example of the output of this code by visiting: (not currently available)
On my site you may notice that I have temporary removed the optional tags from the sitemap. They are however created in the version available for download.
In particular, the priority tag is automatically down-graded for each directory further down the path that the script has to look.
There is no real error handling in this version but you can add that as necessary.
I checked with Google and Yahoo! and as far as I can see they have no problem with you adding a sitemap with the .ASPX extension.
The full code can be downloaded here: http://www.aaronreynolds.co.uk/page/Code.aspx
The full code is unavailable at the moment and will be online again soon.
If you have any problems using the code, please let me know.
AR
If you enjoyed this post, make sure you subscribe to my RSS feed!
PHP upgrade to 5.x from 4 on CentOS
One of my customers has recently purchased a VPS for their website. My Linux VPS is on WebFusion, theirs is on EasySpace.
Now unfortunately EasySpace seem to bugger off at 5pm so I had to rely on Google and hope that some of the Linux boys and girls out there were writing in an intelligible way.
Thankfully for me, I was not let down.
My first source was the AtomiCorp wiki: http://www.atomicorp.com/wiki/index.php/PHP
Then I ran into a little problem with a "dummy" library causing my "yum" to fail. Similar except here: http://languor.us/error-missing-dependency-glibc-common-2-3-4-2-25-needed-package-glibc-dummy-centos-4
With that removed (on account of it being labelled somethink like xxxxxx-dummy-centos-4) I re-ran the update and succesfully upgraded to PHP 5.2.6.
All seems fine (including Plesk) although I expect the packages in Plesk might be out of synch so I'll need to remember the method in case I have to re-install the VPS anytime soon.
If you enjoyed this post, make sure you subscribe to my RSS feed!
PHP, MySQL and even ASP grrr!
I'm not a PHP developer - never have been. I've had to fix problems in PHP sites before now and hence I've picked up a little knowledge of the language.
I've recently been helping my GF to rebuild something using MySQL and PHP and it makes me glad I moved on to using an IDE for server-side programming. It also makes me glad that I can use MS-SQL.
MySQL (we are talking about one of the web-based interfaces here by the way not the actual database) is pretty lousy-looking and difficult to find the features that you need. I know the database has many powerful features but the particular implementation I was using left a lot to be desired.
It's also been a few years since I used Dreamweaver to do any programming but without it I wouldn't have got far very fast in PHP. I'm sure that PHP is far more powerful than classic ASP - in fact I know it is because I've had to do some classic ASP recently. I don't miss using classic ASP though it has to be said.
When I offered to fax something to a friend recently they declined and said they didn't live in the 80s. Classic ASP, like faxes have their uses in todays world but I don't really wanna use them if I don't have to.
I would have to say that anyone moving into web-site server-side programming should look at both camps (PHP and language.NET) before deciding on their path because to be honest once you are used to using one language or system, you'll probably stick with it until it becomes obselete.
The question is when will ASP become obselete?
If you enjoyed this post, make sure you subscribe to my RSS feed!
