Singpolyma

Technical Blog

Archive for the "Tech" Category

Commentosphere Update

Posted on

After a bit of a rocky start Commentosphere seems to be operating normally. After talking a fair bit about the project and its scope with Johan of Ecmanaut, I have reduced the amount of data that needs to be input/stored for each comment and updated the labels/filters on some fields. As a result of this there is a new bookmarklet, so you may wish to switch to that. There are also now JSON feeds, with two callback options and a read-only XML API format for query pages.

Johan’s idea of calling the service ‘Webadict’ has been growing on me, but the one problem there is that it would probably require changing the URL of the service, which is just about impossible on Ning if you want to keep all your data as is.

The del.icio.us importer has been taken offline, as there were performance issue with the Ning backend that caused odd (and mostly useless) results. The Aggregator still has the same sorting problems, tag intersections are not yet supported, and the filter that finds children of the selected comment only works if the child comments have but one parent. These are the only four currently known glitches in the system, and it seems to be working admirably besides these.

I will be out of contact for just over a week, starting this Friday.

Tags:

The Ning Playground

Posted on

The Ning Playground is a webservice for the creation of webservices. It is where the code and data for Commentosphere resides. While great efforts have gone into making the service easy for novices to jump into, this results in a less powerful toolset overall.

Application Creation
Ning handles application creation and setup admirably. Although I did not investigate starting an app from scratch with no files, such a thing is likely possible. If it is not, cloning an app and deleting all code would serve the purpose just as well. There are numerous example applications with working code that can be easily cloned from the omnipresent Ning Pivot sidebar. Once this has been done one merely has to visit the (unchangeable) URL chosen for the new app and perform some minor setup functions and there is a working application. Nothing could be easier, although if left at that it is mostly useless. Selecting ‘edit code’ from the same sidebar presents you with a directory structure where you may add or edit files to build the app.

Language Support
Ning supports both PHP and their own XNHTML. While the focus on PHP may be a negative aspect to some, for me it made it easy to get right into development, as PHP is the language I am familiar with. All standard PHP methods, as well as quite a number of extension packages are supported admirably and without the contstraints usually found on free (or even cheap) hosting. They also provide thier own set of classes to enable interfacing with their Content Store and other things, such as Gmail, Google Maps, and reading/writing RSS feeds.

XNHTML is a very nice, very easy XML derivative that enables basic output control and data access. While I did not investigate it thoroughly (being more apt to the PHP side of things) I did use it for outputting the app name (for which there is a handy tag provided), displaying certian code only if the user is logged in / a specifi user is logged in (a matter of wrapping the code in question inside the provided user test tags), and addind data to the Content Store via form for the Aggregator (which was a simple matte of using the XNHTML form tags instead of normal XHTML and using standard XHTML ‘input’ tags for the form itself). I found XNHTML to be very easy to use, and very conveniant for simple operations.

The Content Store
Here is where things got a tad more confusing. To a novice, the Ning Content Store is very easy to use and easy to learn, but to a programmer used to SQL it is a pain to learn a new data access method, no matter how easy. To its credit, the Content Store has many benefits, including easy sharing of data between all Ning apps and the ability to perform basic queries with ease using the objects provided. It has also, however, some drawbacks, including :

  • No boolean operators for filtering (ie OR / NOT), all filters applied overlap as though put together using AND.
  • No pattern matching quieries analogous to the SQL LIKE operator. The ‘like’ and ‘likeic’ operators in Ning are full-text search operators. They claim that such a feature is on their wishlist for the service, but currently it does not exist because of the load they fear it would place on the servers.
  • The object owners can only be set to NULL (anonymous) or the currently logged in user. This creates a problem for services wanting to provide bidirectional third-party APIs.
  • All data returned is in the form of XN_Content objects, which support many nice operations for the transformation of data (htmlentities, urlencode) but are sadly unsortable, making the merger of multiple queries impossible without writing your own sorting function (which I plan to get to eventually).
  • It’s slow for adding content, and if you’re adding a lot of content (either one large record or a great many records at once — read importer) painfully so. They claim to be working on this as part of their plan to optomise the entire Ning backend, but for now things such as my del.icio.us importer are doomed to lock up connections and cause browsers to do funny things, which messes up the import and basically makes the operation impossible.

Other Considerations
While Ning is about social applications, developement is currently anything but social. In fact, only the creator of an app can modify its code, and this permissing cannot be given to anyone else. While others may clone the app to experiment with the code and then send their modifications back to the creator, group development is virtually impossible. In response to my inquiry about this they said that they are working on solving this, but who knows when that will come about.

All code on Ning is licensed under a fair, but GPL-incompatable license, making the use of GPLed libraries impossible.

Documentation is in plenty, but not always easy to find. For example, when looking up documentation on the nature of the ‘like’ and ‘likeic’ operators none was to be found under their appropriate classes / methods. I had to go to a mammoth article titled Querying the Ning Content Store to find it.

Conclusions
I like Ning, I really do. I like the concept, I like the implementation, but it needs some work. For small-scale apps or non-developers the way it is makes coding easy. Even as a more experianced developer I am not one to complain about ease of use. They need, however, to add features that cater more to the power market as well as the easy market. Above all else I would like to see (1) a faster backend that doesn’t hang on running import scripts and the like (2) group development (3) pattern matching (4) better documentation.

Tags:

Commetosphere

Posted on

I posted before about how some people are posting their comments to del.icio.us. At that time I said that I thought the idea good, but would far prefer it if there were a service dedicated to this use, for reasons I listed. After some discussion on the subject, and seeing more and more how useful content is sometimes lost because it is in a comment somewhere, I decided to try my hand at implementing the idea myself.

