Node.js, PHP, NGINX and WebSockets (Socket.IO)

Don’t try using Express.IO. Just wasnt working.

Tech Used:
Centos 6.5 : http://www.centos.org/download/
Nginx : http://nginx.com/
MySQL : http://www.mysql.com/
Redis : http://redis.io/
PHP 5.5 : http://php.net/
Node.js : http://nodejs.org/
Socket.io : http://socket.io/docs/
Angular JS : https://angularjs.org/
Angular Socket IO : https://github.com/btford/angular-socket-io

Angular Socket IO Info:
http://www.html5rocks.com/en/tutorials/frameworks/angular-websockets/

Socket.IO works. But you have to understand what its doing. (I’ll explain further down)

Quick Info on Event Emitters:

Node.js Events and EventEmitter

Using Nginx to reverse proxy a secure apache site that is using socket.io/node.js/websockets
http://kenneththorman.blogspot.com/2013/07/using-nginx-to-reverse-proxy-secure.html

Loading a configurations in Node.js

Managing config variables inside a Node.js application


http://stackoverflow.com/questions/5869216/how-to-store-node-js-deployment-settings-configuration-files

Continue reading Node.js, PHP, NGINX and WebSockets (Socket.IO)

Angular and Charts

In my first weeks of using angular, I came to the point of needing to put a chart on the page.
I recieved the data through an api call and then i was stuck. How do I get it into the correct format? Which library should I use?
I found chart.js, a super simple library that puts data on a page. GREAT, well at first. I was able to get data on the page, and it looked nice, but responsive design doesnt play well with something that needs fixed widths and heights. But it got me at least thinking on how to do things in angular. The library is simple and nice, I would recommend it for any basic chart you would need.
http://www.chartjs.org/

Then comes highcharts. I looked at the website for it, and was like “nope”. But it was the only thing that could do what I needed, so I tried it.
Once I got it up with a sample chart on a better looking site, the actual chart didn’t as bad, turns out its just the high charts website, still not as pretty as the chart.js charts but it will do.
Using the pablojim hightcharts-ng directive, and just a little bit of fiddle, I was able to get a chart up and running on the site.
http://www.highcharts.com/
http://ngmodules.org/modules/highcharts-ng
https://github.com/pablojim/highcharts-ng

Continue reading Angular and Charts

Angular Seed +

Starting out with angularjs, I had no clue what to do. I tried the tutorial on the official site, that got me far enough to say, “wow, ajax type request are easy, and putting things on the DOM is so simple” but the other half was “wow, one big messy file. I don’t like this.”

I started searching around. I found the angular-seed and angular-boilerplate and … so on, but the seed was almost the same issue, a few big files.

Then I found a post that talked about seed and boilerplate and he mentions an in between and it was beautiful. I quoted below. Within minutes I had figured out how to use it by basically just copying the seed project and breaking it out to his structure. I’ve within 2 months have created 4 fully angular projects with me being the only developer doing both front and backend. It has changed my (work) life.

Blog: I’ve been doing it wrong

You can make it more usable by using sub-directories for controllers, and so on:

controllers/
    LoginController.js
    RegistrationController.js
    AccountListController.js
    SearchResultsController.js
    directives.js
    filters.js
services/
    CartService.js
    UserService.js
    AccountService.js

Continue reading Angular Seed +