Posts

elasticsearch - How to use absolute field names in query_string search with 'fields'? -

i have multiple indices , have search performed globally through these indices. how can tell elasticsearch differentiate field article.author.name (where 'article' type, , 'author.name' nested field) author.name (where 'author' type , 'name' top-level attribute)? so, example, if perform such search: curl -x 'http://localhost:9200/*/author,article/_search?pretty' -d '{ "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "tag": "programming" } } ] } }, "query": { "query_string": { "query": "john doe", "fields": ["author.name"] } } } } i want search through name field inside author type. not inside auth...

Android Animation Translation -

Image
my android translation translate left hand side of screen though have specified y transition only. here code : <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fillafter="true"> <scale android:fromxscale="1.0" android:fromyscale="1.0" android:toxscale="0.6" android:toyscale="0.6" android:duration="1000" /> <translate android:fromydelta="0%p" android:toydelta="-15%p" android:duration="1000" /> </set> before image: after image:

bash - "for" loop wildcard evaluated to variable if no such files present -

$ f in /etc/shell*; echo $f; done /etc/shells $ good! $ f in /etc/no_such*; echo $f; done /etc/no_such* $ bad! how can reap off wildcard evaluation if no files present? there specific shell option enable behaviour globs, called nullglob . enable it, use shopt -s nullglob . when option enabled, pattern no matches evaluates nothing, rather itself. this non-standard feature provided bash, if you're using shell or looking more compatible option can add condition loop body: for f in /etc/no_such*; [ -e "$f" ] && echo "$f"; done this echo if file exists.

Join a Line and Ellipse -

i did find how bind line ellipse through xaml, i'm not familiar binding, , though i've researched it, still don't understand how binding work user input. is there way, programmatically have ellipse joined end of line when line rotates on diameter, ellipse rotates it? wrote done in code, not xaml. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; namespace wpfapplication1 { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow : window { public mainwindow() { initializecomponent(); } public void geo() { ...

logging - log with timbre in clojure: how to set timestamp and local? -

i have following code. (timbre/merge-config! {:timestamp-pattern "yyyy/mm/dd hh:mm:ss zz" } ) (info (str "acm template deploy start..., version " version)) but timestamp format not want. how should set format? $ lein run compiling com.rockiedata.dw.acm.template.deploy 15-jun-25 22:13:00 unknownhost info [com.rockiedata.dw.acm.template.deploy] - acm template deploy start..., version 0.1 and how set local, in document said :timestamp-locale nil but how set chinese local? based on documentation https://github.com/ptaoussanis/timbre should following : (timbre/merge-config! {:timestamp-opts {:pattern "yyyy/mm/dd hh:mm:ss zz" :locale (java.util.locale. "zh_cn")}})

maps - Open a popover with by ID - Mapbox -

Image
in mapbox creating overlays using following code within map creation function - http://jsfiddle.net/shanejones/3ajankv9/ i need work out way open popover it's id in separate function. using post here have modified following example should open layer id 1. function next(next_id){ map.featurelayer.eachlayer(function(marker) { if (marker.feature.properties.id == marker_id) { marker.openpopup(); } }); } but give me undefined error know i'm going wrong here? edit - show error when run above function console. thanks i ran problem in past. ended doing this, it's not best solution may out. map.featurelayer.eachlayer(function(marker) { if (marker.feature.properties.id == marker_id) { marker.fireevent('click', { latlng: { lat: marker._latlng.lat, lng: marker._latlng.lng } }); } });

python - Using a decorated function as a function's default argument -

consider module: #mymodule.py import logging def print_start_end(name): """ decorator creates logger , logs start , end of function call """ def decorator(f): logger = logging.getlogger(name) def wrapper(*args, **kwargs): logger.info("start") res = f(*args, **kwargs) logger.info("end") return res return wrapper return decorator @print_start_end(__name__) def f(x): return x def g(y=f(3)): return y and example script: import logging mymodule import f logger = logging.getlogger("") logger.setlevel(logging.info) h = logging.streamhandler() h.setlevel(logging.info) logger.addhandler(h) print f(3) output: start end 3 the decorator working. write script use g instead of f : import logging mymodule import g logger = logging.getlogger("") logger.setlevel(logging.info) h = logging.streamhandler() h....