Effective Scala

Effective Scala

Using Traackr API

Today Engage121 announced they are launching a new version of their product that integrates with Traackr: Engage121 Launches Version 2.1

How do they do that you might ask? Well, very easy, they are using our awesome API. I thought I would show you how you can do it to. We are going to build a little Traackr widget from one of our alpha lists, Cloud Computing. The widget will display random posts from the list on a web page.

First of, the HTML for the page. Let’s keep it simple. We load JQuery because we will need it later to load the A-List via the API and display the posts.

The body contains a simple DIV and TABLE where we will display the image for the influencer and the text of the post.

<!DOCTYPE html>
<html>
    <head>
        <title>AList Widget</title>
        <script type=“text/javascript”
            src=“https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”>
        </script>
    </head>
    <body>
        <h1>A-List Widget</h1>
        
        <!– alist title –>
        <div id=“alist-title”><i>Loading</i></div>
        
        <!– random post to display –>
        <div id=“alist-post" style="display: none; margin-top: 15px;”>
            <table><tr>
                <td>
                    <!– author's image –>
                    <img id=“author" src=”“/>    
                </td>
                <td>
                    <!– post text –>
                    <div id="post”></div>
                </td>
            </tr></table>
        </div>
        
    </body>
</html>

Now, the fun part. The trick it load to load the A-List via our API, here is the link for it. If you are a Traackr customer, this link is accessible from your campaign’s setting.

Once we have loaded the A-List, we can simply call the Javascript function show_post() every 5 seconds to load a new post. We select each post by randomly selecting 1 influencer from the list, then randomly select 1 channel from this influencer and finally 1 random post. Here is what it looks like:

<script type=“text/javascript”>
            $(document).ready(function(){
                $.ajax({
                    url: 'http://alist.traackr.com/influencers/all/4233.json’,
                    data: {sec: '2728ea00020714632aa811e6f4a89e3a’},
                    dataType: 'jsonp’,
                    jsonp: 'jsonpcallback’,
                    success: function(data) { show_alist(data); }
                });
            });
            
            alist = null;

            var show_alist = function(data) {
                // read list and display title
                alist = data;
                $(’#alist-title’).html(alist.name);
                setTimeout(show_post, 5000);
            } // End function show_alist()
            
            var show_post = function() {
                // Find random influencer
                current_influencer = Math.floor(Math.random() * (alist.list.length - 1));
                influencer = alist.list[current_influencer];
                // Find random channel
                current_channel = Math.floor(Math.random() * (influencer.channels.length - 1));
                channel = influencer.channels[current_channel];
                // Find channel has posts
                if ( channel.posts.length > 0 ) {
                    // FInd random post
                    current_post = Math.floor(Math.random() * (channel.posts.length - 1));
                    // get data
                    img  = influencer.pics.small;
                    post = channel.posts[current_post].title;
                    url  = channel.posts[current_post].url;
                    // display
                    $(’#alist-post’).hide();
                    $(’#author’).attr(‘src’, img);
                    $(’#post’).html(’<a target=“_blank" href=”' + url + ’“>' + post + ’</a>’);
                    $(’#alist-post’).fadeIn(750);
                    setTimeout(show_post, 5000);
                }
                else {
                    setTimeout(show_post, 100);
                }
            }
        </script>

15 min in the oven at 350 and we are done. Check out the final result

And the best part about it? Traackr’s A-Lists refresh automatically weekly, so without having to do anything, just come back every week and discover new content.

That’s all folks!


Traackr's migration from HBase to MongoDB

Starting in the fall of last year, we made the decision to move our backend storage technology from HBase to MongoDB. George Stathis (@gstathis), VP of Engineering at Traackr, writes about the why and how of our decision.

http://traackr.com/blog/2012/02/traackrs-migration-from-hbase-to-mongodb/


The 10gen Blog on MongoDB and NoSQL: Recap: MongoDB Boulder 2012

The 10gen Blog on MongoDB and NoSQL: Recap: MongoDB Boulder 2012

Making 10gen's list

We were happy to share our success story with 10gen:

http://www.10gen.com/customers/traackr


You Only Wish MongoDB Wasn't Relational

You Only Wish MongoDB Wasn't Relational

SOLR v.s. ElasticSearch

While we have been using SOLR for a while now, ElasticSearch has caught our attention lately. Built-in distributed support and the ability to nest or group documents is very interesting.

Here is a quick comparison of SOLR v.s. ElasticSearch:

http://www.findbestopensource.com/article-detail/solr-vs-elasticsearch

And an interesting thread on StackOverflow:

http://stackoverflow.com/questions/2271600/elasticsearch-sphinx-lucene-solr-xapian-which-fits-for-which-usage

Is ElasticSearch mature enough and production ready?


Traackr, a general research tool

Great article in Forbes today about Traackr’s A-List tool.

http://www.forbes.com/sites/haydnshaughnessy/2012/02/03/who-are-the-top-20-influencers-in-big-data/

My 2 favorite quotes from the article:

Though Traackr is marketed as an influence tool, I think it’s a good research tool in general

Again full of names that are new to me. No surprise you might say but that shows the tool has value.


MongoDB Cambridge meetup

George (@gstathis) and I (@dchancogne) will be at  the next MongoDB meetup in Cambridge (NERD center, how appropriate) this coming Monday (02/06). Come join us, ping us, would like to chat with folks about how they use MongoDB and share some stories on how we use it at traackr.com

http://www.meetup.com/Boston-MongoDB-User-Group/