Friday, September 27, 2013

FileZilla: Add Amazon Server


PURPOSE:  To copy/transfer files between personal computer & amazon server.

1.  Download SSH Key (.pem) from Amazon Web Services

2.  FileZilla > Preferences > SFTP

  • Add keyfile...
  • Allow FileZila to convert .pem to .ppk



3.  File > Site Manager

  • Add Host IP & User
  • Protocol:  SFTP - SSH File Transfer Protocol


4.  Connect

Wednesday, September 25, 2013

Execute a Unix Shell Command in Node.js

var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) {sys.puts(stdout)}
exec("ls -la", puts);

STEPS
2 - create newFile.js
3 - copy in text above & save
4 - type shell command:  node newFile.js
5 - output of "command" inside of exec() will show in console

Wednesday, September 18, 2013

Wednesday, September 11, 2013

UnMount NFS Network File Share on Ubuntu

ERROR
sudo: unmount: command not found

SOLUTION
sudo umount 

...Umount...not...UNmount

Tuesday, September 10, 2013

Cloud9IDE node app Not Starting

ERROR in Cloud9IDE
throw er; // Unhandled 'error' event                                                                                                                                                
              ^ 
Error: you may be using the wrong PORT & HOST for your server app 
Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts. 

PROBLEM
Node app is running through another console session.  When attempting to start your new node app session, cloud9 errors about port/host.

SOLUTION 1:  Logout of Cloud9 Session through bottom Console twice

exit
exit

SOLUTION 2:  Find Node Process ID & Kill it

1. top to show processes
2. k to trigger Kill
3. Open up node app in another tab while watching for the node process to jump to top in top processes.  Mine was 23682 (your's will be different).
4. 23682
5. 15 to confirm killing
6. Go back to node directory & node app 

SOLUTION 3:  Find Node Process ID & Kill it
(this one's more difficult to find the node-openshift process)

netstat -lpn

find node process:
tcp        0      0 127.3.221.129:8080          0.0.0.0:*                   LISTEN      23682/node-openshif

kill -15 23682


FULL ERROR THAT CAUSED POST
events.js:72                                                                                                                                                                                
        throw er; // Unhandled 'error' event                                                                                                                                                
              ^                                                                                                                                                                             
                                                                                                                                                                                            
                                                                                                                                                                                            
 Cloud9  Error: you may be using the wrong PORT & HOST for your server app                                                                                                                  
         Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts. See also https://c9.io/site/blog/2013/05/can-i-use-cloud9-to-do-x/                      
Error: listen EADDRINUSE                                                                                                                                                                    
    at errnoException (net.js:906:11)                                                                                                                                                       
    at Server._listen2 (net.js:1044:14)                                                                                                                                                     
    at listen (net.js:1066:10)                                                                                                                                                              
    at Server.listen (net.js:1132:5)                                                                                                                                                        
    at Object. (/var/lib/stickshift/521509f54382ec067d000240/app-root/data/590355/platform/app.js:55:24)                                                                         
    at Module._compile (module.js:456:26)                                                                                                                                                   
    at Object.Module._extensions..js (module.js:474:10)                                                                                                                                     
    at Module.load (module.js:356:32)                                                                                                                                                       
    at Function.Module._load (module.js:312:12)                                                                                                                                             
    at Function.Module.runMain (module.js:497:10)       

Linux Set Timezone by Command Line: Ubuntu 12.04 Server


1.  FIND Timezone Identifier (example:  America/New_York)


tzselect

2.  SET Timezone: Type 2 Commands below

echo "America/New_York" | sudo tee /etc/timezone

sudo dpkg-reconfigure --frontend noninteractive tzdata

3.  TEST Timezone

date



Nodejs Javascript Set Date/Timezone

NODE CONSOLE

process.env.TZ = 'America/New_York';

Date()

Date.now() 
= system time in miliseconds since 1 Jan 1970 UTC

new Date().getHours();

JAVASCRIPT TIMESTAMP

Set timezone in function:
process.env.TZ = 'America/New_York';

ALTERNATIVE
Momentjs Node Module









Apache Internet User

www-data

www-data is the default user that asks apache questions for a webpage on your server

Find out yours by running 'top', accessing your website, then see which user uses apache2:




Tuesday, September 3, 2013

Install Apache onto Ubuntu 12.04 with 1 command

sudo apt-get install lamp-server^
remember the caret (^) at the end of the command

ERROR THAT CAUSED THIS POST (when I forgot ^)
sudo apt-get install lamp-server
Reading package lists... Done

Building dependency tree       

Reading state information... Done
E: Unable to locate package lamp-server

BACKGROUND
LAMP Server is a collection of open source software used to create a web server. The collection consists of:
  • Linux – the operating system
  • Apache – the web server
  • MySQL – the database system
  • PHP – the programming language