3월, 2015의 게시물 표시

nodejs 소켓.io 사용 웹소켓 간단 구현

 var http = require('http');  var fs = require('fs');  var socketio = require('socket.io');  var server = http.createServer(function(request,response){      fs.readFile('ok.html',function(error,data){          response.writeHead(200,{'Content-Type':'text/html'});          response.end(data);      });  }).listen(3000, function(){      console.log('server running 3000 port!');  });  var io = socketio.listen(server);  io.sockets.on('connection', function(socket){      socket.on('message', function(data){         io.sockets.emit('message',data);          });  });

샤오미밴드 사용기( xiaomi band )

이미지
박스 개봉기! 1.박스개봉 2.박스 안 3. 충전중

nodejs 설치 방법 (리눅스)

nodejs 설치 방법 컴파일 툴 설치 1. Install Required Packages # yum groupinstall "Development Tools" # yum install screen   노드소스 다운로드 2. Download Node.js Source # cd /usr # wget http://nodejs.org/dist/v0.10.34/node-v0.10.34.tar.gz # tar xzf node-v0.10.34.tar.gz # cd node-v0.10.34 노드 컴파일 3. Extract and Compile Node.js # python2.7 ./configure # make install 노드 콤포넌트 설치 4. Configure Example Application using Express # npm -g install express # npm -g install supervisor # npm -g install forever

nodejs용 python 최신버전 인스톨

python 최신버전 인스톨 nodejs는 2.7버젼을 필요로 하지만 레드햇(센토스)버젼에는 2.4버젼에 인스톨되어 있습니다. 삭제는 불가능하므로 2.7버젼을 설치 방법입니다. 1. GCC컴파일러 설치. (설치가 되어 있지 않다면)     yum install gcc 2. cd /usr/src     wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz 3. 압축해제     tar xzf Python-2.7.8.tgz     cd Python-2.7.8     ./configure     make altinstall     "make altinstall is used to prevent replacing the default" -> 기본값이 대체되는 것을 방지     python binary file /usr/bin/python. -> 바이너리 파일 위치(확인) 4. 버젼확인     python2.7 -V

nodejs npm으로 package.json 만들기

npm에는 package.json을 생성해 주는 명령어가 존재 npm init 명령어. npm init 명령어를 사용하면 인터렉티브 프롬프트가 동작하면서 프로젝트에 대한 여러가지 정보를 입력할 수 있게 되고 그 정보를 기반으로 기본적인 package.json을 만들며, 기본적인 package.json은 위와 같이 만들 수 있지만 실제적으로 이 파일에서 의존성 라이브러리에 대한 정보를 관리해 주는 것이 좋다. 그러나 npm으로 모듈 설치시마다 package.json을 수정해 주는 것은 매우 귀찮음 그래서 설치시에 package.json의 dependencies 부분을 업데이트 해주는 옵션이 존재함. 그것이  npm install 모듈명 --save 로 모듈 설치시 --save라는 옵션을 붙혀주면 로컬에 모듈을 설치하면서 자동적으로 package.json을 업데이트 해 줍니다. package.json의 dependencies 부분을 업데이트 함.  내용펌 http://blog.outsider.ne.kr/674