#Node - Testing with Mocha
http://visionmedia.github.com/mocha/
##Mocha
npm install mocha -g
Mocha looks for something called test or a directory called test
#Node - Testing with Mocha
http://visionmedia.github.com/mocha/
##Mocha
npm install mocha -g
Mocha looks for something called test or a directory called test
#Node - Memcached Basics
Memcached is an in memory key-value store.
Installing Memcached
apt-get install memcached
To check the version
#Node - Error Handling
##Uncaught Errors
var http = require('http');
http.createServer(function() {
throw new Error('This will be uncaught');
}).listen(3000);
#JavaScript - Regular Expressions (Regex)
Regular expressions are a language for describing patterns in string data. It is available in many languages including JavaScript.
Regular expressions are denoted by slashed (/) instead of quotes. ie /Hello/. Also Regular expressions are objects in JavaScript and have a number of methods including test which returns true or false if the pattern is found.
###Search Search return the index of the start of the text (like IndexOf), if it is found. Remember, the first location (ie h) is 0. An result of -1 indicates that the Regex was not found.
#Linux - Log File Monitoring
Logwatch is a really useful tool which normally runs as a cron
job which mails a summary of the log files to root. It shows a summary of software installed, repeated authentication failures from programs such as sshd and su.
For example running:
logwatch --detail med --range Today --format text --output stdout
#JavaScript - Observer Pattern An array of subscribers are just callback functions
var observer = {
#Linux Partitions The best time to partition is when you are doing a fresh install.
#Ubuntu - Installing Java
##Java 8 sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer
##To install the JDK
sudo apt-get install python-software-properties
#MongoDB - JavaScript
Since a query may return a large number of records which is too large for the client, the find
returns a cursor instead of the data. This cursor can be assigned to a variable.
var vendorCursor = db.vendors.find();
You can see the size of the cursor using:
vendorCursor.size();
You can check to see if there is more data after the current cursor point in the data set using:
#Node - Installing and Compiling Node.js
##Simple Install Ubuntu
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
##Compile and Install