问:
Image detection with Google Vison and NodeJS
I'm using Node JS to call Google Vision Cloud API. It's working fine but I can't understand how to process the returned object.

```<code>clinet.textDetection(fileName).then(response => {

    console.log(response);
    console.log(Type(response));
    console.log(JSON.stringify(response));

    // console.log(JSON.stringify(response.responses));
    // console.log(JSON.stringify(response.fullTextAnnotation));
    // console.log("fullTextAnnotation: " + response.fullTextAnnotation);
    // var jsonObj = JSON.parse(response);
    // console.log(jsonObj.key);

}).catch(err => { console.error(err); });
</code>```

Any clue? I have to read fullTextAnnotation.text key. All the sample I tried (and left on the code sample are not working [for instance I'm getting undefined]

This is the execution output:

```[04/12/2017 15:41:53.780] [LOG]   [ { faceAnnotations: [],
    landmarkAnnotations: [],
    logoAnnotations: [],
    labelAnnotations: [],
    textAnnotations:
     [ [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object] ],
    safeSearchAnnotation: null,
    imagePropertiesAnnotation: null,
    error: null,
    cropHintsAnnotation: null,
    fullTextAnnotation:
     { pages: [Array],
       text: 'Stefano Vecchier\nSystem Administrator\nstefano.vecchier@domino.it\nM +39 392 93 26 453\n' },
    webDetection: null } ]
[04/12/2017 15:41:53.782] [LOG]   [Function: Array]
[04/12/2017 15:41:53.782] [LOG]   [{"faceAnnotations":[],"landmarkAnnotations":[],"logoAnnotations":[],"labelAnnotations":[],"textAnnotations":[{"locations":[],"properties":[],"mid":"","locale":"sq","description":"Stefano Vecchier\nSystem Administrator\nstefano.vecchier@domino.it\nM +39 392 93 26 453\n","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":616,"y":113},{"x":1007,"y":113},{"x":1007,"y":257},{"x":616,"y":257}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"Stefano","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":616,"y":116},{"x":730,"y":115},{"x":730,"y":138},{"x":616,"y":139}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"Vecchier","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":740,"y":114},{"x":870,"y":113},{"x":870,"y":137},{"x":740,"y":138}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"System","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":616,"y":155},{"x":726,"y":153},{"x":726,"y":182},{"x":616,"y":184}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"Administrator","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":736,"y":153},{"x":943,"y":150},{"x":943,"y":175},{"x":736,"y":178}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"stefano.vecchier@domino.it","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":617,"y":195},{"x":1007,"y":190},{"x":1007,"y":216},{"x":617,"y":221}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"M","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":618,"y":236},{"x":640,"y":236},{"x":640,"y":257},{"x":618,"y":257}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"+39","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":654,"y":235},{"x":702,"y":234},{"x":702,"y":255},{"x":654,"y":256}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"392","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":712,"y":234},{"x":759,"y":233},{"x":759,"y":255},{"x":712,"y":256}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"93","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":770,"y":234},{"x":801,"y":234},{"x":801,"y":256},{"x":770,"y":256}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"26","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":812,"y":233},{"x":843,"y":233},{"x":843,"y":255},{"x":812,"y":255}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"453","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":854,"y":232},{"x":902,"y":231},{"x":902,"y":253},{"x":854,"y":254}]}}],"safeSearchAnnotation":null,"imagePropertiesAnnotation":null,"error":null,"cropHintsAnnotation":null,"fullTextAnnotation":{"pages":[{"blocks":[{"paragraphs":[{"words":[{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":116},{"x":630,"y":116},{"x":630,"y":139},{"x":616,"y":139}]},"text":"S"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":632,"y":116},{"x":646,"y":116},{"x":646,"y":139},{"x":632,"y":139}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":648,"y":122},{"x":663,"y":122},{"x":663,"y":139},{"x":648,"y":139}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":665,"y":115},{"x":674,"y":115},{"x":674,"y":138},{"x":665,"y":138}]},"text":"f"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":676,"y":121},{"x":691,"y":121},{"x":691,"y":138},{"x":676,"y":138}]},"text":"a"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":695,"y":121},{"x":710,"y":121},{"x":710,"y":138},{"x":695,"y":138}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":714,"y":121},{"x":730,"y":121},{"x":730,"y":138},{"x":714,"y":138}]},"text":"o"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":116},{"x":730,"y":115},{"x":730,"y":138},{"x":616,"y":139}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":740,"y":114},{"x":759,"y":114},{"x":759,"y":138},{"x":740,"y":138}]},"text":"V"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":761,"y":120},{"x":775,"y":120},{"x":775,"y":137},{"x":761,"y":137}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":778,"y":120},{"x":794,"y":120},{"x":794,"y":137},{"x":778,"y":137}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":796,"y":120},{"x":812,"y":120},{"x":812,"y":137},{"x":796,"y":137}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":815,"y":113},{"x":830,"y":113},{"x":830,"y":136},{"x":815,"y":136}]},"text":"h"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":833,"y":113},{"x":838,"y":113},{"x":838,"y":136},{"x":833,"y":136}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":841,"y":120},{"x":855,"y":120},{"x":855,"y":136},{"x":841,"y":136}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":857,"y":119},{"x":870,"y":119},{"x":870,"y":135},{"x":857,"y":135}]},"text":"r"}],"property":{"detectedLanguages":[{"languageCode":"fr","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":740,"y":114},{"x":870,"y":113},{"x":870,"y":137},{"x":740,"y":138}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":155},{"x":633,"y":155},{"x":633,"y":184},{"x":616,"y":184}]},"text":"S"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":635,"y":155},{"x":653,"y":155},{"x":653,"y":184},{"x":635,"y":184}]},"text":"y"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":654,"y":156},{"x":666,"y":156},{"x":666,"y":177},{"x":654,"y":177}]},"text":"s"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":668,"y":156},{"x":680,"y":156},{"x":680,"y":177},{"x":668,"y":177}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":681,"y":160},{"x":697,"y":160},{"x":697,"y":177},{"x":681,"y":177}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":699,"y":160},{"x":726,"y":160},{"x":726,"y":177},{"x":699,"y":177}]},"text":"m"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":155},{"x":726,"y":153},{"x":726,"y":182},{"x":616,"y":184}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":736,"y":154},{"x":757,"y":154},{"x":757,"y":176},{"x":736,"y":176}]},"text":"A"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":758,"y":154},{"x":776,"y":154},{"x":776,"y":178},{"x":758,"y":178}]},"text":"d"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":779,"y":158},{"x":804,"y":158},{"x":804,"y":175},{"x":779,"y":175}]},"text":"m"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":808,"y":152},{"x":812,"y":152},{"x":812,"y":175},{"x":808,"y":175}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":815,"y":158},{"x":832,"y":158},{"x":832,"y":175},{"x":815,"y":175}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":834,"y":153},{"x":840,"y":153},{"x":840,"y":175},{"x":834,"y":175}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":842,"y":153},{"x":855,"y":153},{"x":855,"y":176},{"x":842,"y":176}]},"text":"s"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":857,"y":153},{"x":870,"y":153},{"x":870,"y":176},{"x":857,"y":176}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":870,"y":157},{"x":883,"y":157},{"x":883,"y":174},{"x":870,"y":174}]},"text":"r"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":883,"y":158},{"x":900,"y":158},{"x":900,"y":176},{"x":883,"y":176}]},"text":"a"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":900,"y":154},{"x":914,"y":154},{"x":914,"y":176},{"x":900,"y":176}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":916,"y":153},{"x":930,"y":153},{"x":930,"y":175},{"x":916,"y":175}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":932,"y":157},{"x":943,"y":157},{"x":943,"y":175},{"x":932,"y":175}]},"text":"r"}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":736,"y":153},{"x":943,"y":150},{"x":943,"y":175},{"x":736,"y":178}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":617,"y":198},{"x":627,"y":198},{"x":627,"y":218},{"x":617,"y":218}]},"text":"s"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":629,"y":198},{"x":640,"y":198},{"x":640,"y":218},{"x":629,"y":218}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":643,"y":201},{"x":657,"y":201},{"x":657,"y":218},{"x":643,"y":218}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":659,"y":194},{"x":668,"y":194},{"x":668,"y":217},{"x":659,"y":217}]},"text":"f"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":669,"y":200},{"x":683,"y":200},{"x":683,"y":217},{"x":669,"y":217}]},"text":"a"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":686,"y":200},{"x":701,"y":200},{"x":701,"y":217},{"x":686,"y":217}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":703,"y":200},{"x":719,"y":200},{"x":719,"y":217},{"x":703,"y":217}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":723,"y":200},{"x":732,"y":200},{"x":732,"y":217},{"x":723,"y":217}]},"text":"."},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":734,"y":199},{"x":743,"y":199},{"x":743,"y":216},{"x":734,"y":216}]},"text":"v"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":746,"y":199},{"x":761,"y":199},{"x":761,"y":216},{"x":746,"y":216}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":763,"y":199},{"x":777,"y":199},{"x":777,"y":216},{"x":763,"y":216}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":781,"y":199},{"x":794,"y":199},{"x":794,"y":216},{"x":781,"y":216}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":798,"y":192},{"x":812,"y":192},{"x":812,"y":215},{"x":798,"y":215}]},"text":"h"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":816,"y":192},{"x":819,"y":192},{"x":819,"y":215},{"x":816,"y":215}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":823,"y":198},{"x":837,"y":198},{"x":837,"y":215},{"x":823,"y":215}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":840,"y":198},{"x":848,"y":198},{"x":848,"y":215},{"x":840,"y":215}]},"text":"r"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":850,"y":194},{"x":872,"y":194},{"x":872,"y":218},{"x":850,"y":218}]},"text":"@"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":876,"y":197},{"x":892,"y":197},{"x":892,"y":214},{"x":876,"y":214}]},"text":"d"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":894,"y":197},{"x":911,"y":197},{"x":911,"y":214},{"x":894,"y":214}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":913,"y":197},{"x":937,"y":197},{"x":937,"y":214},{"x":913,"y":214}]},"text":"m"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":940,"y":191},{"x":944,"y":191},{"x":944,"y":214},{"x":940,"y":214}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":948,"y":196},{"x":963,"y":196},{"x":963,"y":214},{"x":948,"y":214}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":965,"y":196},{"x":980,"y":196},{"x":980,"y":214},{"x":965,"y":214}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":985,"y":210},{"x":988,"y":210},{"x":988,"y":214},{"x":985,"y":214}]},"text":"."},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":992,"y":191},{"x":998,"y":191},{"x":998,"y":214},{"x":992,"y":214}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":1000,"y":191},{"x":1007,"y":191},{"x":1007,"y":214},{"x":1000,"y":214}]},"text":"t"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":617,"y":195},{"x":1007,"y":190},{"x":1007,"y":216},{"x":617,"y":221}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":618,"y":236},{"x":640,"y":236},{"x":640,"y":257},{"x":618,"y":257}]},"text":"M"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":618,"y":236},{"x":640,"y":236},{"x":640,"y":257},{"x":618,"y":257}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":654,"y":241},{"x":669,"y":241},{"x":669,"y":255},{"x":654,"y":255}]},"text":"+"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":671,"y":235},{"x":685,"y":235},{"x":685,"y":256},{"x":671,"y":256}]},"text":"3"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":688,"y":235},{"x":702,"y":235},{"x":702,"y":256},{"x":688,"y":256}]},"text":"9"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":654,"y":235},{"x":702,"y":234},{"x":702,"y":255},{"x":654,"y":256}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":712,"y":234},{"x":726,"y":234},{"x":726,"y":256},{"x":712,"y":256}]},"text":"3"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":729,"y":234},{"x":743,"y":234},{"x":743,"y":256},{"x":729,"y":256}]},"text":"9"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":746,"y":234},{"x":759,"y":234},{"x":759,"y":256},{"x":746,"y":256}]},"text":"2"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":712,"y":234},{"x":759,"y":233},{"x":759,"y":255},{"x":712,"y":256}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":770,"y":234},{"x":784,"y":234},{"x":784,"y":256},{"x":770,"y":256}]},"text":"9"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":787,"y":233},{"x":801,"y":233},{"x":801,"y":255},{"x":787,"y":255}]},"text":"3"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":770,"y":234},{"x":801,"y":234},{"x":801,"y":256},{"x":770,"y":256}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":812,"y":233},{"x":826,"y":233},{"x":826,"y":255},{"x":812,"y":255}]},"text":"2"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":829,"y":233},{"x":843,"y":233},{"x":843,"y":255},{"x":829,"y":255}]},"text":"6"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":812,"y":233},{"x":843,"y":233},{"x":843,"y":255},{"x":812,"y":255}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":854,"y":232},{"x":868,"y":232},{"x":868,"y":253},{"x":854,"y":253}]},"text":"4"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":871,"y":232},{"x":885,"y":232},{"x":885,"y":254},{"x":871,"y":254}]},"text":"5"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":888,"y":232},{"x":902,"y":232},{"x":902,"y":254},{"x":888,"y":254}]},"text":"3"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":854,"y":232},{"x":902,"y":231},{"x":902,"y":253},{"x":854,"y":254}]}}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":113},{"x":1007,"y":113},{"x":1007,"y":257},{"x":616,"y":257}]}}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":113},{"x":1007,"y":113},{"x":1007,"y":257},{"x":616,"y":257}]},"blockType":"TEXT"}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"width":1280,"height":722}],"text":"Stefano Vecchier\nSystem Administrator\nstefano.vecchier@domino.it\nM +39 392 93 26 453\n"},"webDetection":null}]
```

答:
This answer my question:</p>

```<code>const fullTextAnnotation = response[0].fullTextAnnotation;
console.log(fullTextAnnotation.text);
</code>```

Body:
I'm using Node JS to call Google Vision Cloud API. It's working fine but I can't understand how to process the returned object.

clinet.textDetection(fileName).then(response => {

    console.log(response);
    console.log(Type(response));
    console.log(JSON.stringify(response));

    // console.log(JSON.stringify(response.responses));
    // console.log(JSON.stringify(response.fullTextAnnotation));
    // console.log("fullTextAnnotation: " + response.fullTextAnnotation);
    // var jsonObj = JSON.parse(response);
    // console.log(jsonObj.key);

}).catch(err => { console.error(err); });

Any clue? I have to read fullTextAnnotation.text key. All the sample I tried (and left on the code sample are not working [for instance I'm getting undefined]

This is the execution output:

[04/12/2017 15:41:53.780] [LOG]   [ { faceAnnotations: [],
    landmarkAnnotations: [],
    logoAnnotations: [],
    labelAnnotations: [],
    textAnnotations:
     [ [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object] ],
    safeSearchAnnotation: null,
    imagePropertiesAnnotation: null,
    error: null,
    cropHintsAnnotation: null,
    fullTextAnnotation:
     { pages: [Array],
       text: 'Stefano Vecchier\nSystem Administrator\nstefano.vecchier@domino.it\nM +39 392 93 26 453\n' },
    webDetection: null } ]
[04/12/2017 15:41:53.782] [LOG]   [Function: Array]
[04/12/2017 15:41:53.782] [LOG]   [{"faceAnnotations":[],"landmarkAnnotations":[],"logoAnnotations":[],"labelAnnotations":[],"textAnnotations":[{"locations":[],"properties":[],"mid":"","locale":"sq","description":"Stefano Vecchier\nSystem Administrator\nstefano.vecchier@domino.it\nM +39 392 93 26 453\n","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":616,"y":113},{"x":1007,"y":113},{"x":1007,"y":257},{"x":616,"y":257}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"Stefano","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":616,"y":116},{"x":730,"y":115},{"x":730,"y":138},{"x":616,"y":139}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"Vecchier","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":740,"y":114},{"x":870,"y":113},{"x":870,"y":137},{"x":740,"y":138}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"System","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":616,"y":155},{"x":726,"y":153},{"x":726,"y":182},{"x":616,"y":184}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"Administrator","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":736,"y":153},{"x":943,"y":150},{"x":943,"y":175},{"x":736,"y":178}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"stefano.vecchier@domino.it","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":617,"y":195},{"x":1007,"y":190},{"x":1007,"y":216},{"x":617,"y":221}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"M","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":618,"y":236},{"x":640,"y":236},{"x":640,"y":257},{"x":618,"y":257}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"+39","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":654,"y":235},{"x":702,"y":234},{"x":702,"y":255},{"x":654,"y":256}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"392","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":712,"y":234},{"x":759,"y":233},{"x":759,"y":255},{"x":712,"y":256}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"93","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":770,"y":234},{"x":801,"y":234},{"x":801,"y":256},{"x":770,"y":256}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"26","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":812,"y":233},{"x":843,"y":233},{"x":843,"y":255},{"x":812,"y":255}]}},{"locations":[],"properties":[],"mid":"","locale":"","description":"453","score":0,"confidence":0,"topicality":0,"boundingPoly":{"vertices":[{"x":854,"y":232},{"x":902,"y":231},{"x":902,"y":253},{"x":854,"y":254}]}}],"safeSearchAnnotation":null,"imagePropertiesAnnotation":null,"error":null,"cropHintsAnnotation":null,"fullTextAnnotation":{"pages":[{"blocks":[{"paragraphs":[{"words":[{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":116},{"x":630,"y":116},{"x":630,"y":139},{"x":616,"y":139}]},"text":"S"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":632,"y":116},{"x":646,"y":116},{"x":646,"y":139},{"x":632,"y":139}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":648,"y":122},{"x":663,"y":122},{"x":663,"y":139},{"x":648,"y":139}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":665,"y":115},{"x":674,"y":115},{"x":674,"y":138},{"x":665,"y":138}]},"text":"f"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":676,"y":121},{"x":691,"y":121},{"x":691,"y":138},{"x":676,"y":138}]},"text":"a"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":695,"y":121},{"x":710,"y":121},{"x":710,"y":138},{"x":695,"y":138}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":714,"y":121},{"x":730,"y":121},{"x":730,"y":138},{"x":714,"y":138}]},"text":"o"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":116},{"x":730,"y":115},{"x":730,"y":138},{"x":616,"y":139}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":740,"y":114},{"x":759,"y":114},{"x":759,"y":138},{"x":740,"y":138}]},"text":"V"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":761,"y":120},{"x":775,"y":120},{"x":775,"y":137},{"x":761,"y":137}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":778,"y":120},{"x":794,"y":120},{"x":794,"y":137},{"x":778,"y":137}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":796,"y":120},{"x":812,"y":120},{"x":812,"y":137},{"x":796,"y":137}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":815,"y":113},{"x":830,"y":113},{"x":830,"y":136},{"x":815,"y":136}]},"text":"h"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":833,"y":113},{"x":838,"y":113},{"x":838,"y":136},{"x":833,"y":136}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":841,"y":120},{"x":855,"y":120},{"x":855,"y":136},{"x":841,"y":136}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":857,"y":119},{"x":870,"y":119},{"x":870,"y":135},{"x":857,"y":135}]},"text":"r"}],"property":{"detectedLanguages":[{"languageCode":"fr","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":740,"y":114},{"x":870,"y":113},{"x":870,"y":137},{"x":740,"y":138}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":155},{"x":633,"y":155},{"x":633,"y":184},{"x":616,"y":184}]},"text":"S"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":635,"y":155},{"x":653,"y":155},{"x":653,"y":184},{"x":635,"y":184}]},"text":"y"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":654,"y":156},{"x":666,"y":156},{"x":666,"y":177},{"x":654,"y":177}]},"text":"s"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":668,"y":156},{"x":680,"y":156},{"x":680,"y":177},{"x":668,"y":177}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":681,"y":160},{"x":697,"y":160},{"x":697,"y":177},{"x":681,"y":177}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":699,"y":160},{"x":726,"y":160},{"x":726,"y":177},{"x":699,"y":177}]},"text":"m"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":155},{"x":726,"y":153},{"x":726,"y":182},{"x":616,"y":184}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":736,"y":154},{"x":757,"y":154},{"x":757,"y":176},{"x":736,"y":176}]},"text":"A"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":758,"y":154},{"x":776,"y":154},{"x":776,"y":178},{"x":758,"y":178}]},"text":"d"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":779,"y":158},{"x":804,"y":158},{"x":804,"y":175},{"x":779,"y":175}]},"text":"m"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":808,"y":152},{"x":812,"y":152},{"x":812,"y":175},{"x":808,"y":175}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":815,"y":158},{"x":832,"y":158},{"x":832,"y":175},{"x":815,"y":175}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":834,"y":153},{"x":840,"y":153},{"x":840,"y":175},{"x":834,"y":175}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":842,"y":153},{"x":855,"y":153},{"x":855,"y":176},{"x":842,"y":176}]},"text":"s"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":857,"y":153},{"x":870,"y":153},{"x":870,"y":176},{"x":857,"y":176}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":870,"y":157},{"x":883,"y":157},{"x":883,"y":174},{"x":870,"y":174}]},"text":"r"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":883,"y":158},{"x":900,"y":158},{"x":900,"y":176},{"x":883,"y":176}]},"text":"a"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":900,"y":154},{"x":914,"y":154},{"x":914,"y":176},{"x":900,"y":176}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":916,"y":153},{"x":930,"y":153},{"x":930,"y":175},{"x":916,"y":175}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":932,"y":157},{"x":943,"y":157},{"x":943,"y":175},{"x":932,"y":175}]},"text":"r"}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":736,"y":153},{"x":943,"y":150},{"x":943,"y":175},{"x":736,"y":178}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":617,"y":198},{"x":627,"y":198},{"x":627,"y":218},{"x":617,"y":218}]},"text":"s"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":629,"y":198},{"x":640,"y":198},{"x":640,"y":218},{"x":629,"y":218}]},"text":"t"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":643,"y":201},{"x":657,"y":201},{"x":657,"y":218},{"x":643,"y":218}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":659,"y":194},{"x":668,"y":194},{"x":668,"y":217},{"x":659,"y":217}]},"text":"f"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":669,"y":200},{"x":683,"y":200},{"x":683,"y":217},{"x":669,"y":217}]},"text":"a"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":686,"y":200},{"x":701,"y":200},{"x":701,"y":217},{"x":686,"y":217}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":703,"y":200},{"x":719,"y":200},{"x":719,"y":217},{"x":703,"y":217}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":723,"y":200},{"x":732,"y":200},{"x":732,"y":217},{"x":723,"y":217}]},"text":"."},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":734,"y":199},{"x":743,"y":199},{"x":743,"y":216},{"x":734,"y":216}]},"text":"v"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":746,"y":199},{"x":761,"y":199},{"x":761,"y":216},{"x":746,"y":216}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":763,"y":199},{"x":777,"y":199},{"x":777,"y":216},{"x":763,"y":216}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":781,"y":199},{"x":794,"y":199},{"x":794,"y":216},{"x":781,"y":216}]},"text":"c"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":798,"y":192},{"x":812,"y":192},{"x":812,"y":215},{"x":798,"y":215}]},"text":"h"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":816,"y":192},{"x":819,"y":192},{"x":819,"y":215},{"x":816,"y":215}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":823,"y":198},{"x":837,"y":198},{"x":837,"y":215},{"x":823,"y":215}]},"text":"e"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":840,"y":198},{"x":848,"y":198},{"x":848,"y":215},{"x":840,"y":215}]},"text":"r"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":850,"y":194},{"x":872,"y":194},{"x":872,"y":218},{"x":850,"y":218}]},"text":"@"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":876,"y":197},{"x":892,"y":197},{"x":892,"y":214},{"x":876,"y":214}]},"text":"d"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":894,"y":197},{"x":911,"y":197},{"x":911,"y":214},{"x":894,"y":214}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":913,"y":197},{"x":937,"y":197},{"x":937,"y":214},{"x":913,"y":214}]},"text":"m"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":940,"y":191},{"x":944,"y":191},{"x":944,"y":214},{"x":940,"y":214}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":948,"y":196},{"x":963,"y":196},{"x":963,"y":214},{"x":948,"y":214}]},"text":"n"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":965,"y":196},{"x":980,"y":196},{"x":980,"y":214},{"x":965,"y":214}]},"text":"o"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":985,"y":210},{"x":988,"y":210},{"x":988,"y":214},{"x":985,"y":214}]},"text":"."},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":992,"y":191},{"x":998,"y":191},{"x":998,"y":214},{"x":992,"y":214}]},"text":"i"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":1000,"y":191},{"x":1007,"y":191},{"x":1007,"y":214},{"x":1000,"y":214}]},"text":"t"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":617,"y":195},{"x":1007,"y":190},{"x":1007,"y":216},{"x":617,"y":221}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":618,"y":236},{"x":640,"y":236},{"x":640,"y":257},{"x":618,"y":257}]},"text":"M"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":618,"y":236},{"x":640,"y":236},{"x":640,"y":257},{"x":618,"y":257}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":654,"y":241},{"x":669,"y":241},{"x":669,"y":255},{"x":654,"y":255}]},"text":"+"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":671,"y":235},{"x":685,"y":235},{"x":685,"y":256},{"x":671,"y":256}]},"text":"3"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":688,"y":235},{"x":702,"y":235},{"x":702,"y":256},{"x":688,"y":256}]},"text":"9"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":654,"y":235},{"x":702,"y":234},{"x":702,"y":255},{"x":654,"y":256}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":712,"y":234},{"x":726,"y":234},{"x":726,"y":256},{"x":712,"y":256}]},"text":"3"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":729,"y":234},{"x":743,"y":234},{"x":743,"y":256},{"x":729,"y":256}]},"text":"9"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":746,"y":234},{"x":759,"y":234},{"x":759,"y":256},{"x":746,"y":256}]},"text":"2"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":712,"y":234},{"x":759,"y":233},{"x":759,"y":255},{"x":712,"y":256}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":770,"y":234},{"x":784,"y":234},{"x":784,"y":256},{"x":770,"y":256}]},"text":"9"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":787,"y":233},{"x":801,"y":233},{"x":801,"y":255},{"x":787,"y":255}]},"text":"3"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":770,"y":234},{"x":801,"y":234},{"x":801,"y":256},{"x":770,"y":256}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":812,"y":233},{"x":826,"y":233},{"x":826,"y":255},{"x":812,"y":255}]},"text":"2"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":829,"y":233},{"x":843,"y":233},{"x":843,"y":255},{"x":829,"y":255}]},"text":"6"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":812,"y":233},{"x":843,"y":233},{"x":843,"y":255},{"x":812,"y":255}]}},{"symbols":[{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":854,"y":232},{"x":868,"y":232},{"x":868,"y":253},{"x":854,"y":253}]},"text":"4"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":871,"y":232},{"x":885,"y":232},{"x":885,"y":254},{"x":871,"y":254}]},"text":"5"},{"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":{"type":"EOL_SURE_SPACE","isPrefix":false}},"boundingBox":{"vertices":[{"x":888,"y":232},{"x":902,"y":232},{"x":902,"y":254},{"x":888,"y":254}]},"text":"3"}],"property":{"detectedLanguages":[{"languageCode":"en","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":854,"y":232},{"x":902,"y":231},{"x":902,"y":253},{"x":854,"y":254}]}}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":113},{"x":1007,"y":113},{"x":1007,"y":257},{"x":616,"y":257}]}}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"boundingBox":{"vertices":[{"x":616,"y":113},{"x":1007,"y":113},{"x":1007,"y":257},{"x":616,"y":257}]},"blockType":"TEXT"}],"property":{"detectedLanguages":[{"languageCode":"sq","confidence":0}],"detectedBreak":null},"width":1280,"height":722}],"text":"Stefano Vecchier\nSystem Administrator\nstefano.vecchier@domino.it\nM +39 392 93 26 453\n"},"webDetection":null}]

