Archive for June, 2009

30 Jun 09

Animated Ajax Pageview Ticker

In my infinite quest to make everything better I found myself quite frustrated with the use of “plaintext” to display the number of pageviews on a MindTouch page .  Plaintext was clearly way too simple and I saw an opportunity to make it way more complex, quite possibly even confusing.

Using plain numbers is boring, they don’t move, shake, glide or slide.  Plaintext is not flashy enough and it doesn’t update.   If another ten billion people visit the page you’ll never know it’s true popularity, at least not until you refresh (so 90′s).  I know, all very pointless points but this is what I have to tell myself to justify such an endeavour.

counter_ticker_bg

To combat my frustration I decided to build an automated number ticker that updates using ajax to display the REAL-TIME pageviews of a MindTouch page.  The ajax utilizes the MindTouch API to retrieve the latest pageview data.  I used CSS to make the nice numbers which referenced this image.

The Number Ticker currently hits the API every 10 seconds.  This can be reduced to savor server resources and should be a major consideration when deciding to use this script or not.

Lastly, I consolidated it all into one MindTouch template so it can be included into multiple pages.  To create this template:

  1. copy the code below
  2. go to your template namespace (yourwiki.com/template:)
  3. create a new page
  4. view source
  5. paste and save.

Template Code

<h1>Template:AjaxCounterTicker</h1>
<input type="hidden" id="pgapi" value="{{page.api}}">
<div class="counter-wrap">
    <div class="counter-number">
        &nbsp;
    </div>
</div>
<div>
<style>
.counter-wrap {
    height:18px;
    overflow:hidden;
}
.counter-number {
    height:198px;
    width:12px;
    position:relative;
    background-image:url(http://developer.mindtouch.com/@api/deki/files/4548/=counter_ticker_bg.gif);
    float:left;
}
</style>
</div>
<script type="text/javascript">
Deki.$("body").ready( function() {
    getviewcount();
    setInterval("getviewcount()", 10000);
});
function getviewcount() {
    var pgapi = Deki.$("#pgapi").val();
    Deki.$.ajax({
        type: "GET",
        url: pgapi,
        async: false,
        dataType: "xml",
        success: function(xml) {
            var pgviewnum = Deki.$(xml).find("metric\\.views").text();
            loadticker(add_commas(pgviewnum));
        }
    });
}
Deki.$(".counter-number").each( function(i) {
    Deki.$(this).attr('id','num'+i);
});
function loadinput() {
    var newval = Deki.$("#numgo").val();
    loadticker(newval);
}
function loadticker(ticnum) {
    var numheight=18;
    addticker(ticnum);
    if (ticnum && ticnum != 0) {
        var s = String(ticnum);
        for (i=s.length;i>=0; i--)
        {
            var onum=s.charAt(i);
            Deki.$("#num"+i).attr('value',onum);
        }
        Deki.$(".counter-number").each( function() {
            var nval=Deki.$(this).attr("value");
            if (!isNaN(nval)) {
                var nheight = Number(nval)*numheight*-1;
                Deki.$(this).animate({ top: nheight+'px'}, 1500 );
            }
            if (nval==','){
                Deki.$(this).animate({ top: '-180px'}, 1500 );
            }
          });
    }
}
function addticker(newnum) {
    var digitcnt = Deki.$(".counter-number").size();
    var nnum = String(newnum).length;
    var digitdiff = Number(nnum - Number(digitcnt));
    if (digitdiff <0) {
        var ltdig = (Number(nnum)-1);
        Deki.$(".counter-number:gt(" + ltdig + ")").remove();
    }
    for(i=1;i<=digitdiff;i++) {
        Deki.$(".counter-wrap").append('<div class="counter-number" id="num' + (Number(digitcnt+i-1)) + '">&nbsp;</div>');
    }
}
function add_commas(nStr) {
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}
</script>

How to call the Template

{{AjaxCounterTicker();}}

If you have questions please post them as comments and I’ll be sure to respond.  Thank you for your time.

Damien Howley
@DamienH

25 Jun 09

MindTouch a Finalist in the Sourceforge.net CCA

The Sourceforge.net Community Choice Awards have announced their finalists, and we’ve made it into the “Best Commercial Open Source” category! If we win, MindTouch’s CEO, Aaron Fulkerson, will get a robot tattooed on his leg! Check out this vid from Aaron and Steve:

(For me, I’m told that the award comes with a pretty sweet robot trophy, and I’ve love to get my hands on him!)

To vote:

  • Visit the SourceForge CCA Page
  • MindTouch is Pre-Selected in Best Commercial Open Source Project
  • Provide an Email at Bottom of Page
  • Click on the “Send My Vote Now!” Red Button
  • Confirm your Vote Sent to your Email

Thanks for your continued support of MindTouch, and I hope we win the robot ;)

