Singpolyma

Technical Blog

Archive for the "Tech" Category

Asynchronous FreshTags

Posted on

I have updated my version of FreshTags to include support for asynchronous loading of posts. Now if you add the following code to your template:

<script type=”text/javascript”>var freshtags_tag_format = “drop-add-async”;</script>

Instead of the drop-down box taking you over to the tags post page it will load the posts for the tag combination for you asynchronously in the sidebar.

A nice side-benefit of this is that you may now use all the other FreshTags tag-list types (except custom), including flat, flat-multi, list, list-multi, scroll, drop, and sub. Just put them in the above code where I have ‘drop-add-async’.

You will have to be using the jscripts.ning.com version of my FreshTags implementation for this to work, instead of the old one hosted on AWriterz. The code for the new include (which you can replace the old one with to upgrade) is:

<script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=818185

Last Updated Posts

Posted on

Aditya of The Last Word has made a very useful discovery — the new Blogger RSS feeds are ordered by last update! This means that when you make an edit on an old post, that post is moved to the top of your RSS feed! The use for this immidiately becomes apparent : a widget for showing which posts have been updated recently!

Based off of a quick hack Aditya threw together I have developed some reuseable code to just this end. I have it running asynchronously in my sidebar under the ‘Previous Posts’ heading. When you first load the page (or if you have JavaScript turned off) the normal Blogger-generated ‘Previous Posts’ list is displayed. After the page has loaded, if you have JavaScript on, the list will update to a list of the most recently updated posts.

So, on to the code! There are two versions of this hack : synchronous and asynchronous. If you want it to run synchronously (that is, the page waits for the hack to finish before it continues to render) place the following code where you want the widget to appear:

<script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=1317016;
<script type=”text/javascript”>
//<![CDATA[
do_updated_posts(‘<$BlogURL$>’,”,5);
//]]>
</script>

You can change the 5 to whatever number of posts you want in the list. Save and republish : you’re done!

If you want it to run asynchronously (the page loads before the hack does), insert the following code into your <head> section:

<script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=1317016;
<script type=”text/javascript”>
//<![CDATA[
addLoadEvent(function(){do_updated_posts(‘<$BlogURL$>’,’last_updated_posts’,5);});
//]]>
</script>

Again, you can change the 5 to whatever number of posts you want in the list. Then, insert the following code where you want the list to display:

<div id=”last_updated_posts”><i>Loading…</i></div>

Save and republish. You’re done!

The whole way this works may just be a bug in the rss.xml generating engine. If it is, this hack will stop working when they fix it, since it is dependant on the order of items in rss.xml.

IM Interoperability

Posted on

Jabber is the ineroperable-IM protocol… but only geeks even know it exists! With the advent of Google Talk there are more people using it — but many of them don’t even know it. So while Google has federated with the Jabber/XMPP universe, most IM users are still stuck in the MSN, Yahoo, AOL world unable to read out.

The big guys may only be in it for the money, but they’re not stupid. They know that having an account on every major IM network is a huge pain. They just haven’t figured out yet how to work together without losing their precious revenue. They seem to be moving in the right direction, however. The MSN Messenger (soon to be Windows Live Messenger) team has affirmed and re-announced their intention to federation with Yahoo Messenger.

It seems to be unclear whether this will be an actual network federation or a multi-client style feature. What I mean is, will only users of the newest versions of WLM be able to talk to Y!IM? What about older clients? What about Jabber transports? Obviously the transports should be able to evolve to support this (yay!) but whether they themselves allow for full network federation, I think, will be an indication of how ready the big guys are for interoperability.

Asyncronous Archives

Posted on

This hack combines two popular archive hacks with a new functionality in the same script. The two popular hacks included are the displaying of archive post counts in the archive list, and the re-ordering of the archive list. These two can be applied using the script with or without the third, new, functionality with is asyncronous loading of archives into the sidebar. If you don’t know what that means, try it out in my sidebar. Select an archive from the drop-down and notice that instead of being taken to the archive page, the posts in that archive are listed for you right in the sidebar. The steps to implement either part of this hack follow:

  1. Edit your blog template and add the following code directly after the <body> tag:
    <ArchivePage>
    <!– START ARCHIVE XOXO –>
    <ul class=”xoxo posts” style=”display:none;”>
    <Blogger><li><a href=”<$BlogItemPermalinkUrl$>”><BlogItemTitle><$BlogItemTitle$></BlogItemTitle></a></li></Blogger>
    </ul>
    <!– END ARCHIVE XOXO –>
    </ArchivePage>

    Note: if you have your blog marked up using hAtom or the XOXO Blog Format this step is unnecessary.

  2. Add the following code into your sidebar where you want the archive list to display:
    <div id=”archive_list”><i>Loading Archives…</i></div>
    <div id=”archive_display”></div>
    <noscript>
    <ul class=”archive-list”><BloggerArchives>
    <li><a href=”<$BlogArchiveURL$>”><$BlogArchiveName$></a></li>
    </BloggerArchives></ul>
    </noscript>

    Note to advanced users. The noscript section is necessary. You can edit it, but only if you pass two additional parameters to the function in the next step containing the code starting the list and ending the list.

  3. Add the following code into your <head> section:
    <script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=1286814;
    <script type=”text/javascript”>
    //<![CDATA[
    addLoadEvent(function(){get_archive_list(‘archive_list’,’archive_display’,’format‘,sort);});
    //]]>
    </script>

    Where format is drop if you want a drop-down archive list or list if you want the archives displayed in an unordered list. sort is true to sort the archive list oldest-to-newest and false to sort newest-to-oldest.

    If you want the archive list to link to the archive pages instead of loading in the sidebar then delete the archive_display text from the code above.

  4. Save your template and republish your blog.

Advanced users may be interested in the information on the scripts behind this.

Blogger Supporting RSS?

Posted on

For the longest time Blogger has been ATOM-only. This now seems to be a thing of the past. While I can find no official announcement anywhere, RSS 2.0 feeds seem to now be available on all Blogger blogs (unless the blog has not had the index published since whenever the change was). As you would expect, while the old was, say:

http://singpolyma-tech.blogspot.com/atom.xml

They have added to this:

http://singpolyma-tech.blogspot.com/rss.xml

It’s not the nicest implementation of RSS 2.0 I’ve seen, and I’m going to keep using my hAtom2RSS-through-feedburner feed for the comment options, but this is definately a step forward for Blogger.

Tags: