Beer Recommendation Engine using PredictionIO

The Problem: We all love beers. And today, we face an unprecedented variety of options. We are overwhelmed by too many choices and couldn’t decide: What should I drink next? My Solution: In our Hack Reactor thesis project, I build a machine learning server using PredictionIO as a recommendation engine for beer. Boardly speaking, the… Continue reading Beer Recommendation Engine using PredictionIO

Angular.js factory: Handle $http asynchronously

The problem: When I was using $http service to get data from a remote API, my code below was not able to return data back to the controller. myApp.factory(‘myFactory’, function($http){ var data = { anArray:[] }; $http.get(‘/api’).success(function(data) { data.anArray.push(data); }); return data; }); This is because the return data is already executed before the $http… Continue reading Angular.js factory: Handle $http asynchronously

Setup proxy server with Express

The problem: I am working on a project using BreweryDB. I was trying to load some data from the API, but they don’t support jsonp. There is a CORS issue if I directly fetch data using Angular: XMLHttpRequest cannot load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:3000’ is therefore not… Continue reading Setup proxy server with Express

Angular UI bootstrap: Open first accordion with ng-repeat

The problem: I was using accordion directive in Angular UI Bootstrap 0.1.2. Reading the demo page, there is an example to show how to open the first-accordion-group by default: <accordion-group heading=”First Header” is-open=”true”> </accordion-group> This works fine for static content, but it fails to work with dynamic content using ng-repeat. In other words, it DOES… Continue reading Angular UI bootstrap: Open first accordion with ng-repeat