Posts

Featured post

Python Pandas join aggregated tables -

i have data frame 2 columns: product_id , rating. i'm trying join 2 tables. 1 obtained from a = data.groupby('product_id').count() the other one b = data.groupby('product_id').mean() i'd have table has on columns the product_id count mean try: data.groupby('product_id').agg(['mean', 'count'])

c# - Bluetooth LE CanUpdate Characteristic property -

i building xamarin.forms cross platform mobile app, uses monkey.robotics bluetoth low energy functionality. connecting mbed based implimentation of custom gatt service . in xamarin c#, triggers characteristic. canupdate property in monkey.robotics? this standard example c# based on: if (characteristic.canupdate) { characteristic.valueupdated += (s, e) => { debug.writeline("characteristic.valueupdated"); device.begininvokeonmainthread( () => { updatedisplay(characteristic); }); isbusy = false; // spin until first result received }; isbusy = true; characteristic.startupdates(); } this has been working, since changed own custom gatt service connecting to, canupdate property false. property , how triggered? me debugging gatt service code. thanks monkey.robotics open sour

JavaScript - Replace variable from string in all occurrences -

ok, know if have character '-' , want remove in places in string javascript, ... someword = someword.replace(/-/g, ''); but, when applying array of characters, s not working ... const badchars = ('\/:*?"<>|').split(''); let filename = title.replace(/ /g, '-').tolocalelowercase(); (let item = 0; item < badchars.length; item++) { // below not work global '/ /g' filename = filename.replace(/badchars[item]/g, ''); } any ideas? /badchars[item]/g looks badchars , literally, followed i , t , e , or m . if you're trying use character badchars[item] , you'll need use regexp constructor, , you'll need escape regex-specific characters. escaping regular expression has been well-covered . using that: filename = filename.replace(new regexp(regexp.quote(badchars[item]), 'g'), ''); but , don't want that. want character class: let filename = title.replac

java - Static nested class instance -

this question has answer here: java inner class , static nested class 23 answers i came across in java, know static nested class why create instance of 'static'. isn't whole idea of 'static' use without instance? understand concept of inner classes, why (and frankly how possible to) create 'instance' of 'static' member @ ? why this: 1- outerclass.staticnestedclass nestedobject = new outerclass.staticnestedclass(); 2- nestedobject.anestedclassmethod(); and not this: 1- outerclass outerinstance=new outerclass(); 2- outerinstance.staticnestedclass.anestedclassmethod(); use on inner classes, keyword static indicates can access inner class without instance of outer class. for example: public class outer { public static class inner { /* code here. */ } } with construction, can create instance of inn

process - Python What is the difference between a Pool of worker processes and just running multiple Processes? -

i not sure when use pool of workers vs multiple processes. processes = [] m in range(1,5): p = process(target=some_function) p.start() processes.append(p) p in processes: p.join() vs if __name__ == '__main__': # start 4 worker processes pool(processes=4) pool: pool_outputs = pool.map(another_function, inputs) as says on pymotw : the pool class can used manage fixed number of workers simple cases work done can broken , distributed between workers independently. the return values jobs collected , returned list. the pool arguments include number of processes , function run when starting task process (invoked once per child). please have @ examples given there better understand application, functionalities , parameters. basically pool helper, easing management of processes (workers) in cases need consume common input data, process in parallel , produce joint output. the pool quite few thi

javascript - How to use force Jquery mouseenter fadein over again? -

i'm trying set menu, hover on photo show person name , links underneath image-menu. used mouseenter , fadein hover effect, coupled css class has background color set white (so new item cover old one). when try hover menu item has been shown, nothing happens. also, hover not work on items. when hover left, hover not function on 3 items. when hover right side, first 2 items work. please suggest issues be, , how these resolved? please note need have menu shows when mouseover shown, user can click links provided there. script: $(document).ready(function() { $("#pau").mouseenter(function(){ $("#paup").fadein(600); }); $("#red").mouseenter(function(){ $("#redp").fadein(600); }); $("#aesthet").mouseenter(function(){ $("#aesthetp").fadein(600); }); $("#danny").mouseenter(function(){ $("#dannyp").fadein(600); }); $("#kisic").m

java - How to access payload from REST 404 response in Camel cxfrs? -

i have camel route accesses rest service. things work ok if rest response 200 ok. however, if response 404, rest service returns additional info in payload, cannot find way access. this part of debug log running it: [camel (rraacamelcontext) thread #2 - seda://from_rraa] info org.apache.cxf.interceptor.loggingininterceptor - inbound message ---------------------------- id: 2 response-code: 404 encoding: iso-8859-1 content-type: application/json headers: {accept=[application/json], breadcrumbid=[id-steves-macbook-pro-local-53701-1446241733043-1-7], content-type=[application/json], originalheader=[{name=verifyemployeerequest, version=1, scac=rraa, timesent=null, uuid=abcd-1234}], pin=[1234], reason=[init], server=[jetty(9.2.11.v20150529)], transfer-encoding=[chunked], user-agent=[apache cxf 3.1.2]} payload: { "employeeid": "bad-name", "message": "id not found" } my route set as: <route id="rraaiss"> <from uri="