Posts

r - Aggregate by paymentamount -

i have data this: emailaddress customer_acquisation_date customer_order_date payment_amount xy@gmail.com 01/05/2013 6:24 01/05/2013 5:10 $ 20.67 xy@gmail.com 01/05/2013 6:24 02/07/2013 7:21 pm $ 25.56 xy@gmail.com 01/05/2013 6:24 07/10/2013 8:00 $100.00 xy@gmail.com 01/05/2013 6:24 08/12/2013 9:35 $30.00 i trying sum(payment amount) emailaddress want final output as: emailaddress customer_acquisation_date customer_order_date payment_amount xy@gmail.com 01/05/2013 6:24 01/05/2013 $ 177 02/07/2013 07/10/2013 08/12/2013 code writing z <- aggregate(x$emailaddress~x$paymentamount,data=x,fun=sum) error getting error in summary.factor(c(211594l, 291939l, 79240l, 208971l, 369325l, : ‘sum...

Android O - Detect connectivity change in background -

first off: know connectivitymanager.connectivity_action has been deprecated , know how use connectivitymanager.registernetworkcallback . furthermore if read jobscheduler , not entirely sure whether got right. my problem want execute code when phone connected / disconnected to/from network. should happen when app in background well. starting android o have show notification if want run service in background want avoid. tried getting info on when phone connects / disconnects using jobscheduler/jobservice apis, gets executed time schedule it. me seems can't run code when event happens. there way achieve this? maybe have adjust code bit? my jobservice: @requiresapi(api = build.version_codes.lollipop) public class connectivitybackgroundserviceapi21 extends jobservice { @override public boolean onstartjob(jobparameters jobparameters) { logfactory.writemessage(this, log_tag, "job started"); connectivitymanager connectivitymanager = (connecti...

html - CSS circle with inner circle and image -

i'm new css please bare me. i'm trying achieve following: a background circle smaller colored circle inside of it, must centered a small centered image inside of both circles all of these items needs placed in single div i'm trying minimum amount of code. want avoid duplication as possible. believe of can achieved using before , after selectors, i'm not sure how done here's have far: css: .grid-container { display: grid; grid: 100px / 100px; } .circle { border-radius: 50%; width: 100%; height: 100%; background-color: #e4e4e7; } .circle:before { content: ""; border-radius: 50%; width: 80%; height: 80%; top: 10%; left: 10%; background-color: blue; display: block; position: relative; } .image-one:before { content: url("https://stackoverflow.com/favicon.ico"); } .ci...

json - How to deserialize a Timestamp as-is using Jackson Annotation in Java? -

i have field in java bean below @jsonformat jackson annotation: @jsonformat(shape = jsonformat.shape.string, pattern="yyyy-mm-dd hh:mm") private timestamp createdon; when return timestamp , getting converted utc time in json response. lets on formatting timestamp , 2017-09-13 15:30 response getting returned 2017-09-13 10:00 . i know because of jackson annotation default takes system timezone , converts timestamp utc. (in case server belongs asia/calcutta time zone , offset +05:30 , jackson mapper subtracts 5 hrs , 30 minutes convert timestamp utc) is there way return timestamp as-is, i.e, 2017-09-13 15:30 instead of 2017-09-13 10:00 ? i've made test here, changing jvm default timezone asia/calcutta , creating class java.sql.timestamp field: public class testtimestamp { @jsonformat(shape = jsonformat.shape.string, pattern = "yyyy-mm-dd hh:mm") private timestamp createdon; // getter , setter } in other question told j...

javascript Promise excution order -

promise.resolve() .then(() => console.log(2)) .then(() => console.log(3)); promise.resolve() .then(() => console.log(4)) .then(() => console.log(5)); console.log(1); why above code snippet result 1 2 4 3 5 instead of 1 2 3 4 5 . what execution order? it runs in order because that's order callbacks entered callback queue. lets follow through code does: promise.resolve() .then(() => console.log(2)) .then(() => console.log(3)); promise.resolve() .then(() => console.log(4)) .then(() => console.log(5)); console.log(1); first, main code ran, 2 promises created , resolved, , 2 callbacks added callback queue; callbacks 2 , 4. queue [2,4]. console.log(1) happens , function ends. now function done, next callback in callback queue runs, logging 2, pushes new callback callback queue, callback 3. queue [4,3]. next, callback 4 runs , logs 4, , pushes callback 5 queue. queue [3,5] next, callbacks 3 , 5 each run in order, bringing queue []. ...

Extract currency amount from string in Python -

i'm making program takes currency string , converts in other currencies. example, if string 'the car cost me $13,250' need $ , 13250 . have regex (?:\£|\$|\€)(?:.{1,}) sort of it, there reasonably large possibility string might have more 1 price, using different currencies. no know how effectively. what need know how extract of prices string. think if regex returns ['$12,250,000','£14,500,123','£120.25'] fine because can use number: prices = ['$12,250','£14,500','£120'] value in prices: value.replace(',','') and currency: for c in prices: currency = c[0] then there problem price might not whole number, , might $12.54 . on how initial list of prices great. this regular expression work better purposes: (?:[\£\$\€]{1}[,\d]+.?\d*) try out here . then sainoba notes, can use re.findall or re.finditer matches. then can extract currency first character, remove commas, , spl...

authentication - How to specify redirect uri using WebAuthenticationCoreManager? -

i using webauthenticationcoremanager authenticate uwp app: webtokenrequest webtokenrequest = new webtokenrequest(provider, authority, clientid); webtokenrequest.properties.add("resource", resourceid); webtokenrequestresult wtrr = await webauthenticationcoremanager.requesttokenasync(webtokenrequest); i given clientid , redirecturi use, don't know how set redirecturi request. this thread says there no way, short of using webauthenticationbroker , i'm hoping has changed. so, there way specify redirect uri? so, there way specify redirect uri? you don't need set redirect uri web account manager relative apis. it seems redirect uri built in, , cannot set it. purpose using these apis requesting user's permission use microsoft account , obtain access token. can access token without setting redirect uri. confirm having app manifest being modified use app identity of registered microsoft store/registered aad app. more details please refere...