Posts

Showing posts from September, 2014

node.js - Socket.IO connection polling saying error 404 not found -

am working whiteboard drawing canvas found in link below. https://socket.io/demos/whiteboard/ i have followed setup requirements when run application, having error below console failed load resource: server responded status of 404 (not found) socket.io.js:1 http://localhost/socket.io/?eio=3&transport=polling&t=1505327119965-1 404 (not found) i.create @ socket.io.js:1 @ socket.io.js:1 o.request @ socket.io.js:1 o.dopoll @ socket.io.js:1 n.poll @ socket.io.js:2 n.doopen @ socket.io.js:2 n.open @ socket.io.js:1 r.open @ socket.io.js:1 r @ socket.io.js:1 r @ socket.io.js:1 n.open.n.connect @ socket.io.js:1 (anonymous) @ socket.io.js:1 settimeout (async) n.reconnect @ socket.io.js:1 n.maybereconnectonopen @ socket.io.js:1 (anonymous) @ socket.io.js:1 n.emit @ socket.io.js:1 r.onerror @ socket.io.js:1 (anonymous) @ socket.io.js:1 n.emit @ socket.io.js:1 n.onerror @ socket.io.js:1 (anonymous) @ socket.io.js:1 n.emit @ socket.io.js:1 i.onerror @ socket.io.js:1 (anonymous) @ so

sql server - SQL Complex Transformation -

