Posts

c# - Convert an IFile (JSON File) to MyObject -

i upload json file html form explained here in first paragraph. accept 1 file @ time controller: public iactionresult upload(iformfile file) { } now want convert file containing json object. this accepted answer of cuong le. how convert file lets myobject ? how deserialize file? (newtonsoft lib import right?) you can read text file , convert json. can try like, string filecontent = null; using (var reader = new streamreader(file.openreadstream())) { filecontent = reader.readtoend(); } var result = jsonconvert.deserializeobject<myobject>(filecontent ); yes, can use newtonsoft nuget package deserializing. wiki

python - Dask Distributed: Getting some errors after computations -

i running dask distributed on linux centos 7, python 3.6.2 installation. computation seems getting fine (i still improving code, able have results), keep getting python errors apparently linked tornado module. launching 1 node standalone dask distributed cluster. here common example: exception in thread client loop: traceback (most recent call last): file "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() file "/usr/local/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) file "/usr/local/lib/python3.6/site-packages/tornado/ioloop.py", line 832, in start self._run_callback(self._callbacks.popleft()) attributeerror: 'nonetype' object has no attribute 'popleft' and here one: tornado.application - error - exception in callback <bound method workstealing.balance of <distributed.stealing.workstealing object @ 0x7f752ce6d6a0>> traceback (...

angular - Chainig functions with observables fails to retrieve data -

am performing 1 function after has completed this have tried ngoninit () { this.subscriptions.add( this.route.params .subscribe(params => { this.truckdetails = params; this.getchecklistcategory(); }) ) } getchecklistcategory(){ this._checklistcategoryprovider.getall() .subscribe( res=>{ console.log("got data here") //this never executed ///this.checklists = res //this outputs data in frontend }, err=>{ console.log("error here")//this not executed } ) } the second function never executed check both res , error where going wrong? wiki

java - Thymeleaf + Spring Boot: Error resolving template -

i have basic springboot app. using spring initializer, embedded tomcat, thymeleaf template engine, , package executable jar file. i have properties in application.properties server.contextpath=/pecador server.port=5678 running through eclipse can access application , fine http://localhost:5678/pecador/login but when deploy application in server , running command: sudo nohup java -jar pecadorcloudapp-0.0.1-snapshot.jar & /tmp 2>> /dev/null >> /dev/null & and try http://149.152.231.117:5678/pecador/login i got error: org.thymeleaf.exceptions.templateinputexception: error resolving template "/pecador/login/login", template might not exist or might not accessible of configured template resolvers and unzipping jar template there, under: pecadorapp.jar/boot-inf/classes/templates/pecador/login/login.html it looks you're returning view name leading slash( / ). return pecador/login/login , should work in both environments. ...

javascript - Method PUT is not allowed by Access-Control-Allow-Methods in preflight response in Angular JS With Wcf Service -

Image
i working on wcf service. consuming wcf service in angular js application. post, delete , put operation working when trying update record got following errors... xmlhttprequest cannot load http://localhost:56766/studentservice.svc/updatestudent . method put not allowed access-control-allow-methods in preflight response. here wcf service code... [servicecontract] public interface istudentservice { [operationcontract] [webinvoke(method = "get", requestformat = webmessageformat.json, responseformat = webmessageformat.json, uritemplate = "/getallstudent/")] list<studentdatacontract> getallstudent(); [operationcontract] [webget(requestformat = webmessageformat.json, responseformat = webmessageformat.json, uritemplate = "/getstudentdetails/{studentid}")] studentdatacontract getstudentdetails(string studentid); [oper...

Selenium/python - Clicking all elements which are in a particular div -

i learning scrape using selenium , trying 1 of sap pages. the link : https://help.sap.com/viewer/2e167338c1b24da9b2a94e68efd79c42/4.2.4/en-us/ what intend leaf/last level urls page present on table of contents panel. unfortunately, links not in html , if click on each side button on left panel, expand, also, each button click can have more nested buttons! need click these , underlying data. i starting identifying xpath , tried clicking them, gives following error : import time driver = webdriver.chrome("/users/tarun/downloads/chromedriver") driver.get("https://help.sap.com/viewer/2e167338c1b24da9b2a94e68efd79c42/4.2.4/en-us/") time.sleep(20) #tried htmlsource = driver.page_source buttonssidepanel = driver.find_elements_by_xpath('//*[@id="toc"]/treecontrol/div/div[*]/div[1]/div[1]') #also tried - //*[@id="toc"]/treecontrol/div/div[*]/div[1]/div[1]/span[1] x in buttonssidepanel: x.click() time.sleep(1) driver.close(...

javascript - custom checkbox with hidden input -

i making custom checkbox can have both own ui design, , still have input[type="checkbox"] in page purpose of toggling css classes , being able submit form , being taken form. i aware if input has display: none; not passed form, hide since don't use visualy. question: should take account when hidding it? i'm thinking giving position: absolute; , negative margin not show up. label tag can still trigger it. should use opacity or visibility instead? as can see, using opacity:0; , users still able click it. click near actual label on snippet below: .chk { opacity:0; } .chk + label { background-color:red; height: 22px; width: 22px; display:inline-block; padding: 0 0 0 0px; cursor:pointer; } .chk:checked + label { background-color:blue; } <input type='checkbox' id='mychk' class='chk' /><label for='mychk' ></label> now, using negative margin make label ...