Sunday, November 24, 2013

Winamp, a threat, a petition, AngularJS and shit is about to get real

A few days ago, I made a threat that I will remove people from the CDO-ITG group page if they didn't sign a certain petition. I said that I was doing to remove every shit on this group who didn't sign the Winamp petition and I said that I will know who didn't sign. Everyone laughed. Not. fucking. anymore.

Change.org has an API that allows me get at all of the signatures in the Winamp petition. Although, Change.org's API isn't quite mature, it's usable and quite easy to use with AngularJS. Here is a snippet:

wapp.factory('changeOrgService', function($resource){

    var _changeOrg = {};
    
    _changeOrg.getSignatures = function(petitionId){
        var baseUrl = 'https://api.change.org/v1/petitions';
        return $resource(baseUrl + '/:id/signatures?api_key=' + winampPapp.api_key + "&callback=JSON_CALLBACK",{id: petitionId}, 
            { get: { method: 'JSONP', params: { page: 1} }});
    };

    _changeOrg.getPetitionId = function(url){
        var baseUrl = 'http://api.change.org/v1/petitions/get_id';
        return $resource(baseUrl, {},
            { get: {method: 'JSONP'}, params:{api_key: winampPapp.api_key, petition_url: url, callback: 'JSON_CALLBACK'}});
    };

    return _changeOrg;
});

That should be easy to figure since its only a pretty simple AngularJS factory that depends on the ngResource module to get at the data. Add underscore and then you can do something interesting with the petition signature data like figure out how many signed from the Philippines (26), how many are from the Cagayan de Oro (DO YOU WANT TO FUCKING KNOW?! DO YOU?).


Now, how about REALLY signing that petition before I really do something crazy like find out where you live.

Friday, November 22, 2013

Why use Fiddles to teaching programming

  1. No more IDEs to figure out or decide on (every CS instructor and developer has an opinion on IDEs. Great flamewars have started this way.) 
  2. No more complex workflows like requiring source file names must follow a certain pattern, save into a specific folder, etc.
  3. No more projects submitted via a USB drive; If you're still doing this as a CS instructor now, change careers because you suck
  4. No more SDK installations or copying binaries for specific programming languages
  5. No more fighting a version control system; Let's face it teaching programming to freshmen or sophomores is hard enough and you still want to muddy the waters with a VCS?
  6. (some) Fiddles are collaborative; 2 or more students working on the same source file which makes for some interesting group project options.
  7. Fiddles can be shared via social networking; we already share too much of our personal life online why not your code?
  8. Fiddles are bookmark-able so they can be submitted as is and you can quickly see if it can run or not
  9. Fiddles are available for every language (some examples)
  10. And yes all of them are free
Fiddles should change the way how we teaching programming to all levels, if you disagree, tell me I'm interested in hearing what argument you come up with.

Friday, November 15, 2013

When we need something more than Firebug

Us web developers in our quest to build something unique will eventually come upon a wall that looks insurmountable with our current set of debugging tools like Firebug and Chrome's or IE's developer tools. Sometimes you just need something that can work at the HTTP protocol. This is where Fiddler2 comes in. Fiddler is a web debugging proxy for any browser, system or platform. Which makes it quite handy if you're doing AJAX stuff on a lot of different platforms from Java to Node.js.

What's really special with Fiddler is the composer feature which allows to make AJAX verb (GET, DELETE, PUT, HEAD, etc.) calls to your server side API. It then allows you to look at the response headers, cookies, the raw results and a bunch of other values to help you debugged that code.

Use this with Mozilla Firefox to get the most mileage out of it since it does integrate into it quite nicely. Chrome doesn't do it because of that new rule that you can't install a plugin that's not found in the Chrome store.

It also has a nice set of add-ons which is just icing on cake. I like StresStimulus add-on which allows you to do load testing with your web apps.

Another thing is this thing is free and will run on Linux boxes (needs Mono though).

Add this to your toolbox.