How to update remote branch list on local machine?

Leave a comment Standard

I can never remember how do to this, lol. Probably because I don’t use it often enough but since I was looking for it today I thought I’d be nice and share.


(Update 2014-07-21:  As per feedback from commenters)

If you are sure that remote server repo contains more branches and they are not shown when you type

$ git branch -a


$ git branch -r

Then you have to update your remote list, by:

$ git remote update origin –prune

Assuming your remote is named as origin (This is true most of times).

View original post

Angular JS Tutorial: Difference between ng-hide and ng-if

Leave a comment Standard

It took me a while to even realize that there were two different ways toggle the display of HTML DOM elements with Angular JS — thank you Angular docs for not being nearly as helpful as you were when you had comments. Anyways (rant over), this is a really good thing to know because it will help you use the power of Angular to the fullest.

Ng-Show and Ng-Hide

These are use for when you want to toggle the visibility of a DOM element and that toggle can happen any number of times. This is like adding css styles for display. When ng-show is true the css display style is set to block/inline. When ng-show is false the css display style is set to none. Conversely if you use ng-hide instead when ng-hide is set to true display is none and when ng-hide is set to false display is block/inline. The DOM elements are always present no matter if the content is visible or not.

So, now for a good example using ng-show. Let’s say you only want to show a message to someone once they’ve entered their name:

<label for="nameInput">Enter Your Name:</label>
<input type="text" id="nameInput" ng-model="name" />

<div ng-show="name">
  <p>Hello {{name}}, it's nice to meet you!</p>

This also works using ng-hide, if there’s no name then we don’t want to show our greeting:

<label for="nameInput">Enter Your Name:</label>
<input type="text" id="nameInput" ng-model="name" />

<div ng-hide="!name">
  <p>Hello {{name}}, it's nice to meet you!</p>


So now let’s harness the power of Angular JS. If you have a DOM element that you ONLY want to display/hide once — like say when the page first or view first loads — then this is the option for you. Ng-If either adds or removes the DOM element from the DOM. When Ng-If is true then DOM element will be added to the document tree. When Ng-If is false the DOM element will be completely removed from the document tree. Why is this a good thing? This means your page will load faster because your document tree doesn’t have to render and then hide DOM elements that you’re never going to use.

Let’s pretend we have a data object like containing the first and last name of some famous people. We want to display this information in a table. However the data in our object comes from a query to a database — so we might not always have results to display. This is where Ng-If is really handy. Take a look at this example where if we have no results in our data object then our table HTML will be completely removed from the DOM — therefor making it faster — before angular renders the view:

<div ng-if="data.length > 0">
  <h4>Famous People</h4>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Phone Number</th>
    <tr ng-repeat="person in data">

11 Unconventional Tips for Improving your Programming Skills

Leave a comment Standard

Superheroes in Racecars


There are plenty of goodresources out there that teach the technical skills that are necessary for becoming a good programmer, but I’ve seen only a few that give you the more personal lessons that you often only learn through experience or trial and error. In this article, I’m going to share with you some of my own habits and skills that I’ve gained over the years to help me do better work.

This article is based on a post I made over a year ago on the UA CS Facebook Group in response to someone’s question about how you can become a faster programmer. Instead of posting about tools and keyboard shortcuts, most of my tips are about how to get yourself to think faster, along with a few tips for avoiding time-consuming mistakes.

View original post 3,796 more words

Node JS Tutorial: How To Create A Simple Server

Leave a comment Standard
node JS

This will allow you to quickly setup a working node server in just a few easy steps.

1. Install Node.js

For Windows/Linux
Go to and download the
latest version of node for the operating system you want to install it on.

Open node and test if it’s working by typing 2+2 and hitting enter.

For Mac OS X
Visit Homebrew and then open your
command line and run (If you’re prompted to install command line tools go ahead and do that). :

ruby -e "$(curl -fsSL"

When that’s done run you can make sure your install was successful by running:

brew doctor

Then it’s a good idea run this to make sure you have the most up to date copy:

brew update

Then install node by running:

brew install node

Test your install by opening a command line and typing this to see the node version:

node -v

2. Install NPM

This package will help you install lots of node related libraries. You can find out more
about it by visiting
Open a command line and type:

npn install express body-parser

If you get an error on Windows that says something along the lines of

Error: ENOENT, stat...

This means the NPM directory is missing from your filesystem. Navigate to where NPM should be as displayed by the error message and create an empty folder called npm.

3. Create These Simple Server Files

First let’s make our index.html. This should go in the directory you want to serve this index file from. So on a server it would be something along the lines of htdocs/public_html/directory/ or var/www/html and on your local computer it should be whatever directory you did your npm install.

Create the index.html file:

<html ng-app="app">
    <title>My First Node Server File</title>
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="css/stylesheet.css">
  <body ng-controller="appCtrl">
    <div class="page-header">
        <i class="glyphicon glyphicon-certificate"></i>
    <section>You have successfully created your first HTML5 node server.</section>
    <a href="" target="_blank">Tutorials by, LLC</a>

Now let’s create the server.js file:

'use strict';

// Importing express and body parser libraries
var express = require('express');
var bodyParser = require('body-parser');

//this is a built in node library that handles the file system
var fs = require('fs');

* Server configs

* The port to run your node server on
* If you're running this on a web server this should be 80
* If you're running this locally try 8080 or 9080
var BASE_PORT = 8080;

* The root directory of your files
* By default it uses the current folder this file is in
var ROOT_DIR = __dirname + '/';
ROOT_DIR = fs.realpathSync(ROOT_DIR);
if (!fs.existsSync(ROOT_DIR)) {
	console.log('Error: cannot find working directory: ' + ROOT_DIR);

* Create an instance of express
var app = express();

 * Adds a simple logging, "mounted" on the root path.
 * Using Express middleware
app.use(function(req, res, next) {
	console.log('%s %s', req.method, req.url);

 * Allows us to parse http body parameters as json


app.listen(BASE_PORT, function() {
	console.log('Node server started @ http://localhost:' + BASE_PORT);
	console.log('Serving static files from ' + ROOT_DIR);
	console.log('Press Ctrl + c for server termination');

4. Start the Server

Go to the directory you installed npm in and that your index.html and server.js file reside. This is where you want to start the node server. In the console type:

node server.js

Now open your browser. If you installed node on a server then navigate to your index page on your website. You should see your new node js index file. If you’re running the node server on your local machine then type in http://localhost:BASE_PORT and replace BASE_PORT with the port number you configured in the server.js file. You’ll see your index file in your browser.

Congrats! You’ve successfully create your first node server.

Error FIX: Ubuntu LAMP server won’t display flash applets

Comment 1 Standard

If you’re using a Ubuntu LAMP server and you find that your flash applets aren’t being served by your server even if you go directly to the file location then you’ve run into the same problem I did. This happens when apache doesn’t recognize the mime type of the file.

The Solution

Edit your mime.conf file. If you’re using apache2 it will be:

vi /etc/apache2/mods-enabled/mime.conf

Add the following line under the other uncommented out mime types and save your changes:

AddType application/x-shockwave-flash .swf

Make sure you restart apache when you’re done:

service apache2 restart