How to Start a Business For Free

So your New Year’s Resolution was to get your amazing idea off the ground. This is the year you’re going to get your first paying customer! That’s a great idea! Here’s how to start a business for FREE!

For the sake of this post, to start a business means that your idea has been validated enough to start acquiring users. A common misconception is that an idea is so great that it should be developed from A to Z immediately. That is typically a one way ticket to failure. 

In order to show you how to start a business we will need the following:

  • Some keyword research
  • A landing page or pages explaining idea
  • Populate an email list of interested users

Keyword Research

Google’s own keyword planner is pretty great at determining the phrases that are searched for most and how competitive they are. You’ll want to find a phrase that gets a good number of searches, but have low to medium competition.

Example of Google keyword planning to show you how to start a startup
Example of Google keyword planning to show you how to start a business

In the example above, you can see that targeting “mobile dog wash” instead of “mobile pet wash” would give better results.

There is also a free chrome extension called Keyword Surfer that will give information related to Google searches. Using this tool, you can compare your target search terms to other search terms and adjust your strategy as needed.

Create Landing Pages & Acquire Users

You know what people are looking for, now it’s time to put your idea out there. There are quite a few landing page tools out there. Most offer free trials for a limited amount of time. For our target price point (free), we want to find tools that are free indefinitely until we outgrow them.

These tools should give you the ability to create a landing page using some sort of web editor and give you a link that is not only shareable, but indexable by search engines.

Additionally, these tools allow you to acquire users using the built-in email capture tools.

Once you have these tools implemented, you are on your way! Additionally, you could hook up Google Analytics and Search Console and see how your landing pages perform. If they aren’t doing do well, refine your keywords and see what sticks. Good luck!

Vertical alignment and 100% height with Flexbox & CSS3

Before flexbox, in old days of yore (i.e. 2007), getting something to vertically align within an element or have a particular element span the remaining percent of a layout was quite the task. It involved various hacks that may or may not have worked with specific versions of specific browsers of that time period. Using flexbox and CSS3, this can be achieved in just about 2 lines of CSS.

These days, there is a glorious savior: Flexbox!

Flexbox is mostly a fancy name for using the CSS display: flex. Once you slap this on one of your elements, a container div for example, the CSS3 gloves are off!

Let’s solve our vertical alignment issue first. In this sample, we will have a left menu that has a top, middle and bottom. We want the middle to take up the space of what the top and bottom do not.

.flex-container {
 display: flex;
 flex-direction: column;
 width: 100%;
 height: 100%;
}

.flex-grow {
 flex-grow: 1;
}

<div class="flex-container">
  <div class="flex-col">top</div>
  <div class="flex-col flex-grow">middle</div>
  <div class="flex-col">bottom</div>
</div>

The majority of the work is actually done by the flexbox container. Using flexbox allows the element to use the CSS flex-direction: column. By assigning the middle child div element to the have the CSS flex-grow: 1, it will automatically take up the remaining space!

Next, we conquer vertical alignment within elements. Using the same HTML from above, we can apply similar CSS. This time we are going for a flex-direction: row look.

.flex-container {
 display: flex;
 flex-direction: row;
 width: 100%;
 height: 25%;
}

.flex-grow {
 flex-grow: 1;
}

.flex-col {
  display: flex;
  align-items: center;
  justify-content: center;
}

<div class="flex-container">
  <div class="flex-col flex-grow">left</div>
  <div class="flex-col">middle</div>
  <div class="flex-col">right</div>
</div>

With this example, we assign display: flex to both the container and the child elements. Then we add the 1-2 punch of align-items: center and justify-content: center to align our hypothetical nav items both vertically and horizontally.

You’ll also notice that we snuck in some flex-grow goodness in there to not worry about the width of our middle and right items.

Consuming APIs with AngularJS 1.x

Consuming APIs allows you to retrieve data from a particular service. This service can be one that you made or something publicly available. Previously, we made an API to call our own. This post will show you how to create a front-end to consume that API!