Body:
This answer my question:

const fullTextAnnotation = response[0].fullTextAnnotation;
console.log(fullTextAnnotation.text);


来源: stackexchange

问:
Cannot use GraphQL queries in React - has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
I have a React application that connects to a back-end Laravel application that has a GraphQL layer on top of it.

I have a GraphQL query as such:

```<code>http://laravel-quarx.dev/graphql?query=query+getUserNameAndId{users{id,name}}
</code>```

Which will return the following JSON:

{"data":{"users":[{"id":1,"name":"Admin"},{"id":2,"name":"Saqueib Ansrai"}]}}

Here is how I fetch this data in React (I am using Redux so I have my call in the Saga):

```<code>function* fetchProducts(actions) {
    try {
        const response = yield call(fetchApi, {
            method: 'GET',
            url: '?query=query+getUserNameAndId{users{id,name}}',
        });

        yield put(productSuccess(response));
    } catch (e) {
        yield put(productFailure(e.response ? e.response.data.message : e));
    }
}
</code>```

This results in the following error:

XMLHttpRequest cannot load
  http://laravel-quarx.dev/graphql/?query=query+getUserNameAndId{users{id,name}}.
  Redirect from
  'http://laravel-quarx.dev/graphql/?query=query+getUserNameAndId{users{id,name}}'
  to
  'http://laravel-quarx.dev/graphql?query=query+getUserNameAndId{users{id,name}}'
  has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
  header is present on the requested resource. Origin
  'http://localhost:3000' is therefore not allowed access.

