Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/gathadam/public_html/wp-settings.php on line 18
2007 April

MySpace API - Automate your Blog posts

I have written a small API which allows you to add blog posts with a simple URL GET.
Update: It seems that sometime recently the MySpace pages for posting to your blog have changed, and so this API is now broken. I will fix it shortly when I have the time.

The format for usage is:


http://myspaceapi.com.99.seekdotnet.com/BlogPost.aspx?Subject=[Post Subject]&Body=[Post Body]&Email=[Your Myspace Email]&Password=[Your Myspace Password] 

Eg:
http://myspaceapi.com.99.seekdotnet.com/BlogPost.aspx?Subject=This+is+a+test+of+the+API&Body=test+body&Email=info@google.com&Password=googlepw

Remember to HTML encode the [Post Subject] and [Post Body]

To try it out:

The code for this simple test page is:


<script type="text/javascript">
function SubmitBlog()
{
var sSubject = escape(document.getElementById('iSubject').value);
var sBody = escape(document.getElementById('iBody').value);
var sEmail = document.getElementById('iEmail').value;
var sPW = document.getElementById('iPassword').value;
window.location = "http://myspaceapi.com.99.seekdotnet.com/BlogPost.aspx?Subject=" + sSubject + "&Body=" + sBody + "&Email=" + sEmail + "&Password=" + sPW;
}
</script> 

<table>
<tr><td>Post Subject</td><td><input type="text" id='iSubject'></td></tr>
<tr><td colspan=2>Post Body</td></tr>
<tr><td colspan=2><textarea id='iBody' rows=5 cols=31 width=100%></textarea></td></tr>
<tr><td>MySpace Email</td><td><input type="text" id='iEmail'></td></tr>
<tr><td>Myspace Password</td><td><input type="text" id='iPassword'></td></tr>
<tr><td></td><td><input type=button value="Submit" onClick="SubmitBlog()"></td></tr>
</table>

No logs of requests are kept (I have no interest in stealing your password and becoming the most hated man on the internet). All the source code is in ASP.Net. If you would like a copy, send me an email.

At the moment, because all requests are handled via GET, the body posts must be reasonably small. If there is interest I will expand the API to allow POSTs so that the blog body can be larger.

Build your own Social Bookmark widget

It’s important to make it as easy as possible for your visitors to bookmark your site - both so they can find it again, and also so they can share it with their friends. I have a bunch of sites, and I wanted to create a simple way to add bookmarking to all of them.

Basically, the bookmark links provided by the social networks accept 2 parameters:

  • The URL of the site/post
  • The title of the page

It is easy enough to get both those values using javascript:

var TheTitle = encodeURIComponent(document.title);
var TheURL = encodeURIComponent(document.location);

It is important to encode the values, so that they can safely be placed in a bookmark URL.

You then just need the code to output the bookmark link. Here it is for Google Bookmarks

