Programming/jquery2018. 11. 6. 18:57

append는 추가하는 거라 추가하려는 위치의 가장 뒤에 들어간다면

prepend는 추가하려는 위치의 가장 앞에 끼어넣는다. insert에 가깝다고 하면 되려나?


[링크 : http://api.jquery.com/insertBefore/]

[링크 : http://api.jquery.com/insertAfter/]

[링크 : http://api.jquery.com/prepend/]

Posted by 구차니

배열에서 중복된 값을 제거하려니..

ES6 부터는 set(집합)을 이용하면되고

그 이전에는 filter와 indexof를 이용해서 중복을 제거하면 된다.


Use new ES6 feature: [...new Set( [1, 1, 2] )];

function uniqueArray0(array) {

  var result = Array.from(new Set(array));

  return result    

}


Use filter + indexOf

function uniqueArray3(a) {

  function onlyUnique(value, index, self) { 

      return self.indexOf(value) === index;

  }


  // usage

  var unique = a.filter( onlyUnique ); // returns ['a', 1, 2, '1']


  return unique;

}

[링크 : https://stackoverflow.com/questions/1960473/get-all-unique-values-in-a-javascript-array-remove-duplicates]

[링크 : https://codeburst.io/javascript-array-distinct-5edc93501dc4]


Posted by 구차니
Programming/web 관련2018. 11. 6. 16:18

200은 정상

404는 없음

500은 서버 에러


등등등


[링크 : https://zetawiki.com/wiki/REST_관련_HTTP_상태_코드]

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

edge browser mobile  (0) 2018.11.30
chrome 보안 무시  (0) 2018.11.13
sso openid oauth  (0) 2018.09.10
tinestamp(epoch) to utc / localtime  (0) 2018.09.07
li 글자 수직정렬하기  (0) 2018.08.30
Posted by 구차니
Programming/node.js2018. 11. 6. 16:15

body에 json으로 값을 넘길 경우 키가 없는 것이 대한 대책

undefined로 비교하려고 했는데 아래의 방법이 정석일 듯

// CHECK REQ VALIDITY

        if(!req.body["password"] || !req.body["name"]){

            result["success"] = 0;

            result["error"] = "invalid request";

            res.json(result);

            return;

        } 

[링크 : https://velopert.com/332]



파라미터로 넘길경우 값이 없는 것에 대한 대책

app.get('/users/:id', (req, res) => {

  const id = parseInt(req.params.id, 10);

  if (!id) {

    return res.status(400).json({error: 'Incorrect id'});

  }

}); 

[링크 : http://webframeworks.kr/tutorials/nodejs/api-server-by-nodejs-03/]

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

npm 특정 버전의 모듈 설치하기  (0) 2018.11.07
axios 여러개의 요청을 묶어서 하기  (0) 2018.11.07
curl jwt  (0) 2018.10.26
node-rtsp-stream 과 node-rtsp-stream-es6 차이  (0) 2018.10.24
node.js undefined 확인하기  (0) 2018.10.22
Posted by 구차니
Programming/jquery2018. 11. 6. 16:05

표의 특정 라인으로 이동하기

특절 라인에 대해서 length로 받고 윈도우의 scroll로 직접 이동..


이런걸 써서.. 페이지 이동시 딱딱 끊어지게 하는건가?


var w = $(window);

var row = $('#tableid').find('tr').eq( line );


if (row.length){

    w.scrollTop( row.offset().top - (w.height()/2) );

[링크 : https://stackoverflow.com/questions/7852986/javascript-scroll-to-nth-row-in-a-table]

'Programming > jquery' 카테고리의 다른 글

jquery 셀렉터 - 특정 문장으로 시작하는 id 찾기  (0) 2018.11.07
jquery prepend  (0) 2018.11.06
jquery eq() get() 차이  (0) 2018.11.05
jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
Posted by 구차니

리사이즈 알고리즘 멀 쓸지 모르겠지만 품질 저하가 너무 심한듯..


그런 이유로 다단계로 축소해서 복사하라는 답변이.. ㄷㄷ

[링크 : https://stackoverflow.com/questions/28498014/canvas-drawimage-poor-quality]

[링크 : https://stackoverflow.com/questions/18922880/html5-canvas-resize-downscale-image-high-quality]

Posted by 구차니

어제 밤에 똥개 산책 시켜준다고 돌고 오는데

옆 아파트 놀이터에서 중~고 딩 정도로 보이는 머스마 6~7명이 담배를 피는거 발견

한소리 할까 하다가도 솔찍히 쪽수에서 밀려서 겁나고

내가 사는 아파트가 아니니 말할 명분도 없고


오늘 출근하면서 기사를 보니 이런 내용이 딱 나오네

[링크 : https://news.v.daum.net/v/20181105165408783]


+

어른은 세금내기 싫어서 발악인데

애들은 세금내려고 안달이구나 싶으면서도

담배피지 말라는 말보다는 흡연구역 가서 피우라고 정도는 말할걸 그랬나 싶긴하다.

(근데 칼빵 맞음 어떡해.. ㅠㅠ)

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

으어어 ko. 그리고 3달 이후  (0) 2018.11.17
공기청정기 키트?  (2) 2018.11.15
돌 잔치!!  (6) 2018.11.03
키즈카페 다녀옴  (2) 2018.10.28
혓바늘..  (2) 2018.10.27
Posted by 구차니
Programming/Java2018. 11. 5. 15:16

간간히 이야기 나오던 녀석이긴 한데

기사가 뒷북인가.. 아니면 다른 변동사항이 있어서 다시 나온걸까?

[링크 : https://news.v.daum.net/v/20181105075205312]



아무튼.. 국내 JSP나 spring 으로 된 녀석들도 영향을 받을지 모르겠네?

'Programming > Java' 카테고리의 다른 글

jar 만들기 export  (0) 2019.01.03
Java SE 8 설치해보려고 했더니..  (2) 2019.01.03
자바 임베디드 JRE 라이센스?  (0) 2015.05.12
predefined annotation /java  (0) 2014.06.27
JUnit tutorial  (0) 2014.06.27
Posted by 구차니

ffmpeg로 동영상을 합치는 방법

코덱 설정하면 하나로 합칠순 있겠지만.. 단일 파일별로 특정 시간 영역을 자르긴 무리일려나?


16. Joining multiple video parts into one

FFmpeg will also join the multiple video parts and create a single video file.

Create join.txt file that contains the exact paths of the files that you want to join. All files should be same format (same codec). The path name of all files should be mentioned one by one like below.

/home/sk/myvideos/part1.mp4

/home/sk/myvideos/part2.mp4

/home/sk/myvideos/part3.mp4

/home/sk/myvideos/part4.mp4

Now, join all files using command:


$ ffmpeg -f concat -i join.txt -c copy output.mp4 


[링크 : https://www.ostechnix.com/20-ffmpeg-commands-beginners/]

'프로그램 사용 > ffmpeg & ffserver' 카테고리의 다른 글

ffmpeg 레이턴시 관련 옵션 조사  (0) 2018.12.16
ffmpeg / ffplay cli interactive interface  (0) 2018.11.30
ffmpeg concat  (0) 2018.10.10
ffmpeg huffyuv  (0) 2017.02.28
ffmpeg으로 컨테이너 변경하기  (0) 2016.12.01
Posted by 구차니
Programming/jquery2018. 11. 5. 14:34

get은 DOM 객체를 받는다면

eq는 jquery 객체를 받는 차이가 있다.


그래서 이전에.. canvas를 얻었을때 width나 scrollwidth 같은게

jquery 통해서 획득한 녀석은 받아내질 못했던 것으로 보인다.


Retrieve the DOM elements matched by the jQuery object. 

[링크 : https://api.jquery.com/get/]


Reduce the set of matched elements to the one at the specified index. 

[링크 : https://api.jquery.com/eq/]


[링크 : http://www.jquerybyexample.net/2013/04/jquery-difference-between-eq-and-get-method.html]

[링크 : https://fronteer.kr/bbs/view/250]



Posted by 구차니