I am unsure as to what I have to do on my server-side application to bypass the CORS limitations, any ideas?

EDIT:

Headers:

Cors config:

```<code>return [
    /*
    |--------------------------------------------------------------------------
    | Laravel CORS
    |--------------------------------------------------------------------------
    |
    | allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
    | to accept any value.
    |
    */
    'supportsCredentials' => false,
    'allowedOrigins' => ['*'],
    //Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Cache-Control
    'allowedHeaders' => ['*'],
    'allowedMethods' => ['*'], // ex: ['GET', 'POST', 'PUT',  'DELETE']
    'exposedHeaders' => [],
    'maxAge' => 0,
];
</code>```

答:
You have two options, one is making your application to understand cors, and the second is to disable cors in the fetch options in your apollo client:</p>

```<code>const link  = new HttpLink({
        uri: 'URI',
        fetchOptions: {
            mode: 'no-cors'
        }
    });
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have a React application that connects to a back-end Laravel application that has a GraphQL layer on top of it.

I have a GraphQL query as such:

http://laravel-quarx.dev/graphql?query=query+getUserNameAndId{users{id,name}}

Which will return the following JSON:

{"data":{"users":[{"id":1,"name":"Admin"},{"id":2,"name":"Saqueib Ansrai"}]}}

Here is how I fetch this data in React (I am using Redux so I have my call in the Saga):

function* fetchProducts(actions) {
    try {
        const response = yield call(fetchApi, {
            method: 'GET',
            url: '?query=query+getUserNameAndId{users{id,name}}',
        });

        yield put(productSuccess(response));
    } catch (e) {
        yield put(productFailure(e.response ? e.response.data.message : e));
    }
}

This results in the following error:

XMLHttpRequest cannot load
  http://laravel-quarx.dev/graphql/?query=query+getUserNameAndId{users{id,name}}.
  Redirect from
  'http://laravel-quarx.dev/graphql/?query=query+getUserNameAndId{users{id,name}}'
  to
  'http://laravel-quarx.dev/graphql?query=query+getUserNameAndId{users{id,name}}'
  has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
  header is present on the requested resource. Origin
  'http://localhost:3000' is therefore not allowed access.

I am unsure as to what I have to do on my server-side application to bypass the CORS limitations, any ideas?

EDIT:

Headers:

Cors config:

return [
    /*
    |--------------------------------------------------------------------------
    | Laravel CORS
    |--------------------------------------------------------------------------
    |
    | allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
    | to accept any value.
    |
    */
    'supportsCredentials' => false,
    'allowedOrigins' => ['*'],
    //Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Cache-Control
    'allowedHeaders' => ['*'],
    'allowedMethods' => ['*'], // ex: ['GET', 'POST', 'PUT',  'DELETE']
    'exposedHeaders' => [],
    'maxAge' => 0,
];

Body:
You have two options, one is making your application to understand cors, and the second is to disable cors in the fetch options in your apollo client:

const link  = new HttpLink({
        uri: 'URI',
        fetchOptions: {
            mode: 'no-cors'
        }
    });


问:
Implicitly defined variable throws run-time error while explicitly defined does not
Using VB.NET, I'm trying to clean up a code base following ReSharper's guidelines. I currently have the following code:

```<code>'oSearchInput is defined outside this question
Dim oSearchRoutines As New SearchClient
Dim oSearchResults As List(Of SearchResult)

oSearchRoutines = 'WcfCallThatReturnsSearchClient

oSearchResults = oSearchRoutines.getSearchResults(oSearchInput).ToList
</code>```

Now this works completely fine, but ReSharper warns that As New SearchClient has 'Value assigned is not used in any execution path'. So I removed that part to get this code:

```<code>'oSearchInput is defined outside this question
Dim oSearchRoutines
Dim oSearchResults As List(Of SearchResult)

oSearchRoutines = 'WcfCallThatReturnsSearchClient

oSearchResults = oSearchRoutines.getSearchResults(oSearchInput).ToList
</code>```

If I'm understanding this correctly, everything should work exactly the same. However, an error is thrown when calling ToList:

Public member 'ToList' on type 'SearchResult()' not found.

I'm not exactly sure why there's any difference between the two snippets I have here.

答:
Because you're not assinging the type SearchClient in your second example, oSearchRoutines will automatically be of type Object.

An expression of type Object is mainly not allowed to use Extension methods, like for example the ToList-method. For further information see here

The following example illustrates this behaviour:

```<code>Dim x As Object
Dim y As String = "ABC"
x = y

Dim a As List(Of Char) = y.ToList() 'This will work
Dim b As List(Of Char) = x.ToList() 'This will throw a System.MissingMemberException
</code>```

The message Value assigned is not used in any execution path, appears because you're declaring oSearchRoutines with New in your first example.
This is unnecessary because you're assinging a new value to it on the line...

```<code>oSearchRoutines = 'WcfCallThatReturnsSearchClient
</code>```

...before using it anywhere.

Thus you can just declare it without the keyword New

```<code>Dim oSearchRoutines As SearchClient
</code>```

Related question: VB.NET: impossible to use Extension method on System.Object instance

Body:
Using VB.NET, I'm trying to clean up a code base following ReSharper's guidelines. I currently have the following code:

'oSearchInput is defined outside this question
Dim oSearchRoutines As New SearchClient
Dim oSearchResults As List(Of SearchResult)

oSearchRoutines = 'WcfCallThatReturnsSearchClient

oSearchResults = oSearchRoutines.getSearchResults(oSearchInput).ToList

Now this works completely fine, but ReSharper warns that As New SearchClient has 'Value assigned is not used in any execution path'. So I removed that part to get this code:

'oSearchInput is defined outside this question
Dim oSearchRoutines
Dim oSearchResults As List(Of SearchResult)

oSearchRoutines = 'WcfCallThatReturnsSearchClient

oSearchResults = oSearchRoutines.getSearchResults(oSearchInput).ToList

If I'm understanding this correctly, everything should work exactly the same. However, an error is thrown when calling ToList:

Public member 'ToList' on type 'SearchResult()' not found.

I'm not exactly sure why there's any difference between the two snippets I have here.

Body:
Because you're not assinging the type SearchClient in your second example, oSearchRoutines will automatically be of type Object.

An expression of type Object is mainly not allowed to use Extension methods, like for example the ToList-method. For further information see here

The following example illustrates this behaviour:

Dim x As Object
Dim y As String = "ABC"
x = y

Dim a As List(Of Char) = y.ToList() 'This will work
Dim b As List(Of Char) = x.ToList() 'This will throw a System.MissingMemberException

The message Value assigned is not used in any execution path, appears because you're declaring oSearchRoutines with New in your first example.
This is unnecessary because you're assinging a new value to it on the line...

oSearchRoutines = 'WcfCallThatReturnsSearchClient

...before using it anywhere.

Thus you can just declare it without the keyword New

Dim oSearchRoutines As SearchClient

Related question: VB.NET: impossible to use Extension method on System.Object instance


问:
How to select all leaf nodes using XPath expression?
I believe it's possible but couldn't figure out the syntax. Something like this:

```<code>xmlNode.SelectNodes("//*[count(child::*) <= 1]")
</code>```

but this is not correct.

答:
I'm adding this XSLT answer since it seems google's front matches lack such a solution:

After a long struggle with extracting CDATA as XML, eventually, this expression worked best for me:

```<code><xsl:template match="*[not(child::*)]/text()">
</code>```

ContentLicense: CC BY-SA 2.5

Body:
I believe it's possible but couldn't figure out the syntax. Something like this:

xmlNode.SelectNodes("//*[count(child::*) <= 1]")

but this is not correct.

Body:
I'm adding this XSLT answer since it seems google's front matches lack such a solution:

After a long struggle with extracting CDATA as XML, eventually, this expression worked best for me:

<xsl:template match="*[not(child::*)]/text()">


问:
Does AWS offer inter-region / cross region VPC Peering?
AWS inter-region / cross region VPC Peering

We have been using VPC peering for connecting two VPCs within a region. It works great and eliminates the need for a VPN. As we expand to other regions, we use VPNs to connect the VPCs across regions. VPN scaling and HA are two big issues and the connectivity is not robust. Is it possible to create VPC peering between two regions in AWS?

答:
AWS announced on Nov 29, 2017, that AWS started supporting inter-region VPC peering and on Feb 20, 2018 added 9 additional regions.

Amazon EC2 now allows peering relationships to be established between Virtual Private Clouds (VPCs) across different AWS regions. Inter-Region VPC Peering allows VPC resources like:

EC2 instances

RDS databases

Lambda functions

running in different AWS regions to communicate with each other using private IP addresses, without requiring gateways, VPN connections or separate network appliances. As of Feb 20, 2018, inter-region VPC peering is available in:

us-east-1 (N. Virginia) (added Nov 29, 2017)

us-east-2 (Ohio) (added Nov 29, 2017)

us-west-1 (Northern California) (added Feb 20, 2018)

us-west-2 (Oregon) (added Nov 29, 2017)

ap-south-1 (Mumbai) (added Feb 20, 2018)

ap-southeast-1 (Singapore) (added Feb 20, 2018)

ap-southeast-2 (Sydney) (added Feb 20, 2018)

ap-northeast-1 (Tokyo) (added Feb 20, 2018)

ca-central-1 (Central) (added Feb 20, 2018)

eu-west-1 (Ireland) (added Nov 29, 2017)

eu-west-2 (London) (added Feb 20, 2018)

eu-west-3 EU (Paris) (added Feb 20, 2018)

sa-east-1 (São Paulo) (added Feb 20, 2018)

For more information: Announcing Support for Inter-Region VPC Peering

Horizontally scaled

Highly available

Encrypts inter-region traffic

No single point of failure or bandwidth bottleneck

Traffic always stays on the global AWS backbone and never traverses the public internet

Reduces threat vectors, such as common exploits and DDoS attacks


问:
Hide and show div in multiple div aligned side by side
I'm working on an event onclick. I would like to have numerous onclick event in each cells and I want that the div to be equal size (no matter the number) that means the text showing AND that it doesn't the full screen but stay within the width of the border,  and most of all I want to know how can I make just one click event open at a time. Fore example if a user click on the first one I don't want the second to open.

    function show() {
        if(document.getElementById('benefits').style.display=='none') {
            document.getElementById('benefits').style.display='block';
        }
        return false;
    }
    function hide() {
        if(document.getElementById('benefits').style.display=='block') {
            document.getElementById('benefits').style.display='none';
        }
        return false;
    }   ```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#opener{    background-color: #07183d;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;}
