Archive for December, 2007

Whos A Clever Cow Then?

Alexa Logo

While I was at the Alexa page today, I noticed that John Cow has done something very clever, he made a picture parody of a Facebook page called “pensionbook” and it has received a massive amount of traffic over the past month. Check out his stats for the site that hosts the image (johncow.us)

pensionbook traffic

Because of this traffic, his site got listed on the “movers and shakers” part of Alexa. Moving from a rank of 511,000 to 20,000 since the beginning of December. The root of Johncow.us has an image showing a template for sale image. Click through and you get the option of buying a basic version with links to johncow intact or pay a premium to have it without the links.

A pretty awesome pre-planned traffic attack! This is a really good example of monetizing a social bait page, he must have sold quite a few templates!

Unfortunately there are already people who are offering to provide the template for free (but not for long!)

My own Alexa rank has dropped below the 100K barrier now, sweet! For the UK it is below 8000, haha! and with over 50,000 unique visitors in through the doors before Christmas, all my traffic targets have been achieved. By March next year, I’d like to have over 100,000 more visitors and have my Alexa rank down to less than 50k.

I have a pretty good idea how I’m going to proceed, I have some wicked plans for CommentLuv, contests, tutorials and ebooks that will be fun to try. Roll on 2008!

I hope to see all my good blogging buddies rocking on through the new year, see you then!


Introducing AJAX CommentLuv

CommentLuv with AJAX
I have finally implemented AJAX into my CommentLuv plugin, it should dramatically increase the speed at which the comment gets posted after a user clicks “submit” by monitoring the comment form entry box, as soon as it gets some action then a javascript routine gets called to find the feed, scrape the last post from it and display it below the comment form.

Because the fetch_rss has a cache which it checks before it tries to open the remote feed, the last blog post will still be stored in the cache from the AJAX request so it wont need to do much at all to add the last blog post to the comment. sweet!

It’s installed and running ok here in it’s rough state so I can see how it performs while I neaten up the code so it can do all the includes and stuff automatically as well as detect another url change if the user changes their blog url after starting to comment.

At the moment it uses a bit of jquery and a bit of the AJAX goodness that you can see on the Beginners AJAX Tutorials posts, when I’ve figured out how to do it all with jquery and have it working nicely then I’ll release the new updated plugin.

It seems that a quiet Christmas morning is all that’s required to get an AJAX problem solved!

I’ll get used to jQuery and get some tutorials out there after the part 5 and 6 are done with the current series. Happy Holidays everyone!

You can always find the current version of CommentLuv here
(no AJAX in the current version yet…)


How To Successfully Interrupt A Conversation

Has this ever happened to you?

The Unsuccess

Never again, just use your phone!

the success

Comments Off more...

How to stop spam blogs from hotlinking your images with htaccess

It’s a pain in the arse when someone copies your content, especially when they hotlink your images so your bandwidth gets used instead of their own so here’s a neat way of adding to your .htaccess file so you prevent particular blog networks from displaying images from your hosting by hotlinking them.
Use this code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g|jpg|gif|bmp|png)$ http://www.commentluv.com/images/antihotlink.jpg [L]
</IfModule>

Just open up your .htaccess file (found in the root of your web space) and add the above lines. That should prevent blogs from myspace,blogspot and livejournal from hotlinking your images. You can add the url of a blog you know is hotlinking your images by following the format of the other RewriteCond statements.

Change the image url for the RewriteRule to one you have hosted somewhere (not on the same hosting because that will get redirected in a loop every time it is linked to).

It works pretty well, look at this screen shot of a self confessed content copier….
Content Thief owned

There a couple of my posts on that blog and they are littered with images telling the (probably non existent) readers to come and read the article here instead. Another reason to always have an image in my articles!

It’s a shame there isn’t a way to do that with content though! If you are having trouble with spam blogs scraping your content and images, you can read a fantastic article here on what to do when someone steals your content by Lorelle who has a treasure trove of WordPress and blogging information. Well worth a look!


Beginners AJAX Tutorial Series Part 4

Ajax Avenue Street Sign
This is part 4 of the AJAX Tutorial Series.
You can see the other Beginners AJAX Tutorials here.

In this part of the tutorial series we will get ready to rumble! download data using the object we created in the last part…

onreadystatechange

