• A modern forum for a modern web

    Date: 2014.04.16 | Category: nfc ring, nodejs

    Screenshot from 2014 04 16 175611 550x321 A modern forum for a modern web

    We recently migrated our NFC Ring forum over from ProPHPBB (Hosted PHPBB) to NodeBB. Let’s be clear, in this blog post I’m not comparing like for like. ProPHPBB is a free service, it is open source, built on PHP and it’s been the cornerstone of forums on the web for years. NodeBB is the young kid on the block.

    Let’s get this out of the way, we paid the NodeBB team 300$ for our migration from PHPBB. Hosting and support is costing us ~70$ per month. With the support we’re getting we feel it’s value for money, we didn’t pay anything for the service from ProPHPBB, it was ad supported.

    The guys at ProPHPBB were also great, we’d usually get our SQL export within 12 hours of asking. Obviously if we were paying them a monthly fee we’d expect a quicker response or even the ability to dump our own SQL but so is life.

    The ads on the ProPHPBB forum hosting were just far too offensive and damaged our brand. It’s kinda obvious that PHPBB’s days really are numbered, the design and implementation is just too dated now for it to ever really become relevant again, I gotta thank it for it’s service though, truly great software has a shelf life like any other product and we should celebrate the circle of life. Thank you team PHPBB and the community around that project!

    NodeBB presents some other significant advantages than providing value for money:

    • We can map our sub-domain
    • We can use our SSL certs
    • We can use our new Oauth2 Identity provider to provide a single unified sign on.
    • It has a great chat feature and notification system.
    • Posts can be up/downvoted and favorited
    • It is Beautiful, the UI is perfect for our Brand.
    • Responsive CSS provides a nice mobile experience

    Migration wasn’t completely smooth, this wasn’t a huge surprise because we have all been crazy busy but what mattered is that pretty much any time I hit a problem I could jump onto IRC and Julian would sort it out within a few hours.
    I have no regrets about using ProPHPBB initially as it gave us a very quick start with forums. Ultimately though, I’m happy with our new home and it’s onwards and upwards for the NFC Ring Forum!

  • All open issues on my github repositories

    Date: 2014.03.13 | Category: git

    I wrote a quick little script that turns all my open github issues onto clickable links..

    Copy paste the below into githubIssues.js:

    // Edit me
    var username = "YOURUSERNAME";
    var password = "YOURPASSWORD";
    // stop Editing!
    
    var gittub = require("node-github");
    var github = new gittub({version: "3.0.0"});
    
    github.authenticate({
      type: "basic",
      username: username,
      password: password
    });
    
    github.issues.getAll({
      user: "JohnMcLear",
      filter: "subscribed",
      per_page: 100,
      sort: "created",
      direction: "asc"
    }, function(err, res) {
      for(var issueKey in res){
        var issue = res[issueKey];
        var line = "<p class='issue'>";
        line += issue.created_at + " ";
        if(issue.repository) line += issue.repository.full_name + " ";
        line += "<a target='_blank' href='"+issue.html_url+"'>";
        line += issue.title+"</a>";
        line += "</p>";
        if(issue.title) console.log(line);
      }
    });
    

    Edit your username and password then type:

    npm install node-github

    then:

    node githubIssues.js &gt; issues.html

    Open issues.html in your web browser..

    Limitations: Max 100 issues due to Github API limit.

  • Adding i18n to a Cordova App

    Date: 2014.02.14 | Category: cordova, developer, developing, development

    i18n (Internationalization) in applications roughly means adding support for translations and other languages.  In this blog post I will talk you through a general approach to implementing i18n in Cordova Apps.  If your app isn’t open-source, move along, the 90s is on another website.

    As Cordova apps are written in HTML/CSS/JS we can easily leverage existing web platforms and services to provide i18n at break-neck speeds.

    TLDR Services/frameworks used:
    * Translatewiki to provide translations
    * Marcel’s html10n i18n implementation
    * Handlebars for templating
    * Etherpad implementation of detecting locale/language also written by Marcel

    Implementation steps

    * Ensure your app fulfills Translatewiki’s requirements (Open source etc)
    * Talk to Translate / Internationalization team at Wikimedia foundation before creating Gerrit commit
    * Gerrit commit to TranslateWiki adding support for your App.
    * Include handlebars and html10n libraries in your app
    * Modify your HTML putting markup in handlebar script tags
    * Move your text strings into locales files.
    * Include a handlebars html10n render helper
    * Use the Etherpad implementation of detecting locale/language* Give someone at WMF access to commit to your Repo

    Sit back and enjoy..

    Once you have completed your implementation and it’s approved by the WMF the WMF translation team will translate all of your strings and commit them back to your repo. You might want to provide the WMF team with the ability to see each of your strings in situ in a browser, this means providing a mechanism to fake Cordova events..

    Summary

    This implementation is basically a straight copy of how we handle i18n in Etherpad, it’s pretty robust and clean to implement. All in all a complete refactor of the NFC Ring Control App while implementing i18n took about a week of full time commitment, well worth doing as now the larger community can provide translations which if I was to do hans solo would take months icon smile Adding i18n to a Cordova App

  • Cordova Windows Phone 8 Exit Application

    Date: 2014.01.23 | Category: cordova

    If you have a Phonegap/cordova app that goes from page1.html to page2.html then follows a link back to page1.html the standard backbutton behavior wont exit the app.

    Page1 >> Page 2 >> Page 1 — Windows Phone will take you to page 2 instead of exiting the app. It’s expected behavior but it’s kinda poorly documented..

    Anyway I searched around for ages but didn’t find a fix that worked for me..

    Diff friendly folks see the commit that includes this fix

    TLDR of how I fixed this is to use a JS value to track which page I’m on..

    IE in page1.html you could have..

    var currentPage = "index";
    

    Then in your app.deviceready function include..

    if(currentPage == "index"){
      history.go(-(history.length-9999));
      document.addEventListener("backbutton", handleBack, true);
    }else{
      document.addEventListener("backbutton", handleBack, false);
    }
    function handleBack(){
      // handle other logic here such as handling the back events from page2 to page1..
    }
    

    The real magic here is history.go(-(history.length-9999)) which basically tells the history stack to reset. Also the true statement on addEventListener allows the original registered event to fire (Native back button)..

    Anyway give it a try and let me know if it works for you.

  • Getting started with Explore NFC on Raspberry Pi in 60 seconds (Also Raspbmc)

    Date: 2014.01.20 | Category: nfc, nfc ring

    The docs from NXP are slightly over verboose, here I make the assumption you already have a Pi installed and know a little about SSH and using the Linux Terminal. It’s worth noting I’m doing some of these steps on Raspbmc too so things may differ slightly from your environment. I will try cover both wheezy and Raspbmc

    Put module onto Raspberry Pi by y’know, putting it on the Pi.. Reboot..

    SSH into your Pi username pi, password raspberry
    ssh pi@your-pi-ip-address

    Update your Pi and install some deps
    SPI was added late 2013 so it might not be available in your Kernel, doing an update is easy, do..
    sudo apt-get update && sudo apt-get upgrade && sudo apt-get install ca-certificates git-core cmake
    – Make a cup of tea

    cd ~ && sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
    sudo chmod +x /usr/bin/rpi-update && sudo rpi-update
    sudo ldconfig

    Note: If you get a prompt saying you might not need this firmware or it’s the wrong update then just skip this step.

    Enable SPI (not required on Raspbmc)
    sudo nano /etc/modprobe.d/raspi-blacklist.conf
    – Comment out blacklist spi-bcm2708
    – Change it to read (note the hash)
    # blacklist spi-bcm2708

    Enable Pi on Rasmbmc
    sudo boblightd
    For posterity further information about this fix is on this thread — Note that sudo boblightd toggles SPI pins so running it twice might not work..

    Reboot
    sudo shutdown -r now
    – Make a cup of tea

    Grab the demo polling app from my Git Repo of the NXP S/W
    cd ~
    git clone https://github.com/JohnMcLear/NXP-Raspberry-Pi-Card-Polling-Demo.git
    cd NXP-Raspberry-Pi-Card-Polling-Demo
    cmake source
    make

    – Make a cup of tea

    Test
    sudo ./card_polling

    My end goal here is to use my NFC Ring to start/play/pause videos in xbmc using the Pi shield.. Wish me luck..

    Q: I get Failed to open bal.
    A: You forgot to run card_polling as sudo.. sudo ./card_polling

- My Brain made this.