Categories
Snippets

Array.push()

In our review of Array.indexOf() we looked at using the check for -1 assigned to the indexOf() as an indication that that item was not part of the array. With Array.push() we can add items to the array.

Categories
Snippets

Array.indexOf()

Using the indexOf() call in javascript allows you to… Get the index of the Array item you pass across Check to see if an item exists within an Array If we have the following Array we can then pass that array into the indexOf() function to find the index values. I can check to see […]

Categories
Snippets

xvfb-run: error: Xvfb failed to start

When trying to run Sitespeed.io in two different terminals on the same server I received the error that Xvfb could not run. By adding -a as an argument it will automatically pick up another thread to run with instead of the default. do xvfb-run -a sitespeed.io

Categories
Snippets

List directory with file sizes on Linux (ubuntu)

du -sh * I wanted to be able to list ls the files and folders on the server to find out which ones were taking up the most disk space (as part of the sitespeed.io project i’ve been working on). This worked a treat.

Categories
Snippets

Restoring mySQL database from the file system MT

When you get a flat backup of your server the SQL is useless to you. Unless you’ve run SQL exports and backups your self you’re going to have to recover the databases from these flat unusable files. Fortunately there’s a tool in the Media Temple back end that allows for this. Simple connect to the […]

Categories
Snippets

Warning remote host identification has changed ssh

This was another fun error message that I received while putting back together my hacked server. This appears when trying to SSH into the Media Temple server through the Terminal Application on Mac OSX. The solution. You need to clear the key that already exists in your known host…. perl -p -i -e ‘s/^example.com.*n//;’ ~/.ssh/known_hosts […]