document.write(’<a href=”http://www.google.com/bookmarks/mark?op=add&bkmk=’ + TheURL + ‘&title=’ + TheTitle + ‘” title=”Bookmark to Google”><img src=”http://img2.imagepile.net/images/ycc2106/35814433.png” alt=”Google” height=”16″ width=”16″ border=”0″ /> Google</a>’);

Add a few other Networks (BlinkList, Furl, Delicious) and the full code is:


var TheTitle = encodeURIComponent(document.title);
var TheURL = encodeURIComponent(document.location);
document.write("<style>a.sbm{padding-left:7px}</style>");
document.write("<div>Bookmark with:");
document.write('<a class="sbm" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url='+TheURL+'&Title='+TheTitle+'")title="Add To BlinkList"><img src="http://img2.imagepile.net/images/ycc2106/89442389.png" alt="BlinkList"  height="16" width="16" border="0" /> BlinkList</a>');
document.write('<a class="sbm" href="http://www.furl.net/storeIt.jsp?u='+TheURL+'&t='+TheTitle+'" title="Bookmark To Furl"><img src=http://www.furl.net/i/favicon.gif alt="Furl button"  height="16" width="16" border="0" /> Furl</a>');
document.write('<a class="sbm" href="http://www.google.com/bookmarks/mark?op=add&bkmk='+TheURL+'&title='+TheTitle+'" title="Bookmark to Google"><img src="http://img2.imagepile.net/images/ycc2106/35814433.png" alt="Google"  height="16" width="16" border="0" /> Google</a>');
document.write('<a class="sbm" href="http://del.icio.us/post?url='+TheURL+'&title='+TheTitle+'" title="See who bookmarked at del.icio.us" ><img src="http://img2.imagepile.net/images/ycc2106/65682475.png" alt="del.icio.us"  height="16" width="16" border="0" /> Del.icio.us</a>');
document.write("</div>");

Or you can Download it here

To use it on your site or blog, just add the code:

<script src=”socialwidget.js” type=”text/javascript”></script>

The final effect is exactly what you see at the bottom of this blog post.

If you want to add more Social Networks, just find out their particular submission format and add them right in. I chose these four because they were recommended on a recent episode of Rush hour (doesn’t everyone listen to this?) which talked about which were the important social network sites for bookmarking.

Obfuscate your email address to prevent spam

Obfuscate is one of those words you don’t get to use in conversation much isn’t it? Unless you work at the NSA maybe, and they probably have an even more technical term.

Basically, it means “to deliberately make something unclear or difficult to understand” which actually comes in handy when you want to prevent people scraping your site to get your email address.

To try it, just enter the HTML that you want encoded into the top box. Eg:

<a href='mailto:gath@hishouse.com'>Contact Me</a>

Press the ‘Encrypt’ button and then you are given the obfuscated version. Just copy & paste the javascript into your HTML page.



Of course, you hide all kinds of things from prying eyes (automated or not). This kind of encoding can be defeated by a commited hacker (esp. the extremely simple encoding used here) but is usually enough to make the hacker look elsewhere. Using just the method above has managed to keep 95% of my sites spam free.

Right, now I’m off to play Desktop Tower Defence

Batch Image Processing

One of the tasks that I constantly doing is preparing images so that they right size/shape for my sites. Easy enough when there is only 5 images to prepare, but sometimes I have 100s - so I wrote a program which will take care of my image processing in batches.


Batch Image Processing

In the Input Directory just enter the directory and filename of the file that you want to process. The ‘*’ wildcard can be used to specify more than one file. Input files can be JPEG, GIF, TIFF or BMP.
Eg:
C:\temp\my pics\*.gif
This would select all the gif files in the directory.

In the Output Directory just put the directory that you want the new file to be placed. The new file will always be a JPEG (.jpg). If you leave this blank, the new file will be placed in the same directory as the original - but with a slightly different name so it is not overwritten.

Processing Options

Blur Edges: You can blur (fade) the edges of an image to either white or black. This is great if your image has an edge which jars with your background. I use this effect a lot on this site, especially on my post about Fighting Robots.
Resize: Allows you to specify a new height/width. If just one of these is set, then the other is automatically set to keep the image in proportion to its original size. IE - if the original image was 200×100 and you set the new width to be 50, then the height will be automatically set to 25.
Quality: You can adjust the quality of the new image, which affects the size in KB. The default is 100%

Download the Batch Image Processor

Update: Sorry to say, but it is Windows-only.

Eurotrash Bar

Eurotrash is a 3 level bar/dance/party venue tucked away down Corrs Lane, Chinatown. All very trashy, and since the place is run by Croatians & Russians - very authentic (well, I’ll take their word for it).

Ground Level is a mult-themed area, with different areas to hang out & also relax in comfy chairs. Taking their cues from Europe, there is the Mediterranean, Black Forest, French Quarter and a small booth which is the (definitely) red light district.

Upstairs is a gallery/band room. All kinds of exhibitions take place here, and on the weekends it is a great place to mingle & groove. On Thursday nights there is usually a band on, and starting in May the night ‘PopTarts’ begins. PopTarts is a night of female-fronted pop bands and female songwriters, and should be a lot of fun. During the Comedy festival they are having nights put on by local comedians.

Moving up to the 3rd and final floor, we have the penthouse. When Eurotrash was first being set up this was where the owners lived, but now it is a bar/pool room and can also be booked for private functions. This area constantly changes, they are always bringing in new props and mixing it up.

There is an outside area that snakes upward from the ground to the 3rd floor, with plenty of rest stops along the way. It also features the sexiest 2-storey-tall nurse you’ll ever see!

MySpace API

2 small posts today, and maybe something bigger tomorrow.

I was having a think about big content sources, and the biggest one at the moment is MySpace - and now there is an (unofficial) API to help you get through the data.

Tom Morris has put together a MySpace API which fetches a person’s profile and comments.

Try:
http://xml.opiumfield.com/myspace/tom/xml

Just insert the name of the person of the FriendID in place of ‘tom’ for the profile that you want.

Right, now to use or abuse, use or abuse…

Hiding the Digg button from Diggers

I was listening to RushHour a few days ago, and they were talking to ShoeMoney on getting the most out of Social Media. One of the hints that ShoeMoney gave was that members of digg are turned off by sites that have prominent ‘Digg This’ buttons.

So here is some quick & easy code that hides the ‘Digg This’ button if the visitor is from Digg.

Change this:
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>

(This is the code used to display the standard Digg button)

To this:
<script type="text/javascript">
if (document.referrer.replace(’www.’, ”).toLowerCase().substring(0,15)!=’http://digg.com’)
document.write(’\<script src=”http://digg.com/tools/diggthis.js” type=”text/javascript”\>\</script\>’);
</script>

Happy Digging!

How to check if you have a penalty from Google

Almost 2 months ago Google made a small update to their search index. Small to most people, but large to me as Sudoku.com.au dropped from #3 for the keyword ’sudoku’ to #21. Not across all datacenters though, on google.com.au I was still #1.

I checked out what had happened to other sites, and noticed that a few .co.uk sites had also dropped out out of the top 10 into the 20s - while these same sites where still in the top 5 in google.co.uk. So my first thought was that there is some kind of localisation going on; Sites that end in .com.au get a bonus at google.com.au, but are penalised at google.com. This definitely occurs already, but it was surprising to have such a big jump in rankings.

Then I came across this attribute you can add to google search urls, which show ‘unfiltered’ search results. Just add:
&filter=0
to the end of the google url.

Eg:
http://www.google.com/search?hl=en&q=sudoku
becomes
http://www.google.com/search?hl=en&q=sudoku&filter=0
Remove the filter, and I’m back at #4!

So what is being filtered?

I checked around, and it seems that adding &filter=0 mostly removes the ‘duplicate content’ filter. So if your site has duplicate content - either with another site, or within the site itself - it can have a penalty.

This immediately led me to do the site: command, which lists all the pages of your site that google knows about
site:sudoku.com.au
It came back with 4 results! - the rest were left out because google thought they were similar to the 4 already shown. Sudoku.com.au has about 25,000 pages, all with unique comments by visitors. Something was up, and all of a sudden my localisation theory didn’t look so strong.

So what to do?

Continued Tomorrow

Geez DGM Australia are hopeless!

I sell a bunch of DVDs through Amazon each year, enough to make it on their top-seller list. One of the problems with Amazon though, is that Australia is left out - so I tried to find an alternative.

Enter dStore, and their affiliate program with DGM Australia. dStore offers 8% on sales with their aff. program which is pretty good. Just sign up with DGM and you are good to go. At least thats how it should be.

The problem is that DGM haven’t got the linking code to dStore working. You click on a category (eg DVDs), click on the ‘Linking code’ and you get a ‘Page not Found’ error.

I sent them a support request through their site explaining my problem. After about 20 minutes I got an email which contained my support request and a message saying it was undeliverable. Great. Ok, on to the phone. The woman who I spoke to at DGM said that the person who handled dStore was out and could I call back that afternoon. I left a message explaining the problem & asked them to call me. No surprise - no call.

So I tried dStore. I thought they might be a little more interested, but they told me that the affiliate program was handled by DGM, and to contact them with any issues (I wonder if they make any affiliate sales?).

At this point I admitted defeat. There was simply no way to get this affiliate program working.

A month later I was at Ad:Tech in Sydney and I noticed DGM Australia had a booth. I thought ‘why not?’ and walked up & told them about the linking problem with dStore. It took about a minute to explain the issue with their site and they said they would fix it up asap. At that point I wasn’t interested in doing business with them, but I wondered if anything would be done.

A week after that I got a standard newsletter from DGM listing the latest & best performing offers. dStore was mentioned specifically (not under ‘top performer’, though), so my curiousity got the better of me and I logged in to DGM to check them out.

The link code still doesn’t work.