What the hell is that? lol, it’s not move states when you’re ready.. it’s what we use on the object we created to see what state it is in, the different states are:

  • 0 – Uninitialized
  • 1 – Loading
  • 2 – Loaded
  • 3 – Interactive
  • 4 – Complete

We can check for an objects state to see where it’s at to decide if we can output the result or not, we can combine this with a test for the HTTP status of a download to see if it was successful, we can check for a value of 200 which means everything went ok. (a value of 404 would mean file not found just like normal HTTP status codes).

To use the readystate property, just bang it on the end of the object name and put that in an ‘if’ statement. Ie…

if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
{do something}

(the && means AND, so we check the readystate AND the status, if they are BOTH correct then execute the code in the curly brackets)

To put that in the code of the last tutorial, replace the bit that outputs the message about the oranges box being collected with an anonymous function that is attached to the objects readystate. It’s not named an anonymous function because it has a secret identity, it is just a nice way of running a function with no name when a certain thing happens like the objects’ readystate being changed.

For example, if we put
XMLHttpReqestObject.onreadystatechange = function()
{
do something
}

We have attached the onreadystatechange to the object we created, as soon as that objects readystate has altered, the anonymous function takes action and executes the commands contained in the curly brackets ({do something }).

That’s exactly where we put the test to see what the HTTP status and readystate number is. Ie.

XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
{
data downloaded, do something with it...
}
}

You may have noticed little graphics that are synonymous with web 2.0 and AJAX ( ajax loading ). You can add one of those to let the user see something is happening. In the code above, you can check for a readyState of 1 (loading) and add some text like this:

XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 1)
{
obj.innerHtml="Loading...";
}

if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
{
data downloaded, do something with it...
}
}

The FiddyP amazing analogy:
Last time we had created a box for the oranges that we want from the AJAX shop
XMLHttpRequestObject = new XMLHttpRequest();
then we opened it and sent it to the AJAX shop with a label of what we want.
XMLHttpRequestObject.open("GET", dataSource);
And we wait for the signal that the box we sent was filled ok and ready to go
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)

Your whole code will now look like this…

[html]

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject(“Microsoft.XMLHTTP”);
}
function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open(“GET”, dataSource);

XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
}
}
obj.innerHTML = “Ready to download”;

}
}

Fetching data with Ajax

The fetched data will go here.

[/html]

OK, so you have your box at the AJAX shop full of oranges.txt, next tutorial we’ll do something with the oranges…

If you’ve been following the other tutorials then the code above shouldn’t be so hard to understand (shyeah right!), it’s just a bit more added to what we’ve already covered. You can copy the code from above and try it out yourself or you can click here to see it in action (hold on to your hat :-P )

We’re still in the AJAX starting blocks waiting for the bang to start us on the AJAX runway but don’t despair, next tutorial we will actually download data from a server and display it on the page without a reload which is what AJAX is all about. Once we can actually display the data, we can start doing things with it and then we can start to make pretty little scripts that do amazing things like count the amount of times a pink box has been clicked. hehehe, we’ll do more than that I promise!


Review of my Quick Cup from Tefal

Tefal Quick Cup

Here’s my way cool new hot water maker-er!

I love this thing. I am always blarting on about how much electricity is used to boil a half full kettle for just one cup so I jumped at the chance to buy this the other day during an entire outing to the middle of Oxford street to buy a new kettle.

It takes water from rest to hot enough for a cuppa almost instantly, just fill the reservoir with water and it gets filtered by the additional water filter that screws into place inside. Press the button and out comes steaming hot water straight into the cup.

You can see the Tefal Quick Cup in action here

Function

Programming it to output the correct amount of water is easy, just press both buttons until it flashes and then press and hold the hot water button until the desired amount is reached and let go. Press both buttons again and that’s it. Just press the button once from then on and it’ll fill to that amount.

You can also keep the button pressed for hot water and stop it by releasing the button.

The internal filter works just like a normal water filter for Britta and the like, you can let the Quick Cup know that you’ve changed the filter so the light will flash when it’s time to change it

Price

The Unit costs £59.99 and comes with one filter.
The Tefal Quickcup Filters cost £4 each but you can probably buy packs of 6 for cheaper.

I think this will save money in electric bills too.

Opinion

I like the idea of being able to make a quick cup of tea or coffee, no more waiting around for a kettle to boil. It pretty much fills the cup with water that is sufficiently hot enough. I thought it was going to output a temperature something like that of a self service coffee maker but it was hotter even than that.