Our front-end will focus on a single collection called Locations. We will have a map that plots our locations, a page to edit/delete a single location, and a page to create a new location.

This post will focus on creating the map page. Our flow will consist of loading the page, retrieving a list of locations from our API and populating a list will eventually link to a page to update/delete them.

Let’s start setting up our project! Our layout will be handled via Bootstrap. To manage our front-end dependencies, we will us Bower. To install Bower, open a command line and type

npm install -g bower

Once Bower is installed, you can then install Bootstrap and AngularJS by typing:

bower install bootstrap --save
bower install angular --save

At the time of this writing, this will install AngularJS 1.6.2 and Boostrap 3.3.7 into a www directory. These should do just fine for our particular project.

Within that www directory, you’ll want to create a blank HTML template with our Bootstrap and AngularJS files named index.html

<html>
<head>
 <!-- jQuery -->
 <script src="lib/jquery/dist/jquery.js"></script>

 <!-- Angular 1.6.2 -->
 <script src="lib/angular/angular.js"></script>

 <!-- Boostrap 3.3.7 -->
 <link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css">
 <script src="lib/bootstrap/dist/js/bootstrap.min.js"></script>

 <script src="js/app.js"></script>
</head>

<body ng-app="LocationApp">
 
 <div ng-controller="LocationCtrl" class="container">
 
  <div class="row" ng-repeat="location in locations">
   <div class="col-md-3">{{location.name}}</div>
   <div class="col-md-4">{{location.description}}</div>
  </div>
 </div>
</body>
</html>

Our last piece to setup will be our app.js file. This will contain the reference to our app (LocationApp) and our first controller (LocationCtrl).

(function () {
  'use strict';

  angular.module('LocationApp', [])
   .controller('LocationCtrl', function($scope, $http) {
    // Using Angular's $http module, we can retrieve the Location results
    $http.get('http://www.yourapi.com/locations')
     .then(function(result) {
      // Once the data is retrieved, set it to $scope.locations. This variable directly relates to the locations variable in the ng-repeat in the html
      $scope.locations = result.data;
     });
   });
}());

That is all that is needed to pull data from an API and display it on the front-end of your choosing. This practice can be used with public APIs as well. For example, you can use the OpenWeather API.

Finishing up your Mongo/Node API!

You’ve created your Node API, gave it some basic functionality and now you’re going to add the ability to Update and Delete records in your MongoDB collection.

Adding the Update functionality to your Node API

An Update request is handled via the HTTP method PUT and is typically passed some data with an id to update a document in your collection. Depending on how sensitive the collection is, you would want to add validation to prevent users from updating records by passing in random ids.

	server.route({
		method: 'PUT',
		path:'/locations',
		handler: function (request, reply) {
			var locationId = request.payload.id;

			Location.findByIdAndUpdate(locationId, request.payload, function(err, location) {
				if (err) {
					return reply(err);
				} else {
					return reply(location);
				}
			});
		}
	});

Adding the Delete functionality to your Node API

Similar to Update, the Delete functionality is given an id to a document or some data to retrieve a document.

	server.route({
		method: 'DELETE',
		path:'/locations',
		handler: function (request, reply) {
			var locationId = request.payload.id;

			Location.findByIdAndDelete(locationId, function(err, location) {
				if (err) {
					return reply(err);
				} else {
					return reply(location);
				}
			});
		}
	});

In summary, your Node API should now be capable of doing the following when using the corresponding HTTP methods

  • POST – Create a document / Requires a payload containing document data
  • PUT – Update a document / Requires a payload containing document id and document data
  • GET – Get document list / No payload required
  • DELETE – Delete a document / Required a payload containing document id

With these two methods added, you have a Node API that can handle just about everything required from an API! To extend this functionality to other collections, you could simply copy/paste and substitute the collection name as needed. While that would certainly work, it wouldn’t be best practice.

Next we will focus on making sure your API is laid out in a manner that is easy to read, add functionality, test, etc.

Expand your Mongo/Node API in 10 more minutes!