So, using Ning as the hosting and codebase, I have developed Commentosphere. Yes, it’s a tacky name, if you have another suggestion I’m more than open to it 😉 Developing on Ning was an interesting first-time experiance, on which I plan to write a post later. Currently posting to the service is handled primarily by a bookmarklet available on the about page or the posting page, but I hope eventually to have some greasmonkey script’s based off of Johan of Ecmanaut‘s script for del.icio.us. You must have a Ning account to add comments to the service.

For those people who have been tagged their comments on del.icio.us I have included an importer. Having, however, no comment data on del.icio.us myself I have not been able to properly test it, so feedback on this feature would be greatly appreciated!

Comments may be filtered by tag, user, what post they are on, what blog they are on, what parents they have (more on that below), or any combination of these. They are also fully searchable. Tag intersections do not work yet, but I am trying to fix that. Syndication is possible via RSS 2.0 or JavaScript (for inclusion in a blog sidebar, see mine) and there is a JavaScript Feed Generation tool. Other formats (including JSON) should be coming soon.

Comments are semi-threaded on Commentosphere. It works like this: when adding a comment you can specify the permalink URLs of one or more comments that this comment is a reply to. When viewing that comment in the app these ‘parent’ comments are listed and linked to. A link to ‘child’ comments is presented and, if clicked, will bring up a page of all comments who have that comment set as their parent. Multiple parents is currently a tag buggy, but that should be fixed soon.

Last but not least is the aggregator. The aggregator lets you add posts, blogs, tags, and users to monitor for comments. When a new comment is added to Commentosphere for any item you monitor, it will be added to your aggregator. For off-Commentosphere comments you have the option of adding an RSS comments feed that will also have its content mixed into the page. The page may itself be syndicated via RSS to allow you to monitor comments from blogs across the web without cluttering your reader with all the innumerable feeds. The aggregator currently has a known bug in that it does not sort the items in any way, and thus they end up chrological, but grouped by source. This is obviously not the desired behaviour and I am working to correct this.

And that, in a (large) nutshell, is it. More information can be found on the about page or the tips page. Testing and feedback on all features (especially the del.icio.us importer) would be greatly appreciated.

Tags:

In-Blog Tag Viewing

Posted on

This hack has been superceeded by a newer version.

A recent post at Freshblog got me to thinking about integrating the viewing of tags directly into my blogger blog. The solution presented there loads the results from tag queries into your sidebar, and checks the referrer if no tags are specified. The idea here is that if you are on my blog and query a tag, and then click a link to his blog, his sidebar will show his posts for the tag you selected here. It’s a great system, but my only problem with it was that it reloaded the current page with no apparent change at first, until you checked the sidebar. So I have modified the code for my own hack.

This hack will present a drop-down list of tags in your sidebar, pulled from the del.icio.us account you use to tag your blog and filtered for the anchor tag you use (if you use one). Selecting a tag from the drop-down list will take you to a post page on your blogger blog, so you never leave the site, that lists the results of a tag query for the selected tag. The sidebar will also update the same was as on Freshblog to facilitate the inter-blog browsing. Selecting another tag from the drop-down in the sidebar will add that tag to your query, not replace your query.

A ‘reset’ link is placed next to the drop-down box so that you can clear the tag query and switch to another tag without adding it. My version also fixes a minor bug in the original so that when tags in a referrer URL have ‘%20’s in them they are replaced by the del.icio.us-compatible ‘+’

If no tag is found in the <head> section, the script attempts to pull one out of your posts. This can be disabled on your main page by inserting this code along with that in step 2:
<MainPage><script type=”text/javascript”>var no_autocapture = true;</script></MainPage>

Now, without further boring explanation, here’s how to implement the hack :

  1. Create a new post on the blog you would like to implement this hack on with the title ‘Tags’ and click the ‘Edit Html’ tab for the post body, pasting the exact code ‘<div id=”tagspostpage”></div>’ into the post body. Turn comments off for the post and set the post date to January 1, 2000. The time doesn’t matter. Post this post.
  2. Edit the template for your blog and insert the following code into the <head> section :

    <script type=”text/javascript”>
    //<![CDATA[
    var del_user = “username“;
    var anchor = “anchortag“;
    document.write(‘<script src=”http://del.icio.us/feeds/json/tags type=”text/javascript”><\/script>’);
    //]]>
    </script>
    <script src=”http://www.awriterz.org/etcetc/tagspostpage.js type=”text/javascript”></script>

    Replacing ‘username’ with the del.icio.us username where you tag your blog posts and ‘anchortag’ with the anchor tag you use (if you use one). If, like me, you don’t use an anchor tag, then replace ‘anchortag’ with nothing.

  3. At the bottom of your template, right before the ‘</body>’ tag insert this code :

    <script type=”text/javascript”>
    var thediv = document.getElementById(“tagspostpage”);
    if(thediv)
    thediv.innerHTML = return_tagged_posts(true);
    </script>

  4. Insert this code into your template where you want the tags drop-down box and matched posts to appear (as they do in my sidebar) :

    <script type=”text/javascript”>
    list_side_tags();
    write_tagged_posts();
    </script>

  5. Save your template and republish your whole blog.

Google Base Live

Posted on

Google Base launched today. It seems to be a service that will host just about any content, from recepies to schedules to opensource projects. All items can be tagged and an arbitrary number of arbitrary fields with arbitrary datatype are available. This seems to be a service that aims at providing tools, not purpose, and you can do just about anything with it! An interesting idea, it’ll be interesting to see where it leads.

Official Announcement
Google Blogscoped Article

Tags: