Posts

Showing posts from August, 2014

java - Drawing a circle in a turtle program -

Image
i working on processing (as in language) sketch, driven turtle logic (see https://en.wikipedia.org/wiki/turtle_graphics ). means draw line current coordinate supplied coordinate. supplied coordinate become new current coordinate. want approximate circle , have written simple piece of code using trigonometrics. code looks follow: void drawcircle(int radius){ // circle center radius amount left of current xpos int steps = 16; double step = two_pi /steps; for(double theta = step; theta <= two_pi; theta += step){ float deltax = cos((float)theta) - cos((float)(theta - step)); float deltay = sin((float)theta) - sin((float)(theta - step)); movexy(deltax*radius, deltay*radius); } } the program logic simple. use variable theta loop through radians in circle. amount of steps indicate how large each theta chunk is. calculate x,y values specific point in circle governed theta. deduct x,y values of previous cycle (hence theta-step ) amount have move

SonarQube - Some configuration tabs are rendered as empty -

Image
i'v tried both 5.6.2 , 6.0 following configuration tabs rendered empty pages: * general -> email * licenses * security -> encryption the 1 actual need email settings, cannot configure notifications. don't see errors in log, 1 warning is: "jna not found. native methods disabled." what requirements show configuration tab?

java ee - What are good point and features for each protocol in jboss remote naming? -

jboss uses 3 different protocols can used calling remote ejb: remote , ejb http-remote . afaik there 1 more - jnp , abandoned. each shallow described in wildfly 10 documentation here: https://docs.jboss.org/author/display/wfly10/remote+jndi+reference https://docs.jboss.org/author/display/wfly10/remote+jndi+reference+update+draft for me, interesting http-remoting comparing ejb . cannot find information http-remoting . interested in load balancing between servers, have same stateless bean deployed. protocol http-remoting uses http calls, right? mean can use external tool better distribute calls between servers. http-remoting same remoting runs on http port of wildfly , uses http upgrade switch remoting remoting binary protocol introduces in jboss 7 , can used compatibility or if want have remoting on port seperate http ejb not protocol. need setup client differently use jndi prefix (described in links). tries save server call (i.e. jndi lookup) , @ same time s

html - Bootstrap 3 glyphicon not working inside a button -

i have strange issue bootstrap glyphicons. can't glyphicon glyphicon-option-horizontal , glyphicon glyphicon-option-vertical work inside button this: <button class="btn btn-default dropdown-toggle" type="button" id="dropdownmenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <span class="glyphicon glyphicon-option-horizontal"></span> </button> if try example glyphicon glyphicon-plus works , other glyphs well. issue here? i'm using bootstrap v3.0.3. , can't change bootstrap version. tried putting display:inline-block didn't work. add latest bootstrap css version 3.3.7 working now <button class="btn btn-default dropdown-toggle" type="button" id="dropdownmenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <span class="glyphi

memory - Where does the jvm load the compiled java code? -

after compilation of business logic, .class file generated in our hard drive. doubt is, when execute compiled code, has loaded somewhere. location?! the .class file includes instructions hardware , os. .class file loaded jvm memory (ram) before execution of program , being handled there. compiled code executed java virtual machine represented using hardware- , operating system-independent binary format, typically (but not necessarily) stored in file, known class file format. class file format precisely defines representation of class or interface, including details such byte ordering might taken granted in platform-specific object file format. taken from: chapter 2. structure of java virtual machine

Foreign keys work occasionally in MySQL -

i quite new stackoverflow please sorry in case doing wrong. , sorry english - it's not native language. ok, make long story short. using: server version: 5.6.31 mysql community server (gpl) there have 2 tables this: table texts create table `texts` ( `id` int(11) unsigned not null auto_increment, `body` text, `source_id` int(11) unsigned default null, primary key (`id`), key `texts_sources_key` (`source_id`), constraint `texts_sources_key` foreign key (`source_id`) references `texts` (`id`) on delete set null on update cascade ) engine=innodb auto_increment=5 default charset=utf8 table texts_sources create table `texts_sources` ( `id` int(11) unsigned not null auto_increment, `short_desc` varchar(255) default null, `long_desc` text, `url` varchar(255) default null, primary key (`id`) ) engine=innodb auto_increment=2 default charset=utf8 as can see - there foreign key linking these tables on delete set null on update cascade . here initi

python - How verify function implemented? -

i want find how verify() function pillow library implemented. in source code found this: def verify(self): """ verifies contents of file. data read file, method attempts determine if file broken, without decoding image data. if method finds problems, raises suitable exceptions. if need load image after using method, must reopen image file. """ pass where can find implementation? (source code found here: pillow source code ) a comment on github explains: image.[v]erify checks chunk checksums in png files, , no-op elsewhere. so short answer did find default implementation absolutely nothing. except png files , can find implementation in pngimagefile.verify method: def verify(self): "verify png file" if self.fp none: raise runtimeerror("verify must called directly after open") # beginning of idat block self.fp.seek(se

bcmath - Decimal multiplication in php -

i having problem multiplication of 2 decimals 30.63 , 0.15 . calculator says should result in 4.60 . $commission = bcmul(30.63, 0.15,2); result 4.59 . from had read bcmul meant work decimal numbers? many thanks, from the documentation $scale parameter bcmul : this optional parameter used set number of digits after decimal place in result. this means number rounded down (or negative number) when it's used, e.g. > echo bcmul(0.99, 1, 1); 0.9 for values, 30.63 * 0.15 equal 4.5945. supplying $scale value of 2 means 4.59, you've reported. i'm not sure why you're expecting 4.60, unless you're expecting result rounded up .

xml - Searchview doesn't work on Android v6.0 -

well getting confuse one. create app have search feature, yesterday test on xiaomi redmi 2 android 4.4 , feature including search working smoothly. today test on friends nexus 5 android 6.1 , feature work except search feature. when click search button, on xiaomi open searchbar user can type text keyword there on nexus showing keyboard , not searchbar. nothing happen if input text there. please master me. don't know happen exactly. thanks.. nb. activity contain search feature : public class homeactivity extends appcompatactivity implements navigationdrawerfragment.navigationdrawercallbacks, byrentalfragment.categoryselectioncallbacks, bybrandfragment.categoryselectioncallbacks, bytypefragment.categoryselectioncallbacks, resultlistfragment.resultlistcallbacks, searchview.onquerytextlistener, adapterview.onitemclicklistener { private toolbar toolbar; tablayout tablayout; private viewpager viewpager; viewpageradapter viewpageradapter; private int na

Set API key with embed API google analytics -

i rending map google analytics data using embed api as: (function(w,d,s,g,js,fs){ g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}}; js=d.createelement(s);fs=d.getelementsbytagname(s)[0]; js.src='https://apis.google.com/js/platform.js'; fs.parentnode.insertbefore(js,fs);js.onload=function(){g.load('analytics');}; }(window,document,'script')); gapi.analytics.auth.authorize({ serverauth: { access_token: 'my access token' } )}; var commonconfig2 = { query: { ids: 'ga:' + gaviewid, metrics: 'ga:users', dimensions: 'ga:region', 'max-results': 5, sort : '-ga:users' }, chart: { type: 'geo', container: 'timeline', options: { displaymode: 'markers', wid

javascript - JS: For loop continues to iterate after condition is false -

does know cause loop continue after conditions met? post entire file, quite large. here loops: for (var j = 0; j < depkeyarr.length; j++) { var directory = angular.copy(dependencies[depkeyarr[j]]), keyarr = angular.copy(object.keys(directory)); (var = 0; < keyarr.length; i++) { var next = + 1; if (keyarr[i] && !keyarr[i].includes('params')) { if (keyarr[next] && keyarr[next].includes('params')) { directory[keyarr[next]] = directory[keyarr[next]].split(', ') !== [''] ? directory[keyarr[next]].split(', ') : undefined directory[keyarr[next]].push(directory[keyarr[i]]) } var paramarr = directory[keyarr[next]] ? directory[keyarr[next]] : directory[keyarr[i]] switch (depkeyarr[j]) { case 'controller': angular.module('app').controller(keyarr[i], paramarr)

javascript - Getting UniqueID inside OnClientClick() to pass as a parameter to a JS function -

i using devexpress grid , dataitemtemplate column follows: <dataitemtemplate> <asp:button visible="true" enableviewstate="false" cssclass="btn btn-sm btn-danger" data-confirm="are sure want delete organisation member?" id="deletebutton" data-id="<%#: container.keyvalue %>" runat="server" text="delete" onclientclick=' return deleteconfirm("<%= uniqueid %>"); ' onclick="deletebutton_onclick" /> </dataitemtemplate> i want pass unique identifier button js function deleteconfirm() parameter. however instead of unique identifier getting string <%= uniqueid %> how unique identifier each button passed parameter? item within <%= %> or <%# %> notation cannot references properties on object itself. should able pass this , use button directly though: return deleteconfirm(this); the this reference reference butt

Error when using Highcharts with Angular 2 -

i using angular2-highcharts component.ts file below: import { component } '@angular/core'; import { chart_directives } 'angular2-highcharts'; @component({ selector: 'emotions', templateurl: 'app/components/emotions/emotions.component.html', providers: [emotionsservice], directives: [chart_directives] }) export class emotionscomponent { constructor(private emotionsservice: emotionsservice) { this.options = { title : { text : 'simple chart' }, series: [{ data: [29.9, 71.5, 106.4, 129.2], }] }; } options: highchartsoptions; } in template file <chart [options]="options"></chart> package.json file has following alongwith other angular dependencies: "dependencies": { "angular2-highcharts": "0.2.1" }, i have run npm install , angular2-highcharts has been install in node_modules fo

php based crawler/scraper for the page loaded with jquery -

i working on script loads html page of ecommerce site. script fine enable provide me html added jquery on page. is there way resolve this? i using below code:- currently using meta tags fetching data. $url = "https://www.flipkart.com/pureit-classic-23-l-gravity-based-water-purifier/p/itmefqycwh7mgwan?pid=wapefqy5yewy4zgt&srno=s_1_5&otracker=search&lid=lstwapefqy5yewy4zgto514um&qh=d5e3b0f34459bd7d"; $response = getpricefromflipkart($url); echo '<pre>'; print_r($response); echo '</pre>'; /* returns response in json format */ function getpricefromflipkart($url) { $curl = curl_init($url); curl_setopt($curl, curlopt_useragent, "mozilla/5.0 (windows; u; windows nt 10.10; labnol;) ctrlq.org"); curl_setopt($curl, curlopt_failonerror, true); curl_setopt($curl, curlopt_followlocation, true); curl_setopt($curl, curlopt_returntransfer, true); $html = curl_exec($curl); curl_close($curl);

r - Using same alpha/size scale for 2 different plots with ggplot -

Image
i have 2 data frames use make 2 scatter plots. use 1 column set alpha , size of markers , need scaling in second plot identical first. problem while values in plot range 0 1, in plot b range 0 0.5 (the scale in b should 0 1)... quick example: x=seq(from=1, to=10, by=1) y=seq(from=1, to=10, by=1) markera=sample(0:100,10, replace=t)/100 markerb=sample(0:50,10, replace=t)/100 dfa=data.frame(x,y,markera) dfb=data.frame(x,y,markerb) a<- ggplot(dfa,aes(x=x, y=y)) <- + geom_point(aes(alpha=dfa$markera, size=dfa$markera)) b<- ggplot(dfb,aes(x=x, y=y)) b <- b + geom_point(aes(alpha=dfb$markerb, size=dfb$markerb)) b i think there should easy way can't seem find it... just add scale_size , scale_alpha plots. ggplot2 , remember not use $variable in aes here example: a = ggplot(dfa,aes(x=x, y=y)) + geom_point(aes(alpha=markera, size=markera)) + scale_size(limits = c(0,1)) + scale_alpha(limits = c(0,1)) b = ggplot(dfb,aes(x=x, y=y)) + geom_point(a

javascript - To display data in the fields in the modal retrieved from the mysql database -

friends submitting form on clicking submit button , simultaneously displaying submitted data in modal.so hit submit button ,the data gets submitted , modal appears data submitted.everything working fine code problem data not gets displayed in modal. here code submitting form- $("#savep").click(function(e){ e.preventdefault(); formdata = $('form.pform').serialize() + '&' + encodeuri($(this).attr('name')) + '=' + encodeuri($(this).attr('value')); $.ajax({ type: "post", url: "data1_post.php", data: formdata, success: function(msg){ $('input[type="text"], textarea').val(''); $('#entrysavedmodal').modal('show'); }, error: function(){ alert("failure"); }

oracle - Call to groovy service from pl/sql procedure -

is possible make call groovy service oracle pl/sql stored procedure? know it's other way around, i've heard possible yet unable find documentation on it. check out http://www.oracle-base.com/articles/misc/utl_http-and-ssl.php . contains step-by-step instructions setting access web services. i have been using retrieve data web service on 2 years.

Android WiFi Device-to-AP Round-Trip-Time (RTT) -

with android api-level 21 , respectively 23 methods measure wifi roundtrip time (rtt) added sdk: wifimanager.isdevicetoaprttsupported() scanresult.is80211mcresponder() but not find information how use api measure rtt . the relevant class rttmanager still marked system api. is there way perform device-to-ap rtt measurement? i wrote small libary wrap hidden api calls within compat class: android rttmanagercompat the lib makes use of java reflection access api , seems work. update: the app has installed in system/priv-app/ folder therefore phone needs rooted.

Sql server all logins are disabled -

i have sa login disabled, , disabled mistake other login used windows authentication (named: [server_name]\[computer_name]). can't access properties of login enable it, , can't run script that... so now, way reconnect, should reinstall sql server? there other way? i tried solution: connect sql server when system administrators locked out still unable login after starting sql server in single-user mode. i solved problem uninstalling features of sql server reinstall them , restore databases. these steps: 1-run uninstaller , remove data base services , 2 items listed under it. 2-run setup , choose add features existing instance , when reach features page choose removed in previous step. 3-now have fresh sql server accounts , database engine, databases still there, following query can restore them 1 one: use [master] go create database [database_name] on (filename = '...path\dtabase.mdf' attach; go.

php - How to insert (order form data) in multiple rows of mysql having same name -

here code. <form id="form.id" name="form.id" action="order" method="post"> <ul> //loading dynamically javascript <li class="singalproductlist'+ productid +'"> <input type="text" value="'+ productid +'" name="dishid[]" disabled> <input class="newlass'+ productid +'" type="text" value="1" name="dishquantity[]" disabled> <input type="text" value="'+ name +'" name="dishname[]" disabled> <input type="text" value="'+ price +'" name="dishprice[]" disabled> </li> </ul> </form> i using mvc that's why action (order) only. i submitting other button javascript not shown here. i able single li having 4 input fields value without [ ].

php - Laravel ajax form validation -

i want send short form email ajax. code below adds hidden input name='_token' {!! form::open(['route'=>'registercheck', 'id'=>'register_form', 'novalidate'=>'novalidate']) !!} in js script add data request: $.ajax({ method:'post', url: $form.attr('action'), data:{ '_token': $form.find('[name="_token"]').val(), email: $('#email').val(), user: $this.attr('id'), } }) how can authenticate , namespaces should include this? first add meta <meta name="csrf-token" content="{{ csrf_token() }}" /> then in script add var csrf_token = $('meta[name="csrf-token"]').attr('content'); finally change request this $.ajax({ method:'post', url: $form.attr('action'), data:{ _token: csrf_token, email: $('#email').val(), user:

Python: I want to check for the count of the words in the string -

i managed case i'm struggling when have consider 'color' equal 'colour' such words , return count accordingly. this, wrote dictionary of common words spelling changes in american , gb english this, pretty sure isn't right approach. ukus=dict() ukus={'colour':'color','cheque':'check', 'programme':'program','grey':'gray', 'jewellery':'jewelery','aluminium':'aluminum', 'theater':'theatre','license':'licence','armour':'armor', 'artefact':'artifact','centre':'center', 'cypher':'cipher','disc':'disk','fibre':'fiber', 'fulfill':'fulfil','metre':'meter', 'savoury':'savory','tonne':'ton','tyre':'tire', 'color':'colour','check':'chequ

uwp - Xaml Behavior DP not updated -

i have uwp application uses managed uwp behavior sdk. wrote custom behavior has 2 dependency properties, 1 of observablecollection. whenever update item in collection, make sure propertychanged called collection. however, dependency property not being updated. my code: <trigger:custombehavior itemindex="{x:bind itemindex}" presences="{binding elementname=box, path=datacontext.customcollection, updatesourcetrigger=propertychanged, converter={staticresource testconverter}}" /> my testconverter shows me when update item in collection, updatesource trigger working. dependency property in behavior however, not firing changed event. when change entire custom collection, dp updated, when change 1 item, isn't. research far says dependencyobject.setvalue checks see if object has changed , if 1 item changed, think collection didn't change @ all? true, , if so, how can overcome this? thanks a collection-type d

sql server - How to get multiple average values using subqueries -

there many accountants , each of them has jobs (paid hour) , need accountant name of every accountant has average job cost higher overall average of job costs. how do this? select accountant_name, avg(job_cost) 'average' job_view average > (select avg (job_cost) av job_view) group accountant_name; everything needed in view named job_view. above code not working on modifications appreciated. in advance. this should you: select accountant_name , avg(job_cost) 'average' job_view group accountant_name having avg(job_cost) > (select avg(job_cost) job_view) as per comment, error you're getting @ where average > because alias average not visible in where clause , requires put entire contents of column defined in select part. but because in select part average column aggregate function, these can go lower in having section, because having handles filtering of aggregate conditions. why this? because there rules order of executio

javascript - Create a form dynamicaly -

i'm facing issue. have javascript function generates form (using function append() ). i'm trying create form submit button, , when button pressed, php function called, charged stuff. but, it's not working, when press submit button, nothing happens. though, know code works, because ran on empty project, , without using function append() . some question : generating dynamically form using append() prevents php file called? if does, there way make work? if not, idea why it's not working , how using way? here javascript code : function create_user() { var id = document.getelementbyid("right-well"); $(id).empty().append("<h1 class='title'>users</h1>"); $(id).append("<div class='line-title'></div>"); $(id).append("<div class='add-user'>add user</div>"); $(id).append("<form action='../upload.php' method='post' enctype='multipart

Scala: How to avoid check instance and casting -

i found myself in condition of running: somecollection.filter(_.isinstanceof[foo]).asinstanceof[list[foo]] just check if collection has instances of foo , casting final filtered collection. is there better way (assuming cannot change current data structure)? i tried with: somecollection.map(case c: foo => c) but @ runtime returns matchingerror of course looking remaining cases ( case _ => ). somecollection.collect { case c: foo => c }

Php evaluate a string as variable and extract value of it -

<?php $i=2; $teststring='$_session["registered"]["firstname'.$i.'"]'; var_dump($teststring); die; if(isset(($teststring))){ //do } ?> in above code want find value of $_session["registered"]["firstname2'] variable , need suggestion/trick why not just $foo = $_session['registered']["firstname$i"]; array keys strings, , can dynamically generated. there absolutely no difference in php between these two: $foo = array('bar' => 'baz'); $x = 'bar'; echo $foo[$x]; echo $foo['bar']; both output baz .

Excel gets stuck when running VBA macro -

i started getting problem when clicking custom ribbon shortcut (which runs few macros) the code involves opening, saving, closing, deleting workbooks, downloading , parsing xml data through api, , copying , copying other workbooks description: problem caused program stop interacting windows. problem signature: problem event name: apphangb1 application name: excel.exe application version: 15.0.4420.1017 application timestamp: 506741b5 hang signature: 6acb hang type: 0 os version: 6.1.7601.2.1.0.256.1 locale id: 1037 additional hang signature 1: 6acb5e8afc59fd5d0f16b73953ad555b additional hang signature 2: 94d6 additional hang signature 3: 94d63882b3db19ba84c338ce0a96f1fe additional hang signature 4: 6acb additional hang signature 5: 6acb5e8afc59fd5d0f16b73953ad555b additional hang signature 6: 94d6 additional hang signature 7: 94d63882b3db19ba84c338ce0a96f1fe read our privacy statement online: http

java - Identifying a client behind router/firewall -

in web-app need register http clients accessing local network behind router. i started remotehost : remoteport combination, enough became clear, port numer gets regenereated upon each connection. i need able identify clients on similar mac address, property doesn't change. wanted use headers[ "x-forwarded-for" ] , it's not present @ all: [pragma=no-cache, cache-control=no-cache, host=somhost.com:8822, upgrade=websocket, connection=upgrade, sec-websocket-key=scnlm7hzjjy3ckljhjcia==, sec-websocket-extensions=x-webkit-deflate-frame,deflate-frame, sec-websocket-version=13] what other options identify clients? you use api key , is, unique identifier clients send along each request identify themselves. depending on authentication method using, consider standard http authorization header send value: authorization: api-key <value goes here> or create custom http header purpose. careful custom headers: proxies might strip them out.

javascript - Using $document.querySelectorAll in angularjs -

as $document wrapper angular.element(window.document) , ideally $document.queryselectorall() should work, getting error saying not function. can explain? you should able use... document.queryselectorall(..) omit $ because don't need jquery lite since you're using dom api. otherwise use jquery lite method... this link seems pertinent .

Handling multiple persistant volumes for a Rethinkdb Docker Swarm -

i'm using rethinkdb across cloud servers manually joining each server @ setup. i'm interested in moving on swarm approach make scaling , failover easier. current approach cumbersome scale. in current manual approach, create local folder on each server rdb , mount volume store data. however, using swarm means i'd need handle volumes more dynamically. each container need distinct volume keep data separate in case of errors. any recommendations on how handle scenario? lot of tutorials i've seen far mention flocker manage persistent storage, can't see being handled dynamically. currently struggling situation this. i've created temporary fix glusterfs. what install glusterfs on docker nodes , mount folders. way data exists on nodes. less ideal if have lot of writes. slow because of way gluster treats data replication prevent data loss. solid, have issues speed. in case suggest looking flocker. flocker volume plugin migrates data when containe

Access VBA - Reference to Subform disappears after database has been open a while -

i have microsoft access 2013 database has form hidden subform. there text box search value , button click search. there subform on form hidden until search button clicked. once button clicked, subform becomes visible , displays results of search. this process works fine normally. however, last night left database open form displayed in initial state subform hidden. entered search value , clicked search , "object not exist" error. traced vba code , fails on first line references subform: subform.form.recordsource = "(some sql text)" i read on 1 forum access can lose reference hidden control after period of time. assume case here, since when reload form, works fine. this database may stay open on user's computers overnight prevent problem if possible. i'm wondering if there way write code checks see if subform still referenced in memory, , if not, reconnect reference. not sure if possible in vba. like: if not subform.isloaded subform.reload end

sql server - Building batch insert statement powershell to sql -

i have powershell script writes every file , attributes recursively starting specific directory. works directories have many 1,000,000 files. want batch them @ 1000 inserts per transaction. here original ps: $server = "" $database = "" $path = "c:\test" $connection = new-object system.data.sqlclient.sqlconnection $connection.connectionstring = "server='$server';database='$database';trusted_connection=true;" $connection.open() $command = new-object system.data.sqlclient.sqlcommand $command.connection = $connection foreach($file in get-childitem -verbose -recurse -path $path | select-object name,length,mode, directory,creationtime, lastaccesstime, lastwritetime) { $filename = $file.name $filesize = ([int]$file.length) $filemode = $file.mode $filedirectory = $file.directory $filecreationtime = [datetime]$file.creationtime $filelastaccesstime = [datetime]$file.lastaccesstime $filelastwritetime

Python REGEX ignore case at the beginning of the sentence and take the rest -

i have kind of results: ª!è[008:58:049]http_cli:0 - line written in... and want ignore beginning characters ª!è , only: http_cli:0 - line written in... in simple regex line. i tried this: ^[\w0-9]* taking extended ascii characters plus time , not ignoring it, doing opposite... any help? thanks! if want after closing square bracket, no matter what, , skip before can go match this: s = "ª!è[008:58:049]http_cli:0 - line written in..." m = re.match(r'^.*?]([\s\s]*)', s) print(m.group(1)) print's 'http_cli:0 - line written in...' this expression looks through arbitrary number of characters before closing bracket , matches after that. matched group available m.group(1)

Async expressions C# -

i'm trying generate repository methods , including async versions ones, this: //method 1 public static list<myentity> getmyentitybydate(mycontexttype context) { var tmpmov = context.myentity .asnotracking() .tolist(); return tmpmov; } //method 2 v1 public async static list<myentity> getmyentitybydateasync(mycontexttype context) { var tmpmov = await context.myentity .asnotracking() .tolistasync(); return tmpmov; } //method 2 v2 public async static list<myentity> getmyentitybydateasync(mycontexttype context) { list<myentity> tmpmov = null; await task.factory.startnew(() => { tmpmov = getmyentitybydate(context); }); return tmpmov; } now have questions: what pros , cons of using method 2 v1 vs method2 v2, in terms of performance , fluency? before downvote question,

android - ViewGroup.java AddViewInner issue -

i keep getting following errors, it's same error keeps occuring on different lines fatal exception: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. @ android.view.viewgroup.addviewinner(viewgroup.java:3883) fatal exception: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. @ android.view.viewgroup.addviewinner(viewgroup.java:4312) fatal exception: java.lang.illegalstateexception: specified child has parent. must call removeview() on child's parent first. @ android.view.viewgroup.addviewinner(viewgroup.java:4310) things have tried :- while adding fragment add code in oncreateview ((viewgroup) view.getparent()).removeview(view); view = inflater.inflate(r.layout.create_carpool_layout, container, false); return view; and inflate view while inflating layouts / views in adapter make sure view remove

swift - iOS app with YouTube v3 API and youtube-ios-player-helper can't autoplay videos -

i having problem autoplaying videos youtube-ios-player-helper pod provided google/youtube. here relevant part of app (ios 10, swift 3): a channelvideosviewcontroller displays video thumbnails uiviews uitapgesturerecognizer in turn segues playerviewcontroller , passes videoid api call a playerviewcontroller follows: var youtubeplayerview = ytplayerview() // player videos var youtubevideoid = string() // videoid api passed channelvideosviewcontroller override func viewdidload() { // ... skipping ui stuff view.addsubview(youtubeplayerview) youtubeplayerview.load(withvideoid: youtubevideoid, playervars: ["autoplay":1,"modestbranding":1,"showinfo":0,"rel":0]) } with code above helper library loads videos , plays them in fullscreen when press "big red button" want autoplay videos directly after segue view. there way this? "autoplay":1 youtube docs doesn't seem cut ios. youtubeplayerview.playvideo() doesn&#