Blog restoration, upgrade to 2.7 and other stuff

A little while ago I noticed that my blog was down, and that some of the files in the root directory had been corrupted. I contact my host (BlueFur) and they got back to me after 24 hours to say they had fixed the probem, and that all was good.

And they had, kind of.

They had restored the blog from a backup made over a year ago. Great going. That’ll teach me to rely on hosting backups, rather than do my own. Luckily I was able to get most of the posts from google cache, but all the comments made in the last 12 months were lost.

And I’ve finally rejoined society by upgrading to Wordpress 2.7 (up from 2.1). Finally, my posts are being saved automatically…

So now everything is in order. Time for some more posts!

We Got Domain - over 10,000 aged domains for sale

We Got Domain is a quick site that I built to make buying domains from forums like dnforum, digitalpoint etc easier. It extracts domain names from the sale threads and then finds out extra info like Backlinks, Pagerank, Creation date etc. Domains can only be bought on the forums so hopefully We Got Domain will save time for people buying domains while driving extra traffic to the forums (and they get tons of do-follow links as a small bonus).

The site was partly inspired by a the post Purchasing Domains on as well as Shoemoney Marketplace and

I hope you find the site useful - send me an email if you have any suggestions or improvements.

Your own Lolcats widget (I Can Has Cheezburger?)

