'Programming'에 해당되는 글 1780건

  1. 2019.09.10 node.js util.format / sprintf?
  2. 2019.09.10 node.js xpath 지원함수 목록
  3. 2019.09.09 python pip 특정 버전설치 / 목록에서 설치
  4. 2019.09.09 xpath count()
  5. 2019.08.30 정규표현식 n개 이상
  6. 2019.08.22 regexp non-capturing group
  7. 2019.08.21 node.js csv2json
  8. 2019.08.12 node.js regex
  9. 2019.08.12 xpath xsi
  10. 2019.08.08 xpath concat
Programming/node.js2019. 9. 10. 12:45

sprintf() 처럼 %d로 치환해서 출력가능한 모듈이 util.format()으로 존재한다.

 

[링크 : https://nodejs.org/api/util.html#util_util_format_format_args]

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

json2csv / node.js 에서 NULL 값 출력하기  (0) 2019.09.18
js nested function과 변수 scope  (0) 2019.09.15
node.js xpath 지원함수 목록  (0) 2019.09.10
node.js csv2json  (0) 2019.08.21
node.js regex  (0) 2019.08.12
Posted by 구차니
Programming/node.js2019. 9. 10. 10:24

count()가 잘 안되서 지원이 안되는건줄 알았는데 엉뚱한 경로를 해놓고 헤매고 있었다..

FunctionResolver.prototype.addStandardFunctions = function() {
this.functions["{}last"] = Functions.last;
this.functions["{}position"] = Functions.position;
this.functions["{}count"] = Functions.count;
this.functions["{}id"] = Functions.id;
this.functions["{}local-name"] = Functions.localName;
this.functions["{}namespace-uri"] = Functions.namespaceURI;
this.functions["{}name"] = Functions.name;
this.functions["{}string"] = Functions.string;
this.functions["{}concat"] = Functions.concat;
this.functions["{}starts-with"] = Functions.startsWith;
this.functions["{}contains"] = Functions.contains;
this.functions["{}substring-before"] = Functions.substringBefore;
this.functions["{}substring-after"] = Functions.substringAfter;
this.functions["{}substring"] = Functions.substring;
this.functions["{}string-length"] = Functions.stringLength;
this.functions["{}normalize-space"] = Functions.normalizeSpace;
this.functions["{}translate"] = Functions.translate;
this.functions["{}boolean"] = Functions.boolean_;
this.functions["{}not"] = Functions.not;
this.functions["{}true"] = Functions.true_;
this.functions["{}false"] = Functions.false_;
this.functions["{}lang"] = Functions.lang;
this.functions["{}number"] = Functions.number;
this.functions["{}sum"] = Functions.sum;
this.functions["{}floor"] = Functions.floor;
this.functions["{}ceiling"] = Functions.ceiling;
this.functions["{}round"] = Functions.round;
};

[링크 : https://github.com/goto100/xpath/blob/master/xpath.js]

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

js nested function과 변수 scope  (0) 2019.09.15
node.js util.format / sprintf?  (0) 2019.09.10
node.js csv2json  (0) 2019.08.21
node.js regex  (0) 2019.08.12
node.js xpath 모듈  (0) 2019.08.08
Posted by 구차니

requires.txt 이런걸로 패키지 목록이 있으면 -r 옵션을 통해 손쉽게 설치할 수 있다.

pip install -r 파일명

[링크 : https://kwonnam.pe.kr/wiki/python/pip]

 

== 버전으로 특정 버전을 설치할 수 있다.

pip install module==1.10

[링크 : https://antilibrary.org/1122]

'Programming > python(파이썬)' 카테고리의 다른 글

python indent  (0) 2019.12.13
tensorflow, pytorch  (0) 2019.12.10
python expat parseFile()  (0) 2019.06.24
ubuntu에서 python으로 postgres 접속하기  (0) 2019.06.24
python pip 특정 버전 설치하기  (0) 2019.06.18
Posted by 구차니
Programming/xml2019. 9. 9. 19:19

항목이 몇개 있나 세어주는 함수

상위 경로가 중복으로 있을 경우 하위 항목을 세면

본인이 의도하지 않은 범위까지 세어버리니 주의가 필요하다

A - B

   - B

A - B

   - B

이런식으로 B를 세면 A가 두개이고 각각 B가 두개이니 2로 나올것 같지만 4개가 나온다.

count(/A[0]/B) 식으로 세어야 의도한 녀석의 갯수가 나온다.

 

[링크 : https://stackoverflow.com/questions/13799263/use-of-count-in-xpath-expressions?rq=1]

[링크 : https://examples.javacodegeeks.com/core-java/xml/xpath/xpath-count-example/]

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

xpath 복수개의 attribute 동시에 만족하는 항목 찾기  (0) 2019.09.14
xsd minOccurs, maxOccurs  (0) 2019.09.11
xpath xsi  (0) 2019.08.12
xpath concat  (0) 2019.08.08
xpath syntax - attribute 검색 및 특정값 얻기  (0) 2019.08.08
Posted by 구차니

22개 이상의 어떠한 문자에 대해 검색하기

{min,max} 개념이니 한쪽이 빠지면 될 듯?

 

.{22,}

[링크 :https://stackoverflow.com/questions/4735164/trying-to-regex-for-strings-longer-than-22-characters]

'Programming > regexp(정규표현식)' 카테고리의 다른 글

정규 표현식.. 반복  (0) 2019.09.17
regexp non-capturing group  (0) 2019.08.22
정규표현식 - 특정 내용 삭제하기  (0) 2019.04.02
정규표현식 - regular expression  (0) 2009.01.18
Posted by 구차니

먼가 영 안되네...

 

[링크 : https://www.regular-expressions.info/brackets.html]

[링크 : https://stackoverflow.com/questions/3926451/how-to-match-but-not-capture-part-of-a-regex]

 

[링크 : https://www.debuggex.com/]

 

+

2019.08.30

lookbehind?

[링크 : https://stackoverflow.com/questions/3926451/how-to-match-but-not-capture-part-of-a-regex?rq=1]

 

+

(?!\(PMID: )[0-9]*\)

 (PMID: 10373409)

끝에 )를 배제하고 하는 법은 없나? ㅠㅠ

 

+

머가 차이인지 좀 모르겠다...

(?=)

(?!)

 

[링크 : https://unlimitedpower.tistory.com/entry/정규표현식-이것이-고급이다-Positive-Negative-Lookahead-Lookbehind]

 

 

+

2019.11.20

positive lookbehind is (?<=text)

[링크 : https://www.regular-expressions.info/lookaround.html]

Posted by 구차니
Programming/node.js2019. 8. 21. 18:23

csv 파일을 받아서(파일명으로만) 읽어온 뒤 array로 만들어 주는 참한 녀석

(스트림으로 읽는진 모르겠어서 대용량 처리 가능한진 모르겠다)

 

const csvFilePath = 'test.csv'
const csv = require('csvtojson')
csv()
    .fromFile(csvFilePath)
    .then((jsonObj) => {
        jsonObj.forEach(ele => {
            // console.log(ele.idx)
            // console.log(ele.disease_name)
            // console.log(ele.doid)
            // console.log(ele.refsite)
            // console.log(ele.ref_id)

            var dis = ele.disease_name.split(';')
            var ret = "";
            // console.log(dis)
            // console.log(dis.length)
            if(dis.length > 1)
            {
                dis.forEach(ele2 => {
                    ret = '"' + ele.idx + '"';
                    ret += ","
                    ret += '"' + ele2 + '"';
                    ret += ","
                    ret += '"' + ele.doid + '"';
                    ret += ","
                    ret += '"' + ele.refsite + '"';
                    ret += ","
                    ret += '"' + ele.ref_id + '"';
                    console.log(ret)
                })
            }
            else{
                ret = '"' + ele.idx + '"';
                ret += ","
                ret += '"' + ele.disease_name + '"';
                ret += ","
                ret += '"' + ele.doid + '"';
                ret += ","
                ret += '"' + ele.refsite + '"';
                ret += ","
                ret += '"' + ele.ref_id + '"';
                console.log(ret)
            }
            
        })

    })

[링크 : https://www.npmjs.com/package/csvtojson]

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

node.js util.format / sprintf?  (0) 2019.09.10
node.js xpath 지원함수 목록  (0) 2019.09.10
node.js regex  (0) 2019.08.12
node.js xpath 모듈  (0) 2019.08.08
xpath text()  (0) 2019.08.07
Posted by 구차니
Programming/node.js2019. 8. 12. 16:57

별다른 모듈 끌어오지 않아도 기본으로

new RegExp()를 통해 생성이 가능하다.

 

아래는 파일명에서 YYYY-MM 으로 된 녀석을 검색하는 예제

음.. 근데 딱 그 부분만 빼내는 법은 없나?

> var regex =  new RegExp('[0-9]{4}-[0-9]{2}')
undefined
> regex
/[0-9]{4}-[0-9]{2}/
> var fn = "ClinVarFullRelease_2019-07.xml"
undefined
fn.match(regex);
[ '2019-07', index: 19, input: 'ClinVarFullRelease_2019-07.xml' ]

[링크 : https://stackoverflow.com/questions/5675315/node-js-regular-expression-to-get-from-and-to]

 

+

regex.exec(fn)

[링크 : https://opentutorials.org/course/50/43]

 

+

()로 묶으면 완전히 매칭되는 부분만 결과를 돌려준다.

> var regex =  new RegExp('([0-9]{4}-[0-9]{2})')
undefined
fn.match(regex);
[ '2019-07',
  '2019-07',
  index: 19,
  input: 'ClinVarFullRelease_2019-07.xml' ]

[링크 : https://bradbury.tistory.com/47]

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

node.js xpath 지원함수 목록  (0) 2019.09.10
node.js csv2json  (0) 2019.08.21
node.js xpath 모듈  (0) 2019.08.08
xpath text()  (0) 2019.08.07
node.js readline과 r/w stream  (0) 2019.07.31
Posted by 구차니
Programming/xml2019. 8. 12. 15:42

xml namespace나 schema 관련된 녀석을 조회하려는데

어떻게 해야 할지 감이 안와서(evaluation fail막 뜨고..) 찾다가 발견

name이 아니라 name()이 포인트

//*[name()='xsi:noNamespaceSchemaLocation']

 

[링크 : https://stackoverflow.com/questions/4817112/xpath-query-for-xml-node-with-colon-in-node-name]

 

xsi는 Xml Schema Instance의 약자인 것으로 보인다.

인스턴스 문서가 참조할 때는 두 가지 특별한 애트리뷰트를 사용하는데, xsi:schemaLocation xsi:noNamespaceSchemaLocation이 그것이다. 관습적으로 "xsi"는 "http://www.w3.org/2001/XMLSchema-instance"를 가리키는 접두어로 쓰인다.)

[링크 : https://ko.wikipedia.org/wiki/XML_스키마_(W3C)]

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

xsd minOccurs, maxOccurs  (0) 2019.09.11
xpath count()  (0) 2019.09.09
xpath concat  (0) 2019.08.08
xpath syntax - attribute 검색 및 특정값 얻기  (0) 2019.08.08
xpath..  (0) 2019.08.01
Posted by 구차니
Programming/xml2019. 8. 8. 11:09

음.. 시도해보고 수정필요

해당 항목을 검색해서 그 결과를 붙여주는건 아니라 실망..

 

[링크 : https://stackoverflow.com/questions/21996965/concatenate-multiple-node-values-in-xpath]

[링크 : https://stackoverflow.com/questions/3398871/concatenate-multiple-attribute-values]

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

xpath count()  (0) 2019.09.09
xpath xsi  (0) 2019.08.12
xpath syntax - attribute 검색 및 특정값 얻기  (0) 2019.08.08
xpath..  (0) 2019.08.01
xmllint string()  (0) 2019.07.25
Posted by 구차니