'Programming'에 해당되는 글 1789건

  1. 2018.09.04 node.js + AJAX 테스트
  2. 2018.09.04 node.js CORS
  3. 2018.09.03 node.js와 웹소켓
  4. 2018.09.03 jquey ajax 테스트 4
  5. 2018.08.30 jquery 복수 속성 선택하기
  6. 2018.08.30 li 글자 수직정렬하기
  7. 2018.08.29 node.js 와 v8
  8. 2018.08.29 node.js odroid
  9. 2018.08.29 user agent stylesheet
  10. 2018.08.28 div min-width 4
Programming/node.js2018. 9. 4. 11:27

해보니 1초 정도 늦게 나오는거 봐서는 cpu사용율 샘플링 시간을 1초 정도로 잡고 있는 것으로 보인다.


var os = require('os-utils');


os.cpuUsage(function(v){

    console.log( 'CPU Usage (%): ' + v );

}); 


[링크 : https://github.com/oscmejia/os-utils]

[링크 : https://stackoverflow.com/questions/36816181/get-view-memory-cpu-usage-via-nodejs]



<script type="text/javascript">

$(document).ready(function()

{

var sys = {};

$.ajax(

{

url:'http://localhost:3000/sys',

type:'get',

success:function(data)

{

$('#result').text(data.mem);

}

})

});

</script>

<div id="result">blah blah</div>



머. 이로서(?) ajax + node.js 까지 끝(?!)


[링크 : https://opentutorials.org/course/1375/6851]

'Programming > node.js' 카테고리의 다른 글

npm package.json  (0) 2018.09.05
nodaemon  (0) 2018.09.04
node.js CORS  (0) 2018.09.04
node.js와 웹소켓  (0) 2018.09.03
node.js 와 v8  (0) 2018.08.29
Posted by 구차니
Programming/node.js2018. 9. 4. 11:21

Cross Origin Resource Sharing

다른 도메인의 자원을 공유하는 것으로


RESTful API의 사용으로 웹서버와 REST 서버가 분리됨으로 인해

웹 브라우저에서 크로스 사이트에 대한 보안 정책에 위배되어 접근이 불가능한 것을 우회해주는 설정

(생각해보면 iframe에서 다른 도메인꺼 넣으면 안되던것의 연장선?)


node.js에서 헤더 설정

[링크 : http://guswnsxodlf.github.io/enable-CORS-on-express]


CORS 크롬 플러그인

[링크 : https://chrome.google.com/webstore/detail/allow-control-allow-origi/n.../related?hl=ko]

'Programming > node.js' 카테고리의 다른 글

nodaemon  (0) 2018.09.04
node.js + AJAX 테스트  (0) 2018.09.04
node.js와 웹소켓  (0) 2018.09.03
node.js 와 v8  (0) 2018.08.29
node.js odroid  (0) 2018.08.29
Posted by 구차니
Programming/node.js2018. 9. 3. 17:29

polling 보다는 interrupt가 낫듯(?)

ajax 단기간 빠른 polling 대신 웹소켓 검색



[링크 : https://poiemaweb.com/nodejs-socketio] node.js + socket.io

[링크 : https://www.a-mean-blog.com/ko/blog/단편강좌/_/Node-JS-Socket-io-채팅사이트-만들기]


[링크 : http://html5korea.com/웹소켓websocket-시작하기강의번역/] php 기반

'Programming > node.js' 카테고리의 다른 글

node.js + AJAX 테스트  (0) 2018.09.04
node.js CORS  (0) 2018.09.04
node.js 와 v8  (0) 2018.08.29
node.js odroid  (0) 2018.08.29
node.js refresh  (0) 2018.08.17
Posted by 구차니

가장 만만한 예제로 하는 중

일단.. jqeury를 통해서 load하는거나 다름없긴 하지만

ajax를 통해서 페이지를 불러오는 식으로 일단은 구현



<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<link rel="stylesheet" href="css/style.css">

<script src="js/jquery-3.2.1.min.js"></script>

</head>

<body>

<div id="whole">

<div class="top" id="header"></div>

<div class="content center" id="content"></div>

</div>


<script type="text/javascript">

$(document).ready(function()

{

$.ajax(

{

url:'./pagelet/login.html',

success:function(data)

{

$('#result').append(data);

}

})

});

</script>

<div id="result">blah blah</div>

</body>

</html> 


[링크 : https://opentutorials.org/course/1375/6851]



append로 해도 내용이 없으면 티가 안나는데

내용이 하나라도 있으면 append 답게, 그 이후에 내용이 추가된다.

empty()하거나 html()로 그냥 갈아 치워버리는 것도 방법이 될 듯.


[링크 : https://stackoverflow.com/questions/1675215/ajax-replace-instead-of-append]



위의 예제에서 json까진 해야지 ajax 쓸만해질 듯..


+

ajax 함수에서 사용되는 변수(?)들 이름

type이나 url 이런게 일종의 식별자니까.. 알아두면 작업이 용이할 듯

[링크 : https://www.w3schools.com/jquery/ajax_ajax.asp]

Posted by 구차니

먼가 말이 이상한데..

일단 특정 엘리먼트에서 특정 어트리뷰트를 골라서

선택되는 양을 줄이거나, 특정 노드 하위만을 선별적으로 고르고 싶을때 사용


jQuery( "[attributeFilter1][attributeFilter2][attributeFilterN]" )

attributeFilter1: An attribute filter.

attributeFilter2: Another attribute filter, reducing the selection even more

attributeFilterN: As many more attribute filters as necessary 

[링크 : https://api.jquery.com/multiple-attribute-selector/]


깔끔한 코드는 아니지만.. tab 구현하기 위해 작성한 녀석

div 태그 하위의 parent_id로 시작하는 녀석을 찾아서 class 값을 변경하기 위해 다중 속성 선택자를 사용함

$(document).ready(function(){

$('ul.tabs li').click(function(){

var tab_id = $(this).attr('id');

var parent_id = $(this).parent().attr('id');


$("li[id^="+parent_id+"]").removeClass("sel unsel");

$("li[id^="+parent_id+"]").addClass("unsel");

$(this).removeClass("unsel");

$(this).addClass("sel");

$("div[id^="+parent_id+"]").removeClass("disp non-disp");

$("div[id^="+parent_id+"]").addClass("non-disp");

$("#"+tab_id+"-view").removeClass("non-disp");

$("#"+tab_id+"-view").addClass("disp");

})

}) 



Posted by 구차니
Programming/web 관련2018. 8. 30. 16:20

일단은.. 내꺼에서는 이게 효과가 있었음

li {

height:30px;

line-height: 30px; 

}


[링크 : https://stackoverflow.com/questions/3400548/how-to-vertically-align-li-elements-in-ul]

'Programming > web 관련' 카테고리의 다른 글

sso openid oauth  (0) 2018.09.10
tinestamp(epoch) to utc / localtime  (0) 2018.09.07
user agent stylesheet  (0) 2018.08.29
div min-width  (4) 2018.08.28
웹폰트 - 나눔고딕  (0) 2018.08.27
Posted by 구차니
Programming/node.js2018. 8. 29. 19:12

v8 javascript 엔진을 기반으로 초반에는 node.js를 구현한듯?

근데 여전히.. v8 snapshot 기능은 못 찾음(arm에서 작동 안되는 이유가 얘라고..)


[링크 : https://blog.ghaiklor.com/how-nodejs-works-bfe09efc80ca]

[링크 : https://stackoverflow.com/questions/42616120/what-is-the-relationship-between-node-js-and-v8]

'Programming > node.js' 카테고리의 다른 글

node.js CORS  (0) 2018.09.04
node.js와 웹소켓  (0) 2018.09.03
node.js odroid  (0) 2018.08.29
node.js refresh  (0) 2018.08.17
html5 / css3 / jquey ajax / angularJS  (0) 2018.08.08
Posted by 구차니
Programming/node.js2018. 8. 29. 19:06

odroid에서 node.js 하려면

빌드할때 snapshot 기능을 꺼야 한다고 한다.


[링크 : http://awesometic.tistory.com/5]

[링크 : http://lovedove.tistory.com/101]


+

라즈베리에서 node.js 돌리는법

[링크 : https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp]

'Programming > node.js' 카테고리의 다른 글

node.js와 웹소켓  (0) 2018.09.03
node.js 와 v8  (0) 2018.08.29
node.js refresh  (0) 2018.08.17
html5 / css3 / jquey ajax / angularJS  (0) 2018.08.08
typescript - ts  (2) 2018.08.07
Posted by 구차니
Programming/web 관련2018. 8. 29. 17:47

'Programming > web 관련' 카테고리의 다른 글

tinestamp(epoch) to utc / localtime  (0) 2018.09.07
li 글자 수직정렬하기  (0) 2018.08.30
div min-width  (4) 2018.08.28
웹폰트 - 나눔고딕  (0) 2018.08.27
div width와 margin:auto;  (2) 2018.08.27
Posted by 구차니
Programming/web 관련2018. 8. 28. 14:22

역시.. 생각하는 모든것은 이미 존재하는건가!


div 태그에서 100% width 해놔도 일정 크기 이하로는 줄지 않도록 해주는 설정값

[링크 : https://www.w3schools.com/cssref/pr_dim_min-width.asp]

'Programming > web 관련' 카테고리의 다른 글

li 글자 수직정렬하기  (0) 2018.08.30
user agent stylesheet  (0) 2018.08.29
웹폰트 - 나눔고딕  (0) 2018.08.27
div width와 margin:auto;  (2) 2018.08.27
tr hover  (2) 2018.08.27
Posted by 구차니