#benefits{ background-color: #07183d;
    border: none;
    color: white;
    padding: 15px 32px;    text-decoration: none;
    display: inline-block;
    font-size: 16px;}}
a{text-decoration:none;}
a:visited{text-decoration:none;color: white;}
#upbutton {border:1px dotted white;
}</code>```

SOCIETES: 400

Part CAC 40 : 15 700
Part Filiales +100M€: 9 700
% contacts IT: 21%

fermer

CONTACTS: 400

Part CAC 40 : 15 700
Part Filiales +100M€: 9 700
% contacts IT: 21%

fermer

 ```

答:
Do you want it displayed like this? Or do you want to hide the other one once one of them is displayed?
How the following code works:

We changed the id to classes to apply the same CSS style as demonstrated below.

Each of the div tags can have a seperate id say b1,b2 and so on. For this, we can call the hide and show functions by passing the parameter '1' for b1, '2' for b2 and so on.

When we obtain the id in the javascript function, we just append the passed parameter with 'b'. Example : For b1 when onclick is invoked, the javascript gets the id by ('b'+1) which is b1 and applies the css for it individually. The same criteria is applied for both show() and hide() and it works as you can see from the code snippet below.

Hope, it helps.

function show(id) {
        if(document.getElementById('b'+id).style.display=='none') {
            document.getElementById('b'+id).style.display='block';
        }
        return false;
    }
    function hide(id) {
        if(document.getElementById('b'+id).style.display=='block') {
            document.getElementById('b'+id).style.display='none';
        }
        return false;
    }```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.opener {
  background-color: #07183d;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
}

.benefits {
  background-color: #07183d;
  border: none;
  color: white;
  padding: 15px 32px;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  width:300px;
}

}
a {
  text-decoration: none;
}
a:visited {
  text-decoration: none;
  color: white;
}
#upbutton {
  border: 1px dotted white;
}</code>```

SOCIETES: 400

Part CAC 40 : 15 700
Part Filiales +100M€: 9 700
% contacts IT: 21%

fermer

CONTACTS: 400

Part CAC 80 : 30 923
Part Filiales +300M€: 3 600
% contacts cs: 51%

fermer

```

Body:
I'm working on an event onclick. I would like to have numerous onclick event in each cells and I want that the div to be equal size (no matter the number) that means the text showing AND that it doesn't the full screen but stay within the width of the border,  and most of all I want to know how can I make just one click event open at a time. Fore example if a user click on the first one I don't want the second to open.

    function show() {
        if(document.getElementById('benefits').style.display=='none') {
            document.getElementById('benefits').style.display='block';
        }
        return false;
    }
    function hide() {
        if(document.getElementById('benefits').style.display=='block') {
            document.getElementById('benefits').style.display='none';
        }
        return false;
    }

#opener{    background-color: #07183d;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;}
#benefits{ background-color: #07183d;
    border: none;
    color: white;
    padding: 15px 32px;    text-decoration: none;
    display: inline-block;
    font-size: 16px;}}
a{text-decoration:none;}
a:visited{text-decoration:none;color: white;}
#upbutton {border:1px dotted white;
}

SOCIETES: 400

Part CAC 40 : 15 700
Part Filiales +100M€: 9 700
% contacts IT: 21%

fermer

CONTACTS: 400

Part CAC 40 : 15 700
Part Filiales +100M€: 9 700
% contacts IT: 21%

fermer

Body:
Do you want it displayed like this? Or do you want to hide the other one once one of them is displayed?
How the following code works:

We changed the id to classes to apply the same CSS style as demonstrated below.

Each of the div tags can have a seperate id say b1,b2 and so on. For this, we can call the hide and show functions by passing the parameter '1' for b1, '2' for b2 and so on.

When we obtain the id in the javascript function, we just append the passed parameter with 'b'. Example : For b1 when onclick is invoked, the javascript gets the id by ('b'+1) which is b1 and applies the css for it individually. The same criteria is applied for both show() and hide() and it works as you can see from the code snippet below.

Hope, it helps.

function show(id) {
        if(document.getElementById('b'+id).style.display=='none') {
            document.getElementById('b'+id).style.display='block';
        }
        return false;
    }
    function hide(id) {
        if(document.getElementById('b'+id).style.display=='block') {
            document.getElementById('b'+id).style.display='none';
        }
        return false;
    }

.opener {
  background-color: #07183d;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
}

.benefits {
  background-color: #07183d;
  border: none;
  color: white;
  padding: 15px 32px;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  width:300px;
}

}
a {
  text-decoration: none;
}
a:visited {
  text-decoration: none;
  color: white;
}
#upbutton {
  border: 1px dotted white;
}

<div class="opener"><a href="#1" name="1" onclick=" show('1');">SOCIETES: 400</a></div>
<div class="benefits" id="b1" style="display:none;">Part CAC 40 : 15 700<br/>Part Filiales +100M€: 9 700<br/>% contacts IT: 21%
  <div id="upbutton"><a onclick=" hide('1');">fermer</a></div>
</div>

<div class="opener"><a href="#1" name="1" onclick=" show('2');">CONTACTS: 400</a></div>
<div class="benefits" id="b2" style="display:none;">Part CAC 80 : 30 923<br/>Part Filiales +300M€: 3 600<br/>% contacts cs: 51%
  <div id="upbutton"><a onclick=" hide('2');">fermer</a></div>
</div>


问:
Pandas columns line intersection
I've got a pandas dataframe where each column represents the y values of a descending line from 1 to 0 and the indexes represent the x values. Now I'm interested in finding the intersection points between these lines and a given constant (linearly interpolated).

Example of the desired output:

```<code>>>> df = pd.DataFrame({'y1': [1, .7, .4, .1, 0],
                       'y2': [1, .9, .7, .3, 0],
                       'y3': [1, .6, .3, .2, 0],
                       'y4': [1, .7, .5, .3, 0]}, index=[0, 10, 20, 30, 40])
