Posts

To find difference between two integer fields and check it falls under a specific range, using scripts in elasticsearch -

i have 2 fields,let name them "fielda" , "fieldb" in documents , need find difference between them , check if value falls under specific range "rangea" or " rangeb" , return documents matches criteria. schema data shown below: { "fielda": 45 "fieldb":13 } i need find document have difference between "fielda" , "fieldb" in between 30 , 35. how can using scripting in elasticsearch? this can done using aggregations , scripts below: { "aggregations": { "age_diff": { "range": { "script": "doc[\"fielda\"].value - doc[\"fieldb\"].value", "ranges": [ { "from": 30, "to": 35 } ] } } } } this way can check how many documents falls under specified range.but if want...

Android Custom Dialog Display -

my custom dialog layout has 2 edit text fields. <edittext android:id="@+id/e2" android:inputtype="none" android:longclickable="false" android:selectallonfocus="true" android:textisselectable="true" /> <edittext android:id="@+id/e2" android:inputtype="none" android:longclickable="false" android:selectallonfocus="true" android:textisselectable="true" /> i implement class using onfocuschangelistener . my idea when click text field, 1 custom popup dialog appears select pre-defined value. it work correctly have minor problem. if click editext 1 => dialog apear (i select button dismisses) => click editext 2 => dialig appear (i select button dismisses). however, if if click editext 1 => dialog appears (i select button dismisses), click on editext 1 again (even many times try), dialog not show (in expectation, shoul...

C++ overloading of << or >> example and explanation -

this question has answer here: what basic rules , idioms operator overloading? 7 answers i learning c++ , don't understand how << , >> operator overloading works. can please provide example and/or explanation of method overloads either operator? class { int x; public: a(int _x) : x(_x){} friend ostream& operator<<(ostream& os, elem); }; ostream& operator<<(ostream& os, elem) { os << elem.x; return os; } then can call std::cout << a(5); //prints 5 explanation: you're doing in here, making friend function class. we're making friend because want refer private fields. if have struct, don't have declare friend. we're returning ostream& can "chaining" - cout << x << y wouldn't work if returned ostream . we're taking referen...

Chrome not loading CSS source maps? -

Image
until recently, chrome browser loading css source map files correctly. now, not. the setting on: and css files have source mapping tag @ bottom: /*# sourcemappingurl=home.cshtml.css.map */ but network tab , fiddler2 show chrome not trying load source map file. is there i'm missing? sourcemappingurl syntax correct? i've toggled "enable css source maps" setting on , off. chrome version: 44.0.2403.30 beta-m sourcemap files generated web essentials in vs 2013. you can try following steps: 1- delete map file , regenerate again. 2- using chrome inspector, go settings > general , click on button "restore defaults , reload"

sql server - Composite Primary key vs. Auto-Increment Primary key -

i looking little advice on how proceed table have been importing case data department: id creationdate closeddate lastupdatedate name description de5838 2015-06-02 06:14:11.11 null 2015-06-02 06:19:33.33 : should updated ... description : not defect… de5834 2015-06-01 16:16:03.03 null 2015-06-01 16:24:19.19 sync error ultimate packages... getting error .... de5822 2015-06-01 10:37:10.10 null 2015-06-01 10:37:10.10 terminal subscription has expired... given terminal serial number… de5818 2015-06-01 09:53:44.44 null 2015-06-01 09:53:44.44 no option code… allie pulled report.... for quite time, (and without of data definition outside department), have been treating id field pk - starting see other department has been recycling these id numbers ( i know, know - really bad idea )...

Understanding an error returned by stargazer in R -

i trying reproduce simplified version of r output described in this posting . more generally, related attempt use stargazer() function generate latex table lmer object. following author's posting, i've loaded appropriate libraries , created 2 lmer objects using following code: library(lme4) library(stargazer) data(cake) m1 <- lmer(angle ~ temp + (1 | replicate) + (1|recipe:replicate), cake, reml= false) m2 <- lmer(angle ~ factor(temperature) + (1 | replicate) + (1|recipe:replicate), cake, reml= false) when attempt following code, returns error below: stargazer(m1, m2, style="ajps", title="an illustrative model using cake data", dep.var.labels.include = false, covariate.labels=c( "temperature (continuous)", "temperature (factor $<$ 185)", "temperature (factor $<$ 195)", "temperature (factor $<$ 205)", "temperature (factor $<$ 215)", "temperature (factor $<$ 225...

javascript - show nth-child number when click - turn nth-child number into a variable -

this question has answer here: get element's nth-child number in pure javascript 4 answers i need javascript show me nth-child number when click li. example if click "apple" console.log show me "2". want turn nth-child number variable. <!doctype html> <html> <head> <style type="text/css"> li:nth-child(1) b {color: #eeaa33;} li:nth-child(2) b {color: #0000ff;} li:nth-child(3) b {color: #ff3300;} </style> </head> <body> <ul class="menu"> <li><b>apple</b></li> <li><b>watermelon</b></li> <li><b>blueberry</b></li> </ul> <script> //i need javascript show me nth-child n...