It does work but it tends to splash a little bit, the gap between the nozzle and the cup opening is quite big so when water streams out, some of it splashes out when it hits the liquid inside the cup. One solution I have found is to leave the spoon in the cup at an angle so the water hits the spoon handle, that spreads the water out before it splashes down.

Overall, I would say it was worth the money and works well enough. My missus says she still needs a kettle for when she wants to fill the sink up or other dark rituals that she does in the kitchen. :-)

4/5

Response to comments:

Graham Hanson: ….It costs me about half a pence per mug.
I’d like to do the same sums on this thing, so we can compare and verify their claims of up to 65% energy saving.
What I need to know is this…

1. when you use it in manual mode, how long in seconds do you keep your finger on the button for to fill a mug ~350ml

2. what is the power rating? does it say on the bottom?

This sounded like a great excuse to make a cup of coffee, I checked the bottom of the device and the power rating on the bottom says 2500-3000W. The time to fill a full mug was just shy of 25 seconds. Here’s a video I made on my phone …(it sounds a lot louder on the video than it actually is)

Hope this helps!


CommentLuv, Alexa and AJAX updates

I’ve seen quite a few blogs using CommentLuv now which is fantastic and I see a lot of comments about blog authors finding more great blogs by following the links to the last blog post but, I see some places not picking up everyones last post because their hosting does not allow Curl commands which is what I use for parsing the comment authors page, they can still use the fetch_rss() function so I have created some external hosting for a script that takes a URL, parses that page and outputs a feed with the location of the feed.

I’ve added a bit to the plugin that calls that external file if the hosting it is installed on doesn’t allow Curl commands, it can read the result because it doesn’t need to open it as a file using file and fopen commands.

I have found it is quicker to parse the users page first rather than try all the combinations of the default locations because each try can take up to 5 seconds (or whatever you put as the MAGPIE_TIMEOUT) which isn’t ideal. Now with the option of every blog being able to parse the users page first it shouldn’t take too long and because the rss functions of wordpress uses a cache when it reads a feed, when someone comes back and writes another comment on your blog, the plugin will use the location it found last time because it will be stored as a feed in the cache. yey!

I’ve also added a check box to allow the user to not add their last blog post, this is if you want to leave a comment asking a splog that is using commentluv to stop scraping your content (you wouldn’t want to leave a link to your blog on a splog) or if you are commenting on your own blog from elsewhere without being logged on and don’t want your last post shown.

I’ve made it easier to change the message that is displayed below the comment form too. Just edit the bit in the quotes in the source code below the changelog.

The Future
I am in the middle of learning event listeners so I can really cut the time down for parsing the page by doing it AJAX style after the user has entered their blog url and clicks to the comment area to make their entry. This should make CommentLuv almost completely transparent and prevent any longer than necessary waits after submitting the comment.

I imagine that will be after Christmas as well as adding language support and it’s own options page. I have purposely kept away from using extra tables in the WP database because, A) I don’t want to mess up an existing database, B) I haven’t used MySQL before, and C) I don’t know how! (yet)

Much later than that, I want to create a widget style box for displaying links to your commenters posts (Cliq style). I am sure I can add Gravatars to it too but that will require storing the last blog posts in the database in their own table.

You can download version 0.997 of CommentLuv here (one-click installer plugin users can use this link http://downloads.wordpress.org/plugin/commentluv.zip)

AJAX tutorials

Tutorial 4 is ready and will be published tomorrow. I have seen quite a few hits coming in for them so I have spent a bit more time trying to add some graphical explanations for each process in the script to make it a little easier to follow. I have part 5 all planned out so that part 6 can see you creating your own AJAX scripts. Maybe some homework assignments to send out? :-)

Alexa Ranking

I am pleased to see my traffic going up a bit each week. The largest referrer is Stumbleupon with a steady stream of hits coming in as well as a few sharks fin spikes in my stats. I think that has helped with me getting close to the sub 100,000 mark for my alexa rank which, today is at 106,955. For just the sites visited by UK users, I am very close to being in the top 10,000 visited sites. (I can see it now, “FiddyP makes it to the top 104 UK sites”) :-)

Happy Hanuka/Christmas/Holidays/Eed Al-Adha (delete as appropriate)!


