Bungee-Powered Digg Gadget

I’m a fan of applications that have a high simplicity to compelling ratio. A simple email client for example, or maybe a small and clean stock ticker web application -easy to develop and and run on the web (ideally) but having an “interesting” end-result . An example of a very low simple/compelling ratio would be my tax preparation software. Ok, maybe it’s just because I hate taxes 🙂

Here I present my attempt at such an application. It’s nothing that will disrupt the technology world, but I think it’s extremely simple yet somewhat compelling.

I built a gadget you can embed on any web page to display the last 10 comments made by a digg user on digg.com and the date entered. It will also show how many digg votes a digg user’s comment received as well as links to the Digg article and Digg’d URL. One nice feature is that it separates the digg and bury votes for each comment. This is information you can’t get when reading comments on digg.com.

To embed the gadget to a web page you simply put it inside an iframe. The gadget will expand to the size of your iframe. Then put the Digg username in the URL. This tells the gadget which digg user’s comments to retrieve. It does not require any kind of authentication to digg.com.

Click to see Digg Comment Viewer run

Here is the HTML code you need to embed the gadget on any website or blog post. Replace Kevin Rose’s username with your own digg username:

<iframe
src="http://testdeploy.bungeeconnect.com/dcvprofile?embedded=1&digguser=kevinrose" mce_src="http://testdeploy.bungeeconnect.com/dcvprofile?embedded=1&digguser=kevinrose" width="300" height="275" frameborder=”0”>
</iframe>

That’s all there is to it. Small, easy to install, easy and straightforward for the user… and “somewhat” compelling.

You can see a working version of the Digg Comment Viewer by going to this page, and by clicking on the “Launch Digg Comment Viewer (popup)” link.

For Bungee developers interested in seeing the Bungee Logic code behind this gadget, below is the function that does all the work. Keep in mind that the user interface is all done in a Bungee form, so you will not see anything in the source code that deals with the UI.

public DiggCommentViewer() 
{ 
var string digguser // Get the digg username 
AppGlobal.queryArgs.get("digguser", digguser);// Get comments from digguser 
diggAPI.getEvents("/user/" + digguser + "/comments?count=10&appkey=http://bungeeconnect.com", comments); 
 // Update each comment with additional information from the digg story 
for each CurrentElement in comments.comment 
   { 
   var boolean StopIterating; 
   var stories tmpStories; 
   var comment CurrentElement; 
   var int32 CurrentIndex; 
   var XMLUtil xmlUtil = new XMLUtil; 
   var XMLDocObject xmlObject = new XMLDocObject; 
   var string storyXML; 
   var int Length;      

   // Get the story info on each comment 
   diggAPI.getStory(CurrentElement.story, storyXML); 
   xmlObject.readString(storyXML); 
   xmlUtil.convertXMLToObject(xmlObject.root, stories, tmpStories);      

   // Set the href, link, diggs, title for each comment 
   CurrentElement.href = tmpStories.story.href; 
   CurrentElement.link = tmpStories.story.link; 
   CurrentElement.diggs = tmpStories.story.diggs; 
   CurrentElement.title = tmpStories.story.title; 
   } 
}

If you want to re-create the Digg Comment Viewer in your own Bungee account, you are in luck. I have put this application in the “Open Example Code” section on the Home Tab of the Builder. All you have to do is select diggCommentView and click on the Create New button. This will automatically create the solution in your workspace.

To simulate the application in the Builder:

  • in the Solution Explorer, open the “Main” class in the “diggCommentViewer project’ (just click once)
  • in the Solution Detail, open the “commentViewer” form (double-click) and click the Simulate button (next to “Save”, top left hand corner of the Builder)
  • When the app runs, enter your digg username in the gray field above and click on the “GO” button of the app. You should now see your last ten comments you made on digg.com.

To have a Digg username auto populate in the username field when you first run the application:

  • double click on the Main class
  • drag an assignment statement to the top of the getComments() function.
  • your assignment statement should look like this (substitute kevinrose for another username):
diggUsername = 'kevinrose';

Now you are all set to post and deploy your application and embed into a web page / blog.

If you want to put the Digg Comment Viewer on your facebook profile page, you can install the Digg Comment Viewer application. Facebook doesn’t allow you to add content directly to your profile page, it’s all done via Facebook applications.

If you have any questions or need any help, let me know.

Matt Misbach

Advertisements

3 Comments »

  1. You did something I haven’t seen before – you sent a parameter from the query string into a Bungee field – can you elaborate on how you made the connection?

  2. misbach said

    We provide a function called queryArgs.get() that is inside of AppGlobal that allows you to get all the arguments from the URL.

    Steps:
    1. Drag a function statement to your code
    2. Change the site to “AppGlobal”
    3. Click on the Ellipsis, browse to and select the queryArgs.get() function
    4. Now just specify what “key” you want to get the value of in the “In” parameter.

  3. […] get even more fancy and embed your Bungee app into existing web pages or as a widget. As an example, see Matt’s post “Bungee-Powered Digg Gadget“ […]

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: