As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label BRPS. Show all posts

Alright, this is a null-grade post. Nothing really important except the first part.

One of my favorite channel, Food Wishes, has just announced that they are acquired by If you don't know either, well, I guess you probably a fast food lover.

Aside: There is nothing wrong with fast food, I don't get why some people so dislike them to emphasis their taste or healthy diet. It's how you make, not how fast food is cooked.

Anyway, I read the press release and just realized how big Food Wishes is. 2 million views and work independently, Chef John really does an amazing job.

If you have watched his videos, that number isn't really hard to imagine. His videos is so fun too watch, especially when he make some pun connection.

Back to the service I was talking about. (Was I?) Let's take a look at screenshots first.

I do not edit it or use Firebug to make fun of screenshot. They are untouched, SOO<del>C</del>S. (Straight-Out-Of-Screen)

That's just v1.5 (I think I can call that), there is an old v1.0, which generates 36,772 requests in last 24 hours. Multiply it by 30, that would be 1,103,160+. (The real number should be little higher, because it's actually 23h-24h window) Sum up them, it's 2,541,340.

Holy smoky bacon with cheese, I have no idea my simple script serves 2.5+ million times a month. If that wasn't Chef John, I wouldn't have looked into it.

If I nuke the service someday, I wonder if I would hear some swears?

I wish this statistics was my blog's.

PS. that service is NFS, the question mark sneaks into title by itself.


BRPS is dead. (2015-12-02T02:44:34Z)

After 40 posts, I decided to add my own BRPS1 (Blogger Related Posts Service) gadget to this blog. I modified the current brps.js and embedded it into source, it uses jQuery 1.3 and it would cause some problem in this blog.

Here is the code:

<div id='related_posts'></div>
// GPL'ed, verson 3 or later
function BRPS_watchdog() {
  if (window.brps_start == undefined)
  diff = (new Date()).valueOf() - brps_start;
  if (diff >= 30 * 1000) {
    $('#related_posts').append('<p style="color:#f00">Something went wrong with BRPS server!</p>');
    window.brps_start = undefined;
    window.setTimeout('BRPS_watchdog()', 5000);

function BRPS_get() {
  var key = '%%%%% YOUR BRPS KEY %%%%%';
  var blog_id = '%%%%% YOUR BLOGGER BLOG ID %%%%%';

  // Get Post ID
  var links = $("link[rel='alternate']");
  var post_id = '';
  for (var i=0; i<links.length; i++) {
    m = /.*\/feeds\/(\d+)\/comments\/default/.exec($(links[i]).attr('href'));
    if (m != null && m.length == 2) {
      post_id = m[1];
  var $rps = $('#related_posts');
  if (blog_id != '' && post_id != '') {
    if (window.brps_start == undefined)
      window.setTimeout('BRPS_watchdog()', 5000);
    window.brps_start = (new Date()).valueOf();
    $.getJSON("" + blog_id + "&post=" + post_id + "&key=" + key + "&callback=?",
          window.brps_start = undefined;
          if (data.error) {
            $('<p>' + data.error + '</p>').appendTo($rps);
            if (data.code == 3)
              // Need to retry in 5 seconds
              window.setTimeout('BRPS_get()', 5000);
          else {
            if (data.entry.length > 0) {
              var $rps_ul = $('<ul></ul>').appendTo($rps).hide();
              $.each(data.entry, function(i, entry){
                  .append($('<a/>').attr('href','title', 'Score: ' + entry.score.toString()).text(entry.title))
            else {
              $('<p>No related posts found.</p>').appendTo($rps);
  else {
    $('<p>Only available in single post.</p>').appendTo($rps);

Since my blog always requires jQuery, therefore I didnt put the embedding code in the code above. You might need the following code to be before the code above:

<script src=''></script>

A few changes:

  • The Blog ID2 and Key1 are hand coded in script.
  • Remove the BRPS options, because I know what I want.
  • No longer rendering the title and if the page is not a single post page, then it will show a message instead of emptying gadget to show nothing.
  • The list will be sliding down and fading in.

Generally, it should run faster, though you wouldnt feel that.

[1](1, 2) The brps.js is no longer available to new users, see Using BRPS new method to get related posts list.
[2]Search your blog HTML source for blogID, you will see it.

By request of westius, BRPS now is able to append a small piece that may help your track if your visitor click on posts of related posts list.

The new option is append_src:
<script type="text/javascript">
window.brps_options = {
"append_src": true

The the links in related posts list will look like

The label in Blogger is like the tag in WordPress. But it's not necessary to be that though. You can use label as anyway that you want to. However, since BRPS is fully based on label query. You must follow some rules in order to get the most related posts.

The following is the guidelines:
  • Label you post with Category + Tag If you have a computer topic blog and you have a post about photo editing using GIMP on Windows. You may label with Windows, which is using in Category way. But it's not good enough. You may label with Windows, Howto. It's still not enough, try Windows, Howto, Photo editing. You can try more Windows, Howto, Photo editing, GIMP. Why not one more? Windows, Howto, Photo editing, GIMP, Filter. Now I believe that you got the idea, you can go on your own.
  • As of writing, Blogger supports up to 20 labels to one blog posting. It won't cost you if you label with 20 labels, so why not just label as many as possible and get the most related posts. BRPS queries all 20 labels for you, don't waste the ability of BRPS!
  • When you label a post, Photo editing give you more precise results than Photo, editing. Because the later may also match File, editing.


BRPS is dead and some links have been removed from this post. (2015-12-13T02:56:56Z)

After small update, I then added a requests count with chart using Google Chart API and a list of active blogs. Check out the screenshot below:

Blogger Related Posts Service: Statistics via kwout

I also replace with just Blogger.


BRPS is dead and some links have been removed from this post. (2015-12-13T02:52:18Z)

Today, I spent about an hour to update BRPS. I actually updated for fixing a bug. Somehow, querying label Fedora caused a error return on one of my blogs. I dont understand why that would happen. Right now, I just exclude any situation like from final result.

Currently, BRPS receives 1.5K+ requests a day. I would say there might be 10+ blogs actively use BRPS, not include my blogs. I cant give you an explicit list since I havent designed that in BRPS, I might never do that.

Here is a screenshot:

Disappointingly, no one wrote for introducing BRPS. They just use it, I wonder if they do know what BRPS is and I believe some of them have never visited BRPS website. They might be copying the code from a blogger which I asked him if he wanted to write about BRPS.

Anyway, I also makde an important modification retrying. Retrying is quite important and more necessary because I increased label querying from 5 labels to 10 labels. That means the 5-second download timeout on GAE almost has to be happened (Note that there is still other type of timeout, I havent dealt with), currently, as my observation, that happens in a rate as 1%. From now on, BRPS might have more DeadlineExceededError.

Amazingly, I got no compliant about that 1%. Possibly, no one notices that Related Posts section missing.

I dont like to use a widget that has linkback, so I wont put that kind of things in my widget. I just hope people would like it and write for it. I am still waiting.


BRPS is dead and some links have been removed from this post. (2015-12-13T02:55:06Z)

I just finished my third Google App Engine application, Related Posts Service. I believe BRPS is currently most easiest way to have related posts on your blogs.

It only needs three lines of code. You can also simply click and a button to add it to your sidebar as a widget. If you want this Related Posts just right after your post, you only need to manually add these three lines of code at right place.

Honestly, I didnt write it with much care, so it might be broken very soon or never be. I dont know how many posts data can be stored within 500MB, I havent written any clean-up code. The speed is quite fast, just a second or two for querying 5 labels via Blogger Data API. I may raise the label querying limit to 10 or higher, when BRPS has more bloggers use it.

The JavaScript script is relative simple, but enough for bloggers use standard templates. I am very welcome anyone to improve it or any part of BRPS.

Again, I am a lazy person. Current status is all what I need, I will only fix bugs for myself. I wish you can request some features, then I will add them if possible.


Here is a link to a blog post, which collects the old ways. (2008-11-17)