Code Lab

Some code examples.


Running Multiple Vagrant Installs with PUPHPET

By Andre Gagnon  

When using PUPHET vagrant machines running on VirtualBox, there’s a problem when one tries to run a multiple, simultaneous vagrant installs right out of the box:

Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 2222 is already in use on the host machine.

To fix this, modify your current projects Vagrantfile to use another port. Example, where '1234' would be replaced by a unique host port: :forwarded_port, guest: 22, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this case, Vagrant was unable to. This is usually because the guest machine is in a state which doesn't allow modifying port forwarding.

Despite what this message says, you can fix the problem by running the command:

vagrant reload
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 10200.

This command reconfigures a new SSH Host Port, which fixes the conflict.   This can be verified in VirtualBox | Settings | Network | Port Forwarding.  This worked on the following system: Max OSX, Vagrant V1.7.2

Gettting Google Maps Javascript API V3 to Run on Bootstrap 3.0 Website

Gettting Google Maps Javascript API V3 to Run on Bootstrap 3.0

By Andre Gagnon  

Getting a full-screen Google map to run on Bootstrap was a bit tricky.  Bootstrap 3.0 is a useful CSS framework with standard interface components, cross-browser compatibility, and built-in mobile responsive CSS media queries. Getting a full screen Google Maps Javascript API V3 to work with this framework requires a little bit of unique CSS. The standard javascript to display a Google map can be found at the Google API site.