>>> xs = get_intersection(df, .5)
>>> xs
{'x1': 16.6667,  # = scipy.interpolate.interp1d([.7, .4], [10, 20])(.5)
 'x2': 25.0,     # =                   interp1d([.7, .3], [20, 30])(.5)
 'x3': 13.3332,  # =                   interp1d([.6, .3], [10, 20])(.5)
 'x4': 20}       # No interpolation required
</code>```

My data consists of roughly 400 rows and 50.000 columns.

possible solution:

I found this SO answer that finds the intersection points between two lines with the following method:

```<code>idx = np.argwhere(np.diff(np.sign(f - g)) != 0).reshape(-1) + 0
</code>```

I think this can be adjusted to work with my dataframes, but I'm not sure how to proceed from here:

```<code>>>> idx = np.argwhere(np.diff(np.sign(df - .5), axis=0) != 0)
>>> idx
array([[1, 0],
       [1, 2],
       [1, 3],
       [2, 1],
       [2, 3]], dtype=int64)
</code>```

Since people seem to misunderstand the question, I'm interested in finding these points:

Which can be found by linearly interpolating the two nearest points.

Solution:
B. M. gave me a step in the right direction:

```<code>def get_intersection(df, c):
    dfind = len(df) - df.loc[::-1].apply(np.searchsorted, args=(c,), raw=True)

    result = {}
    for i, v in enumerate(dfind):
        result[df.columns.values[i]] = interp1d([df.iloc[v][i], df.iloc[v - 1][i]], [df.index[v], df.index[v - 1]])(.5)

    return result

>>> get_intersection(df, .5)
{'y1': array(16.666666666666668), 'y2': array(25.0), 'y3': array(13.333333333333332), 'y4': array(20.0)}
</code>```

答:
since you need 1D function (interp1d), loops are as clear, easy to read, and speed as pandas functions. use np.searchsorted to find the good segment :

```<code>d = dict()
ind=df.index.values
for k,v in df.iteritems():
    y=v.values
    i=len(y)-np.searchsorted(y[::-1],0.5) #indices
    sl = slice(i-1,i+1)
    d[k]= +scipy.interpolate.interp1d(v[sl],ind[sl])(.5)

print (pd.Series(d))

# y1    16.666667
# y2    25.000000
# y3    13.333333
# y4    20.000000
# dtype: float64
</code>```

Probably this must be tuned if no intersection point exists.

Title: Pandas columns line intersection

Body:
I've got a pandas dataframe where each column represents the y values of a descending line from 1 to 0 and the indexes represent the x values. Now I'm interested in finding the intersection points between these lines and a given constant (linearly interpolated).

Example of the desired output:

>>> df = pd.DataFrame({'y1': [1, .7, .4, .1, 0],
                       'y2': [1, .9, .7, .3, 0],
                       'y3': [1, .6, .3, .2, 0],
                       'y4': [1, .7, .5, .3, 0]}, index=[0, 10, 20, 30, 40])
>>> xs = get_intersection(df, .5)
>>> xs
{'x1': 16.6667,  # = scipy.interpolate.interp1d([.7, .4], [10, 20])(.5)
 'x2': 25.0,     # =                   interp1d([.7, .3], [20, 30])(.5)
 'x3': 13.3332,  # =                   interp1d([.6, .3], [10, 20])(.5)
 'x4': 20}       # No interpolation required

My data consists of roughly 400 rows and 50.000 columns.

possible solution:

I found this SO answer that finds the intersection points between two lines with the following method:

idx = np.argwhere(np.diff(np.sign(f - g)) != 0).reshape(-1) + 0

I think this can be adjusted to work with my dataframes, but I'm not sure how to proceed from here:

>>> idx = np.argwhere(np.diff(np.sign(df - .5), axis=0) != 0)
>>> idx
array([[1, 0],
       [1, 2],
       [1, 3],
       [2, 1],
       [2, 3]], dtype=int64)

Since people seem to misunderstand the question, I'm interested in finding these points:

Which can be found by linearly interpolating the two nearest points.

Solution:
B. M. gave me a step in the right direction:

def get_intersection(df, c):
    dfind = len(df) - df.loc[::-1].apply(np.searchsorted, args=(c,), raw=True)

    result = {}
    for i, v in enumerate(dfind):
        result[df.columns.values[i]] = interp1d([df.iloc[v][i], df.iloc[v - 1][i]], [df.index[v], df.index[v - 1]])(.5)

    return result

>>> get_intersection(df, .5)
{'y1': array(16.666666666666668), 'y2': array(25.0), 'y3': array(13.333333333333332), 'y4': array(20.0)}

Body:
since you need 1D function (interp1d), loops are as clear, easy to read, and speed as pandas functions. use np.searchsorted to find the good segment :

d = dict()
ind=df.index.values
for k,v in df.iteritems():
    y=v.values
    i=len(y)-np.searchsorted(y[::-1],0.5) #indices
    sl = slice(i-1,i+1)
    d[k]= +scipy.interpolate.interp1d(v[sl],ind[sl])(.5)

print (pd.Series(d))

# y1    16.666667
# y2    25.000000
# y3    13.333333
# y4    20.000000
# dtype: float64

Probably this must be tuned if no intersection point exists.


问:
How to export request Json string using DeveloperTools/Network of FF or Chrome
We want to rewrite a large web project. To make the work more safe we want to cover it by numerous API tests that will be extracted from peeking at the real web calls. (And let us be honest, from the code analysis, too).

Thus I am trying to extract the Json strings sent by different requests. The problem is that the tool provided by the browser (it is practically the same for both FF and Chrome) gives me the Json in a structured form. And I need to use it as strings.

To rewrite all large and deeply structured strings from more than a hundred of requests manually is a horror. How can I copypaste the string representation of request parameters?

答: I have found that in Chrome - near the "request payload" header there is a switch: view source <-> view parsed. The first variant shows the Json string. BTW, IE has buttons for that and FF... has nothing?


问:
Getting body part headers with IMAP C-Client
I am using UW IMAP c-client v. 2007e and I couldn't find the following function: I need to retrieve a header of certain body part. I.e., the mail message contains multiple body parts, and one of them is an attachment looking like this:

```<code>  --_004_57D6D2035A40B8ECEBA59CB9C13F52A1334093MBXC18_
  Content-Type: text/plain; name="func.txt"
  Content-Description: func.txt
  Content-Disposition: attachment; filename="func.txt"; size=604;
    creation-date="Thu, 12 Aug 2010 18:41:40 GMT";
    modification-date="Thu, 12 Aug 2010 18:41:40 GMT"
  Content-Transfer-Encoding: base64

  ...blah-blah-blah in base64...
</code>```

Now, I can retrieve the blah-blah part with imap_fetchbody() but I don't see the function that can give me only the headers part (or headers+body, that would be OK too). I can get whole message text, but then I'd have to parse it myself into parts, which I don't want to do. Is there a way I could make c-client retrieve this header for certain part?

答:
You want the MIME section of the part.  From the IMAP RFC:

The MIME part specifier refers to the [MIME-IMB] header for
this part.

The c-client function for doing a FETCH is:

```<code>long imap_msgdata (MAILSTREAM *stream,unsigned long msgno,char *section,
                   unsigned long first,unsigned long last,STRINGLIST *lines,
                   long flags)