Previously we spent 10 minutes setting up a barebones Node API using Mongo and Node. Now we are going to invest 10 more minutes to add Create and Read Mongo functionality. These are known as the C and R of CRUD functionality.

Begin the Node API expanding!

Install Mongoose

npm install mongoose

Mongoose is a ORM the bridge between our Node API and Mongo. Mongoose allows you to create models via Node and associate them with your Mongo collections.

Create a Model

A model is a representation of your Mongo collection. In our case, we are going to have a Locations collection consisting of a latitude, longitude, and created fields.

Your directory structure should look similar to this:

models
- Location.js
node_modules
index.js
package.json
Procfile

Create the following Location.js file in a models directory

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var LocationSchema = new Schema({
  name: { type: String, required: true },
  description: { type: String },
  lat: { type: String, required: true },
  lng: { type: String, required: true },
  created: { type: Date, required: true, default: Date.now }
});

module.exports = mongoose.model('Location', LocationSchema);

Update index.js to include new routes

Our server needs to know when to read our Locations or create a Location when you access a specific URL with a given server method. The server methods we will be working with are GET and POST.

const Hapi = require('hapi');
const Mongoose = require('mongoose');

const Location = require('./models/Location');

// Create a server with a host and port
const server = new Hapi.Server();

var mongoUri = process.env.MONGODB_URI || 'mongodb://YOUR_MONGO_URI';
var serverPort = process.env.PORT || 8080;

Mongoose.connect(mongoUri, function(err) {
	if (err) {
		console.log(err);
		process.exit(1);
	}

	server.connection({
		port: serverPort
	});

	// GET locations route
	server.route({
		method: 'GET',
		path:'/locations',
		handler: function (request, reply) {
			// Retrieve all locations
			Location.find({}, function(err, locations) {
				return reply(locations);
			});
		}
	});

	// POST locations route
	server.route({
		method: 'POST',
		path:'/locations',
		handler: function (request, reply) {
			// Make a new location
			var location = new Location();

			// Assign the new location fields to the values from our POST
			location.name = request.payload.name;
			location.description = request.payload.description;
			location.lat = request.payload.lat;
			location.lng = request.payload.lng;

			location.save(function(err, location) {
				if (err) {
					return reply(err);
				} else {
					Location.find({}, function(err, locations) {
						console.log(locations);
					});
					return reply(location);
				}
			});
		}
	});

	// Start the server
	server.start((err) => {

		if (err) {
			throw err;
		}
		console.log('Server running at:', server.info.uri);
	});
});

To explain in detail, your Node API will respond different depending on how you access it. When you to tell your Node API to GET /locations via http://yourapi:8080/locations then you should be presented with a list of Locations from your Mongo database.

When you access your Node API via a POST request to http://yourapi:8080/locations and provide it with some data, your Node API should respond by inserting provided data into your Mongo database.

That’s it! You now have the ability to retrieve and create new records. Further enhancements could be to add validation to your POST request to ensure things don’t go haywire with bogus data or even add the ability to update (via PUT) or delete (via DELETE) your records.

Create a Mongo/Node API in 10 minutes!

