Posts

ElasticSearch: greater between two aggregations -

i'm new elasticsearch , trying greater value between 2 aggregations, possible? need greater between avg_field1 , avg_field2. i thinking in try use script: max , didn't find example of usage.. don't know if it's possible. my aggregations now: { "aggs" : { "group_by_frame" : { "histogram" : { "field" : "index_histogram", "interval" : 100 }, "aggs" : { "avg_field1" : { "avg" : { "field" : "field1" } }, "avg_field2" : { "avg" : { "field" : "field2" } } } } } please see answer here: elastic search sum of aggregated values basically cannot aggregate on different aggregations.

r - Fastest way to map a new data frame column based on two other columns -

i have data frame looks this: id|value 01| 100 01| 101 01| 300 #edited case left out 02| 300 03| 100 03| 101 04| 100 and add new column looks @ both id , values assigned each id. for example: if id has both value 100 , 101 add category a. if id has value of 300 add category b. if id has 1 value (either 100 or 101, not both) assign category c. result: id|value|category 01| 100 | 01| 101 | 01| 300 | b #edited case left out 02| 300 | b 03| 100 | 03| 101 | 04| 100 | c i understand can loop through , assign category, question whether there faster vectorized way? a couple of options data.table we number of elements per 'id' '100', '101' , add them together. output 0, 1, or 2 corresponding none, single element, or both present. can converted factor , change labels 'a' '2', 'b' '0' , 'c' '1'. library(data.table) setdt(df2)[, indx:=sum(unique(value)==100)+sum(unique(value)==101), ...

google chrome - GAS not working on windows machine -

i created application using gas , html service. works on safari , chrome on mac, using different logins google apps account, same accounts, not run on of browsers in windows machine. regards, arjun code load page function doget(e) { logger.log( utilities.jsonstringify(e) ); if (!e.parameter.page | e.parameter['page'] == 'index'){ var template = htmlservice.createtemplatefromfile('index'); var htmloutput = template.evaluate() .setsandboxmode(htmlservice.sandboxmode.iframe); return htmloutput; } return htmlservice.createtemplatefromfile(e.parameter['page']).evaluate(); } the page not loading <style type="text/css"> #header { height:100px; background:green; font-size:300%; color: black; align-content: centre; } body { padding: 50px; } .animate { transition: 0.1s; -webkit-transition: 0.1s; } .action-button { position: relative; padding: 10px 40px; margin: 0px 10px 10px ...

php - Composer: Prefer VCS Repository over Packagist -

i'd use adldap/adldap library in php based project. while maintainer of package has not added package packagist, have included composer.json file. so, normally, i'd add following my composer.json , , go day. "repositories": [ { "type": "vcs", "url": "https://github.com/adldap/adldap" }], "require": { /* other packages */ "adldap/adldap":"4.04" }, however, won't work, because adldap/adldap claimed by different project in packagist , , composer assumes want packagist package. (making things more complicated, packagist package fork of original project, , fork isn't accepting upstream changes). is there way tell composer prefer version configured vcs repository? or stuck forking package myself, changing name, , pointing composer fork? (or 1 of other forks maintained work around issue?) the problem package that, "v4.0.4" version branch doesn...

cq5 - AEM6. XML import to JCR(Oak) -

during migration site cq5.4 aem6 i've faced problem in importing xml data jcr. on cq5.4 used "content loader tool"(http(s)://[host]:[port]/crx/loader/index.jsp ) load xml jcr. starting cq5.6.1 tool deprecated , gone. aem6 doesn't have also, same several crx:xml* primary node types(crx:xmlcharacterdata, crx:xmldocument, crx:xmlelement, crx:xmlnode). i've tried re-import data programmatically, below sample groovy script importxml(); def importxml(){ fileinputstream inputstream = new fileinputstream("c:/data.xml "); // xml file session.importxml("/content/xmlnode", // destination jcr node inputstream , javax.jcr.importuuidbehavior.import_uuid_create_new); session.save(); } but import result, lost sibling data. imported data has 1 node on each layer in jcr. reason oak doesn't support same name siblings (sns). http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/introduction-to-oak.html http://j...

javascript - PHP / JQUERY - display each sub array of json -

i have post script below, current script output this. ["error1","error2","error3"] ["good1","good2","good3"] i want output each error in separate paragraph , each in paragraph php script $error[] = "error1"; $error[] = "error2"; $error[] = "error3"; $good[] = "good1"; $good[] = "good2"; $good[] = "good3"; $data["error"] = json_encode($error); $data["good"] = json_encode($good); die(json_encode($data)); jquery script function _request() { $("form").submit(function(e) { e.preventdefault(); $.ajax( { url: $(this).attr("action"), type: "post", data: $(this).serializearray(), datatype: 'json', ...

windows 7 - Powershell to Script to Add Part of a Grandparent Folder to Child Item Names -

at work, maintain large (500+) file system of company's clients. each client has own folder, subfolders years, , account files in each year folder. on client's folder, their name , six-digit identifier number. facilitate upcoming audit, asked attach 6 digit identifier number on grandparent folder each of child item account files. there way specify portion of grandparent's folder add child item? if so, script? p.s. apologize, new coding, i'm actively trying learn powershell. sounds need learn regular expressions . $grandparent = 'c:\bobby 123456\2014\bobby 15-5555' if ($grandparent -match 'c:\\(?<name>.*)\s(?<idcode1>\d{6})\\(?<year>\d{4})\\.*\s(?<idcode2>\d{2}-\d{4})'){ $matches.name $matches.idcode1 $matches.year $matches.idcode2 "{0} {1} {2}" -f $matches.name,$matches.idcode2,$matches.idcode1 } here favorite reference regex .