</code>```

So if you want the headers from part 2.3 of message #8 (for instance), you'd call it as:

```<code>imap_msgdata(stream, 8, "2.3.MIME", 0, 0, null, FT_PEEK);
</code>```

(FT_PEEK keeps the message from being marked as \Seen.  If you want to mark the message read, pass 0 as the last argument.)

Body:
I am using UW IMAP c-client v. 2007e and I couldn't find the following function: I need to retrieve a header of certain body part. I.e., the mail message contains multiple body parts, and one of them is an attachment looking like this:

  --_004_57D6D2035A40B8ECEBA59CB9C13F52A1334093MBXC18_
  Content-Type: text/plain; name="func.txt"
  Content-Description: func.txt
  Content-Disposition: attachment; filename="func.txt"; size=604;
    creation-date="Thu, 12 Aug 2010 18:41:40 GMT";
    modification-date="Thu, 12 Aug 2010 18:41:40 GMT"
  Content-Transfer-Encoding: base64

  ...blah-blah-blah in base64...

Now, I can retrieve the blah-blah part with imap_fetchbody() but I don't see the function that can give me only the headers part (or headers+body, that would be OK too). I can get whole message text, but then I'd have to parse it myself into parts, which I don't want to do. Is there a way I could make c-client retrieve this header for certain part?

Body:
You want the MIME section of the part.  From the IMAP RFC:

The MIME part specifier refers to the [MIME-IMB] header for
this part.

The c-client function for doing a FETCH is:

long imap_msgdata (MAILSTREAM *stream,unsigned long msgno,char *section,
                   unsigned long first,unsigned long last,STRINGLIST *lines,
                   long flags)

So if you want the headers from part 2.3 of message #8 (for instance), you'd call it as:

imap_msgdata(stream, 8, "2.3.MIME", 0, 0, null, FT_PEEK);

(FT_PEEK keeps the message from being marked as \Seen.  If you want to mark the message read, pass 0 as the last argument.)


问:
Javascript - Get value of url of OpenLayers Vector Source
I have create a Vector source and specified a url for the source. What I want to do now is get the value of that url (in string) from somewhere else. Is that possible?

```<code>var sourceChitwan = new ol.source.Vector({
url: chitwanURL,
format: new ol.format.GeoJSON()
});
</code>```

chitwanURL is a string containing the url.
I want the url from somewhere else. I tried sourceChitwan.getUrl() but it returns undefined.

答:
The problem is solved but I will leave here the solution so anyone with a similar problem in the future can find it easily without reading all the comments:

Openlayers class ol.source.Vector does not have a method to get the URL in the API version 3. It is necessary to upload to version 4 to find it.

Body:
I have create a Vector source and specified a url for the source. What I want to do now is get the value of that url (in string) from somewhere else. Is that possible?

var sourceChitwan = new ol.source.Vector({
url: chitwanURL,
format: new ol.format.GeoJSON()
});

chitwanURL is a string containing the url.
I want the url from somewhere else. I tried sourceChitwan.getUrl() but it returns undefined.


问:
What is the difference between /PDB and /Fd options
There is the /Fd option for the compiler and the /PDB option for the linker. While /PDB defaults to $(OutDir)$(TargetName).pdb, the compiler option /Fd defaults to $(IntDir)vc$(PlatformToolsetVersion).pdb. Thus, two files are generated during a build. According to the documentation both are called Program Database File and both are related to debug information. What is the difference between both files?

答:
The VCxxx.pdb file is primarily necessary for static library projects.  It stores the debug info for the library.  The linker needs it when it generates the final PDB file that the debugger uses, it picks the relevant debug info records for the actual functions it links into the final image.

Does some other stuff as well, murky, I think it supplies dependency info.  It got more convoluted with the /Debug:FASTLINK option available since VS2015 Update 1, now it also provides debug info at runtime.  Which trades the effort of generating a complete PDB, quite expensive for large projects, with the debugger spending more time to dig up the VCxxx.pdb files.  Almost always a win.  I never yet found a good reason to override /Fd, but always preferred default build options.


问:
How to find the second minimum number without using arrays or loops
I tried to write a program that receive from the user 5 integers and print the second minimum number.

Here is a sample of what I've tried:

```<code>#include <iostream>
using namespace std;
int main () {
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if (a>b && a<c && a<d && a<e)
    cout<<a<<endl;
if (b>a && b<c && b<d && b<e)
    cout<<b<<endl;
if (c>a && c<b && c<d && c<e)
    cout<<c<<endl;
if (d>a && d<b && d<c && d<e)
    cout <<d<<endl;
if (e>a && e<b && e<c && e<d)
cout <<e<<endl;
return 0;

}
</code>```

When I enter 1 2 3 4 5 it prints the second minimum, but when I enter

5 4 3 2 1 Nothing will print on the screen. What am I doing wrong with this? Is there any other way to write my program?

答:
This should work for you. (Note that it might not be the best approach and you can minimize it with a function to calculate min and secondMin instead of the ugly copy paste of the logic but it will get you started:

```<code>#include <iostream>
using namespace std;
int main () {
int a,b,c,d,e;
int min, secondMin;

cin>>a>>b;

min = a < b ? a : b;
secondMin = a < b ? b : a;

cin>>c;

if (c < min)
{
    secondMin = min;
    min = c;
}
else if (c < secondMin)
{
    secondMin = c;
}

cin>>d;

if (d < min)
{
    secondMin = min;
    min = d;
}
else if (c < secondMin)
{
    secondMin = d;
}

cin>>e;

if (e < min)
{
    secondMin = min;
    min = e;
}
else if (e < secondMin)
{
    secondMin = e;
}

cout << "min = " << min << ", secondMin = " << secondMin << endl;

return 0;

}
</code>```

if you have any questions feel free to ask in the comment

Body:
I tried to write a program that receive from the user 5 integers and print the second minimum number.

Here is a sample of what I've tried:

#include <iostream>
using namespace std;
int main () {
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if (a>b && a<c && a<d && a<e)
    cout<<a<<endl;
if (b>a && b<c && b<d && b<e)
    cout<<b<<endl;
if (c>a && c<b && c<d && c<e)
    cout<<c<<endl;
if (d>a && d<b && d<c && d<e)
    cout <<d<<endl;
if (e>a && e<b && e<c && e<d)
cout <<e<<endl;
return 0;

}

When I enter 1 2 3 4 5 it prints the second minimum, but when I enter

5 4 3 2 1 Nothing will print on the screen. What am I doing wrong with this? Is there any other way to write my program?

Body:
This should work for you. (Note that it might not be the best approach and you can minimize it with a function to calculate min and secondMin instead of the ugly copy paste of the logic but it will get you started:

#include <iostream>
using namespace std;
int main () {
int a,b,c,d,e;
int min, secondMin;

cin>>a>>b;

min = a < b ? a : b;
secondMin = a < b ? b : a;

cin>>c;

if (c < min)
{
    secondMin = min;
    min = c;
}
else if (c < secondMin)
{
    secondMin = c;
}

cin>>d;

if (d < min)
{
    secondMin = min;
    min = d;
}
else if (c < secondMin)
{
    secondMin = d;
}

cin>>e;

if (e < min)
{
    secondMin = min;
    min = e;
}
else if (e < secondMin)
{
    secondMin = e;
}

cout << "min = " << min << ", secondMin = " << secondMin << endl;

return 0;

}

if you have any questions feel free to ask in the comment


问:
Is it faster to use two separate SQL statements or one SQL statement with JOIN?
I'm in doubt about the performance by "two or more individual SQL commands" or "1 but using 'join' SQL command".

Here is the thing:

For example, I have two tables: post, user

post has a user_id indicating this post is issued by some user in user

and I'm going to extract both post and username.

I can either

```
SELECT * FROM `post` LEFT JOIN `user` on post.user_id = user.id WHERE 1
```

or

```
$rows = $db->sql("SELEFT * FROM `post` WHERE 1")
for $row in $rows:
    $db->sql("SELECT * FROM `user` WHERE id = $row['user_id']")
```

I'm wondering which one will have better performance?

And what if I have 3 or more tables to join, which way will be better (from the performance perspective)?

答:
The join will almost always be better performance. Even if the data it retrieves is "large", you're still only performing a single query.

It's like buying groceries. Easier to drive to the store ONCE, fill up a cart, and come home with many different items, versus going to the store, buying one thing, coming home, going to the store again, buying another.

Each of those trips adds up and you'll end up spending more time driving than enjoying your groceries.

Body:
I'm in doubt about the performance by "two or more individual SQL commands" or "1 but using 'join' SQL command".

Here is the thing:

For example, I have two tables: post, user

post has a user_id indicating this post is issued by some user in user

and I'm going to extract both post and username.

I can either

SELECT * FROM `post` LEFT JOIN `user` on post.user_id = user.id WHERE 1

or

$rows = $db->sql("SELEFT * FROM `post` WHERE 1")
for $row in $rows:
    $db->sql("SELECT * FROM `user` WHERE id = $row['user_id']")

I'm wondering which one will have better performance?

And what if I have 3 or more tables to join, which way will be better (from the performance perspective)?


问:
Highlighting a cell in excel then moving down
I know 0% VBA and I am in need of help. I need to create a VBA button that will highlight a row of cells and then move down 1 and then when the button is clicked it will repeat the above process.

Here is a snippet of what I am talking about:

I would just want the above to be move down to the next row and then highlight those 3 columns and repeat.

Please let me know if you have any idea how I could implement this for "x" number of rows of data.

Thank you!

EDIT: Code below that I have tried

```<code>Private Sub CommandButton1_Click()
Sub Macro1()
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("A12:C12").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("A13:C13").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End Sub
</code>```

答:
I've tried the following and it worked as you wanted:</p>

```<code>Sub Button1_Click()
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row 'Check the last row with data
For i = 1 To LastRow 'loop until you find the last highlighted cell
    If Sheet1.Cells(i, 1).Interior.Color = 65535 Then
    x = i + 1 ' add one for the next row
    End If
Next i

If x > 1 Then
    Sheet1.Range("A" & x & ":C" & x).Interior.Color = 65535 'add colour to the next cell found in previous loop
Else
    x = 1
    Sheet1.Range("A" & x & ":C" & x).Interior.Color = 65535 'if no cell found in previous loop, highlight the first row
