Chris Risner . Com

Google Plus One Enabled!

Posted on: 6/2/2011 12:58:00 AM by

While going through some of the recent news, I noticed that Google had officially released their Plus One capabilities.  Plus One seems to be getting a lot of press as being “competition” with Facebook.  As far as I can tell, the idea is that since I can hit the Plus One button on a site or a search result and then my friends will see it as more relevant in search results, that competes with sharing a link in Facebook.  I don’t share links on Facebook that often though so maybe I just don’t see it yet.  At any rate, I felt that I should immediately  comply with Google’s implied wishes and add Plus One to my site and the Veritas source code (now on GIT, more about that later).  Now, whenever you view an entry on the site, you can see the Plus One button near the bottom of the entry.  Feel free to click it as much as possible so that other people will know as well!   As far as implementation goes, it is VERY SIMPLE.  You can view instructions on implementing it at the Google Webmaster site.  You need to put two tags in your html.  In the head, or just before the body close, you need to put the javascript include:

<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>

From there, all you have to do is insert the following where you want the “Plus One” button to appear:

<g:plusone></g:plusone>

There are a few parameters you can read about for use with the plusone tag.  Since I wanted to show the Plus One on pages where I’m showing multiple entries, I need to specify what URL I’m referring to for each instance of the Plus One.  This is done easily enough by adding a HREF attribute to the plus one tag.  So now the tag from above becomes something like this:

<g:plusone href="http://chrisrisner.com/myUniqueUrl"></g:plusone>

That’s about all there is to it.  Plus One Away!

Categories: Google, Javascript, Veritas, Web
Bookmark and Share
First Article

Importing Comments into Disqus

Posted on: 4/10/2011 10:40:00 PM by

After seeing Disqus in action on Keith Elder’s blog, I decided to incorporate it in my Veritas Blog Engine redesign.  Setting up Disqus is pretty easy.  If you’re using a more standard blog engine (Wordpress, Blogger, etc) than they have plugins and very easy to use integration methods.  If you’re writing your own site, you just need to drop some javascript onto your page and replace a few values.  Specifically, you have to put in your account name, the blog entry url, and the unique page title (or disqus identifier).  There are a couple caveats to using Disqus.  Prior to using it, a viewer could comment on any entry shown on the home page without having to go to the entry’s unique page (so the comments for multiple entries were viewable on the same page).  Unfortunately, Disqus can’t handle this.  You can only show the “disqus comments” for one entry at a time.  So now, viewers have to click and go to the unique page to add comments (or even just view the comments).  I think that with the ease of use of Disqus for administering comments as well as users logging in with their info to add comments makes this trade off worth it.  Importing is another issue though.

When I first started looking at Disqus, I saw that you could import comments and figured that as long as I could import, I could figure things out and make it work.  This did prove to be true, however, there were a few hoops to jump through.  If you checkout Disqus and want to import from WordPress or Blogger, then they have an easy to use format for importing your comments.  If, however, you’re using your own format, they do provide a generic format (WXR) to import your comments.  You can read about and checkout this format here.  The format is documented, though not as well as it could be.  Both the Content:Encoded and the comment_content are shown using CDATA for the content.  Presumably so you don’t have to bother encoding the html of your blog entry and the comment.  In the course of running into issues I ended up just encoding my html and not using CDATA at all. 

Another issue I ran into while getting my xml ready was the link to the blog entries.  I had a few links that had apostrophes in them.  While this seemed to work fine in several browsers, it ended up being very problematic after I imported my comments (this was my own fault and not Disqus’).  Just make sure your urls are properly encoded (i.e. replace your apostrophes with %27).

The last issue I ran into, I will blame on Disqus.  Their import example has the following in the xml:

   1:  <!-- sso only; see docs -->
   2:  <dsq:remote>
   3:    <!-- unique internal identifier; username, user id, etc. -->
   4:    <dsq:id>user id</dsq:id>
   5:    <!-- avatar -->
   6:    <dsq:avatar>http://url.to/avatar.png</dsq:avatar>
   7:  </dsq:remote>

Now I don’t know if there are some docs (as in “see docs”) that I didn’t see but I assumed (incorrectly) that I should send over my ID for the commenter.  That was a bad assumption.  This section caused my comments and threads to not be imported at all.  Furthermore, the import process doesn’t really give you any information about why your xml does or does not work.  I did send a couple tweets back and forth with Disqus, though I don’t think they actually looked at the xml I was trying to import (and presumably they would have seen the DSQ Remote section and told me to drop it right away).  Once I dropped that section from all of my item elements, the import worked great (besides the URL encoding issue I mentioned above).    Below you can see an example of the xml I ended up importing.  There is one Item element in this xml where my full import had one item for each comment.

   1:  <?xml version="1.0" encoding="UTF-8"?>
   2:      <rss version="2.0"  xmlns:content="http://purl.org/rss/1.0/modules/content/"  xmlns:dsq="http://www.disqus.com/"  xmlns:dc="http://purl.org/dc/elements/1.1/"  xmlns:wp="http://wordpress.org/export/1.0/">  
   3:          <channel>    
   4:              <item>
   5:                  <title>re: Detroit Restaurant Week: My First Android App</title>
   6:                  <link>http://chrisrisner.com/Detroit-Restaurant-Week--My-First-Android-App</link>
   7:                  <content:encoded>&lt;p&gt;&lt;My Encoded Html&lt;p&gt;</content:encoded>
   8:                  <dsq:thread_identifier>Detroit-Restaurant-Week--My-First-Android-App</dsq:thread_identifier>
   9:              <wp:post_date_gmt>2011-03-20 23:32:00</wp:post_date_gmt>
  10:              <wp:comment_status>open</wp:comment_status>
  11:              <wp:comment>
  12:                  <wp:comment_id>188</wp:comment_id>
  13:                  <wp:comment_author>MyName</wp:comment_author>
  14:                  <wp:comment_author_email>Test@TestComment.com</wp:comment_author_email>
  15:                  <wp:comment_author_url>http://www.chrisrisner.com</wp:comment_author_url>
  16:                  <wp:comment_author_IP>24.145.221.93</wp:comment_author_IP>
  17:                  <wp:comment_date_gmt>2011-03-27 18:00:35</wp:comment_date_gmt>
  18:                  <wp:comment_content>Now to port it to WinPhone7!</wp:comment_content>
  19:                  <wp:comment_approved>1</wp:comment_approved>
  20:                  <wp:comment_parent>0</wp:comment_parent>
  21:              </wp:comment>
  22:          </item>  
  23:      </channel>
  24:  </rss>
Categories: Veritas, Web
Bookmark and Share
First Article

Blog Upgrade Number One

Posted on: 4/5/2011 12:44:00 AM by

I’ve been blogging off and on for the past few months about rewriting my blog framework, Veritas.  Today, I can happily say that I’m done(ish).  What you’re reading right now is being hosted by the fruits of my labor and my upgraded, MVC2, .Net 4.0 blog engine.  There is still some work I will eventually do but the site is pretty solid right now.  I left off talking about the UI and didn’t really get to the last piece which was the actual blog entry display.  I finished that off without writing about it and then also finished the whole admin section as well.  If and when I have the time, or if enough people are clamoring for it, I’ll talk about those things as well.  In the mean time, you can still read all about the majority of the site and check out the code for yourself.  Up next I still have a lot of stuff to talk about regarding my Android Application and the experience I’ve had making it.  In the mean time, you can download the current full source to the site here.

Categories: .Net, Veritas, Web
Bookmark and Share
First Article






Categories