Tuesday, December 17, 2013

Linux Console Output to File (both STDOUT&STDERR)

COMMAND
ls -l 2>&1 | tee output.txt

BASH
bash.sh 2>&1 | tee output.txt

2>&1 = direct both STDOUT & STDERR to the same place
| = pipe = sends command before into something after
tee = command line program that write console output (stdout) to console and to a file
output.txt = file name for STDOUT & STDERR

Post Specific to Ubuntu Linux

Monday, December 16, 2013

Node.js Console Output (STDOUT) to File

I solved by rewriting console.log function.  This was the quickest way to convert stdout object to a string without adding another module.

OUTPUT.JS
var fs = require('fs');
var sys = require('sys');
var exec = require('child_process').exec;
        
function puts(error, stdout, stderr){
    var oldWrite = process.stdout.write;
    process.stdout.write = function(d) {
        fs.writeFile('shellOutput.txt', d);
        oldWrite.apply(this, arguments);
    };
    console.log(stdout);
}

exec('ls -al', puts);

TEST
node output.js

Git Clone Develop Branch

git clone -b develop https://git@github.com/username/myproject.git

-b = branch
develop = my branch name

Wednesday, December 11, 2013

Node.js Forever Error Log

1. forever list



2. open logfile to see last error:

cd .forever/
cat QJb-.log (the .log file with most recent date)


POST SPECIFIC TO:
Node.js and Forever module crashing on Ubuntu 12.04

References

Tuesday, December 3, 2013

Add FAVICON to Website Tab

FAVICON = image in left corner of website tab of browser

1.  Favicon Generator

2.  Add this code inside <head> </head> of each HTML of website:

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">

Reference

Style Horizontal Line HTML, CSS


<hr style="color:red;background-color:red;height:1px;border:none;"/>


HTML <hr> = horizontal line
CSS style= Supports All Browsers