End If
End Sub
</code>```

Body:
I know 0% VBA and I am in need of help. I need to create a VBA button that will highlight a row of cells and then move down 1 and then when the button is clicked it will repeat the above process.

Here is a snippet of what I am talking about:

I would just want the above to be move down to the next row and then highlight those 3 columns and repeat.

Please let me know if you have any idea how I could implement this for "x" number of rows of data.

Thank you!

EDIT: Code below that I have tried

Private Sub CommandButton1_Click()
Sub Macro1()
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("A12:C12").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("A13:C13").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End Sub

Body:
I've tried the following and it worked as you wanted:

Sub Button1_Click()
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row 'Check the last row with data
For i = 1 To LastRow 'loop until you find the last highlighted cell
    If Sheet1.Cells(i, 1).Interior.Color = 65535 Then
    x = i + 1 ' add one for the next row
    End If
Next i

If x > 1 Then
    Sheet1.Range("A" & x & ":C" & x).Interior.Color = 65535 'add colour to the next cell found in previous loop
Else
    x = 1
    Sheet1.Range("A" & x & ":C" & x).Interior.Color = 65535 'if no cell found in previous loop, highlight the first row
End If
End Sub


答:
This would highlight the selected row and move one row down. Then waiting for the next button press.</p>

```<code>Option Explicit

Private Sub HighlightSelectedRowAndMoveDown()
    With Selection.EntireRow      'use the entire row of the selected cell
        .Interior.Color = 65535   'color its background yellow
        .Offset(1, 0).Select      'move selection one row down
    End With
End Sub
</code>```

Title: Highlighting a cell in excel then moving down

Body:
This would highlight the selected row and move one row down. Then waiting for the next button press.

Option Explicit

Private Sub HighlightSelectedRowAndMoveDown()
    With Selection.EntireRow      'use the entire row of the selected cell
        .Interior.Color = 65535   'color its background yellow
        .Offset(1, 0).Select      'move selection one row down
    End With
End Sub


问:
how loads child component before the father
I've got an angular app (TypeScript) setup where a parent component contains another child component within.
City component  (child) makes an Ajax request to load data (cities) which takes approx 2 secs.

```<code>@Component({
    providers: [UserService],
    template: `<city [city]='user.city' (citySelected)="user.city = $event"></city>`

})
export class FormComponent implements OnInit{

    private user:User = new User();

....
</code>```

Problem, I require the city component to load first before the parent component.

答:
Your child component should load first considering how Angular 2 handles component interactions.

I see that you're trying to initialize your User object from the parent component.  Considering how Angular 2 works, your child component would load first, and would not have access to user.city.  The easiest solution for this is to add an *ngIf in your template to delay initialization of the child component in order to wait for the User object to be loaded.

Here is a snippet from the above question that includes the solution I mentioned.

```<code>@Component({
providers: [UserService],
template: `<city *ngIf="user" [city]='user.city'
(citySelected)="user.city = $event"></city>`

})

export class FormComponent implements OnInit{

    private user:User = new User();

}
</code>```

Let me know if anyone needs more clarification. Cheers!

Body:
I've got an angular app (TypeScript) setup where a parent component contains another child component within.
City component  (child) makes an Ajax request to load data (cities) which takes approx 2 secs.

@Component({
    providers: [UserService],
    template: `<city [city]='user.city' (citySelected)="user.city = $event"></city>`

})
export class FormComponent implements OnInit{

    private user:User = new User();

....

Problem, I require the city component to load first before the parent component.

Body:
Your child component should load first considering how Angular 2 handles component interactions.

I see that you're trying to initialize your User object from the parent component.  Considering how Angular 2 works, your child component would load first, and would not have access to user.city.  The easiest solution for this is to add an *ngIf in your template to delay initialization of the child component in order to wait for the User object to be loaded.

Here is a snippet from the above question that includes the solution I mentioned.

@Component({
providers: [UserService],
template: `<city *ngIf="user" [city]='user.city'
(citySelected)="user.city = $event"></city>`

})

export class FormComponent implements OnInit{

    private user:User = new User();

}

Let me know if anyone needs more clarification. Cheers!


问:
download files from vsts package feed

We have certain Chocolatey packages stored in VSTS private package management feed. I'm trying to download a specific package from feed in VSTS in PowerShell. I'm using the below commands:

$user = "my-user-id"

$token = "my-pat-token"

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

$url = "vsts-package-url"

$webClient = New-Object System.Net.WebClient
$webClient.Headers.Add('HttpRequestHeader.Authorization',"Basic $base64AuthInfo")
```

After this, I should be able to download the package when using $webClient.DownloadFile($url, $fileName).

However file contains dummy text expecting me to sign-in and has 401 related details.

Its basically a PowerShell code. Can anyone please advise how should I go about this? I do not want to install the package from feed, only download it.

I was wondering if there is a better way to do this as this process still needs me to prepare package url first which would be different for each package iteration?

答:
It looks like you're creating the auth header incorrectly. Basically, with a PAT, no user name is needed.

I use this snippet of code all the time:

```<code>$pat = 'yourPatHere'
$bytes = [System.Text.Encoding]::ASCII.GetBytes(":$($pat)")
$encodedText =[Convert]::ToBase64String($bytes)

$header = @{Authorization = "Basic $encodedText"}
</code>```

You can then use Invoke-WebRequest to download the feed information:

```<code>Invoke-WebRequest -Uri 'https://uri' -Header $header -Method Get
</code>```

That looks roughly the same as your code, but Invoke-WebRequest is idiomatic PowerShell vs creating a WebClient. Shouldn't matter in the end.

Actually downloading a file from a feed is a different matter. The packages are exposed via standard mechanisms for that specific type of feed. See the documentation. Basically, if you need a NuGet package, you download it from the NuGet feed, not from package management.

Title: download files from vsts package feed

Body:
We have certain Chocolatey packages stored in VSTS private package management feed. I'm trying to download a specific package from feed in VSTS in PowerShell. I'm using the below commands:

$user = "my-user-id"

$token = "my-pat-token"

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

$url = "vsts-package-url"

$webClient = New-Object System.Net.WebClient
$webClient.Headers.Add('HttpRequestHeader.Authorization',"Basic $base64AuthInfo")

After this, I should be able to download the package when using $webClient.DownloadFile($url, $fileName).

However file contains dummy text expecting me to sign-in and has 401 related details.

Its basically a PowerShell code. Can anyone please advise how should I go about this? I do not want to install the package from feed, only download it.

I was wondering if there is a better way to do this as this process still needs me to prepare package url first which would be different for each package iteration?

Body:
It looks like you're creating the auth header incorrectly. Basically, with a PAT, no user name is needed.

I use this snippet of code all the time:

$pat = 'yourPatHere'
$bytes = [System.Text.Encoding]::ASCII.GetBytes(":$($pat)")
$encodedText =[Convert]::ToBase64String($bytes)

$header = @{Authorization = "Basic $encodedText"}

You can then use Invoke-WebRequest to download the feed information:

Invoke-WebRequest -Uri 'https://uri' -Header $header -Method Get

That looks roughly the same as your code, but Invoke-WebRequest is idiomatic PowerShell vs creating a WebClient. Shouldn't matter in the end.

Actually downloading a file from a feed is a different matter. The packages are exposed via standard mechanisms for that specific type of feed. See the documentation. Basically, if you need a NuGet package, you download it from the NuGet feed, not from package management.


问:
Excluding files/folders from VSTS publish
We are using the new VSO/VSTS style build within TFS on premise, 2015 Update 1 as of yesterday.

During the publish build artifacts stage we want to copy all the files/folders from a root bar 2 sub folders.

ie:

```<code>$\somefilestopublish1\...
$\somefilestopublish2\...
$\somefilestoexclude1\...
$\somefilestoexclude2\...
</code>```

Currently I have **\* as the contents argument which obviously will publish everything.  I have tried appending ;-:<exclude_pattern> as suggested by a Google search but that just stopped all output and resulted in an empty folder.

Is there a way to use the minimatch expression to exclude folders or will I need to swap to explicitly selecting the folders to publish instead.

答:
On TFS 2017 Update 1 if you are using the Copy Files task and you want to copy all files from the $(Build.SourcesDirectory) but exclude the $tf folder what I found to work was the following.

In the Contents text box enter the following two lines.

```<code>**\*
!$tf\**
</code>```

This post on social.msdn.microsoft.com is what helped me figure this out.

Body:
We are using the new VSO/VSTS style build within TFS on premise, 2015 Update 1 as of yesterday.

During the publish build artifacts stage we want to copy all the files/folders from a root bar 2 sub folders.

ie:

$\somefilestopublish1\...
$\somefilestopublish2\...
$\somefilestoexclude1\...
$\somefilestoexclude2\...

Currently I have **\* as the contents argument which obviously will publish everything.  I have tried appending ;-:<exclude_pattern> as suggested by a Google search but that just stopped all output and resulted in an empty folder.

Is there a way to use the minimatch expression to exclude folders or will I need to swap to explicitly selecting the folders to publish instead.

Body:
On TFS 2017 Update 1 if you are using the Copy Files task and you want to copy all files from the $(Build.SourcesDirectory) but exclude the $tf folder what I found to work was the following.

In the Contents text box enter the following two lines.

**\*
!$tf\**

This post on social.msdn.microsoft.com is what helped me figure this out.