Image
i have bellow, want person move gp due change of address should have start date , end date in period. end date date less next start date. please how write query? declare @tab table(local_patient_identifier varchar(70), nhs_number varchar(70), gmp varchar(70), practice_code_gp varchar(70), cds_date date) insert @tab values ('a111111111', '8bfd000', 'g111111', 'n77777', '2016-05-23'), ('a111111111', '8bfd000', 'g222222', 'n77777', '2016-06-13'), ('a111111111', '8bfd000', 'g222222', 'n77777', '2016-06-13'), ('a111111111', '8bfd000', 'g3333333', 'zz44444', '2017-02-09'), ('a111111111', '8bfd000', 'g3333333', 'zz44444', '2017-03-06'), ('a111111111', '8bfd000', 'g3333333', 'zz44444', '2017-03-15'), ('a111111111

matlab - Predict missing values from given data -

i have data of 120 points. of them missing. have predict missing values these points. have use linear regression models. basis function should use predict values , how think of such basis function? linear regression model linear in parameters w0,w1,...,wn. not linear in x. used datenum convert date data type number. used polyfit. getting nan values of array it. doing wrong? taking polynomials of different degrees , take polynomial have least testing error. data points scattered think polynomial regression not work. so, think should use gaussian function basis function. haven't tried yet. want know, things have said correct? if can show me output great. code: close format long g fileid = fopen('real_ts.csv'); c = textscan(fileid,'%s %n','delimiter',',','treatasempty',{'.'}); x = datenum(c{1},'mm/dd/yyyy'); t = c{2}; find = isnan(t); f = x(find); x = x(~find); t = t(~find); plot(x,t,'*'); hold on; %mu = 732000:10

jmeter - Transactions Count in the aggregate report generated from the distributed testing is mismatch with the count in the database -

Image
aggregate report no.of samples/transactions/data count generated distributed testing not matching count in database. total no of machines 3, 1 of machine used client slave don't have enough machines , reason our load balancer persistence based on ip address have use min 3 machines test inorder distribute load between 2 application servers,other wise have run 30 users test using single machine .total no.of users 30 , users in stepping thread group defined 10.three machines*10 users become total 30. 3 machines under same subnet 172.xx.x.xxx,172.xx.xx.xxx,172.xx.x.xxx , test data csv files placed under bin folder in 3 machines.i taking 1 transaction example here createnewstartcard_saveemployee_tc.in database has created 56 transactions has aggregate report shows 37. see below screenshots of distributed testing : when did same test in non distributed testing i.e single machine,data inserted(count) in database matches no.of samples/transactions/data count in aggregate repo

javascript - Jquery field selection -

<form> <div class="content-search-block"> <div class="search-bar"> <div class="search-bar"> <input type="text" class="form-control" id="dname" name="dname" value="" placeholder="otsi töötajaid"> <button type="submit" id="submit" class="icon"><i class="fa fa-search"></i></button> </div> </div> </form> so have kind of search field. kind of start on js file.(yeah in wp) seems script doesent load on submit button? jquery(document).ready(function(){ jquery('#submit').click(function(){ var name = jquery("#dname").val(); i tried jquery(document).ready(function(){ jquery('#submit').click(function

r - List of different length vectors to dataframe -

this question has answer here: adding na make list elements equal length 1 answer converting nested list (unequal length) data frame [duplicate] 1 answer i trying convert list of vectors differing lengths dataframe using sapply - lst = list(c(1, 2, 3), c(4, 5), c(2, 7, 3)) rand = sapply(lst, function(x) {length(x) = 3}) but gives me output - rand [1] 3 3 3 whereas want - [[1]] [1] 1 2 3 [[2]] [1] 4 5 na [[3]] [1] 2 7 3

OSX MySql terminal parameters -

so going crazy this. have mamp installed , it's mysql working fine. installed mysql 5.7.19 official dmg site , installed. from pref panel not getting status updates , such cannot stop though running. trivial though can launctl unload it. however, big issue facing although server starts correctly (from pref panel) , can see process running , respective /tmp/mysql.sock file when try run mysql in terminal (or other mysql command) error stating cant find sock file , pipes out applications/mamp path. i looked everywhere my.cnf might setting , there none (apart 1 used mamp). no environment variables set override it, nothing. in fact, there no other my.cnf files reason still thinks should using /applications/mamp path. my_print_defaults client confirms pipes out --socket=/applications/mamp/tmp/mysql/mysql.sock but have absolutely no idea , how being set , need able run on instance terminal commands. driving me crazy hours now. no files at /etc/my.cnf /etc/mysql/my.cnf

python - Highly inconsistent OCR result for tesseract -

Image
this original screenshot , cropped image 4 parts , cleared background of image extent can possibly tesseract detects last column here , ignores rest. the output tesseract shown there blank spaces remove while processing result femme—fatale. darklordeia achinesen1gg4 noob_diablo_ the output tesseract shown there blank spaces remove while processing result kicked. nosnoel chikizd death_eag|e_42 chai—. 3579 10 1 7 148 2962 3 o 7 101 2214 2 2 7 99 2205 1 3 6 78 8212 7198 6307 5640 4884 15 40 40 6o 80 80 am dumping output of result = `pytesseract.image_to_string(image.open("d:/newapproach/b&w"+str(i)+".jpg"),lang="new_language")` but not know how proceed here consistent result.is there anyway if can force tesseract recognize text.because in trainer tesseract on default recognition scan it's not detected once select area scanned , received correctly code my suggestion perform ocr on

java 8 - Java8: foreach set and calling a method with a parameter -

i'm struggling coming out right syntax this: i have functionalinterface: @functionalinterface interface observer { void notifyme(packet p); }; and i'm trying make following call: packet -> observers.foreach(observer::notifyme); it doesn't compile! idea how make work? thanks!

Laravel 5/AngularJS custom authentication best practice -

i'm working on application using laravel 5.3 end , angularjs front end. authentication, user's information needs matched against external api. so, i've been using custom version of laravel's built-in authentication, i.e., user enters information angularjs front-end sends laravel back-end laravel uses auth::login check against external api either tell user credentials wrong or move them home page my question is, point forward, bad practice continue using laravel's built-in auth middleware functionality see if user authenticated when move around application? everything i'm reading seems discuss using token based authentication (mostly jwt), , while method works, i'm new angularjs , ensure i'm doing follows best practice. thank you! as far best practices go there lot of different ways go it. use laravel's built in authentication you'd have make sure session id keeps getting sent every request or auth::user null. when come

java - setContentView() in android causing crash -

i callling mainactivity.java file file named intro.java when first created app project, mainactivity.java main file. later on, changed manifest.xml placing intent-filter in .intro activity. my intro.java has 2 buttons, of quiz button not working, though facts button works. calling mainactivity.java quiz button through intent. have used log.v find error. app reaches till before setcontentview() method in mainactivity.java after crashes. please help. intro.java package com.example.aasiq.quizapp; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.textview; public class intro extends appcompatactivity { textview t; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_intro); t = (textview) findviewbyid(r.id.text); } public void q(

javascript - Does flow's structural subtyping "forget" specific subtype properties? -

i studying structural typing. skeptical idea 2 types considered equivalent because happen have portion of structure in common. feels lot static duck typing , ignores semantic level of types. took closer @ flow's structural typing of ordinary objects , have encountered following behavior: const o:{} = {foo: true}; o.foo; // type error {} structural type , supertype of ordinary objects. hence makes sense can annotate o it, because {foo: true} structural subtype of {} . however, when try access existing foo property, operation doesn't type check. odd because afaik structural subtype can contain specific properties long includes required properties of supertype. it seems flow's structural subtyping algorithm forgets properties specific subtype. behavior intended or did run edge case? the overall issue you're describing fact of casting subtype supertype. performing cast, you're explicitly telling compiler discard information given object. for ins

asp.net mvc - .net core and kestrel - best practices for using IIS as an intermediary for Windows Authentication? -

i'm interested in porting .net mvc app .net core mvc , using kestrel webserver. i know kestrel doesn't support windows authentication, can suggest ideas on using iis intermediary wa? for example, user hits page on iis server check credentials -> page sends aes encrypted key specific user/domain info kestrel server page verify identity. maybe fetching information through ajax call work too. does example seem reasonable performance/security point? i decided go ahead , build by: 1) building net core app on iis windows authentication enabled, 2) passing aes encrypted string user information + other information via url kestrel server core apps, 3) core apps decrypt key, check if still valid , user info valid. 4) pass encrypted string tempdata cookie , reload url without string user not see of url garbage. this seems work well, , user doesn't see indication via url of kind of authentication string, able use number of kestrel servers independent

java - spring difference between value and ref -

https://www.tutorialspoint.com/spring/constructor_based_dependency_injection.htm my question in last sentence of tutorial. final note, in case passing reference object, need use ref attribute of <constructor-arg> tag , if passing value directly should use value attribute shown above. i little bit confused reference of object , value. can primary types value, java class , beans references? what else might used reference here? thank much a reference points spring bean. a value true value being inputted. e.g. "foo" or "1"

excel - How to Print Selection without the cell background color ( black and white print ) VB -

how change line of code in order not select cell fill color or somehow printout selection in black , white, while keeping fill color on page. range("h8:k10" & "," & "a" & firstrow & ":g" & lastrow).printout this should trick. worksheets("sheet1").pagesetup.blackandwhite = true

python - Scrapy yield request from one spider to another -

i have following code: #firstspider.py class firstspider(scrapy.spider): name = 'first' start_urls = ['https://www.basesite.com'] next_urls = [] def parse(self, response): url in response.css('bunch > of > css > here'): self.next_urls.append(url.css('more > css > here')) l = loader(item=item(), selector=url.css('more > css')) l.add_css('add', 'more > css') ... ... yield l.load_item() url in self.next_urls: new_urls = self.start_urls[0] + url yield scrapy.request(new_urls, callback=secondspider.parse_url) #secondspider.py class secondspider(scrapy.spider): name = 'second' start_urls = ['https://www.basesite.com'] def parse_url(self): """parse team data.""" return self # self htmlresponse not 'response' object

Cloud Functions for Firebase: get actual timestamp of database -

i need actual timestamp of firebase database servers instead of placeholder firebase.database.servervalue.timestamp . in order avoid xy problem, provide 2 use cases: a) have created own reset password system using cloud functions , jwt. user requests reset password. sign object containing username , current timestamp(currently using date.now()) , send embedded link email. when open link, need verify jwt , compare timestamp stored under uid in firebase database. update timestamp in database next time try use same token, show expired(even if 1 hour expiration have set token has not passed). using date.now() here enough? how can pass current firebase time jwt.sign() . b) need store negative version of creationtimestamp of posts in database sorting purposes. -firebase.database.servervalue.timestamp not work. correct way that? google goes through great trouble make sure of servers have times closely synchronized possible. so, if you're running code in cloud funct

python - PyCharm debugger attaches to local process but doesn't pause -

i've got long-running python 3.5 process has hung. followed https://www.jetbrains.com/help/pycharm/attaching-to-local-process.html attach process. i have attached process attaching process pid=4332 c:\python35\python3.exe "c:\program files\jetbrains\pycharm community edition 2017.2\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py" --port 13980 --pid 4332 connected pydev debugger (build 172.3317.103) attach finished successfully. but when press pycharm debugger pause button examine state nothing happens.

html - Bootstrap tooltip is not visible using javascript -

Image
i new bootstrap. using bootstrap range slider , javascript in program. inspite of using following, not able see tooltip of slider: <input id = "cheaphfslider" type="range" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-tooltip="show" onchange="sliderchanged(this)"> <label id = "cheaphfsliderval"> when hover cursor on slider in chrome's debugging mode, can see 'tooltip tooltip-main top' being highlighted in elements tab of debugger. attaching screen shot of above. related css , js are: <!-- bootstrap css--> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/y6pd6fv/vv2hjna6t+vslu6fwyxjcftcephbnj0lyafsxtsjbbfadjzaleqsn6m" crossorigin="anonymous"> <!-- bootstrap slider css --> <link rel="s

c# - How to execute CoreAdmin commands with SolrNet Unity with Multiple Solr instances? -

i using solrnet version 0.5.1 unity ioc. before performing search or add index operation, when service starts check if solr core created & if rebuild core in case of schema changes. want through c# class library. have registered ioc inside container using following code. can access isolroperations no issues. when try create core, how can resolve headerparser, statusparser required while creating instance of solrcoreadmin? tried searching example in every example, have mentioned initialize solr startup.init<userindexingdata>(solrconfig.url); not want reinitialize container me. if reinitialize, throws 'connection' registered exception. tried resolving isolrheaderresponseparser & isolrstatusresponseparser instances through container got exception. new ioc & di. appreciated. private static void registersolrdependencies(iunitycontainer retval) { retval.registertype<ireadonlymappingmanager, memoizingmappingmanager>(

c# - How do I set AuthenticationScheme and AutomaticAuthenticate in .NET Core 2? -

i tried follow guide allow login of user when running tests in .net core 2 http://geeklearning.io/how-to-deal-with-identity-when-testing-an-asp-net-core-application/ it says should configure authentication middleware test purposes this: public class testauthenticationoptions : authenticationoptions { public virtual claimsidentity identity { get; } = new claimsidentity(new claim[] { new claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", guid.newguid().tostring()), new claim("http://schemas.microsoft.com/identity/claims/tenantid", "test"), new claim("http://schemas.microsoft.com/identity/claims/objectidentifier", guid.newguid().tostring()), new claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname", "test"), new claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname", "test"), new clai

android - How to get set the ringtone in notification -

i develop app user can set ringtone specified task here's code appointment.class: intent intent = new intent(ringtonemanager.action_ringtone_picker); intent.putextra(ringtonemanager.extra_ringtone_type, ringtonemanager.type_notification); intent.putextra(ringtonemanager.extra_ringtone_title, "select tone"); intent.putextra(ringtonemanager.extra_ringtone_existing_uri, (uri) null); this.startactivityforresult(intent, 5); and activity extends broadcastreceiver @override public void onreceive(context context, intent intent) { switch (getresultcode()){ case appointmentpage.result_ok: log.e("sample","asdas"); break; } my problem dont see sample in logcat. how can see it? you should use onactivityresults in activity user save preference , retrieve in onrecieve use @override protected void onactivityresult(int requestcode, int resultcode, intent data)

php - How to use PDO with dependency injection? -

i'm having hard time understanding how use dependency injection. i've read on lot of questions/answers here can't picture code i'm using. model.php abstract class model { protected static function getdb() { static $db = null; if ($db === null) { $db = new pdo('mysql:host=host;dbname=dbname;charset=utf8', 'dbuser', 'password'); } return $db; } } the model.php contains function, want move away setting , calling statically . user.php class user extends model { /* * selects of user information */ public function getuser($id){ $db = static::getdb(); $sth = $db->prepare('select * user id = :id'); $sth->bindvalue(':id', $id, pdo::param_int); $sth->execute(); return $sth->fetch(); } /* * selects of user posts */ public function getuserposts($id){ $db = static::getdb();

php - Trouble writing a string value with spaces to a form -

i'm trying write php file pulls names of products database , creates button automatically searches out item name on ebay. i've been successful, i've found that, if product name has spaces, value written form concatenated @ space- i.e, passing string "red barchetta" appear "red" in search bar the specific problem occurs on line down near end: input type="text" name="_nkw" value='.$row['name'].' ...where $row['name'] might "cosmic catch", "_nkw" winds being "cosmic" i'm sure rookie mistake, there's i'm missing. appreciated. <?php $db_host = 'xxxxxxxxx'; // server name $db_user = 'xxxxx'; // username $db_pass = 'xxxxxx'; // password $db_name = 'xxxx'; // database name $conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name); if (!$conn) { die ('failed connect mysql: ' . mysqli_connect_error()); } $sql =

elasticsearch - Query to find the average number of entries for the given hour range -

i have below-given query should find average number of entries given hour range, i.e. 15:00 16:00. this query not working properly. how can indicate hour range (without date) , find average number of entries per range? post /myindex/_search { "size": 0, "query": { "bool": { "filter": [ {"term": {"eventid": "11"}}, {"term": {"eventtype": "type1"}} ] } }, "aggs": { "range": { "date_range": { "field": "datetime", "ranges": [ { "from": "16:00-1h/h", "to": "16:00/h" } ] } } } } should use moving average? how? i tried this, appreciate if can me finish query. don't know if "value_count" : { "

C# how to allow users to input decimals as an answer? -

new language , site. i'm still bit confused differences between decimal , boolean. let's have line. console.writeline("enter change."); i'm not sure put after accepts decimals user input. i've seen decimal.parse seems common answer not sure on how works. as little information provided here, i'm not sure how long question last. despite this, seems you're working on console app , looking console.read() or console.readline() here. these take user input string, i'd imagine currency prefer in number format. seeing it's cents, guess int people aren't spending fractions of cent. code below uses int32.tryparse() method, returns bool value regarding ability parse string int, , takes in string parse , int use out parameter. have enclosed in do/while statement ensure user inputs usable data, , prompted again if not case, followed output of change provide feedback upon success. edit: appears author looking decimal input. code be

lasagne - Theano: pass time step argument to step function in custom GRU -

i new theano , lasagne , working on project requires implementing custom gru. i having problems passing index of scan function step function in code below. i have based code on this theano-users thread , new theano , missing something. also, looked @ stackoverflow's theano-pass-iterating-index-of-scan-to-the-called-function , should identical trying do, unable accepted solution work code. the relevant code snippets below. i've included 2 step functions below because conditionals determine if step or step_masked passed fn argument theano.scan . i.e. need add time step idx argument both of them.) please let me know if need provide other context. class customgrumodel(grulayer): ... def get_output_for(): ... def step(idx, input_n, hid_prev, *args): # conditionals involving idx ... def step_masked(idx, input_n, mask_n, hid_prev, *args): hid = step(idx, input_n, hid_previous, *args)

javascript - Send data without leaving the original page -

the watchlistinsert.php sends information database , want send without leaving original page clicked from. think need use ajax, have tried few different things, not working. hope can me out. echo "<td>"."<a id='add' href=\"watchlistinsert.php?symbol=$symbol&price=$price&watchlistgroupid=$watchlistgroupid\">add</a>" ."</td>"; you have options @ disposal: you can - have written - via ajax you might able use websockets you send http-request hidden iframe: how post iframe? you use javascript load image server ... , url said image url php script

How can I keep my changes with a remote Git repository I track? -

i'm learning use git. cloned open source git repository. added different build system. these changes did not involve touching on original source code. need able update cloned repo based on changes in original repository while maintaining additions (build system sources). there way this? clear i'm not aiming @ contributing additions, need keep cloned repo updated original , still use own build system added.

mysql - Insert data to DB with PHP -

this question has answer here: reference - error mean in php? 29 answers how mysqli error in different environments? 1 answer so i'm creating simple page , want login , passwords go db on login form: <form id="form_6de933" name="validate" action="insert.php" method="post" class="login-form narrow-cols"> i added action="insert.php" , on insert.php file tried this <?php $servername = "localhost"; $username = "xxx"; $password = "xxx"; $dbname = "xxx"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) {     die("connection failed: " . $conn->connect_error); } $sql

ios - First time animating is glitchy -

i animating view gradientview in/out using following: func hideorshowgradientview(hide: bool) { uiview.animate(withduration: 0.4, animations: { self.gradientview.ishidden = hide }) } this works well, on first time, there no animation. appears. on second , third time works wonderfully. i've tried calling animate block on main thread no luck there. why animation failing occur on first , first time around? should using animation method? have tried calling self.view.layoutifneeded() . forces view , it's subviews complete of it's pending animations immediately, might interfering animation. can use this: func hideorshowgradientview(hide: bool) { self.view.layoutifneeded() uiview.animate(withduration: 0.4, animations: { self.gradientview.ishidden = hide self.view.layoutifneeded() }) } apple recommends calling layoutifneeded() twice, once before animation block forces redraw on view , it's subviews, , compl

r - Unable to open URL using RSelenium with Selenium Standalone Server -

i'm trying scrape census data using rselenium in rstudio i'm having trouble navigating url using chrome browser. i have selenium standalone server running , chrome driver setup environment variable in system settings. as minimum working example, i'm able implement following commands: > library(rselenium) > remdr <- remotedriver(browsername = "chrome") > remdr$open() running last command gives me following output: [1] "connecting remote server" $applicationcacheenabled [1] false $rotatable [1] false $chrome $chrome$userdatadir [1] "c:\\users\\rchoksi\\appdata\\local\\temp\\scoped_dir5908_26290" $takesheapsnapshot [1] true $databaseenabled [1] false $handlesalerts [1] true $version [1] "61.0.3163.79" $platform [1] "windows nt" $browserconnectionenabled [1] false $nativeevents [1] true $acceptsslcerts [1] true $locationcontextenabled [1] true $webstorageenabled [1] true $browsername [1] &

python - unconverted data remains for only some of records -

i have dataset including timestamps of them have decimals in seconds, don't. need compare these timestamps , classify those. don't know how define format differently these records. so, have decimals in seconds, can write: a = datetime.strptime(time, "%h:%m:%s.%f") and don't have, write: a = datetime.strptime(time, "%h:%m:%s") i need compare a timestamp. use string.split function separate string 3 fields, , see if third 1 has ".". might want more error handling have provided here. def has_seconds(a_string): return "." in a_string.split(":")[2] if has_seconds(a_time): = datetime.strptime(a_time, "%h:%m:%s.%f") else: = datetime.strptime(a_time, "%h:%m:%s")

ios - provisioning profile or entitlement error? -

i need put on xamarin project provisioning profile , certificate... working xamarin forms on windows connectected physical mac...what happend is: when need run project in ios run through windows , mac that...but physical device need cert. , prov. profile... work if pass project virtual mac , put there certificate , provisioning profile , pass again windows? how project access keychain in windoews project? need need install certificate in windows ?? how things work? i'm little confuse...i need please, me if can did things , certificate works...but error appears...i tried disabled keychain...but still in way... my error installation failed: code signing/provisioning profiles not correctly configured. have entitlement not supported current provisioning profile, check ios device log details (error: 0xe8008016) my provisioning profile appears on developer account , in project...its linked certificate , device registered on apple developer account , linked certificate too

java - Sbt script and different resources and source directories -

i making build.sbt script java project. project not follow standard structure (as src/main/java) need point sbt script correct 1 (as have made gradle script in have changed both source , resources directories). structure of project is: src packagename main.java resources test i have search lot don't find anything, documentation build java project sbt not make example. finally, cannot change structure of project. that actual sbt script: organization := "something" name := "name" version := "1.0-snapshot" it returns java.lang.runtimeexception: no main class detected. i have found solution: unmanagedsourcedirectories in compile += basedirectory.value / "src" resourcedirectory in compile := basedirectory.value / "src" adding these 2 lines makes flow of compilation work. (more details on: http://www.scala-sbt.org/0.13/docs/howto-customizing-paths.html )

javascript - hitting save button adds extra one more empty field -

Image
i have rules component number of rules can added , added rules shown either along additional add feature rules. there no problem while adding, removing rule field when posting data server, data gets posted 1 more empty field generated in client side. don't know how , why happening. here code const _id = 0; function guid() { function s4() { return math.floor((1 + math.random()) * 0x10000).tostring(16).substring(1); } return s4() + s4(); } const removebykey = (obj, deletekey) => object.keys(obj).filter(key => key !== deletekey).reduce((result, current) => { result[current] = obj[current]; return result; }, {}); class rules extends react.purecomponent { constructor(props, context) { super(props, context); this.state = { rules: { ruleandregulations: {} }, }; } componentdidmount() { this.props.loadrules(); } componentwillreceiveprops(nextprops) { if (nextprops.rules.size && nextprops.rules !== this.

javascript - history.back(-1) not working in chrome -

the scenario is, have old application in html , javascript. first page/form has dropdown list, search text field, find button , list view. when enter on search field , click find, invokes javascirpt function selects items on list view , goes page/form created javascript function displaying items of list view matched search , button. when button clicked supposed go first form , display selected items on list view. work in ie11 not working in chrome. chrome goes page previous page search text field, find button , list view. same happens if click on chorme browser button. chrome version 61. find code below: <input type="button" value="find" onclick="fndtxt(this.form)"> function fndtxt(lgrp) { var txt=lgrp.srchtxt.value var stextgrp=txt.split(' '); var seltxt='you have selected:<br>start date:\n'; var j=0,k=0; var selfield='' seltxt += lgrp.sdate.value+' , end date:'+lgrp.edate.value

python - How to find the parent of item when clicked in empty space PyQt4 QTreeWidget -

didn't quite know how word here go, this part of program displays folders found in directory , subdirectorys in qtreewidget (it loads them fine) ability create new folders no matter depth in tree. example have directory: data\examples\folders\ and right click in empty space in qtreewidget below folders branch, want ability create folder below directory becomes: data\examples\folder\untitled\ i have context menu working cannot understand how implement way place new folder item @ specific depth not know parent of area clicked here code (only retentive parts): self.treelist = qtgui.qtreewidget() self.treelist.setheaderlabels(["name"]) self.treelist.setcontextmenupolicy(qtcore.qt.customcontextmenu) self.treelist.customcontextmenurequested.connect(self.opencontextmenu) and opencontextmenu function def opencontextmenu(self,point): addfolder = qtgui.qaction(qtgui.qicon("data\\icons\\folder.png"), "&new folder", self) addfold

list - loop inside a dictionary python -

i starting learning django , python... it's been 2 months. i'm doing 1 of own personal projects , have section querying webservice , passing result templates. the webservice returning dictionary below. x = {'id':[{ 'key-1': 'first name', 'key-2': 'john' },{ 'key-1': 'last name', 'key-2': 'doe' },{ 'key-1': 'age', 'key-2': '25' }] i expecting iterate list inside dictionary , create own dictionary below: d = {'first name': 'john', 'last name': 'doe', 'age': '25' } i not sure missing, can please me learning how build dictionary? caveat aware of ordering rules values method dictionaries. ordering rules 2.x documentation , 3.x documentation . edit2: to prevent weirdness dictionary ordering , provided solution, wrap data ordereddict : from collections import ordereddict x =

Improve performance of Writing a file - Python 3.4 -

i not versed python, based on knowledge , browsing wrote script mentioned below, script looks files in c:\temp\dats folder , writes in c:\temp\datsoutput\output.text file, reason code running terribly slow, can advise me improve have better performance? import os = open(r"c:\temp\datsoutput\output.txt", "w") path = r'c:\temp\dats' filename in os.listdir(path): fullpath = path+"\\"+filename open(fullpath, "r") ins: line in ins: a.write(line) two speedups. first, copy whole file @ once. second, treat files binary (add “b” after “r” or “w” when opening file.) combined, runs 10x faster. final code looks this import os = open(r"c:\temp\datsoutput\output.txt", "wb") path = r'c:\temp\dats' filename in os.listdir(path): fullpath = path+"\\"+filename open(fullpath, "rb") ins: a.write(ins.read(

java - Comparing 2 JSONArray -

i have jsonarrays needs compared may have child entities inside not in same order though : [{ "a" : "in", "b" : "dl"},{ "a" : "us", "b" : "ka"}] //jsonarray 1 [{ "a" : "us", "b" : "ka"},{ "a" : "in", "b" : "dl"}] //jsonarray 2 here code. before calling jsonelemnt, converting both jsonarray string , passing function compare : //converting both jsonarray string jsonarray1str , jsonarray2str jsonelement jsonelement1 = parser.parse(jsonarray1str); jsonelement jsonelement2 = parser.parse(jsonarray2str); system.out.println(comparejson(jsonelement1, jsonelement2)); //comparejson function public static boolean comparejson(jsonelement jsonelement1, jsonelement jsonelement2) { boolean isequal = true; // check whether both jsonelement not null if (jsonelement1 != null &

insert an sd card before using the camera android emulator -

Image
when open camera in android emulator. message insert sd card before using camera android emulator here configuration of emulator my android studio version is android studio 2.3.3 build #ai-162.4069837, built on june 6, 2017 jre: 1.8.0_92-b14 amd64 jvm: java hotspot(tm) 64-bit server vm oracle corporation any idea how solve this?

Android Studio - Navigating Activities -

i can't seem figure 1 out. have mainactivity , created secondactivity , thirdactivity want able navigate to. i'm using bottomnavigation in mainactivity navigated between activities: public class mainactivity extends appcompatactivity { protected bottomnavigationview navigationview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); bottomnavigationview.onnavigationitemselectedlistener monnavigationitemselectedlistener = new bottomnavigationview.onnavigationitemselectedlistener() { @override public boolean onnavigationitemselected(@nonnull menuitem item) { switch (item.getitemid()) { case r.id.navigation_menuitem1: intent intent = new intent(mainactivity.this, mainactivity.class); startactivity(intent); return true; case r.id.navigation_menuit