Singpolyma

Technical Blog

Archive for the "Tech" Category

coComment JSONP

Posted on

coComment is a new service like Commentosphere that helps you tracks your comments/conversations across the web. If you haven’t heard of coComment yet check out Johan’s article at Ecmanaut.

One of the features missing from coComment has been JSON(P) feeds of data. They have a ‘blog box’ JavaScript include, but it is limitedly customisable. So, frustrated with the way it did work, but still wanting to display my coComment data in my sidebar like I have been doing with Commentosphere, I created a hack that generates JSONP feeds for coComment.

Using the script is simple. You pass the URL to the JavaScript for a customised blog box on coComment to the script, along with optionally the name of a callback function (using ‘&callback’). You can tack on ‘&raw’ to make it output raw JSON data. If no callback is specified and you do not specify raw data it will check to see if you have a coComment.callbacks objects with a comments function and call that. The URL is:
http://comment.ning.com/cocomment/json.php?url=URLtoBLOGBOX

If you want a sidebar element, or just some example JavaScript code to work with, here is what I use. Put this in your <head> section:

<script type=”text/javascript”>
//<![CDATA[
var list_cocomment_limit = NUMBER OF CHARACTERS;
var list_cocomment_id = “cocomment”;
var list_cocomment_url = “URL TO BLOG BOX“;
function list_cocomment_callback() {
val = ”;
val += ‘<ul class=”cocomment”>’;
for(var i=0; i<coComment.comments.length; i++) {
val += ‘ <li><a href=”‘+coComment.comments[i].articlelink+'”>’+coComment.comments[i].body.substr(0,list_cocomment_limit)+’…</a></li>’;
}//end for
val += ‘</ul>’;
val += ‘<a href=”‘+coComment.url+'”>More</a> on <a href=”http://www.cocomment.com;;
item = document.getElementById(list_cocomment_id);
item.innerHTML = val;
}//end function list_cocomment_callback
coComment = {};
coComment.callbacks = {};
coComment.callbacks.comments = list_cocomment_callback;
function list_cocomment() {
coComment = {};
coComment.callbacks = {};
coComment.callbacks.comments = list_cocomment_callback;
var thescript = document.createElement(“script”);
thescript.type = “text/javascript”;
thescript.src = ‘http://comment.ning.com/cocomment/json.php?url);
document.body.appendChild(thescript);
}//end function list_cocomment
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != ‘function’) {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}//end if
}//end function addLoadEvent
addLoadEvent(list_cocomment);
//]]>
</script>

And in your sidebar put ‘<div id=”cocomment”><i>Loading…</i></div>‘.

Del.icio.us JSONP is Native!

Posted on

For quite awhile now, del.icio.us has offered JSON support, but not a proper JSONP implementation. I even wrote my own proxying script to fix this oversight. It seems that that will no longer be necessary. If you pass callback=CALLBACK to a del.icio.us JSON feed it will now output proper JSONP that does not set the Delicious.posts variable (easy to fix in your callback function) but calls CALLBACK with the JSON object as a parameter. Compare these:
http://del.icio.us/feeds/json/singpolyma.techblog/
http://del.icio.us/feeds/json/singpolyma.techblog/?callback=CALLBACK
There has, as yet, been no official announcement on the del.icio.us blog, so this feature may yet be pulled like some others have, but I hope they will not. Hopefully I will soon be modifying my version of FreshTags to make good use of this native JSONP support.

Gmail Chat

Posted on

Google is launching inline chatting for Gmail in the near future. There is already an option in your Gmail settings (or at least in mine, it seems to be coming online account-by-account) to save all your Google Talk chat logs into a section of your Gmail account called ‘chats’, to be searchable just like your email. There is also an information page stating that they plan to include the ability to chat directly from your Gmail screen (a la Meebo and others). This should prove interesting.

BoxtheWeb 0.20 and Reading Lists

Posted on

BoxtheWeb 0.20 has been released, and with it many different new features. One of the most notable, is support for reading lists. Those new to the concept of reading lists may like this TechCrunch article as a starting point. Basically, the idea is to be able to subscribe to lists of what other people subscribe to. The new version of BoxtheWeb includes ‘subscription boxes’, which allow you to subscribe to XOXO, OPML, or even RSS/ATOM feeds and give a list of feeds referenced. Each of these feeds can then either be previewed or added to your own BoxtheWeb screen.

Each BoxtheWeb account also now publishes a public feed of the its boxes in XOXO and OPML format. This feed can be filtered to contain only feeds or by tag. Boxes may be marked private so that they are not added to this feed. There is no direct mention of the email address anywhere in the URL or the file, only an MD5 hash (although passing an actual address instead of a hash will work, and result in a feed that contains the email address in ownerName). You can see examples of these feeds by clicking the XOXO or OPML links beside ‘Reading List’ in my sidebar.

New Feed

Posted on

No, my feed has not moved. It is still at feedburner in the same place. What is different is what it supports. I am now generating my feed direct from my template to RSS 2.0 using my new hAtom2RSS converter. This script supports both XOXO Blog Format and hAtom templates, including all extensions to hAtom described by the XOXO Blog Format. It outputs the comments, wfw:commentFeed, and slash:comments tags when the appropriate data is provided in the page. While this doesn’t do much that is visible in most current readers, what it does do is make the ‘comment count’ option for FeedFlare work. So I now have comment counts being displayed in my feed from a Blogger blog! I highly reccomend that anyone using the hAtom2RSS converter pair it with FeedBurner, if for no other reason than speed. The script polls your home page every time it is accessed, so having FeedBurner cache the feed will definately provide a performance boost.