Posts

Showing posts from January, 2013

java - Lazy loading doesn't work for @Formula in Hibernate -

i'm trying make 1 of fields calculable, don't want calculate time entity retrieved. want, calculate in case it's necessary current query or time getter invoked. that's why use @formula: @basic(fetch = fetchtype.lazy) @formula("(select max(myentity.creation_time) myentity myentity myentity.account_id = id)") private localdatetime entitiesmodifieddate; to make work, use bytecode instrument this: <plugin> <artifactid>maven-antrun-plugin</artifactid> <version>1.3</version> <executions> <execution> <id>instrument domain classes</id> <configuration> <tasks> <taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.instrumenttask"> <classpath>

c# - Add range is not working with list -

this question has answer here: what nullreferenceexception, , how fix it? 29 answers i having payee contact details object public class payeecontactdetails { //[jsonproperty("id")] //[defaultvalue("")] //public int id { get; set; } [jsonproperty("contact_name")] [defaultvalue("")] public string contactname { get; set; } [jsonproperty("contact_email")] [defaultvalue("")] public string contactemail { get; set; } ........ ........ } and here having payeecontactgroup class public class payeecontactgroup { [jsonproperty("payee_contacts")] public list<payeecontactdetails> payeecontact { get; set; } } here getting data api response on page page after completion of pages need send data @ time db for purpose doing this paye

Unprotecting spring-security-saml endpoint using controllerAnnotations staticRules in Grails 3 -

i'm trying configure grails-spring-security-saml ( https://github.com/jeffwils/grails-spring-security-saml ) plugin in grails 3.2.6 application. using local openam identity provider. original doc shows configuration sample using intercepturlmap securityconfigtype protect controllers @secured annotations set securityconfigtype annotation . saw there rule in intercepturlmap permit access /spring-security-saml/** copied rule controllerannotations.staticrules here resulting section in application.yml grails: plugin: springsecurity: userlookup: userdomainclassname: unbox.sso.user authorityjoinclassname: unbox.sso.userrole attributeclassname: unbox.sso.attribute authority: classname: unbox.sso.role securityconfigtype: annotation logout: postonly: false controllerannotations: staticrules: - pattern: '/spring-security-saml/**'

c# - Oracle Advanced Queues - Dequeueing Commit/Rollback -

we're attempting use oracle aq build queueing system our app in .net 4.7. basically, our problem wrap dequeueing process in upper level transaction containing other instructions , able commit or rollback "manually" after executing queue.dequeue() instruction. so far, works enqueueing: using (var tr = con.begintransaction()) { try { enqmsg.senderid = new oracleaqagent("subscriber1"); enqmsg.payload = new oraclexmltype(con, new xdocument( new xelement("workflowexecution", new xelement("id", i), new xelement("workflowname", guid.newguid().tostring().substring(0, 8)), new xelement("requestsource", guid.newguid().tostring().substring(0, 6)))).tostring()); queue.enqueue(enqmsg); //other instructions here... tr.commit(); } catch (exception) { tr.rollback(); } } with same approach, tryi

javascript - ReactJS: Module parse failed ',,.../index.js' you may need appropriate loader to handle this file type -

i change default index.js file location generated create-react-app . this directory structure :- |--main-project |--client |--components |--pages |--public |--app.js |--index.js |--mode_modules |--server |--package.json | |-- /react small files package-lock.json , stuff my corresponding path.js configuration in node_module/react-scripts/config module.exports = { dotenv: resolveapp('.env'), apppath: resolveapp('.'), appbuild: resolveapp('build'), apppublic: resolveapp('public'), apphtml: resolveapp('client/public/index.html'), appindexjs: resolveapp('client/index.js'), apppackagejson: resolveapp('package.json'), appsrc: resolveapp('src'), yarnlockfile: resolveapp('yarn.lock'), testssetup: resolveapp('src/setuptests.js'), appnodemodules: resolveapp('node_modules'), publicurl: getpublicurl(resolveapp('package.js

.net - C# parse JSON group by type -

this json [ { "name": "teama", "zone": "north", "id": 12, "players": [ { "name": "taplayer1", "type": "keeper" }, { "name": "taplayer2", "type": "bowler" } ] }, { "name": "teamb", "zone": "south", "id": 20, "players": [ { "name": "tbplayer1", "type": "keeper" } ] }, { "name": "teamc", "zone": "south", "id": 45, "players": null }, { "name": "teamd",

java 8 - how to call default method in interface use reflection -

public interface testserviceiface { default string test(string str, int flag) { return str; } } interface this,if implements interface, , have instance ,how can call default method? if use reflection, how do? , have interface,no impl class , no impl instance.how call default method? you can access interface default methods reflection below: class<testserviceiface> type = testserviceiface.class; method defaultmethod = type.getmethod("test", string.class, int.class); string result = (string) defaultmethod.invoke(instance, "foo", 0); however, if subclass override default method , overrided method called, means interface default method supports polymorphism .

rest - How to mock Spring WebClient in Unit Test -

we wrote small spring boot rest application, performs rest request on rest endpoint. @requestmapping("/api/v1") @springbootapplication @restcontroller @slf4j public class application { @autowired private webclient webclient; @requestmapping(value = "/zyx", method = post) @responsebody xyzapiresponse zyx(@requestbody xyzapirequest request, @requestheader httpheaders headers) { webclient.post() .uri("/api/v1/someapi") .accept(mediatype.application_json) .contenttype(mediatype.application_json) .body(bodyinserters.fromobject(request.getdata())) .exchange() .subscribeon(schedulers.elastic()) .flatmap(response -> response.bodytomono(xyzserviceresponse.class).map(r -> { if (r != null) { r.setstatus(response.statuscode().v

tomcat7 - how to properly avail a merely webpage from Tomcat outside the network -

i have rhel 6.8 server machine in cloud , want access webpage same cloud machine's ip. made tomcat 7.0.79 setup in machine , problem can access machine through putty only, terminal available check on machine. did bind tomcat machine's private ip (local ip), , trying access means of it's public ip outside network not accessing. java installed , java_home environmental variable configured. since can't check through browser, i'm using " curl " command accessing both private , public ips displaying: curl: (7) couldn't connect host please check below changes made in order bind tomcat local ip , suggest me solution: i have modified {tomcat_directory}/bin/server.xml : <connector port="80" protocol="http/1.1" connectiontimeout="20000" redirectport="8443" address="192.168.43.50" /> <engine name="catalina" defaulthost="19

javascript - Flow: turn off "Unused suppression" error for supress_comment -

the production build of app produces file development build not. handle difference in code (simplified example) const manifest = (process.env.node_env === 'production') ? require(./production-app-manifest.json') : { version: 'dummy development manifest' } flow therefore (correctly) fails on second line 'required module not found' when in development . as docs suggest here , suppressed error so const manifest = (process.env.node_env === 'production') // $flowfixme: file not present in development ? require(./production-app-manifest.json') : { version: 'dummy development manifest' } this solves problem in development . however, after production build, unused suppression error because file is present. this quite frustrating. want tell flow ignore line, regardless of if file present or not. can configure flow turn off unused suppression error? probably easiest way make line has error time. turn requi

c++ - A. Appleman and Easy Task -

http://codeforces.com/contest/462/problem/a problem , want solve c++ can 1 explain me want here specially @ line of question and answer can`t understand https://github.com/ahmedalbarbary/competitive-programming/blob/master/codeforces%20-%20not%20mine%20codes/problem-%20462a%20-%20appleman%20and%20easy%20task thanks helping me you have count every cell [i,j]   how many of cell [i,j-1], cell[i,j+1], cell[i-1,j], cell[i+1,j] (i.e. adjacent cells, i.e. neighbour cells) contain 'o' . if count number (for every cell [i,j]) result "yes", else "no". (thus, test may finished when first odd count detected.) thereby, 0 counted number (of course). the possible issue: for border cells, of tests have skipped prevent out-of-bound access. the solution uses trick this: stores input beginning indices [1,1] instead of indices [0,0]. leaves "unused" border cells around actual input matrix. advance: no tests cells skip necessary. as memor

Permission send sms android -

i writing app send message inputted number through sms. when try send message error "user 10074 not have android.permission.send_sms" though have permission in manifest. try { smsmanager smsmanager = smsmanager.getdefault(); smsmanager.sendtextmessage("5554", null, "hello", null, null); // smsmanager.sendtextmessage(number,null,matn,null,null); toast.maketext(sms.this, "ok", toast.length_long).show(); } catch (exception e) { toast.maketext(sms.this, "error"+e, toast.length_long).show(); } } }); and code in manifest <uses-permission android:name="android.permission.send_sms" /> beginning in android 6.0 (api level 23) , users grant permissions apps while app running, not when install app. try ask run time permission requestsmspermission(); private void requestsmspermiss

python - Given a word from a list, I need to find all the next number values of the list -

i starting python. sorry if question trivial. i have been searching, not found problem. given word list, need find first word contains @ least 1 number position of given word. for example, given word = car , list is: ls1 = ['moto', 'frezze', 'car', 'deciding', 'local', 'using', '4587125', 'joy', 'car', 'yort', '548h21'] i expected return: ls2 = ['4587125','548h21'] i have been trying, no results found... help, my code, def hasnumbers(inputstring): return any(char.isdigit() char in inputstring) def number_word (character): while not hasnumbers(character): character = [ls1()[i + 1] i, word in enumerate(ls1()[:-1]) if word == character] if hasnumbers(character): return character marcus iterate list , keep track how have seen word, when see number, yield have seen word before. can make generator: def get_nums_after(lst, word): se

android - react native app restarted when changing permission through settings -

i have react native app. working fine in both ios & android if change permissions(camera, storage) through settings option app restarted. for example, if on home-screen , had changed permission app restarted , takes me login screen. are there options maintain current app state(both ios , android)? please suggest me.

Export Adf table into Pdf in JDeveloper and ADF -

i using jdeveloper 12.2.1.1.0.i trying export adf table pdf. when user clicks button, table download pdf file. i have been following waslley souza blog few modifications. [ http://waslleysouza.com.br/en/2015/03/export-table-as-a-pdf-file-in-adf/][1] the page contains table button follows: <af:commandbutton text="export pdf" id="cb3" inlinestyle="border-width:inherit;"> <af:filedownloadactionlistener filename="emp.pdf" method="#{samplebean.exportallrowstopdf}" contenttype="application/pdf"/> i have added jar files, yet getting following error in log: <org.apache.fop.fo.fotreebuilder> <fotreebuilder> <fatalerror> <org.xml.sax.saxparseexception; linenumber: 0; columnnumber: 0; document empty (something might wrong xslt stylesheet).> (location of error unknown)org.apache.fop.fo.validationexception: document empty (something might wrong xslt styleshee

openerp - why the state changes even when the conditions are not satisfied? -

i created 2 buttons on form, when click fenced button if description, analyse , conclusion not empty state value should fenced else nothing should happens , when click not yet button, if description or analyse or conclusion not empty state value should change in progress. here 2 buttons fenced , not yet: <group name="group_tests_buttons" class="oe_button_box" col="6"> <button name="write_new" type="object" class="oe_stat_button" string="fenced"> </button> <button name="write_new2" type="object" class="oe_stat_button" string="not yet"> </button>

If-None-Match header always null in asp.net core controller -

Image
i send request "if-none-match" header postman, it's null in controller. i'm using asp.net core 1.1. is there wrong code? debug code if (request.headers.containskey("if-none-match")) { var oldetag = request.headers["if-none-match"].first(); if (cache.get($"tenant-{id}-{oldetag}") != null) { return statuscode((int)httpstatuscode.notmodified); } } update 1 i create new request both if-match & if-none-match header, if-match header exists in controller if-none-match still null . you wrong header in debugger. instead on headerifmatch check headerifnonematch request.headers.containskey("if-none-match") - code fine , works me via postman. but, accordingly screenshot, looks add if-none-match query parameter, not header.

javascript - how to show and hide columns of using datatable jquery -

i need show , hide columns of datatable after doing javascript test , doesn't work good. test javascript : if ( $('#commune_to_display').val()==""){ $('#utable td:nth-child(2)').hide(); $('#commune_to ').hide(); } this test works in first page of datatable , after pagination column still show how can fix it? you can show/hide columns shown below. replace 3 , 4 actual column indexes. var table = $('#utable').datatable(); table.column(3).visible(true); // show table.column(4).visible(false); // hide

haproxy - How do I route by path in DC/OS? -

let's have single domain fooapi.com , 2 versions of api: v1 , v2. how configure haproxy in marathon.json file both api versions can live behind same domain different path? eg. fooapi.com/v1/ , fooapi.com/v2/ . the following configuration doesn't work (latest dcos): "labels": { "haproxy_0_vhost": "fooapi.com", "haproxy_deployment_group": "api-grp", "haproxy_group": "external", "haproxy_0_path": "/v1" } after reading through marathon-lb docs, i've solved adding haproxy_0_http_backend_proxypass_path config parameter: "labels": { "haproxy_0_vhost": "fooapi.com", "haproxy_deployment_group": "api-grp", "haproxy_group": "external", "haproxy_0_http_backend_proxypass_path": "/v1", "haproxy_0_path": "/v1" }

r - Comparing dates inside group using same reference -

i have data table different patients ("spell") , several temperature ("temp") measures each patient ("episode"). have date , time in each temperature taken. spell episode date temp 1 3 2-1-17 21:00 40 1 2 2-1-17 20:00 36 1 1 1-1-17 10:00 37 2 3 2-1-17 15:00 36 2 2 2-1-17 10:00 37 2 1 1-1-17 8:00 36 3 1 3-1-17 10:00 40 4 3 4-1-17 15:00 36 4 2 3-1-17 12:00 40 4 1 3-1-17 10:00 39 5 7 3-1-17 17:30 36 5 6 2-1-17 17:00 36 5 5 2-1-17 16:00 37 5 1 1-1-17 9:00 36 5 4 1-1-17 14:00 39 5 3 1-1-17 13:00 40 5 2 1-1-17 11:00 39 i interested in keeping measurements done 24h prior last one, have grouped observations spell , reverse date, unsure on how in-group comparison using same reference (in case,

javascript - document.documentElement.scrollTop condition -

trying understand first part of conditional statement in code window.addeventlistener("scroll",function(event){ if(document.documentelement.scrolltop || document.body.scrolltop >= scrolldistance){ animatepoints(); the second part says, if number of pixels have scrolled top of body greater or equates point want animation start, call function in mind, work possible scenario i don't understand first conditional (and have tried messing around in console) console.log(document.documentelement.scrolltop) returns 0. understanding because never scrolling root element <html> return @ 0. if true first condition met , should fire animatepoints function (yet isn't) basically if document.documentelement.scrolltop isn't 0, false, undefined, null or '' runs second statement document.body.scrolltop >= scrolldistance .

regex - Search true if the word is Singular or Plural Java -

i trying achieve result in if user enters word, in plural or singular, regex should return true for example 'i want drone' or 'i want drones'. @test public void testproductsearchregexp() { string regexp = "(?i).*?\\b%s\\b.*?"; string query = "i want drone flir duo"; string data1 = "drone"; string data2 = "flir duo"; string data3 = "flir"; string data4 = "drones"; boolean isdata1 = query.matches(string.format(regexp, data1)); boolean isdata2 = query.matches(string.format(regexp, data2)); boolean isdata3 = query.matches(string.format(regexp, data3)); boolean isdata4 = query.matches(string.format(regexp, data4)); asserttrue(isdata1); asserttrue(isdata2); asserttrue(isdata3); asserttrue(isdata4);//test fails here (obviously) } your valuable time on question appreciated.

localization - How to handle multilingual data in lettuce? -

i wrote *.feature file , step.py lettuce work correctly, when put persian data *.feature file, stops working. this feature file: feature: computefactorial in order play lettuce beginners we'll implement factorial scenario: factorial of 0 given have number 0 when compute factorial see number علی and step.py: from lettuce import * @step('i have number (\d+)') def have_the_number(step, number): world.number = int(number) @step('i compute factorial') def compute_its_factorial(step): world.number = factorial(world.number) @step('i see number (\w+)') def check_number(step, expected): #expected = int(expected) assert true def factorial(number): return -1 how can this? if want use string need quotation marks . feature file should this. scenario: factorial of 0 given have number 0 when compute factorial see number "علی" and in step file: ... @step('i see number "(\w+)&qu

regula - regex For Float Numbers with Limits -

Image
i need regex expression floating , whole numbers have limit accept 1 or 2 digit before point , 1 or 2 digits after point. whole number limit should 2 digit. should valid: - 1.1 - 11.1 - 1.11 - 11.11 - 2 - 22 should invalid: - 111.111 - 222 here regex: /^\d{1,2}(\.\d){1,2}?$/ not working kindly me in use following pattern: ^\d{1,2}(?:\.\d{1,2})?$ see the regex demo . details : ^ - start of string \d{1,2} - 1 or 2 digits (?:\.\d{1,2})? - optional sequence of: \. - dot \d{1,2} - 1 or 2 digits $ - end of string.

python - Log messages via TCP, significantly slower than similar code in Java -

in python 3 have queuehandler attached logger , queuelistener shipping logrecords sockethandler sends logs via tcp java app that's listening. both programs run on localhost. import logging import queue log_q = queue.queue(-1) logger = logging.getlogger('testlogger') socket_handler = logging.handlers.sockethandler('localhost', 1337) q_handler = logging.handlers.queuehandler(log_q) q_listener = logging.handlers.queuelistener(log_q, socket_handler) logger.addhandler(q_handler) q_listener.start() i'm sending logrecords large lists attached them. logger.info("prox_marker", extra={'vector': [some_list]}) where [some_list] list of ~100k double values. i run following code test throughput: for in range(1000): logger.info("prox_marker", extra={'vector': [some_list]}) which takes 30-35 seconds complete. if run similar test in java, java app twice fast. in python queuehandler/-listener + sockethandler setup

gcc - Compile and run program without main() in C -

i'm trying compile , run following program without main() function in c . have compiled program using following command. gcc -nostartfiles nomain.c and compiler gives warning /usr/bin/ld: warning: cannot find entry symbol _start; defaulting 0000000000400340 ok, no problem. then, have run executable file(a.out), both printf statements print successfully, , segmentation fault . so, question is, why segmentation fault after execute print statements? my code: #include <stdio.h> void nomain() { printf("hello world...\n"); printf("successfully run without main...\n"); } output: hello world... run without main... segmentation fault (core dumped) let's have @ generated assembly of program: .lc0: .string "hello world..." .lc1: .string "successfully run without main..." nomain: push rbp mov rbp, rsp mov edi, offset flat:.lc0 call

How do I retrieve the Linkedin API for my company page? -

i have installed linkedin campaign manager app our ma tool eloqua configure need api our linkedin company page , not know how retrieve it? can me? br, josefine to retrieve api linkedin company page: > sign in campaign manager. > select account set data integration. > click tools in top navigation bar. > click matched audiences. > select uploaded list audiences tab. > select connect data integration. >review terms , click next view api keys let me know if helps, br, sheressa

r - Pooling sandwich variance estimator over multiply imputed datasets -

i running poisson regression on multiply imputed data predict common binary outcome. after running mice , have obtained stacked data frame comprising raw data , 5 imputed datasets. here toy example: df <- mice::nhanes imp <- mice(df) #impute data com <- complete(imp, "long", true) #creates data frame i want to: run regression on each imputed dataset calculate robust standard errors using sandwich variance estimator combine / pool results of both analyses i can run regression on mids object using with , pool commands: fit.pois.mids <- with(imp, glm(hyp ~ age + bmi + chl, family = poisson)) summary(pool(fit.pois.mids)) i can run regression on each of imputed datasets before combining them: imp.df <- split(com, com$.imp); names(imp.df) <- c("raw", "imp1", "imp2", "imp3", "imp4", "imp5") #creates list of data frames representing each imputed dataset fit.pois <- lapply(imp.d

android - Reason why my device failed SafetNet attest API -

i working safetynet attest api , have tested app on number of devices. devices un-rooted devices original bootloader. till passed attest api test. testing on motorola nexus 6. not rooted , bootloader 1 provided oem. reason device failing ctsprofilematch , basicintegrity check. a small table given here listing why device might fail, output json has boolean fields , no data on why device failed. any idea on how fetch details on why device failed?

javascript - Mapping arrow keys to scrollwheel function? -

i running slideshow on client site. slideshow animates each slide, , relies solely on scrollwheel of mouse although 'swipes' when in touchscreen devices. it's important note here page doesn't actually scoll when using scrollwheel, activates next slide animation. webpage never scolls in traditional sense... however people don't use scrollwheel, use keyboard arrows. is there way, ideally using javascript, force arrow keys emulate single scroll of mousewheel? i apologise lack of code or previous efforts - haven't been able find regards problem , code embedded in slideshow extension. i'm hoping add own js complement base slideshow. you try trigger mousewheel event on gallery element code using this: var element = <reference element mousewheel events bound to> document.addeventlistener('keydown', function(e){ var event = new event('mouseevents'); event.initevent('mousewheel', true, true); swit

stdmap - Efficient search for data in multiple hierarchical data structures in C++ -

hello have problem of searching data inside big map created. creating fsm framework. have several condition s should appended transition s (based on following conditions). condition should appended transition between 2 states s1 & s2, if state s1 found in set s1set , state s2 found in set s2set . since have several conditions each it's pair of sets, created map able check. std::map<std::set<int>, std::pair<std::set<statearch*>, std::set<statearch*> > > mapbypassconditions; the set of ints condition , pair of sets search s1 , s2. however, feel inefficient because each transition in fsm have go through entire map , search s1 , s2 , check if need append condition it. do guys have better ideas? perhaps better organization of map? p.s. using c++98 framework bit old , not yet working newer versions

performance - Enable files extensions with jQuery validate -

the code works half well, can not check file extensions. how enable feature when user types in wrong file formats displays error message? $(document).ready(function () { jquery.validator.setdefaults({ success : "valid" }); var validator = $("#myform").validate({ rules : { "file1" : { required : true, extension : "slx|mdl", accept : false }, "file2" : { extension : "m", accept : false }, "file3" : { extension : "xlsx|xls", accept : false }, "file4" : { extension : "pdf", accept : false } } }); });

Firebase multi-path update - Permission denied -

i have been trying add rules firebase database few days error keeps poping , can't find wrong. there error : firebase warning: update @ / failed: permission_denied permission_denied: permission denied i searched solutions , found related post ( permission denied error during multiple update on firebase ). seems displayed error not right. though got because had no rights set on root path ('/'), according post, not problem. i tried set 3 'write' rules 'true' , works, guess problem must in rules. see below code. angular service: let event = { "title": "title" "uid": "fzon4aeqgknnrlhqmh7zwynhttp1" } let uid = this.authservice.fbuser.uid; let eventid = this.db.list('eventsdata').push(undefined).key; let updateobject = {}; updateobject[`eventdata/${eventid}`] = event; updateobject[`userevents/${uid}/${eventid}`] = true; updateobject[`eventguests/${eventid}/${uid}`]= { attendanc

Random `ApiError: Invalid Credentials` calling BigQuery from Google Cloud Functions -

Image
my function called 15 times per hour (every 4 minutes), , runs query via startquery . "invalid credentials" error happens randomly after 30 minutes. happens more , more until calls fail. this query reads data table in dataset, , saves result table located in dataset, via options destination , writedisposition=write_truncate . 2 datasets located in eu. redeploying function removes problem temporarily. a call gcloud beta functions describe my-function indicates uses app engine default service account: my-project-id@appspot.gserviceaccount.com . here error details: apierror: invalid credentials @ object.parsehttprespbody (/user_code/node_modules/@google-cloud/bigquery/node_modules/@google-cloud/common/src/util.js:192:30) @ object.handleresp (/user_code/node_modules/@google-cloud/bigquery/node_modules/@google-cloud/common/src/util.js:132:18) @ /user_code/node_modules/@google-cloud/bigquery/node_modules/@google-cloud/common/src/util.js:465:12 @ request.onresponse [

java - Modifying react-native files -

i changed baseviewmanager.java file inside of react-native make resource-id available thru react-native. thing no matter do, nothing takes effect, if put typos in .java files. colleague told me it's because .java not being built. so how build react-native .java files?? i tried npm start of course nothing took effect. and code want change @reactprop(name = prop_test_id) public void settestid(t view, string testid) { view.settag(r.id.react_test_id, testid); // temporarily set tag , keyed tags avoid end end test regressions view.settag(testid); } @reactprop(name = prop_native_id) public void setnativeid(t view, string nativeid) { view.settag(r.id.view_tag_native_id, nativeid); reactfindviewutil.notifyviewrendered(view); } you have build react native source. here tutorial that: https://facebook.github.io/react-native/docs/android-building-from-source.html tried , works :)

java - Persist RxJava calls between activities using Dagger2 -

i have behaviorrelay object in executionstream class handles network calls. please refer executionstream class. i can call requesttrackingandexecution() method activity. have implemented dagger2 dependency such can inject executionstream instance in activity. my dagger2 configuration: @perapplication @provides public executionstream provideexecutionstream(pmsapi pmsapi) { return new executionstream(pmsapi); } @perapplication annotation @scope @retention(runtime) public @interface perapplication { } what need do: want call requesttrackingandexecution() method activity , subscribe emitted data in activity b. currently, suubscriber in activity b not getting data emitted activity a<--- see here i have injected executionstream class in both activities @inject executionstream executionstream; for emitting observable, calling internshipandtrackingrelay.accept(data); in requesttrackingandexecution() method after getting data network call. code subscribi

android - Facing this error The following binaries are missing: ndk-build. Please install them -

i'm trying build ' linphone-android ' . link git repo somehow manged resolv bugs i'm stuck @ when try run ' ./prepare.py **' commanad in terminal giving me ndk error i.e **error: following binaries missing: ndk-build. please install them. i have ndk path in .bash file unable resolve error. please share solution :) i assuming have added android-sdk , android-ndk path in environment. if not can add sdk , ndk path using below command. export path=/users/kaushik512/library/android/sdk/platform-tools/:/users/kaushik512/library/android/sdk/tools/:/users/kaushik512/downloads/android-ndk-r12b/:/nobackup/local/prog/nasm/bin:$path export path=/opt/local/bin/:$path after adding path check using echo $path . add above in path , see if issue resolved.

c# - Best method to handling exception when using business class in asp.net -

i using 1 asp.net application have business class mediator between database , application. in aspx page code behind handling exception log file every method. in business class have method getting called aspx page.i handling exception in business class method. below page method example calling business methods: public void mypagemethod { businessclass bc = new businessclass(); bc.getdata(); } below business class method getting called page: public string getdata() { string data = string.empty(); try { //some business logic } catch(exception e) { } return data; } now question here need handle exception business class method also?

How to find the files being written between a time range in java in unix -

i have several files in directory , want find files written between time range. know not possible create time of file in linux. i can work out sorting files last modified time , there simpler way ? in case mean implicitly java solution: in java, can use file.lastmodified() file’s last modified timestamps. method returns time in milliseconds (long value, epoch time), may format simpledateformat make human readable format. so need this: file folder = new file("your/path"); file[] listoffiles = folder.listfiles(); (int = 0; < listoffiles.length; i++) { if (listoffiles[i].isfile()) { if(listoffiles[i].lastmodified() > && listoffiles[i].lastmodified() < to){ dosomething(); } } } note : from,to of type long , represent time stamp.

c# - Could not load file or assembly Newtonsoft.Json -

this question has answer here: c# application error in others computers 3 answers app works on computer not colleagues - not load file or assembly or 1 of dependencies 2 answers “could not load file or assembly” error. works on computer not others 6 answers i trying use json.net in c# write json file. when build code builds fine , creates parser.exe fine. when try run parser.exe on seperate server needs run gives me error system.io.filenotfoudexception: not load file or assembly 'newtonsoft.json, version=10.0.0.0, culture=neutral, publickeytoken=30ad4f...' or 1 of dependencies. system cannot file file specified. do need copy newtonsoft dll server needs run. appreciated.

Weight optimization using genetic algorithm in MATLAB -

i new genetic algorithm , hoping guys can me out. i have dataset: dataset = [[3 4 4 4] ;[2 3 2 3] ;[1 1 3 2] ;[3 2 4 3] ;[0 3 1 0]]; where last column [4, 3, 2, 3, 0] represents actual labels; , first 3 columns represent feature vector [x1 x2 x3] . i want use genetic algorithm optimize weights [w1 w2 w3] . how can achieve ?? your weights optimization variables. basic optimization: w = [w1 w2 w3]; x = [x1 x2 x3]; wopt = ga(@fitnessfunc(w, x), length(w)) function y = fitnessfunc(w,x) y = w(1) * x(1) + w(2) * x(2) + w(3) * x(3); see matlab documentation on ga more options on ga function call , passing parameters how construct program. remember weights variables you're optimizing. dataset x values parameters.

excel vba - VBA How to properly globally initialize form and get/set values from its controls -

i have problems getting values textboxes form in vba app. in module have logics subs initialize form, presets values in , on: dim usf new userform1 'in case assume form initialized 'globally, on top of subs, 'files , subs in vba project can acces 'controls in it. , works, every second 'run raises "automation error" sub start() 'when declare form here, program 'start, none of subs can 'acces form controls. of course in case 'must initialize form in 'every single sub. i've tried passing form 'argumend functions, 'this not work or in wrong way. subs 'can't read values form controls.

class - How to compare two classes in vb.net? -

let's suppose have class this: class myclass(of template) 'some things here end class so far, good. however, things depending on template, like class myclass(of template) 'some things here public sub mymethod 'if template myotherclass ' things 'else ' other things 'end if end sub end class of course, give object , check whether typeof (obj) myotherclass , seems less intuitive me. there way compare 2 classes in vb.net? you compare type class myclass(of template) 'some things here public sub mymethod if gettype(template) gettype(myotherclass) things else other things end if end sub end class but seems bad thing do. point of oo have logic in it's respective class instead of doing this.

mysql - Difference between these sql queries -

i can't seem understand why these 2 queries return different results following task: "find names , grades of students have friends in same grade. return result sorted grade, name within each grade." tables here: https://lagunita.stanford.edu/c4x/db/sql/asset/socialdata.html the first query: select distinct h1.name, h1.grade highschooler h1, friend f, highschooler h2 h1.id = f.id1 , h2.id = f.id2 , h1.grade = h2.grade order h1.grade, h1.name the second query: select name, grade highschooler id not in ( select id1 highschooler h1, friend, highschooler h2 h1.id = friend.id1 , friend.id2 = h2.id , h1.grade <> h2.grade) order grade, name; the second 1 returns expected result, not first one. if cares clarify, thanks. the first query applies 3 filter in query simultaneously data in tables , returns entries matching filters. second query firstly subquery returns rows matching subquery condition , ids not there returned, includes ids h1.id =

xslt 2.0 - How to implement saxon OutputURIResolver in Java? -

i new java. have similar scenario [ catch output stream of xsl result-document not understanding pass href , base parameter.. my xslt (result-document) follows: <xsl:template match="/" mode="create-text-file"> <xsl:param name="book-name" tunnel="yes"/> <xsl:result-document href="{$book-name}.xml" doctype-public=" test" doctype-system="test.dtd"> <xsl:apply-templates/> </xsl:result-document> </xsl:template> another: <xsl:result-document href="{$book-name}.opf" doctype-public="" doctype-system="" indent="yes"> <xsl:apply-templates mode="#current"/> </xsl:result-document> parameter book-name getting : <xsl:template match="d

javascript - pause youtube video and show div with a form -

i have youtube video on website: <div id="video"> <iframe width="560" height="315" src="https://www.youtube.com/embed/some_video" frameborder="0" allowfullscreen></iframe> </div> after fixed time, want pause , ask user question overlaying form on video: <h1>how video far? </h1> <div id="question"> <form> <input type="radio" name="question" value="poor" checked>poor<br> <input type="radio" name="question" value="good">good<br> <input type="submit" value="submit"> </form> </div> what javascript code pause video after fixed period of time , css displaying form nicely? want mimic way lectures on coursera.org once looked like. tyr this: html: <div id="video">

sorting - It is possible to sort by "valid" percentage in my data? -

Image
using tableau, have arranged data in 100.00% stacked bar: i want sort data descending (largest smallest) valid component type (green) - possbile? update (26th july 2017) merawalaid's answer worked; followed steps, adjusted code match specific project, , resulted in this: as can see, sorted, not quite should (for example, fourth , sixth rows featured high in chart. is there might wrong have missed here? i able this: you can download workbook here. advised though, feel there simpler way out there this. what did create 2 calculated fields. 'validcomponentcount': if ([component type]='valid component') 1 else 0 end '% of valid': {fixed [rootname] : sum([validcount])/count([number of records])} then sorted 'rootname' column based on descending value of 2nd calculated field (% of valid).

swift - Editor placeholder in source file -

following arkit tutorial https://www.youtube.com/watch?v=r8u8rgdmop4 but getting editor placeholder in source file error in following code (2nd line). has there been change in swift cause this? override func viewwillappear(_ animated: bool) { super.viewwillappear(animated) let configuration = arworldtrackingsessionconfiguration() sceneview.session.run(configuration) addobject() } there placeholder in file, meaning you'll see grey or blue block, that'll value, indicating need replace placeholder of value. the gray blocks in image placeholders. it possible xcode being idiotic, try cleaning project, run again.

java - Mylyn WikiText Extras won’t install in eclipse Oxygen, says Mylyn WikiText 3.0.6 is installed -

vogella suggests installing mylyn wikitext extras editing asciidoc. on (just installed) eclipse oxygen java ee, refuses install. according instructions , selected mylyn wikitext extras mylyn docs eclipse repository. eclipse says: cannot complete install because of conflicting dependency. software being installed: mylyn wikitext extras 3.0.14.201707112336 (org.eclipse.mylyn.wikitext.extras_feature.feature.group 3.0.14.201707112336) software installed: mylyn wikitext 3.0.6.201703111926 (org.eclipse.mylyn.wikitext_feature.feature.group 3.0.6.201703111926) 1 of following can installed @ once: mylyn wikitext tasks ui 3.0.6.201703111926 (org.eclipse.mylyn.wikitext.tasks.ui 3.0.6.201703111926) mylyn wikitext tasks ui 3.0.14.201707112336 (org.eclipse.mylyn.wikitext.tasks.ui 3.0.14.201707112336) cannot satisfy dependency: from: mylyn wikitext extras 3.0.14.201707112336 (org.eclipse.mylyn.wikitext.extras_feature.feature.group 3.0.14.201707112336) to: org.eclipse.

javascript - Inserting and removing data from a child node wtih push () -

background in web app, each player object in database. when user selects player, instead of whole object being sent user's "selection" node under "user" parent node, player id inserted instead ease of reference. code i trying create web app such insert player id specific child node using push (). code : //add player if not added if(!selected || selected[player.position<2) { ref3.push(player.id); } which results in following in database: fantasyapp: { players: { player 1: { goals: 0, assists: 0, id: 1 }, player 2: { goals: 1, assists: 3 id:2 } ... }, users: { user1: { selections: { fkajsdfjadfaj: 1 jfuueiuhfnalp: 2 } } ... } } my issue my issue how delete user selected player database when user changes mind selection. below code h

hadoop - Oozie pyspark job -

i have simple workflow. <workflow-app name="testsparkjob" xmlns="uri:oozie:workflow:0.5"> <start to="testjob"/> <action name="testjob"> <spark xmlns="uri:oozie:spark-action:0.1"> <job-tracker>${jobtracker}</job-tracker> <name-node>${namenode}</name-node> <configuration> <property> <name>mapred.compress.map.output</name> <value>true</value> </property> </configuration> <master>local[*]</master> <name>spark example</name> <jar>mapping.py</jar> <spark-opts>--executor-memory 1g --num-executors 3 --executor-cores 1 </spark-opts> <arg>argument1</arg> <arg>argument2</arg> </spark> <ok to="end"/>