Posts

Showing posts from February, 2014

Yii2: Why in the beforeDelete method, does the hasMany return a null? -

i'm trying delete related data has many-to-many relationship my complex model: /** * @return \yii\db\activequery */ public function getcomplexdocument() { return $this->hasmany(complexdocument::classname(), ['complex_id' => 'id']); } /** * @return \yii\db\activequery */ public function getdocuments() { return $this->hasmany(documents::classname(), ['id' => 'document_id']) ->via('complexdocument'); } in beforedelete following: public function beforedelete() { foreach ($this->documents $document){ var_dump($document); } return parent::beforedelete(); } deletion not happen, checked , hasmany connections return null. in debug see following i did way: public function delete() { foreach ($this->documents $document){ $document->delete(); } return parent::delete(); // todo: change autogenerated stub } everything works, related do...

ios - App Crash, "Lost Connection" -

similar this question , i having issues , app crashing in same way. assume same answer on other question: memory issue; except getting crash during avassetexportsession call. guard let exporter = avassetexportsession(asset: mixcomposition, presetname: avassetexportpresethighestquality) else { return } exporter.outputfiletype = avfiletypempeg4 exporter.outputurl = url exporter.videocomposition = maincomposition print("done") exporter.exportasynchronously(completionhandler: { dispatchqueue.main.async(execute: { self.exportdidfinish(exporter) print("removing ai") self.removeai() print("removed ai") completion() }) }) func exportdidfinish(_ exporter:avassetexportsession) { if(exporter.status == avassetexportsessionstatus.completed) { print("cool") } else if(exporter.statu...

jquery - AJAX only works one time -

i did modal login form , submit through post ajax request. can login 1 time, when logout , try login again error message of ajax request (csrf failed) : prohibido (403) verificación csrf fallida. solicitud abortada the login works again if refresh whole page pressing f5. after success on login refresh header, not whole page. refresh code this: $('#update-' + idtoupdate).load(' #' + idtoupdate); edit: i discovered csrf token works 1 time after success request. have generate new token form work again, , token update if refresh whole page pressing f5, , not want do. any solution problem? not ajax requests update csrf token, not secure. i found solution. insert ids of forms csrf token in function $('#update-' + idtoupdate).load(' #' + idtoupdate); after success request. partial async f5 refresh of forms, csrf tokens update , can new requests.

aspnetboilerplate - generating swagger client using swaggergen tool doesnt work with asp net boilerplate -

i tried generating c# code , api created asp net boilerplate, response not deserializing correctly. upon investigation, seems json response wrapped using class called "ajaxresponse"; however, swagger.json doesnt include type in method response. does know how build c# swagger client accounts wrapped result? aspnet boilerplate wraps real result within ajaxresponse. class ajaxresponse generic type class. swaggergen tool fails produce right proxy classes because wrapping result occurs in runtime. signature of api, grabbed swagger raw result (not wrapped). so solution disabling automatic wrapper solution-wide. add 2 lines preinitialize() method in web.core project. , problem solved. configuration.modules.abpaspnetcore().defaultwrapresultattribute.wraponerror = false; configuration.modules.abpaspnetcore().defaultwrapresultattribute.wraponsuccess = false;

php - Javascript charts not populating data from mysql -

i attempting query mysql table info use data populate chart getting x axis "clothing undefined" running across , bars not populating. i using following script query table clothing.php: if($_get['action'] == 'clothingordered' && $_get['id']){ $uid = $_get['id']; $sql = "select clothing, orders clothingorder userid = '$uid'"; $query = mysqli_query($db_conx, $sql); if($query){ $data = array(); foreach($query $row){ $data[] = $row; } print json_encode($data); }else{ echo mysqli_error($db_conx); } }else{ print 'not good'; } this yields: [{"clothing":"tshirt ","orders":"4"},{"clothing":"jeans","orders":"7"},{"clothing":"hats","orders":"34"},{"clothing":"dresses","orders":"12"},{"clothing":"jackets","orders...

value cannot be null. parameter name encoder MySql C# -

i using 2 separate buttons rotate image , save image. somehow rotation working. save(update) not working. tried find problem, couldn't. the error "value cannot null. parameter name encoder". best guess rotateflip somehow effecting picture box. regards this code, private void btnrotate_click(object sender, eventargs e) { if (pictureboxprofile.image != null) { pictureboxprofile.image.rotateflip(rotatefliptype.rotate90flipnone); pictureboxprofile.refresh(); } else { messagebox.show("select image"); } } private void btnsave_click(object sender, eventargs e) { if (txtshortname.text == "" || txtphonenumberm.text == "" || txtfullname.text == "" || gender.text == "" || richtextboxaddress.text == "" || txtphonenumberh.text == "" || status.text ...

html5 - Content of textarea not showing up on render -

Image
can't seem inner content of textarea tags show on load. sample html i'm experiencing problem with: <textarea name="textareaname" rows="8" cols="80">text area content edit on load.</textarea> inspect element shows html renders that, complete innerhtml. it's not showing text in textarea. idea causing this? render in inspect element:

html - select option:checked background color change but option text color not change in css -

select option:checked background color perfect work option text color not work please me css code <style> select option:checked{ background: red linear-gradient(0deg, red 0%, red 100%); color: #000 ! important; } </style> html code <select multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select> please ans me thank you here solution <select multiple class="select_option_class_name"> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select> $('.select_option_class_name').change(function () { $(this).find('option:selected').css('color', 'red'); $(this).find('option:selected').css(...

mysql - how to retrieve serialize data into tabel in php using unserialized -

greeting, name tri. working on serialize data database in mysql php. after serialized data database, don't know how retrieve table using unserialized. after unserialized data database, data converted array when use print_r(); method. this code : $cart_id = 9; $sql = "select details shop id_order =".$cart_id; $result = $this->db->query($sql); if($result->num_rows()>0){ foreach ($result->result_array() $row) { $cart = unserialize($row['details']); } echo '<pre>'; echo print_r($cart); echo '</pre>'; i stored serialized data column details inside orders table. but when try retrieve serialized colum details using unserialized, can show of them using print_r(). this print_r() result code after unserialized : array ( [c4ca4238a0b923820dcc509a6f75849b] => array ( [rowid] => c4ca4238a0b923820dcc509a6f75849b ...

visual studio - Enable mail box from C# powershell -

the code enable mail box on prem exchange server works when run in debug mode visual studio fails when deployed on iis on same instance.the commands work powershell console throws exception cannot connect server access denied. could 1 pls me this? pfb snippet works fine when run visual studio debug mode , fails when run code deployed on iis string connectionuri = strconuri; string loginpassword = pwd; securestring secpassword = new securestring(); foreach (char c in loginpassword) { secpassword.appendchar(c); } pscredential credential = new pscredential(usercred, secpassword); runspace runspace = system.management.automation.runspaces.runspacefactory.createrunspace(); powershell powershell = powershell.create(); pscommand command = new pscommand(); command.addcommand("new-pssession"); command.addparameter("configurationname"...

spring - Achieving multi tasking -

how can achieve multi tasking in spring/jpa. having service perform 2 tasks update record search record. these 2 independent task. since there no need 1 wait other task finish. during research found there @scheduled can used schedule tasks. here scenario different, solution parallel processing of 2 independent tasks. which jpa api can used here achieve multi taking? i think rather relying on jpa apis , use thread pools carry out these tasks. thread1 pool executing search while record updation on thread2. way lot simpler if prefer use other orm frameworks

android - How to layout three buttons evenly located under LinearLayout? -

Image
i have 3 buttons need located in 1 line @ bottom of screen. below code in activity xml. in order make 3 button takes space, wrap each of them inside linearlayout , set layout android:layout_weight 1 , android:layout_gravity center. <linearlayout android:layout_width="match_parent" android:layout_height="90px" android:background="#88104502" android:orientation="horizontal"> <linearlayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="center" android:orientation="horizontal" android:layout_weight="1"> <button android:id="@+id/goback" android:layout_width="70px" android:layout_height="80px" android:gravity="center" ...

Runtime boolean and String error in java? -

hi println giving me error working fine if print them separately. idea why happening? class stringtesting { public static void main(string me[]) { string s1="varun"; string s2="varun"; string s3="varun"; string s4=new string("varun"); string s5=new string("varun"); system.out.println(" "+s1==s3+" "+s1==s2+" ");//here giving me error } } and in advance :) in terms of operators , + has precedence on == . it means code : " "+s1==s3+" "+s1==s2+" " is translated compiler : " varun"=="varun varun"=="varun " the first part " varun"=="varun varun" produces boolean and applying "varun " string == comparator, results : booleanexpression == "varun " comparing boolean string not valid. anyway, if was, don't want want output boolean result of == compar...

java - Send and Receive packets from same TCP port -

i have 2 custom programs 1 sends stream of data , other 1 receive stream further processing. possible send data 1 tcp port , receive(read) data same port ?. if not can recommend alternative method.any appreciated. (the 2 programs run on same machine) a tcp connection has 2 ends , permits communication in both directions. each end's sending port other end's receiving port. case. if you're asking if each end's sending port can same other end's receiving port, answer yes. that's case. if you're asking if both ends can have same sending , receiving port, answer is: 1) if source ip address same on both ends (say 127.0.0.1 ) absolutely not. if be, impossible distinguish between 2 endpoints. 2) if source ip address different on both sends (say 127.0.0.2 on 1 end , 127.0.0.3 on other) theoretically possible , can happen if you're using 2 different machines. far know, no common tcp/ip stack permits single port used in way if both ends on sa...

c# - Determine if MethodInfo represents a lambda expression -

how 1 determine if methodinfo represents metadata lambda expression? i think talking anonymous methods.so, can write extension method , check whether name of method contains invalid chars.because compiler generated methods contains invalid chars, can use feature determine whether method anonymous or not: public static bool isanonymous(this methodinfo method) { var invalidchars = new[] {'<', '>'}; return method.name.any(invalidchars.contains); } test: func<int> f = () => 23; console.write(f.method.isanonymous()); // true more elegant why validating method name using isvalidlanguageindependentidentifier method, (method this answer): public static bool isanonymous(this methodinfo method) { return !codegenerator.isvalidlanguageindependentidentifier(method.name); } remember in order access isvalidlanguageindependentidentifier method need include system.codedom.compiler namespace.

c++ - How to link shared libraries in custom path directly without specifying RPATH? -

i on ubuntu 16.04, , required use external library ( mcr ). puts of it's shared libraries inside matlab/bin/glnxa64/ folder. need libmx.so in there there libraries in there has exact same name ones in /usr/lib different (because file size different), example libtiff.so.5 . this becomes problem because when use find_library function in cmake add matlab/bin/glnxa64/ rpath in order link libmx.so application, since application depends on external library (opencv) linked libtiff.so.5 in /usr/lib when built, when compile application shows compilation error of /usr/lib/libopencv_imgcodecs.so.3.3.0: undefined reference `tiffreaddirectory@libtiff_4.0' it because application trying link libtiff.so.5 in matlab/bin/glnxa64/ instead of /usr/lib because rpath has higher priority default directories. best way solve this? i tried renaming libtiff.so.5 in matlab/bin/glnxa64/ libtiff_old.so.5 . solves ugly. is there anyway can alternate search priority rpath goes a...

c# - Raising events by calling delegates - why not by event name? -

i have looking @ old piece of code , cannot somehow understand following: public event eventhandler namechanged; #endregion #region protected void onnamechanged(eventargs args) /// <summary> /// raises namechanged event. /// </summary> /// <param name="args">event arguments.</param> protected void onnamechanged(eventargs args) { eventhandler eh = this.namechanged; if (eh != null) { eh(this, args); } } why event raised invocation of delegate? not call event (namechanged) usual? edit: can see suggested on msdn: https://docs.microsoft.com/en-us/dotnet/standard/events/ whenever reference event, in fact copying invocation list local reference. doing that, make sure between checking validity of event eh != null , invoking event eh(this, args) eh's value wouldn't change (maybe different thread). in c# 6, there new operator https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-co...

spring mvc - always http error 404 : after useing swagger-codegen generat i can't use the rest service -

description when generate code swagger-codegen, got 3 problems . first : error creating bean name 'documentationpluginsbootstrapper' second: error creating bean name 'webmvcrequesthandlerprovider' last one: org.springframework.http.invalidmediatypeexception: invalid mime type "json": not contain '/' i google solutions , , remove annotation :@enablewebmvc , @enableswagger2 , there nothing wrong then deploy project , , can't use . the used url :localhost:8002/basic/resources/api/tb-build as expected, should have got json data , truth http error 404 swagger-codegen version 2.2.1 command line used generation java -jar j:\swagger-codegen-cli-2.2.1.jar generate -i "c:\users\angelina\desktop\basic.json" -l spring --library spring-mvc -o server/basic/spring-mvc some configuration: pom.xml: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance...

c# - How to make left join, group by and select with the single query? -

Image
assume have following data: var workers = new[] { new { name = "john", id = 1 }, new { name = "greg", id = 2 }, new { name = "jack", id = 3 }, new { name = "josh", id = 4 }, new { name = "jill", id = 5 }, new { name = "jane", id = 6 } }; var contracts = new[] { new { contractnumber="1", workerid=1, contractdate = new datetime(2017,6,30) }, new { contractnumber="2", workerid=2, contractdate = new datetime(2017,7,10) }, new { contractnumber="3", workerid=2, contractdate = new datetime(2017,7,15) }, new { contractnumber="4", workerid=5, contractdate = new datetime(2017,7,20) }, new { contractnumber="5", workerid=1, contractdate = new datetime(2017,7,25) } }; what need select first worker has minimum quantity of contracts contract date greater or equals to: var fromdate = new datetime(2017, 7, 1); excl...

ios - cancelTracking called unexpectedly when dragging in customized segmented control -

Image
i'm using customized segmented control this tutorial , in addition, selected segment changed on swipe/drag, added these functions: override func begintracking(_ touch: uitouch, event: uievent?) -> bool { super.begintracking(touch, with: event) let location = touch.location(in: self) lasttouchlocation = location return true } override func continuetracking(_ touch: uitouch, event: uievent?) -> bool { super.continuetracking(touch, with: event) let location = touch.location(in: self) print(location.x - lasttouchlocation!.x) let newx = thumbview.frame.origin.x + (location.x - lasttouchlocation!.x) if frame.minx <= newx && newx + thumbview.frame.width <= frame.maxx { thumbview.frame.origin.x = newx } lasttouchlocation = location return true } override func endtracking(_ touch: uitouch?, event: uievent?) { super.endtracking(touch, with: event) let location = touch != nil ? touch!.location(in...

mysql - Pointing data from 1 table to another -

table 1 id - int last_name-varchar(255) first_name--varchar(255) adress- varchar(255) city- varchar(255) table 2 idpk- int brand- varchar (255) model- archar(255) reg_number - varchar(8) person_idfk - int now need 2 recordings table 1 point 1 recording table 2. how can ,what command should use ?

python - What is the function of __init__ method here -

this question has answer here: understanding python super() __init__() methods [duplicate] 7 answers how invoke super constructor? 5 answers what 'super' in python? 5 answers class mythread(threading.thread): def __init__(self,str1,str2): threading.thread.__init__(self) self.str1 = str1 self.str2 = str2 def run(self): run1(self.str1,self.str2) i know __init__ used initialize class purpose in next line.is there alternative this? __init__ used initialize class objects. when create new object of mythread , first calls threading.thread.__init__(self) , defines 2 attributes str1 , str2. note explicity call threading.thread , base...

python - Check if multiple strings are present in pandas dataframe -

i trying determine if 2 variables found in dataframe table: code index 600.si 4th q 2015 500.si full year ggr.si 1st q 2016 # if variable_code , variable_date not found in table, print not found if table['code'].str.contains(variable_code).any() & table['index'].str.contains(variable_date).any(): print('found') else: print('not found') however, return me found . i think if statement structured incorrectly bool comparison 2 items. how can solved? update normally, variable_code found in table . if variable_code found in table , check if variable_date present too. what trying achieve is, if both of these conditions not present, print not found . with str.contains , regex=true default, if you're not careful, won't matching right things. if want check equality rather containment, use == operator, this: if not table[(table['code'] == variable_code) & (table['index'...

windows - How to run system() as administrator in PHP? -

i need send commands system admin throught php system() function on windows environment. i know can dangerous, need that. i have solved issue using toolkit named cpau by using can exec command simply: cpau -u administrator -p pwd_here -lwp -ex "net user myuser mypwd /add" to make work i've needed change administrator password in computer management > users. for people saying "use runas" i not use runas because prompts password , can't pass in same command line. ps: remember place cpau in php folder.

laravel - homestead vagrant up suddenly gives error -

i error while trying boot homestead server vagrant up. saw identical issue here answer wasn't descriptive me follow. c:/users/ekwonwa henry/homestead/scripts/homestead.rb:168:in `+': no implicit conversion of nil string (typeerror) c:/users/ekwonwa henry/homestead/scripts/homestead.rb:168:in `block (2 levels) in configure' c:/hashicorp/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/kernel_v2/config/vm_provisioner.rb:72:in `call' c:/hashicorp/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/kernel_v2/config/vm_provisioner.rb:72:in `add_config' c:/hashicorp/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/kernel_v2/config/vm.rb:324:in `provision' c:/users/ekwonwa henry/homestead/scripts/homestead.rb:167:in `block in configure' c:/users/ekwonwa henry/homestead/scripts/homestead.rb:156:in `each' c:/users/ekwonwa henry/homestead/scripts/homestead.rb:156:in `configure' c:/users/ekwonwa...

Service Fabric can't connect to guest executable on UDP (Unreal Engine Server) -

i'm trying deploy unreal server guest executable service fabric. i've been fallowing blog post: http://haishibai.blogspot.com/2017/03/setting-up-highly-available-minecraft.html except i'm not using containers , use windows based service. on local cluster works. can connect client deployed server. when trying connect remote server, can't connect it. when looking @ service fabric managment page seems server process working (it have proper process id). in loadbalancing service have port forwarding on udp/7777, though healthprobes on tcp (there no option select udp, don't know if mnatter). here servicemanifest: <?xml version="1.0" encoding="utf-8"?> <servicemanifest name="unrealguestpkg" version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="h...

swift3 - Swift 3.1 Text to speech Bug -

i make small test programme. classic example. import uikit import avfoundation class viewcontroller: uiviewcontroller { let voices = avspeechsynthesisvoice.speechvoices() var voicetouse: avspeechsynthesisvoice? let string = "hello, world!" func tts(){ let utterance = avspeechutterance(string: string) utterance.voice = avspeechsynthesisvoice(language: "en-us") utterance.volume = 1.5 utterance.rate = 0.5 utterance.pitchmultiplier = 1.25 let synth = avspeechsynthesizer() synth.speak(utterance) } override func viewdidload() { super.viewdidload() tts() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } } but in logs time write bug 2017-08-19 21:42:22.674325 ttsonle[75447:2812397] 0x608000147170 copy matching assets reply: xpc_type_dictionary { count = 2, transaction: 0, voucher = 0x0, contents = "assets...

Null entry for the parameter in Asp.net MVC -

i use asp.net mvc coding. i'm using @html.pagedlistpager when clicking on page number. this error: the parameter dictionary contains null entry parameter 'page' of non-nullable type 'system.int32' method 'system.web.mvc.actionresult pagegroup (int32)' in '****.areas.****.controllers.groupcontroller'. optional parameter must reference type, nullable type, or declared optional parameter. parameter name: parameters in arearegistration.cs public override void registerarea(arearegistrationcontext context) { context.maproute("***_group", "***/group/pagegroup/{page}", new { page = urlparameter.optional} ); } in view @html.pagedlistpager(model.groupitems, page => url.routeurl("***_group", new {page})) in controller public actionresult pagegroup(int page) { //code }

selenium - How to automate voice apps testing -

is there way automate testing of apps take voice input (similar siri)? possible test selenium or should use other tools? there tools google voice, call recorder,ipadio helps automate voice. can try integrate these apps appium, automation framework mobile applications.

javascript - How to download a csv file created in JS to your android phone (webview) -

i want export csv file created in js , let people download on phone. this js code creating file: var createacsvfile = function () { var arrayofdatatoexport = []; (var k = 0; k < localstorage.length; k++) { console.log([localstorage.key(k),json.parse(localstorage.getitem(localstorage.key(k)))]); arrayofdatatoexport.push([localstorage.key(k),json.parse(localstorage.getitem(localstorage.key(k)))]) } var csvrows = []; for(var i=0, l=arrayofdatatoexport.length; i<l; ++i){ csvrows.push(arrayofdatatoexport[i].join(',')); } var csvstring = csvrows.join("%0a"); var = document.createelement('a'); a.href = 'data:attachment/csv,' + csvstring; a.target = '_blank'; a.download = 'exportfile.csv'; document.body.appendchild(a); a.click(); }; createacsvfile(); this android code: protected void oncreate(bundle savedinstancestate) { ...

android - Bounce animation with depth -

how can add bounce animation view go down , come should 1 time . if set bounce interpolator y bouncing given duration want 1 time should go 5dp down , current view objectanimator animator = objectanimator.offloat(targetview, "translationy", 0, 50, 0); animator.setinterpolator(new bounceinterpolator()); animator.setduration(200); animator.start(); use overshootinterpolator . doc: an interpolator change flings forward , overshoots last value comes back. you can adjust tension of overshoot using constructor tension parameter: overshootinterpolator(float tension) tension: amount of overshoot. when tension equals 0.0f, there no overshoot , interpolator becomes simple deceleration interpolator. default value of tension 2.0f . example using viewpropertyanimator : targetview.animate() .translationy(50) .setinterpolator(new overshootinterpolator()) .setduration(200); using objectanimator: objectanima...

javascript - run after the callback is finished -

i need run function after displaypredictionsuggestions callback retrieves , stores result in global variable place . as understand callback runs asynchronously. can't sure callback finished when invoke console.log( json.stringfy( place ) ); how make sure program continues after callback finished (without nesting)? predictionservice = new google.maps.places.autocompleteservice(); predictionservice.getplacepredictions({ input: '1 street, city' }, displaypredictionsuggestions ); displaypredictionsuggestions = function(predictions, status) { place = predictions[0]['place_id']; } console.log( json.stringfy( place ) ); you can avoid nesting callbacks using promises .

math - Combining IMU and image tracking pose -

i improve image-based tracking using imu. imu should used in cases when i’m losing tracking (e.g. marker or image). tracking , imu working when used separately, not working anymore when used simultaneously. imu , image based tracking providing high level pose 3x4 matrix 3x3 rotation matrix , 3x1 translation vector. pose defined in target reference frame (meaning camera position relative tracked object). imu provides 3x4 pose matrix imu is, @ moment, available rotational device tracking, therefore no translations possible after image tracking has been lost. in case if find image trackable, store pose provided imu (lastimuposeonmarker) , pose provided image trackable (lasttrackedposeonmarker). when lose image trackable, calculate difference rotation between “lastimuposeonmarker” , current imu pose , rotate “lasttrackedposeonmarker” difference rotation. to calculate difference rotation matrix x applying following formula: lasttrackedposeonmarker * x = currentimupose ==> ...

Apache to connect through a proxy server -

currently have reverse enabled show below reverse proxy proxyrequests off <proxy *> order deny,allow allow </proxy> proxypass /foo http://foo.example.com/bar proxypassreverse /foo http://foo.example.com/bar so request comes apache "/foo" forwarded " http://foo.example.com/bar ". if apache can access "foo.example.com" via proxy 176.77.86.8:8888. how configure it. using curl through proxy working expected curl -x http://176.77.86.8:8888 -l http://foo.example.com/bar got working, proxyremote thing looking for proxyremote http://foo.example.com http://176.77.86.8:8888

android - Why this java recursive method not creating infinite loop? -

i new android development, while trying read code example, encountered method being called within itself, logically should create infinite loop of calling itself. not. why? in mainactivity.java public void onwishlistselected() { launchuserspecificfragment(new wishlistfragment(), wishlistfragment.class.getsimplename(), new logindialoginterface() { @override public void successfulloginorregistration(user user) { // if login successful launch wishlistfragment. onwishlistselected(); // why doesn't create infine loop? } }); } and calling it: public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == r.id.action_wish_list) { onwishlistselected(); return true; } else if (id == r.id.action_cart) { oncartselected(); return true; } return super.onoptionsitemselected(item)...

android - Error:(6, 0) Gradle DSL method not found: 'google()' -

/users/ren/desktop/recylerviewbaseadapter/build.gradle error:(6, 0) gradle dsl method not found: 'google()' possible causes: project 'recylerviewbaseadapter' may using version of gradle not contain method. gradle settings build file may missing gradle plugin. apply gradle plugin the google() repo shortcut looks in google's maven repository dependencies. introduced gradle v.4.0 . it requires (currently) gradle v.4 android studio 3.x. gradle plugin android 3.x try use in gradle-wrapper.properties use: distributionurl=\ https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip as gradle plugin android use: classpath 'com.android.tools.build:gradle:3.0.0-beta1' in case (also android studio 2.3, gradle plugin 2.3.3 , gradle v3.3) can use same maven repo using { url 'https://maven.google.com'} . same. just use example: buildscript { repositories { maven { url 'https://maven.google....

Can't load options with Select.Async -

i can't basic application async options loading work. getoptions function gets called select control doesn't display them. here's code , plunkr link https://plnkr.co/edit/vkzxhjqrhdwflmqpt8b5?p=preview var options = [ { value: 'one', label: 'one' }, { value: 'two', label: 'two' } ]; function logchange(val) { console.log("selected: " + json.stringify(val)); } function getoptions(input) { console.log(input) return promise.resolve(options) } reactdom.render( <select.async name="form-field-name" value="one" loadoptions={getoptions} onchange={logchange} />, document.getelementbyid('example') ); i believe need return { options: yourdataarray } instead of yourdataarray. for example, in code, return promise.resolve(options) should changed return promise.resolve({options}) hope helps.

osx - Getting error "Unable to determine linked PHP" while Laravel Valet install on MAC -

Image
take @ - this question different possible duplicate - laravel valet linked php error because guy has following result - $ php /usr/local/cellar/php70/7.0.6/bin/php while had $ php /usr/local/bin/php and because followed stack overflow answer /usr/local/opt/php71/bin/php the problem seems originated laravel valets ability find php @ location expects or having multiple php versions choose from. not sure guess. , not know how fix this. i had same issue today. me solution run composer global update update global packages latest version of laravel. this required because of change order of arguments collection methods in 5.3: https://github.com/laravel/framework/blob/5.5/src/illuminate/support/arr.php#l175 , change way valet validates version of php installed: https://github.com/laravel/valet/commit/84ade711b61fd79ead98e08b5186704f68b4f993

python - Don't understand: ValueError: operands could not be broadcast together with shapes -

i have code create processes , opearate 2 own arrays each "threads" using lock scheme: if __name__ == "__main__": geom_file = sys.argv[1] filename = sys.argv[2] event = none resolution = 5814.0 dist = 0.2 n_3d = 501 # num of points output_array = [] pixm = cg.pixel_maps_from_geometry_file(geom_file) #getting pairs of coordinates in 3d x_array = pixm.x.flatten() y_array = pixm.y.flatten() z_array = np.ones_like(x_array) * dist open(filename,'r') stream: #reading stream file ang getting necessary info lines = stream.readlines() output_array = get_opt_patterns(lines) i_xyz_buf = rawarray(ct.c_double, n_3d * n_3d * n_3d) count_dot_buf = rawarray(ct.c_double, n_3d * n_3d * n_3d) mask_buf = rawarray(ct.c_int, len(x_array)) result_lock = lock() mask_lock = lock() pool = pool(os.cpu_count(), initializer=init_worker, initar...

javascript - how to generate lazy iteration thing in typescript -

currently still doing question : make general purpose infinite sequence initialisation function creates infinite lazy sequences. take parameter function compute next value current value. in other words, should “factory” functions naturalnumbers. thus, if call our function initsequence, initsequence(n=>n+1) return function equivalent naturalnumbers. this template given interface lazysequence<t> { value: t; next(): lazysequence<t>; } // implement function: function initsequence<t>(transform: (value: t) => t): (initialvalue: t) => lazysequence<t> { // code here } so far, code in typescript interface lazysequence<t> { value: t; next(): lazysequence<t>; } // implement function: function initsequence<t>(transform: (value: t) => t): (initialvalue: t) => lazysequence<t> { // code here ... return () => initsequence(v=>v+1) => lazysequence; } and seemed code do...