OK, I’m the first to admit that the whole lolcats thing might not be for everyone. But it’s for me. If it’s for you, too, then enjoy :)
If you would like this widget on your site/blog, just add the code:
<script src='' type='text/javascript'></script>
And here’s how it was done:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim sCacheKey As String = "CACHE_ICanHasCheezburger"
        Dim oLolCat As clsLolCat
        Dim sHTML As String        

        oLolCat = CType(Cache(sCacheKey), clsLolCat)        

        If oLolCat Is Nothing Then
            oLolCat = PicAndCaptionGet()
            Cache.Insert(sCacheKey, oLolCat, Nothing, Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration)
        End If        

        sHTML = "<div><a href='" & oLolCat.sLinkURL & "'><img border='0' src='" & oLolCat.sPicURL & "'/></a>"
        sHTML = sHTML & "<div>More at LolCats at <a href=''>I Can Has Cheezburger</a></div></div>"        

        sHTML = "document.write(""" & sHTML & """);"

    End Sub

This first part just checks to see if we have the LolCat HTML in the cache. If we don’t then generate the HTML and put it in the cache again. Saves us hitting the site all the time (or in this case, feedburner).

    Private Function PicAndCaptionGet() As clsLolCat
        Dim Http As HttpWebRequest
        Dim sRequestURL As String
        Dim WebResponse As HttpWebResponse
        Dim responseStream As Stream
        Dim Reader As StreamReader
        Dim sText As String
        Dim oRSSDoc As New System.Xml.XmlDocument
        Dim oFirstNode As System.Xml.XmlNode
        Dim oLolCat As New clsLolCat        

        sRequestURL = ""
        Http = CType(WebRequest.Create(sRequestURL), HttpWebRequest)
        Http.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate")
        WebResponse = CType(Http.GetResponse(), HttpWebResponse)
        responseStream = WebResponse.GetResponseStream        

        If (WebResponse.ContentEncoding.ToLower().Contains("gzip")) Then
            responseStream = New GZipStream(responseStream, CompressionMode.Decompress)
        ElseIf (WebResponse.ContentEncoding.ToLower().Contains("deflate")) Then
            responseStream = New DeflateStream(responseStream, CompressionMode.Decompress)
        End If        

        Reader = New StreamReader(responseStream, Encoding.Default)
        sText = Reader.ReadToEnd()

        oFirstNode = oRSSDoc.SelectSingleNode("//item")
        oLolCat.sCaption = oFirstNode("title").InnerText
        oLolCat.sLinkURL = oFirstNode("link").InnerText
        oLolCat.sPicURL = oFirstNode("media:content").Attributes("url").Value        

        PicAndCaptionGet = oLolCat
    End Function        

End Class        

Public Class clsLolCat
    Public sPicURL As String
    Public sCaption As String
    Public sLinkURL As String
End Class

This is the code that visits the icanhascheezburger RSS feed and extracts the latest post details. This is all pretty simple stuff, with one cool bit that takes care of the gzip compression that is on the feed. Full credit must go to Rick Strahl for his post talking about gzip:

Aussie Estate Agents fight Google in Court (and get what they want, sorta)

I noticed in the paper over the weekend that two Melbourne real estate agents sought legal action in December to force Google to not display posts from a certain blog when their names were ‘googled’. The blog posts apparently showed the agents (Paul Castran and Mark Forytarz) in a bit of a bad light - suggesting one bullied a mentally disabled man into selling his house to earn the agent commission and that the other agent participated in illegal dummy bidding. Interestingly, there was no legal action brought against the blogger who wrote the posts. Also, the newspaper article stated that the posts were not removed from the Google index.

Suing Google has been tried several times before, and rarely goes well, but when I did a search the agents names:

The defamatory article is not there, and there is this line at the bottom of the page:
In response to a legal request submitted to Google, we have removed 1 result(s) from this page. If you wish, you may read more about the request at
Notice that the search was done in, if you do it in then the defamatory blog post is the first result (though perhaps this will be gone soon, too).

So what caused what here? Did legal action have no effect as claimed by the newspaper? Did the two agents just approach google through other channels (similar to a DMCA takedown)? Given that the initial action reportedly failed, did the recent publicity have anything to do with google removing the blog posts?

But now the posts have been removed from, everything is fine for the real estate agents, right?
Not quite.
Now, if you search for ‘Paul Castran’ the #2 result is Paul Castran Wins Today’s Stupid Prize!. Time for more legal action? :)

AGLOCO goes belly up

I just got this email.

Dear Gath,

We would like to update you on the status of AGLOCO’s operations. We continue to believe in the AGLOCO concept, but our revenue is currently not sufficient to give Members a meaningful distribution. And though there are increases in membership, the resulting revenue is not enough to support operating costs. As a development team we are unable to continue to use our savings to fund the operations. If any Member would like to pursue continuing the operations of AGLOCO, you may contact us at .

We would like to thank every Member for supporting our effort to bring a piece of the Internet directly to the user. We hope that we can find a way to keep the operations going.

AGLOCO Development Team

So, it looks like all the people who said ‘If it seems too good to be true….’ were right. Looks like I’m going to cancel my order for the ferrari.

Need more traffic? Blog MatchUp is coming!

I’ve been a bit quiet lately, but thats just because I’ve been working on my latest project - and it’s almost ready.

Blog MatchUp allows you to compete with other blogs for bragging rights over who has the most traffic. But as everyone saw from the ShoeMoney vs john Chow competition, everyone is a winner with more traffic.

At the moment Blog MatchUp is taking registrations, but should be ready to launch beta testing within a week.


Draggable Marker Google Maps Demo

So you’ve been checking out my previous posts on Google Maps and Draggable Markers, and it would be nice to have a demo so you can see the draggable markers in action.

Check this out:

And the code as well? Here is the source for the Google Maps Demo

Add Draggable Markers and Events to your Google Maps

Following on from my last post on how to add Google Maps to your ASP.Net site, I’m now going to show how easy it is to add draggable markers to your map.

First, make sure you have the map working on your webform.

Having the map fire server-side events on user actions is pretty simple, and here is the code:

    Private Sub AddEventToMapDemo()
        Dim GeoCode As Subgurim.Controles.GeoCode
        Dim sMapKey As String = System.Configuration.ConfigurationManager.AppSettings("")

        GeoCode = GMap.geoCodeRequest("3052. VIC. australia", sMapKey)
        Dim gLatLng As New Subgurim.Controles.GLatLng(, GeoCode.Placemark.coordinates.lng)

        GMap.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal)
        Dim oOption As New Subgurim.Controles.GMarkerOptions
        oOption.draggable = True
        oMarker = New Subgurim.Controles.GMarker(gLatLng, oOption)

        GMap.addListener(New Subgurim.Controles.GListener(oMarker.ID, Subgurim.Controles.GListener.Event.dragend, _
        "function(){{ var ev = new serverEvent('dragend', 0); ev.addArg(" & oMarker.ID & ".getPoint().lat()); ev.addArg(" & oMarker.ID & ".getPoint().lng()); ev.send(); }}"))

    End Sub

You then need to add code to handle the event:

    Protected Function GMap_ServerEvent(ByVal s As Object, ByVal e As Subgurim.Controles.GAjaxServerEventOtherArgs) As String

        If e.eventName = "dragend" Then
            Response.Write("New Latitude =" & e.eventArgs(0) & ", New Longitude = " & e.eventArgs(1))
        End If

    End Function

The server-side event will be fired every time the marker is dragged and dropped.

In my situation, I wanted to allow the user to drag & drop the marker as many times as they wanted - and only store the new Lat/Long values when the user pressed the Save button.

This is a little bit harder to code as the variables used to reference the marker cannot be accessed globally - so we can’t just read their values when the user presses the save button (to the gurus: I’m sure they can, but I couldn’t find an easy way to get at them) . However, we can store them in hidden fields when the DragEnd event is raised, and examine those fields when Save is pressed.

Add these fields to your webform:

<input type=hidden id="hidLat" name="hidLat" runat=server />
<input type=hidden id="hidLng" name="hidLng" runat=server />
<asp:Button ID="Button1" runat="server" Text="Save" />

And add this sub to your code-behind:

    Private Sub NewLatLongOnSaveMapDemo()
        Dim GeoCode As Subgurim.Controles.GeoCode
        Dim sMapKey As String = System.Configuration.ConfigurationManager.AppSettings("")

        GeoCode = GMap.geoCodeRequest("3052. VIC. australia", sMapKey)
        Dim gLatLng As New Subgurim.Controles.GLatLng(, GeoCode.Placemark.coordinates.lng)

        GMap.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal)
        Dim oOption As New Subgurim.Controles.GMarkerOptions
        oOption.draggable = True
        oMarker = New Subgurim.Controles.GMarker(gLatLng, oOption)

            GMap.addListener(New Subgurim.Controles.GListener(oMarker.ID, Subgurim.Controles.GListener.Event.dragend, _
            "function(){ document.getElementById('hidLat').value=" & oMarker.ID & ".getPoint().lat();document.getElementById('hidLng').value=" & oMarker.ID & ".getPoint().lng() }"))

    End Sub

And here is the ‘Save’ button click event:

    Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Write("New Latitude =" & hidLat.Value & ", New Longitude = " & Me.hidLng.Value)
    End Sub

Code the perfect Exit Popup (exit console)

All popups are bad news, right? Nothing gets rid of visitors faster than a crappy ad for casinoviagraporn getting in their face.

But what about visitors that found your site through a search engine, spend 5 seconds on 1 page of your site & then press the back button?

They didn’t find what they want.
They aren’t coming back.
Don’t they deserve some popup love?

Seriously, you have (most likely) lost these visitors for good anyway, so showing them a popup won’t make much difference to your visitor retention.

So how do you do it?
The key is the javascript event onUnload. This fires when a page is exited, whether by navigating out via a link, pressing the back button or closing the browser. The problem is, it fires every time a page unloads - and we only want a popup when the visitor leaves your site (not every time they navigate to a new page on your site).

Over at they describe a solution which involves adding an onClick event to every internal link. The onClick event effectively blocks the popup from firing within the onUnload event.

Its a good solution, but finding every internal link within a decent sized site is a nightmare. So we need an automatic way of adding the onClick event to internal links, and it must not overwrite any existing onClick events we have already set up (unobtrusive javascript).

Check this out:

var Page_Enter;
var TimeLimit=20;
var Page_ShowPopOnExit=false;
var MySiteDomain='YOURSITE.COM';

function XBrowserAddHandlerPops(target,eventName,handlerName) {
  if ( target.addEventListener ) {
    target.addEventListener(eventName, function(e){target[handlerName](e);}, false);
  } else if ( target.attachEvent ) {
    target.attachEvent("on" + eventName, function(e){target[handlerName](e);});
  } else {
    var originalHandler = target["on" + eventName];
    if ( originalHandler ) {
      target["on" + eventName] = function(e){originalHandler(e);target[handlerName](e);};
    } else {
      target["on" + eventName] = target[handlerName];

function InternalLink() {
	Page_ShowPopOnExit = false;

function PageEnter() {
   Page_Enter=new Date();

function SiteExit() {
   var time_dif;
   var Page_Exit=new Date();
   if (time_dif<=TimeLimit && Page_ShowPopOnExit==true)
	alert('Here is your popup!');

function LinkConvert()
var href;
	var anchors = document.getElementsByTagName('a');

	for(var y=0; y<anchors.length; y++)
		href = anchors[y].href.toLowerCase();
		if (!(href.indexOf("http://")!=-1 && href.indexOf(MySiteDomain)==-1))


Save this as popup.js

The javascript does a few things.

  1. As soon as the page is finished loading a copy of the time is stored, so we can tell how long they have been on the page.
  2. All internal links have an onClick event handler added. An internal link is determined as one is missing ‘http://’ (internal relative links do not have the http:// ) and your domain name in the href. Note: If you are using javascript links for internal navigation then this method will not work. However, it should be easy to add the ‘Page_ShowPopOnExit = false;’ to your javascript link code.
  3. When the page unloads 2 checks are done; Has the person left the page within XX seconds? (if they stay 5 minutes then perhaps they liked your site, so no popup for them). Is the visitor following an internal link? If the answers are Yes & No respectively, then show them a pop.

Great, but if we just add this .js file to every page on our site then even people who directly type in our URL can be shown pops. These are the hardest of our hardcore fans, and should never get a pop. Also, I only want to show pops to people that hit my site from a search engine & immediately leave - if they visit more than 1 page then no pop for them.

So we need to inspect the Referrer, and check that they are coming from a search engine. I’m going to do this server side so I can cut down on my page size if the visitor is not pop-worthy.

In ASP.Net (put it in the page.load event):

Dim sPageReferrer As String = ""
If Not (Request.UrlReferrer Is Nothing) Then
    sPageReferrer = LCase(Request.UrlReferrer.ToString)
End If
If InStr(sPageReferrer, "") > 0 Or InStr(sPageReferrer, "") > 0 Or InStr(sPageReferrer, "") > 0 Then
    RegisterClientScriptBlock("PopUnder", "<script src='includes/popunder.js' type='text/javascript'></script>")
End If

If you wanted to do this in the .js file, then just change the last bit of popup.js to:

var href = document.referrer.toLowerCase();
if (href.indexOf("")!=-1 || href.indexOf("")!=-1 || href.indexOf("")!=-1)

Add Google Maps to your .Net site in 10 minutes

Ever wanted to add a Google Map to your site but only had 15 minutes to spare? Now you can add a map and still have time to brag to your mates and bask in the worship that (inevitably) comes afterward.

Basically, the guys over at have already done all the hard work in writing the .Net wrapper for Google Maps. Problem is, the examples on their site are mostly in spanish & its a bit difficult to find out exactly what is needed to get everything working.

But all this is cutting into your bragging time - so lets get started!

1. Get a Google Maps API key from here:

2. Download the SubGurim wrapper dll from here:

3. Unzip it, and put it in your \bin directory

4. Add it to your toolbox by
Tools -> Choose Toolbox Items -> Browse -> Select the .dll file -> OK
GMap will now be in the ‘Standard’ area of your Toolbox.

5. Add a new webpage.

6. Drag the GMap from the toolbox onto the page. A new instance of the GMap will appear on the page, with the name ‘GMap1′

7. Add the following lines to your web.config file:

    <add key="" value="YourGoogleMapsAPIKeyHere" />

8. Add the following code to your Page.Load sub

        Dim sStreetAddress As String
        Dim sMapKey As String = ConfigurationManager.AppSettings("")
        Dim GeoCode As Subgurim.Controles.GeoCode

        sStreetAddress = "100 Russell St. Melbourne. VIC. 3000. Australia"
        GeoCode = GMap1.geoCodeRequest(sStreetAddress, sMapKey)
        Dim gLatLng As New Subgurim.Controles.GLatLng(, GeoCode.Placemark.coordinates.lng)

        GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal)
        Dim oMarker As New Subgurim.Controles.GMarker(gLatLng)

Press F5, and start basking in the glory!

Update: I’ve now posted the code to add draggable markers and events to your Google Maps