24 Jun 09

Fresh Meat and Fresh Project

Good morning everybody! I am Ricky, a freshly recruited intern here at MindTouch, Inc. I will be working with the other engineers here to help make MindTouch even better then it already is now. A quick bit about myself; I am a student at UCSD, the only UC that has an inorganic mascot, studying Computational Cognitive Science and Computer Science. While working at MindTouch, I will be under the tutelage of Guerric, who has already tasked me with a fun project to help slowly introduce me to the wonders associated with being a programmer.

My first project has been tentatively named “Download Statistics”. The goal of this project is to create a system that is suited for creating various download metrics in order to make better informed product decisions. The two major sources of information will be from Apache logs generated from repository downloads and a proxy for web downloads. This all gets processed and stored inside a database. This database will then be accessed through use of Dekiscript allowing pretty presentation of the data in meaningful ways such as real time tracking of unique downloads.

An interesting things about this project is that I will be using MonoDevelop as my IDE. So far it has been a fruitful experience and will hopefully lead to more of its use at the company.

And an interesting thing about my experience in the company, everybody uses laptops! It is so weird to see everybody working on laptops, especially 12.1 to 13.3 inch ones! And going along with laptops, the one that I brought to work, an old Dell Inspirion 1410, outright froze on the first day from the strain. Maybe it’s time to get an indestructible Thinkpad T500.

24 Jun 09

API code sample documentation

At MindTouch we always strive to improve the documentation of our product to make it easier for people to use and develop on top of MindTouch.  In an effort to
code-sample improve our API documentation I’ve added a template to the following API pages in an effort to capture code samples from the community for the API functions.  I encourage all to check out the Code Samples section of the following pages and to add code samples.  Also please leave comments on this blog post about the way the way the section is setup  so that we can improve it.

API Function Pages with new Code Sample Section:

After feedback we will implement any necessary changes and then roll this out across all of the API functions.

Thank you for any contributions.

23 Jun 09

Get support for MindTouch Core with “Summer of Support”

corey-and-brian
Brian and Corey, the extraordinary
MindTouch Support Team duo

Here at MindTouch Development HQ, we’ve been especially proud of the  uptick of activity in the community. Please continue your contributions!

And for those of you on Core who are running into some pretty basic issues, we want to help you.

Normally, our support plans are only offered to commercial customers, but for the summer months only, MindTouch is offering access to our basic support plans for Core deployments. Until July 1st, we are offering Core installs basic support at $995, with 10 tickets for system maintenance and system configuration. These tickets will expire on September 21st, 2009. (Perfect to have for the Minneopa release!) Your purchase of this plan also counts as credits towards a commercial license purchase!

Basic support is offered for the following systems (sorry, Slackware users):

  • Operating Systems: Red Hat 5; Fedora 9; Ubuntu 7.04, 8.04, 9.04; Debian Etch, Lenny; CentOS 5; SUSE 10.1; VMware ESX, WorkStation, Server
  • Database: mySQL 5
  • Webserver: Apache 2

These tickets cover support for installing, upgrading, and configuring MindTouch Core.

Interested? Show your support for MindTouch by dropping by our store and purchasing a plan!

Tags:

Copyright © 2011 MindTouch, Inc. Powered by