Dear Santa… my I DO NOT WANT list

Shoot Santa

Dear Santa

I DO NOT want a repeat of Christmas Days long gone, I want a good one this year so here’s a list of what I DONT want to make things easier for you…

  • Star Wars.
    Yes, I know I am a geek but that doesn’t mean that anything with a space ship on it is good, even if it comes in a Trilogy.
  • Books Written Before 2007
    Science Fiction is my favorite, there aren’t as many sci-fi books as all the others so if you buy me a sci-fi book, check the inside cover for when it was first published. If it says any year before 2007 then there’s a fair chance that I’ve read it already. I swear if I get another Asimov book written in 1959 (and read thrice already before I was 16) then I will shove it up your arse!.
  • “Novelty” items
    Anything with the word “novelty” in it’s title is not good. That means no novelty Chocolate or novelty Willy Warmer this year – not funny! (still)
  • Models
    No cars, planes, boats or helicopters.. UNLESS, they are fully controllable on all axis. A car would need to be speedy and capable of massive jumps, a plane will need extras so it can drop stuff from a height, a boat only if it also flies and a helicopter will need at least 4 channels (that means if it only goes up and down, it’s crap and I wont like it)
  • Jumpers
    Yes, even big woolly ones with trees on.
  • DVD’s
    Ok, so like, I have broadband and a few programs called BitTorrent and Usenet. This means I have probably seen every movie there is and if I haven’t, it’s because I didn’t want to. Everything I have ever wanted to watch on DVD can either be downloaded as a DVD or in HD. Don’t waste your money, if you must buy me DVD’s then buy me the ones that can be written to. (so I can put more than 1 movie on it)
  • PC Games
    For the same reasons above, if it exists then I’ve probably downloaded it, played it, got bored with it and then deleted it.
  • Music
    Again, broadband exists.
  • Soap
    Oh come on! I do not need expensive soap (or cheap for that matter). I have a particular shower gel and soap that I like, forcing me to wash in your green biodegradable organic pig shit soap is hell.
  • Free Stuff
    Anything that you got for free as a bonus item at the checkout does not count as a gift.
  • Live Animals
    Unless you are going to kill it and let me eat it.
  • Cuddly Toy
    Anything that is fluffy and evokes an “ahhh” from a female will be beheaded and binned.
  • Vouchers for shops I don’t go to
    Even a £50 voucher is no good if it is for “Jazmins Custom Bookend Shop”. Seriously.
  • My present to you last year
    Any present I receive that I had bought myself and given away already will be placed in your nostril and set light to.

Yours Sincerely,

Andy Bailey
Geek aged 35+ :-)

thanks to all the stumbleupon-ers that brought so much traffic to here! I have now got a dedicated server for FiddyP so bring it on!! :-)

Comments Off more...

Its cold thinking outside the box

Think outside the box

I WANT to be a robot. To think is hard for me, I’d rather do what people tell me. It’s easier that way, ABC is always ABC, I don’t need to think to get that right. It’s the same as doing my job, if I just do what the job requires then I don’t have to think! that’s why I want a system for making money online. I want an ebook that tells me exactly what to do and I want to pay a particular price of 97USD for it. I wont need to read it, I’ll just buy it and leave it on my pc.

I know I’m lazy and complacent. I just don’t want to think outside the box like the big earners are telling me to. It’s nice and warm in here and I know exactly how many steps it takes to get from one end to the other. It’s easy. Put in an easy chair, make a window and I could spend my whole life ‘in the box’ and be perfectly content.

I wont be alone! There are millions of others like me, happy to live out their whole lives within their four corners without needing to venture outside. It’s cold outside the box.

New type of food? no way! I know how this stuff tastes.
Who am I voting for? well, the guy I voted for last time of course!
It’s a long drive to work but I don’t want to go to the trouble of moving house and I wouldn’t even dare thinking about getting a new job, OMG that would require me to go outside my comfort zone. I’d have to learn new skills, and worse than that…

I’D HAVE TO GET TO KNOW NEW PEOPLE!!! I wouldn’t be able to go through that whole process of deciding if someone is good or not, are they a bully? do they smell? will they think I’m cool?

It’s much better staying where I am, the journey to and fro is a long one and there’s a guy that bullies me but at least I can handle that, if I moved I might end up with a bigger bully to deal with…A few hours a day in my car wont hurt me, I can daydream all I want.