Using Heroku, you can get the barebones of a Node/Mongo API in just under 10 minutes!

    Prerequisites

  • A registered Heroku account
  • Install Heroku CLI
  • Access to your Heroku dashboard
  • Step 1 – Create and navigate to project directory

    Wherever you want your project to be. Perhaps c:\My Cool Things\API or /Users/hank/projects/api-project.

    Step 1 – Create Heroku app

    From the command line of your choice, from your project directory:

    $ heroku create

    You’ll be presented with a nifty server name. Something like falling-wind-1234 or similarly zen-like.

    Step 2 – Create app structure

    For a barebones API you’ll need just just 3 basic things.

    2a – Procfile
    Needed for Heroku to run the app. The contents of this file is just one line for now.

    web: node index.js

    2b – package.js
    This manages your node packages and will be managed automatically via your

    $ npm install

    commands you make later.

    Type

    $ npm init

    and hit enter through all of the prompts. The default values will be fine for now.

    2c – index.js
    The starting point of your app will start and connect to your mongo/node server. We will create this in Step 4!

    Step 3 – Install dependencies

    Since this is a barebone API, we will have just 3 dependencies: mongodb and hapijs

    Back at the command line, type

    $ npm install mongodb --save
    $ npm install hapijs --save
    $ npm install mongoose --save

    Step 4 – Create index.js

    const Hapi = require('hapi');
    const Mongoose = require('mongoose');
    
    // Create a server with a host and port
    const server = new Hapi.Server();
    
    var mongoUri = process.env.MONGODB_URI || 'mongodb://YOUR_MONGO_URI';
    var serverPort = process.env.PORT || 8080;
    
    Mongoose.connect(mongoUri, function(err) {
    	if (err) {
    		console.log(err);
    		process.exit(1);
    	}
    
    	server.connection({
    		port: serverPort
    	});
    
    	// GET locations route
    	server.route({
    		method: 'GET',
    		path:'/hello',
    		handler: function (request, reply) {
    			return reply("Hello, this is my API");
    		}
    	});
    
    	// Start the server
    	server.start((err) => {
    
    		if (err) {
    			throw err;
    		}
    		console.log('Server running at:', server.info.uri);
    	});
    });
    
    

    Step 5 – Deploy!

    To send it up to your Heroku app, type

    $ git commit -am "My 10 minute API!"
    $ git push heroku

    After the app is built, you can navigate to your Heroku app url (for example, https://guarded-bear-24888.herokuapp.com/) and see the results!

    Using our example, navigating to just the base url will produce a 404, but a valid response nonetheless! If you navigate to the base url followed by /hello, you should get our hello world response.

    Next steps for your newly minted API could be to create some routes that interact with your mongo instance, make some hapijs views or publish your code to your personal github repo.

Google Web Toolkit (GWT) using Eclipse

GWT is Google’s open source set of tools to develop and debug ajax enabled web applications. GWT applications are written in Java and then compiled into Javascript.

The following article shows how to compile and deploy the sample GWT project in Eclipse 4.3/4.4 and can be downloaded here. For the sake of keeping this relevant to a broader group, I will be assuming basic level Java and Eclipse experience.

1. Setting Up Your Environment

There are a few Eclipse SDKs and browser plugins you’ll need to install in order to start developing GWT applications. To do this, navigate to Help > Install New Software. Depending on your version of Eclipse, you’ll need to enter the following into the “Work with:” dropdown:

4.3 – https://dl.google.com/eclipse/plugin/4.3
4.4 – https://dl.google.com/eclipse/plugin/4.4

You’ll want to check Google Plugin for Eclipse and SDKs to install the corresponding plugin/sdk for your Eclipse version.

2. Create Your Web Application

Once your environment is setup, you can birth your new GWT project. In Eclipse, navigate to File > New > Other. You’ll be prompted with a New Project Wizard. Expand the Google folder and select Web Application Project.

Enter a name for your project. For this example, I chose DemoApp.

Next, you’ll enter a Package. I chose com.demo.demoapp. This determines your folder structure in the src folder of your project. In this example, the folder structure would be /src/com/demo/demoapp.

Uncheck Generate project sample code. The sample code provides a very nice starting point, but does include some fairly advanced Java code (interfaces, implementations, etc). I would recommend checking out the sample code provided once you have a firm grasp of how GWT operates.

All other settings should be correct as default. Location determines which Eclipse workspace to use. Google Web Toolkit and Google App Engine under Google SDKs allows you to specify a particular version of each.

If you are deploying to Google App Engine and have already setup your Application ID, you can enter it here. Otherwise, you can leave this blank for now. It will be touched on later in this article.

3. Project Source

A GWT application can be separated into 2 parts, Server and Client. Technically, it could be separated into 2.5 parts if you count code that is used for the server and client (shared), but for the sake of brevity, we’ll focus on the 2 distinct parts.

Your server code can be found in your package directory. Using the settings from above, this example’s server code can be found at /src/com/demo/demoapp.

By the time you finish this section your project directory structure should look similar to this:

/src
--/com
----/demo
------/demoapp
--------DemoApp.gwt.xml
--------/client
----------DemoApp.java
--------/server
--------/shared
/war
--DemoApp.html

Create a folder for each area of your code. Within the /src/com/demo/demoapp folder, I created a server and client folder. For code that would be used by both, a shared folder would be useful, but we wont be putting anything in that in this example.

Create your Entry Point Class

The main entry point for the client side of things is within the file named after your project, DemoApp.java. In this example, I created this file in the client directory. This class implements the EntryPoint class. Within this Java class, we will create the method onModuleLoad(). Upon loading, this method is called automatically. In this example, we will use this entry point to create our user interface and event handlers.

Here is our entry point in full:

package com.demo.demoapp.client;

import com.google.gwt.core.client.EntryPoint;

public class DemoApp implements EntryPoint {
    public void onModuleLoad() {
    }
}

Create your Module XML

Next we will need to create a Module XML file detailing some things about our project. This will be named DemoApp.gwt.xml and it is placed in your package directory (/src/com/demo/demoapp). Obviously, DemoApp would be named after whatever your project name is. Here are the contents of our simple Module XML file. The parts relevant to your project have been marked in bold.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.0//EN"
 "http://google-web-toolkit.googlecode.com/svn/tags/2.6.0/distro-source/core/src/gwt-module.dtd">

<module rename-to='demoapp'>
 <!-- Inherit the core Web Toolkit stuff. -->
 <inherits name='com.google.gwt.user.User'/>

 <entry-point class='com.demo.demoapp.client.DemoApp'/>

 <!-- Specify the paths for translatable code -->
 <source path='client'/>
 <source path='shared'/>
</module>

Create your HTML Host Page

Our last step is to create a frontend to connect our fancy Java EntryPoint class to. These are called HTML Host Pages. These sound fancier than they really are. An HTML Host Page consists mostly of basic HTML. It can have references to your stylesheets, scripts, etc.

To start creating HTML Host Pages, you will need to create a war directory at the root of your project. Not in your package. This is where you would keep your static resources (scripts, css, etc). GWT also stores it’s compiled static resources here as well in a subfolder named after your project. For example, /war/demoapp.

For our very basic HTML Host Page, we will use the following:

<!doctype html>

<html>
  <head>
    <script type="text/javascript" language="javascript" src="demoapp/demoapp.nocache.js"></script>
  </head>

  <body>
    <div id="demoapp_main"></div>
  </body>
</html>

The most important thing to notice is that we are referencing the script myapp/myapp.nocache.js. This file will be created when we compile our project.

You could compile your project with just the entry point class and module XML before creating your host pages, but for the sake of keeping things in order, I explain the compile process after you master the ancient art of the HTML Host Page.

The next point of interest is the div with the id of demoapp_main. Going back to our entry point class, we can reference elements in our host page using their ID attribute.

Our new entry point class could look like this. New code has been highlighted in bold.

package com.demo.demoapp.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;

public class DemoApp implements EntryPoint {

	public void onModuleLoad() {
		final Button btn = new Button("Demo Button");
		RootPanel.get("demoapp_main").add(btn);
	}
}

All we are doing here is creating an instance of a button and adding it to our demoapp_main div from our HTML host page and attaching a click event to it.

We are now ready to compile and deploy.

4. Compile

To compile a GWT application in Eclipse, you right click on your project name and select Google > GWT Compile. You’ll be presented with the option to set a specific log level and the option to change the output style of the compiled Javascript. For now, leave these as default.

If you ever need to add compiler/VM arguments, you can expand the Advanced section and enter them there.

If any changes are made to any of your package code, you will need to compile your project again.

5. Deploy

Deploying locally to debug
To debug locally, you click on Run > Debug As > Web Application. If this is your first time viewing a GWT application locally, you will be prompted to download the GWT plugin.

At the time of writing, the plugin doesn’t seem to support Firefox versions higher than 26. Unfortunately, my Firefox was version 34 so I had to resort to Chrome.

Deploying to Google App Engine

If you are setup to use Google App Engine, you can deploy directly to it using an Application ID that has been setup in your Google App Engine console.

To set your project up to deploy to Google App Engine, right click on your project name and navigate to Google > App Engine Settings and enter your Application ID under Deployment. Hit Ok and right click on your project name and navigate to Google > Deploy to App Engine. Your project should then open up as the address app.appspot.com.

Upload to Host

If you want to deploy to your own server, simply upload the contents of the /war folder to your host of choice.

Getting Started: meteor.js

Introduction

meteor.js is a library that allows you to make real-time web applications from start to finish without any other supporting libraries or tools. When you install meteor.js, you get everything you need to develop both the client and server side of your application. That’s quite a big deal in this age of being faced with having to cherry pick from the many client/server-side technologies available today for your application.

The downside to using meteor.js is that it requires a server to be running the meteor process. So if you have any sort of VPS (Virtual Private Server) hosting (HostMonster, DreamHost, etc), then you may need to build your meteor app elsewhere.

For the sake of this post, we will be deploying to meteor’s free development hosting option.

Installing

From your terminal of choice (mac, SSH, etc), simply install meteor.js via curl like so:

curl https://install.meteor.com/ | sh

For windows, you can download the installer https://www.meteor.com/install. If you are doing this in a shared environment, such as a site on HostMonster, you’ll end up with a warning message with a few options.

Couldn't write the launcher script. Please either:

(1) Run the following as root:
cp "{Environment Specific Path}/.meteor/packages/meteor-tool/1.0.35/meteor-tool-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
(2) Add "$HOME/.meteor" to your path, or
(3) Rerun this command to try again.

Typically, due to not having root access, your best bet is #2. Note: the areas bolded above may be different in your environment. Adjust accordingly. To do this, type this in your terminal window:

PATH=$PATH:$HOME/.meteor

You can test this right away by typing meteor in your terminal. If you were successful, it will give you a warning about not being in a project directory. This only changes the path for this particular terminal session. If you want to make it more permanent, you can edit your .bashrc file. My .bashrc file is located at ~/.bashrc and look something like this after adding the meteor path to it.

alias php="php-cli"
export HPATH=$HOME
export PATH=$PATH:$HPATH/.meteor

Deploy Your First meteor.js Application

Navigate to the directory you want to create your first meteor.js application. In my case, I created a subfolder in my public_html directory. Once there, create your first app:

meteor create project-name

meteor.js will do it’s thing and after a few seconds, your barebones meteor app will be ready to go. By default, meteor will create a build directory (.meteor), and html, css, and js files. Depending on your meteor version you may get slightly different contents in your html/js.

At this point you can deploy your project to meteor’s free hosting by typing

meteor deploy project-name.meteor.com

and after a few prompts, your project will be visible at http://project-name.meteor.com.

Applying Some meteor.js Fundamentals

Once you’re done basking in the glory of your first published meteor app, we will start poking at the html/js files. In your html file, you will see an example of meteor’s template structure.

<body>
  {{> hello}}
</body>

<template name="hello">
  <h1>Hello World!</h1>
  {{greeting}}
  <input type="button" value="Click" />
</template>

{{> hello}} will output the contents of everything inside of <template name="hello"></template>. Inside the hello template that there is a template variable named greeting. This corresponds to some code in the project-name.js file.

if (Meteor.isClient) {
Template.hello.greeting = function () {
return "Welcome to demo.";
};
...
}

You can have regular javascript variables, but in order to make it a template variable it can be created a variety of ways.

Template.hello.greeting = function() {
return 'This is a greeting';
}

//-- standard javascript variable
var foo = 'This is foo.';
//-- ..turned template variable
Template.hello.foo = function() {
return foo;
}

Template.hello.sum = function() {
a  = 2;
b = 2;
c = (a + b);
return c;
}

One of the most efficient ways is to create template variables via helpers.

Template.hello.helpers({
list: [{'label': 'One'    }, {'label': 'Two'}, {'label': 'Three'}],
sum: function() {
return (2+2);
}
});

Once we have some template variables defined, we can output them in our template. Depending on the kind of variable, we can do this a few ways. Using our example variables above, our modified template could look like this;

<template name="hello">
<h1>{{greeting}}</h1>
<ul>
{{#each list}}
<li>{{label}}</li>
{{/each}}
</ul>
<h3>{{sum}}</h3>
<p>{{foo}}</p>
</template>

Since list is an array of objects, we can use meteor’s {{#each}} to iterate through it and output each item’s properties.

Now you have the basics of meteor.js down. Keep in mind that meteor.js excels at real-time applications. Chat rooms, messaging, anything the could benefit from live data. As web applications start to mature past the already robust features of AJAX/REST driven development, meteor.js could be one of the key players in the next stack of web development.

Tinkering with Dreamhost

So you have an old Dreamhost hosting account that’s been sitting around for a few years and you need to put some fancy new web tech on it via SSH. Perhaps you want to install Laravel! If only there was an article that could get you up and running with Laravel!

Laravel requires PHP 5.4. Once you are SSH’d into your account you should run a php -v to see what version you have. I was actually running 5.2. Not good.

For your Dreamhost account, your PHP installations are located at /usr/local/. For my particular server, I had /php5, /php53, and /php54. In order for the latest version of PHP to run when I use the php command, I will need to map the alias via alias php='/usr/local/php54/bin/php'.

For my scenario, I was actually trying to get Laravel 4 up and running and not only was my php alias out of date, but I was missing the phar extension required by Composer. To remedy this in Dreamhost, you need to create ~/.php/5.4/phprc file and put the line extension = phar.so. To verify what extensions/modules are loaded, you can do php -m to see a list.

Note: This post covers upgrading the php version that is used when you are logged into your Dreamhost account via SSH. To change the version that your server actually runs, you would go to Manage Account , scroll down to Domains Hosted and click the Edit button next to the domain you wish to upgrade. You’ll find your available PHP options under Web Options > PHP Mode.

Quickstart: Bootstrap

Impress your friends when you show them a page that looks fantastic across any and all devices and screens! Start the timer! You’ll be a maker of responsive pages in 15 minutes!

1. Get Bootstrap & jQuery

For Bootstrap, you can either download it and include it or use the code below to pull it from Bootstrap’s CDN buddy, MaxCDN.

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">


<!-- Optional theme -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">


<!-- Latest compiled and minified JavaScript -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

Same story with jQuery. You can use Google’s hosted library or download your own copy. Here is the Google option:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

2. Create an HTML grid layout

Your page must use the HTML5 doctype so make sure it uses the same doctype listed below.

<!DOCTYPE html>
<html>
... jQuery/Bootstrap scripts/css from above...
<body>
<!-- responsive layout -->
</body>
</html>

Responsive frameworks usually work within some sort of grid. For Bootstrap, your layout is separated into 12 %-based columns equaling 100% of the container. You can divvy up your content however you see fit within those columns via the different column css classes.

There are 3 main column classes. There is .col-sm-n for 768px and up, .col.md-n for 992px and up, and .col.lg-n for 1200px and up. Keep in mind, in the class names above, n is the number of columns. So .col-sm-3, .col-md-8, .col-lg-4 are all valid examples.

You can apply multiple column classes to get different layouts based on the width of the screen. To use the same layout across the board, you would use one of the lowest column classes, .col-sm-n.

For example, if you want your layout to have a left nav that takes up 3 columns and the rest of the content to take the remaining 9 columns. 9 + 3 = 12.

<div class="container">
<div class="row">
<div class="col-sm-3">Left Content</div>
<div class="col-sm-9">Right Content</div>
</div>
</div>

If you want the left content and right content to both take up the width of the screen that is 992px or less (.col-sm-n), but maintain the 3 and 9 column layout for anything above (.col-md-n and .col-lg-n).

<div class="container">
<div class="row">
<div class="col-md-3">Left Content</div>
<div class="col-md-9">Right Content</div>
</div>
</div>