Yep, definitely better not doing anything. I’ll keep moaning about the journey and sucky pay for a while longer. My wife can handle it, she doesn’t need anything more. She doesn’t work, she should be OK with what we’ve got. I mean, it’s not as if she is the one going to work 40 hours a week (ok, so with the journey time it’s more like 70).

Screw the whole residual, multiple stream income thing. I don’t need it. I’ve got security in my job along with the other 200 people that sit in cubicles.

Yep, I’m fine.

Slap Face

.. a parody response to Stephans’ article entitled “burning down the house

Comments Off more...

Beginners AJAX Tutorial Series Part 3

Ajax Avenue Street Sign
This is part 3 of the AJAX Tutorial Series.
You can see the other Beginners AJAX Tutorials here.

In this part of the tutorial series we will open the object that you created in the last tutorial. So far, we have created an object to handle the data and made sure it is created in whatever browser you are using. Now, if we want to work with the created object, we need to open it…

Open The XMLHttpRequest Object

Opening the object prepares it for use to fetch the data from a server, the act of opening the object doesn’t actually fetch any data yet.

The FiddyP amazing analogy :- Imagine you created a page to collect a box of oranges from the local AJAX fruit shop. In the last tutorial, you created the box (object), now you need to open it so the AJAX oranges can fit inside…

The open comand: [square brackets] = optional arguments.

open("method", "url" [, asyncFlag[, "username"[, "password"]]])

Explanation:

  • method is the HTTP method to use when opening the connection. It can be ‘GET’, ‘POST’, ‘PUT’ or ‘HEAD’
  • url is the URL you want to download from
  • asyncFlag is a Boolean (one or the other) value used to indicate that the call is asynchronous. (no waiting for it to finish)
    This defaults to TRUE or 1 so is not needed unless you want to specify that the page waits for completion.
  • username is if you need a username to access the page identified by URL
  • password is for a password if it’s required.

Make sense? lol, maybe not. Here’s how it looks in use:

XMLHttpRequestObject.open("GET","oranges.txt");

We just add the open bit of code on to the end of the name of the object we created. Here’s an example page where we create a form in HTML and add a button for the user to click to open a remote file on the server with AJAX. Because AJAX uses CSS to change elements of the page, we need to create a <div> on the page to show the data we retrieve from the remote file. We’ll also have to create a function to take action when the button is clicked (we can’t do it the normal way with the <form> action because that would cause the page to reload).

Here’s the form and div html:
[html]

The oranges box will go here.

[/html]

You can see that the button has an ‘onclick’ event. That’s the javascript bit that calls the function when the button is clicked. The <div> has an id so the function will know where to put the collected data.

The javascript function is held in the <head> part of the document;
[javascript]function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open(“GET”, dataSource);

obj.innerHTML=”Oranges Box Opened!”;
}
}[/javascript]

The function is called with the name of the data file we want (dataSource) and where to put the output (divID)
The first line checks if the XMLHttpRequestObject was created (we did that last time so you know it should get to this point)
If it finds that the object was created, it moves on to set the variable obj to the <div> we created by using getElementByID
Next, we use the open command on the object we created earlier, set the option to GET and point it to the external data file we specified when calling the function.
Once that is done, we can output a message to the <div> we assigned to the variable obj by using .innerHTML=

We’ll just put this function in place of the “hello world” message that we put in the last tutorial..

The whole code looks like this…
[html]

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject(“Microsoft.XMLHTTP”);
}

function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open(“GET”, dataSource);
obj.innerHTML=”Oranges Box Opened!”;
}
}

Fetching data with Ajax

The Oranges box will go here.

[/html]

You can copy the contents of the HTML shown above and save it as a HTML file, you can also create a file called oranges.txt and put it in the same directory as the HTML file. (it doesn’t matter what is in the text file as we wont be doing anything with it other than to open it). Open the HTML file in your browser and try it yourself or click here to see it in action if you can’t wait.

That’s it for this week, we’re still not doing anything major yet but, be happy! we have so far, created an object and opened it. YEY! come back for part 4 where we will prepare to download information from the file we opened. (oh, I bet you can’t wait!!)

beep beep w00t!



  • 279
    Unique
    Today
    Powered By Google Analytics
  • Copyright © 1996-2010 FiddyP. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress