Posts

Showing posts from April, 2014

scipy - Take Values inside of odeint in python -

my question if there's way take values in function not integrated in odeint. exemple: if have derivative dy(x)/dt = a*x+ln(x) , before equation computed throught of intermediate equation a = b*d . take a's value during process. more detailed (only exemple): def func(y,t) k = y[0] b = 3 = cos(t**2) + b dy/dt = a*t+ln(t) return [dy/dt] can take a's values of function? the answer josh karpel the code that: def reaction(state,t): # integrate results p = state[0] t = state[1] # function determine enthalpy of system f1(t,p) = enthalpy # function determine specific volume of system f2(t,p) = specific volume # function determine heat release reactions f3(t,p,t) = heat release reactions # derivatives dp/dt = f(t,p,enthalpy,specific volume,heat release reactions) dt/dt = f(t,p,enthalpy,specific volume,heat release reactions) the real code bigger that. but, know if there way store values of f1 (enthalpy), f

arduino - Servo delay on direction change -

i'm using sg-90 servo , sweeping left , right between 2 values. problem there distinct delay of 500ms between direction changes. position of servo predictable, due @ direction changes not. bool servodir = true; int servocnt = 90; int servoinc = 1; int servomin = servocnt - 5; int servomax = servocnt + 5; void loop() { if (servodir) { dx = servoinc; if (servocnt > servomax) { servodir = false; } } else { dx = -servoinc; if (servocnt < servomin) { servodir = true; } } servocnt += dx; servo.write(servocnt); // delay or other code here (mine 40ms) } i've tried both arduino servo library , varspeedservo library. both show same thing. what cause of , can it? update so if speed @ direction change, so: int = 5; void loop() { if (servodir) { dx = servoinc; if (servocnt > servomax) { dx -= extra; servodir = false; } } else { dx = -servoinc

office-ui-fabric-react: How to change a theme's default font to be smaller -

the default font bit large target application. i saw loadtheme change primary theme color, there way change default font size across components? ifontstyles has variety of sizes specified, there way set font size fabric react components "small" (fontsizes.small)? i have tried set css font-size smaller directly in outer containers , inside fabric component, components still seem render around 14px (ms-font-size-m) once rendering goes inside fabric component. the theme code confusing me looks fabric-react uses combination of fabric-core scss, fabric-react scss , glamor (runtime js->css) generate stylesheets needed , return classnames react code classname property. there not appear use of inline styles.

r - Subset dataframe based of non-sequential dates -

i have data looks this df<-data.frame(datecol=as.date(c("2010-04-03","2010-04-04","2010-04-05","2010-04-06","2010-04-07", "2010-04-03","2010-04-04","2010-04-05","2010-04-06","2010-04-07", "2010-05-06","2010-05-07","2010-05-09","2010-06-06","2010-06-07")),x=c(1,1,1,0,1,1,1,0,0,0,1,0,0,0,1),type=c(rep("a",5),rep("b",5),rep("c",5))) > df datecol x type 1 2010-04-03 1 2 2010-04-04 1 3 2010-04-05 1 4 2010-04-06 0 5 2010-04-07 1 6 2010-04-03 1 b 7 2010-04-04 1 b 8 2010-04-05 0 b 9 2010-04-06 0 b 10 2010-04-07 0 b 11 2010-05-06 1 c 12 2010-05-07 0 c 13 2010-05-09 0 c 14 2010-06-06 0 c 15 2010-06-07 1 c i need subset dataframe type, keep "types" have 2 or more di

string - how I could redirect variable that contain a value and the value contain another value in ruby? -

i have variable varpage equal start , need obtain start value output , save file this code varpage="start" start="1,4,1,0,1,1,1,30,12,;1,4,1,2,1,1,1,30,29,;1,5,1,2,0,1,1,30,29,;1,4,1,2,0,1,1,30,29,;1,4,1,0,1,1,1,30,29,;" file.open("mmmm3", "w") |f| f.puts "@#{varpage}" end i expected output "1,4,1,0,1,1,1,30,12,;1,4,1,2,1,1,1,30,29,;1,5,1,2,0,1,1,30,29,;1,4,1,2,0,1,1,30,29,;1,4,1,0,1,1,1,30,29,;" please me if understand question correctly, can use hash: varpage = "start" options = {"start" => "1,4,1,0,1,1,1,30,12,;1,4,1,2,1,1,1,30,29,;1,5,1,2,0,1,1,30,29,;1,4,1,2,0,1,1,30,29,;1,4,1,0,1,1,1,30,29,;"} file.open("mmmm3", "w" |f| f.puts options[varpage] end

javascript - Backtracking algorithm to create a "jumbled" but not random array -

i have written backtracking algorithm make jumbled-looking array of 70 items input array of 10 items. rules needs follow are: no repeat item in each group of 5 no item appears in same position in of 3 consecutive groups of 5 each item appears 7 times in total this works, if make input array bigger output array, breaks rule 3. if make input array length 70, algorithm works overflows. <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html" /> <title>backtracking pseudo randomiser</title> </head> <body> <button onclick=go();>go</button> <script> function go() { function pseudoran(input,output) { if (output.length==70) { output=listtomatrix(output,5); printit(output); return; } else { var tmp=input.shift(); var mod=outpu

python - Sklearn | LinearRegression | Fit -

i'm having few issues linearregression algorithm in scikit learn - have trawled through forums , googled lot, reason, haven't managed bypass error. using python 3.5 below i've attempted, keep getting value error:"found input variables inconsistent numbers of samples: [403, 174]" x = df[["impressions", "clicks", "eligible_impressions", "measureable_impressions", "viewable_impressions"]].values y = df["total_conversions"].values.reshape(-1,1) print ("the shape of x {}".format(x.shape)) print ("the shape of y {}".format(y.shape)) shape of x (577, 5) shape of y (577, 1) x_train, y_train, x_test, y_test = train_test_split(x, y, test_size=0.3, random_state = 42) linreg = linearregression() linreg.fit(x_train, y_train) y_pred = linreg.predict(x_test) print (y_pred) print ("the shape of x_train {}".format(x_train.shape)) print ("the shape of y_train {}".format(

bash - How to delete shortest matched pattern from the end of string by re module of python? -

i converting bash code python code. now make function has same functionality of ${variable%pattern} in bash; delete shortest matched pattern end of string, for example, expect delete_tail('_usr_home_you_file.ext.tar.oz', r'.') results in '_usr_home_you_file.ext.tar' i made python function below, import re def delete_tail(word,pattern): return re.sub('{0}.*?$'.format(pattern), '', word) however, deletes longest matched pattern following. word='_usr_home_you_file.ext.tar.oz' delete_shortest_match_tail=delete_tail(word,r'\.') print("word = {0}".format(word)) print("delete_shortest_match_tail = {0}". format(delete_shortest_match_tail)) output: delete_shortest_match_tail = _usr_home_you_file how can make function deletes shortest matched pattern end of string expected above? thank much. you rather want search string in front of pattern rather pattern replace it. regex looks left

Why my Android notification's setTicker doesn't work? -

my code below: notificationmanager manager = (notificationmanager) getsystemservice(notification_service); notification notification = new notificationcompat.builder(mainactivity.this) .setcontenttitle("nothing") .setcontenttext("nothing").setwhen(system.currenttimemillis()) .setsmallicon(r.mipmap.ic_launcher) .setticker("help help:)") .setcontentinfo("nothing") .build(); manager.notify(1, notification); when run this, "help help:)" didn't appear. tickertext appear on phone before android 5.0 (l) extracted documentation : text summarizes notification accessibility services. of l release, text no longer shown on screen, still useful accessibility services (where serves audible announcement of notification's appearance). http

c# - WebBrowser Control is opening multiple windows -

i writing windows forms application interface component has built in web server used changing device's settings. think of router configuration page. want interact device via post , commands configuration page performs. being said, i'm using webbrowser control item. in below code, when run, opens 2 ie windows. prefer not open windows, or @ least, open , let me close window. can me perform this? using system.text; using system.threading; using system.windows.forms; using device.model; using device.view; namespace devicename.controller.staticclasses { public static class deviceadapter { private static device _device; private static string _pword; public static void getdhcporstatic(device selecteddevice, string txtpassword, frmmainform mainform) { _device = selecteddevice; _pword = txtpassword; var browserthread = new thread(getdhcporstaticthread); browserthread.setapartmentstate(

JavaScript error handling async function passed to reduce -

i'm passing async function array reduce function. what's syntax catching errors thrown passed in function? reducing happening inside try catch block, catching other errors fine, node gives me unhandledpromiserejectionwarning if passed in function throws error. code: afunction = async (anarray) => { try { const result = await anarray.reduce(async (a, b) => { await dosomethingto(b); }, promise.resolve()); return result; } catch (error) { winston.error(error); } } (edit) actual code: exports.chainedquerydb = async (queries, finaltask, download) => { let client = await pool.connect(); try { winston.info(`begin chained table query.`); // loop through query array const result = await queries.reduce(async (a, b) => { await client.query(b); }, promise.resolve()); if (download) { return streamout(download, client); } return result.rows; } catch (error) { throw error; }

Convert String to Array in php? -

i want convert string array in php, not cant, me, please ? $str = "a,b battery_counter,step1 battery_explanation,step2 calc_coupon,step3 broadband_standard,step4"; i want return: return array( 'a' => 'b', 'battery_counter' => 'step1', 'battery_explanation' => 'step2', 'calc_coupon' => 'step3', 'broadband_standard' => 'step4' ) without knowing more limits of software: $return_array = array(); $exploded_var = explode("\n",$str); foreach($exploded_var $pair_var){ $tmp = explode(",",$pair_var); $return_array[$tmp[0]] = $tmp[1]; } return $return_array; you need explode string twice, once "pair strings" (e.g., "a,b") , second time split pair strings apart. warning: solution 100% specific how presented $str variable. not expandable arbitrary string.

code signing - Xcode 9 distribution build fails because format of exportOptions.plist has changed in new release -

i trying compile ad-hoc ipa app using sdk version 6.1.2 , xcode 9 beta (trying see if app works in new version). build failing following error message: error domain=ideprovisioningerrordomain code=9 ""dghospice.app" requires provisioning profile." userinfo= {nslocalizeddescription="dghospice.app" requires provisioning profile., nslocalizedrecoverysuggestion=add profile "provisioningprofiles" dictionary in export options property list.} the distribution profile valid , can create ipa if use ios sdk 10. build fails in 11.0. can me pinpoint issue? use command /applications/xcode-beta.app/xcodebuild -help . you'll have detail information exportoptionsplist available keys -exportoptionsplist: .... provisioningprofiles : dictionary for manual signing only. specify provisioning profile use each executable in app. keys in dictionary bundle identifiers of executables; values provisioning profile name or uui

apache spark - When should I repartition an RDD? -

i know can repartition rdd increase it's partitions , use coalesce decrease it's partitions. have 2 questions regarding cannot understand after reading @ different resources. spark use sensible default (1 partition per block 64mb in first versions , 128mb) when generating rdd. read recommended use 2 or 3 times number of cores running jobs. here comes question: 1- how many partitions should use given file. example, suppose have 10gb .parquet file, 3 executors 2 cores , 3gb memory each. should repartition? how many partitions should use? better way make choice? 2- data types (ie .txt, .parquet, etc..) repartitioned default if no partitioning provided? spark can run single concurrent task every partition of rdd, total number of cores in cluster. for example : val rdd= sc.textfile ("file.txt", 5) the above line of code create rdd named textfile 5 partitions. suppose have cluster 4 cores , assume each partition needs process 5 minutes. in case o

javascript - Using Filter on Radio Buttons -

when using filter on radio button, error stating .filter not function. far know, selecting radio buttons name returns array , should able use filter on array. any highly appreciated. <form action="" name='myform'> <p>select beach</p> <input type="checkbox" value='miami' id='miami' name='check'> <label for="miami">miami</label> <br> <input type="checkbox" value='florida' id='florida' name='check'> <label for="florida">florida</label> <br> <input type="checkbox" value='jamaica' id='jamaica' name='check'> <label for="jamaica">jamaica</label> <p>select airline</p> <input type="radio" value='american' id='american' name='airline'> <label for="american">america

cmd - Batch script - /* and */ what does it do? -

i have here sample code use (came stackoverflow thread). don't have question on how runs. i wondering /* , */ symbols for? @set @a=0 /* ::modify input file , output file @cscript //nologo //e:jscript "%~f0" < names.txt > output.txt ::modify output file , result file :: @move /y output.txt names_result.csv type output.txt > names_result.csv ::end @goto :eof */ wscript.stdout.write(wscript.stdin.readall().replace(/\t/g,",")); this way embed java script in cmd file. see here. trick make js believe it's defining set , , after /* */ gobble cmd lines have been used run script. read 2 times, once cmd shell , once js engine.

javascript - Change tooltip with progress slider -

i using script change colored slider. want add text/tooltip progress drag 0% 100% . how can add this? please can me this? fiddle function getthecolor(colorval) { var thecolor = ""; if (colorval < 50) { myred = 255; mygreen = parseint(((colorval * 2) * 255) / 100); } else { myred = parseint(((100 - colorval) * 2) * 255 / 100); mygreen = 255; } thecolor = "rgb(" + myred + "," + mygreen + ",0)"; return (thecolor); } function refreshswatch() { var coloredslider = $("#coloredslider").slider("value"), mycolor = getthecolor(coloredslider); $("#coloredslider .ui-slider-range").css("background-color", mycolor); $("#coloredslider .ui-state-default, .ui-widget-content .ui-state-default").css("background-color", mycolor); } $(function() { $("#coloredslider").slider({ orientation: "horizontal",

how to run npm commands using cmake -

i've got karma set in subd_app dir. testing set if run "npm install" , "npm test" sub_app, karma run successfully. challenge main directory , subdirs written in c/cpp , use cmake make/build main dir. how incorporate 2 npm commands executed when run cmake , make all? example: main_dir/ main.c other c , cpp files cmakelists.txt sub_dir/ other.c cmakelists.txt other c , cpp files sub_app/ js , html files package.json karma.conf.js

c# - Lucene.Net Search with "#" Not working -

i'm using lucene.net search records in website. have lots of records special character hash ("#") "c#", "c#.net", etc... but when search using term "c#" lucene not returning results. have checked lucene escaping special characters, "#" not in characters list. is there way search term "#" on lucene.net? i have created own analyzer using whitespacetokenizer , wroked. https://issues.apache.org/jira/browse/lucenenet-595 thanks, singaravelu

css - Using other languages inside of C#? -

i looking knows language c# pretty , can me answer question have been looking answer day, google searches result in nothing "new" , years ago. i'm looking way can use languages css , html in winforms applications? know wpf has better, more cleaner ui winforms still, ugly , not modern. is there way can use css or sort of framework enhances styling lot in c# winforms? ui controls right ugly. i'm looking create nice, clean looking applications skype, spotify, , visual studio, , more. there pre-made frameworks or packages this? or idea can give... html markup language , css used styling webpages , designed displaying text, images, etc. on web. they not provide interactive experience or event driven approach required windows applications. javascript used enhance web pages allow more interactive approach, still not level possible in winforms. although modern approaches such angular2, node.js etc. allow more. so if want use these technologies link

php - Cannot read image files, css and script libraries using absolute and relative url -

from public_html folder redirecting domain specific folder load , view website. code written in php . root folder of website home/new/www.mysite.com www.mysite.com folder of website contain index.php , assets. i define root folder myroot . in index.php have line of code. $mypaths = explode('/', ltrim($parse_url['path'], '/')); if($mypaths ['0']){ $mypaths ['0'] = "page"; if(file_exists($mypaths ['1'].'.php')){ $mybody = $mypaths ['1'].'.php'; } else $mybody = myroot.'/home.php'; }else{ $mybody = myroot.'/home.php'; } include(myroot.'/header.php'); include($mybody ); include(myroot.'/footer.php'); header.php includes navigation of website , stylesheet linked. $mybody body of website show. footer.php footer of website. from there, shows html code of site (no css style, no images!) tried change href link href="../a

Git makes a merge commit but as a normal (non-merge) commit -

make merge commit no conflicts, ctrl-c in git bash, , commit. git makes normal (non-merge) commit merge commit message. looks bug me. update : have git_merge_autoedit=yes (other no ) in .bashrc external editor configured. this confusing later on repo topology show branch not merged in , there not easy way find out when merge made. git should still stay in merging state. not happen in case of conflicts (at least i'm not able repro), (master|merging) prompt till resolve conflicts , commit, correctly goes merge commit. update : this bug affects distributions have external editor ( core.editor ) configured. fix on pu branch of git repo michael j gruber. see commit 9d89b3552 ("merge: save merge state earlier", 2017-08-23) merge: save merge state earlier if git merge process killed while waiting editor finish, merge state lost prepared merge msg , tree kept. so, subsequent git commit creates squashed merge when user asked proper merge comm

matlab - Maltab, add vector to matrix -

i want add vector existing matrix. exampel: matrix=[1 2 3 4 5 6 0 7 0] vector = [7 8] so target find equal number of vector , matrix example with: ismember(matrix,vector) after vector should insert matrix following: matrix=[1 2 3 4 5 6 0 7 0 0 8 0] thanks everybody instead of using ismember , can better use find 2 output arguments: >> [row, col]=find(matrix==vector(1)) row = 3 col = 2 using matlab's automatic matrix expansion, , assuming vector column vector (you can adjust code accordingly): >> matrix(row:(row+length(vector)-1),col) = vector matrix = 1 2 3 4 5 6 0 7 0 0 8 0 if match not @ edge (i.e., row~=size(matrix,1) ), not work though, vector override other entries.

javascript - How to show list dom revered in vue js? -

i want show vue js list in v-for reversed on dom. object should not change. created reversed list v-for. html default list top bottom, want append items bottom top in dom. can see telegram web messages list ng-repeat. is there way v-for? or option? thanks. add page controller $scope.setorderproperty = function(propertyname) { if ($scope.orderproperty === propertyname) { $scope.orderproperty = '-' + propertyname; } else if ($scope.orderproperty === '-' + propertyname) { $scope.orderproperty = propertyname; } else { $scope.orderproperty = propertyname; } } and $scope.sorttype = 'x.userid'; $scope.sortreverse = false; $scope.searchfish = '';

javascript - React js autofocus input field -

i created input, , want autofocus it. when page loads, fake input div displayed , when user ckicks div real input focused. works fine. want autofocus , show keyboard. i tried set autofocus , "trigger" focus on real input, on desktops works fine when test on mobile devices keyboard not appear. i tried "trigger" click on fake input (div), , not work. now when page loads looks this should this i don't know wrong. here code: import react, {component} 'react'; import proptypes 'prop-types'; import {field} 'redux-form'; import {rules} 'authcomponents/partials/validationrules'; import reactdom 'react-dom'; const renderfakeinputcontent = (that, type, meta) => { // code not relevant issue return content; }; class reduxformpininput extends component { renderfield = ({input, label, type, meta: {pristine, touched, error, warning, valid, dirty}}) => { let fakeinputblurredclass =

email - Shall I use HSM to decrypt message instead of using an application server that link to HSM to decrypt the message -

our company using hsm store private keys of individuals. messages encrypted public keys. problem me whether should use server connect hsm private key , decrypt message in server or pass encrypted message hsm , ask hsm decrypt me (so key not need pass outside hsm). but, hsm usuallyhas function; if yes, slow? messages emails , instant messages. ...whether should use server connect hsm private key , decrypt message in server or pass encrypted message hsm , ask hsm decrypt me if have proper hsm, never allow exporting plain private keys out of it. otherwise having hsm protect keys useless. have hsm decryption on data. you can consider adding application server picture anyway have abstraction layer between client applications , hsm. depending on hsm have, have 2 options: have application server physical hsm attached (e.g. pci-e card) exposing own api client applications. use networked hsm , register application server client. typically (pretty always) code ca

c# - Xamarin Forms Google Authenticateion, Error: disallowed_useragent -

currently developing xamarin forms application , added google authentication. here code pcl: var authenticator = new oauth2authenticator( clientid, null, constants.scope, new uri(constants.authorizeurl), new uri(redirecturi), new uri(constants.accesstokenurl), null, true); authenticator.completed += this.onauthcompleted; authenticator.error += this.onautherror; authenticationstate.authenticator = authenticator; var presenter = new xamarin.auth.presenters.oauthloginpresenter(); presenter.login(authenticator); i using latest version of xamarin.auth , 1.5.0.3 receive: screenshot i went through many articles , code examples, looks maybe google updated authentication once again. link 1 , link 2 , link 3 , link 4 . event on official page xamarin.forms example invalid , not working link 5 . i checked several code examples, again no success, sample 1 , multiple samples here . download source , tried use it, expecting it's working, they'

jquery - changing coloum data in kendo grid conditionaly -

i trying change value of colums in kendo grid conditionaly. grid id binded data needs modifications in data binded. i have used couple of sample codes got stackoverflow none of them reflecting. there no change in grid data 1st way var grid = $("#grid").data("kendogrid"); var items = grid.datasource.data(); (var = 0; < items.length; i++) { items[i]["matchcount"] = "4"; } 2nd way tried var dataitem = $("#grid").data("kendogrid").datasource.data()[0]; dataitem.set("matchcount", "ccc"); 3rd way var dataitem = $("#grid").data("kendogrid").datasource.data()[0]; dataitem.set("matchcount", "50"); the way grid binded below: $("#grid").kendogrid({ datasource: datasource, columns: [ { field: "rowid", title: "rowid", h

javascript - How to filter json based on a query dynamically generated? -

i want filter json object using js angular project. json structure this: { "docs": [ { "firstname": "", "lastname": "", "birthdate": "", "city": "", "country": "" }, { "firstname": "", "lastname": "", "birthdate": "", "city": "", "country": "" } ] } the query builder similar angular-query-builder the query like: (firstname = tom or (firstname = jerry , lastname = jack)) based on query js function should filter json object , console resulting json . you can use custom filter (if don't want use query builder) filter out values based on firstname , lastname function myctrl($scope){ $scope.people = { "docs": [ { "firstname": "tom", "lastname": "larry", "birthd

Login problems because of firebase database rules -

my firebase database has following rules: { "rules": { ".read": "auth == null", ".write": "auth != null" } } due not able login app though using valid email id , password. when change rules 1 below, things work fine. { "rules": { ".read": "auth != null", ".write": "auth != null" } } my app has requirement in users need read value of specific child stored inside database if not authenticated users. changing rules ".read": "auth == null" causing login problem. should in case? "auth == null" means user logged out , logged out users can read data. if want give access anyone, set ".read": true.

postgresql - Limit query by count distinct column values -

i have table people, this: id personid someattribute 1 1 yellow 2 1 red 3 2 yellow 4 3 green 5 3 black 6 3 purple 7 4 white previously returning of persons api seperate objects. if user set limit 3, setting query maxresults in hibernate 3 , returning: {"personid": 1, "attr":"yellow"} {"personid": 1, "attr":"red"} {"personid": 2, "attr":"yellow"} and if specify limit 3 , page 2(setmaxresult(3), setfirstresult(6) be: {"personid": 3, "attr":"green"} {"personid": 3, "attr":"black"} {"personid": 3, "attr":"purple"} but want select people , combine 1 json object this: { "personid":3, "attrs": [ {"attr":"green"}, {"attr":"black"}, {"attr":"purple"}

Convert diffrent diffrent string date, into one single date formate In mysql -

Image
i have column create_date in sql table, datatype varchar(225) . problem is, in column values in different date formats please check attached image i want create column constant_date_format using create _date column, there way? i have tried mysql str_to_date function : str_to_date(create_date, '%m/%d/%y') it working if create_date column have same date format. thanks in advance. you can case when regular expression select case when create_date regexp [0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9] str_to_date(create_date, '%m-%d-%y') when create_date regexp format str_to_date(create_date, '%m/%d/%y') else create_date end create_date table_name https://www.guru99.com/regular-expressions.html

devise - Rails: warning: already initialized constant User::HABTM_Roles rolify -

this issue i' m facing when trying create seeds.rb inorder define roles rolify gem in rails on line 2 , change rolify rolify: role_cname => 'usertype' to rolify :role_cname => 'usertype' you have 2 rolify on user.rb , 1 sufficient.

docusignapi - Fetching signature image for logged in user using docusign rest api -

i have project in have created form containing fileds:- 1.) name 2.) signature in signature column there button "add signature" when click on button opens popup enter docusign email , password. once click on login get's signature image url of user. problem code not getting image. my issue want display signature image after authentication in project. please suggest me wrong in code. my project url is:- http://surgimedik.esoftech.in/out/out.adddocument.phpfolderid=1&showtree=1#popup1 admin / admin you can check below url getting image url. when hit it asks login itstead of showing image. http://surgimedik.esoftech.in/docusign/test.phpemail=akash@esoftech.org&pwd=terminate@12345 <?php $email = $_request["email"]; $password = $_request["pwd"]; $integratorkey = '4a394221-7742-4f39-8a90-9021732676e8'; $header = "<docusigncredentials><username>" . $email . "</username><pa

multithreading - How to implement multithreaded AbortJob? -

i have implemented following go routines func main() { go processjob(job) } func processjob() { task := range tasks go performtask(task) } } func performtask(task) { sub := range task { go perfromsubtask(sub) } } func performsubtask(sub) error { // } now want implement abortjob() such if pass jobid abortjob using channels, routines should stop tasks , exits gracefully. how in go?

python - How to compare user logged's field with other user in Django's views -

suppose have following model: import ephem class person(models.model): username = models.foreignkey(user, blank=false) slug = models.slugfield(blank=false) location = foreignkey(location, blank=true) # return longitude & latitude city pyephem library city = models.charfield(max_length=255, blank=false, default='') def __str__(self): return self.username def get_city(self): city = ephem.observer() city.lon = float(self.location.longitude) city.lat = float(self.location.latitude) return city # return city location field def save(self, *args, **kwargs): if not self.pk: self.slug = slugify(self.username) super(person, self).save(*args, **kwargs) how make programmatically in django's views compare between attribute of logged user , attribute's other user ? which's username field based on slug & there&#

python - Choropleth map with OpenStreetMap data -

my goal so-called "choropleth map" (i guess) of zip code areas in germany. have found python package "folium" seems takes .json file input: https://github.com/python-visualization/folium on openstreetmap see shp.zip , .osm.pbf files. inside shp.zip archive find sorts of file endings i've never heard of no .json file. how use data openstreetmap feed folium? running wrong direction? edit / solution : went https://overpass-turbo.eu/ (which retrieves data openstreetmap via specific query language ql) , hit run on following code: [timeout:900]; area[name="deutschland"][admin_level=2][boundary=administrative]->.myarea; rel(area.myarea)["boundary"="postal_code"]; out geom; you can "export geojson" in case didn't work because it's data cannot processed inside browser. exporting "raw data" works. did , used "osmtogeojson" right format. after able feed openstreetmap data folium described

android - SDKBOX Kept asking to "Select ANDROID_PROJECT_DIR" while importing iap -

Image
i new sdkbox, trying import in app purchase sdk , other sdk cocos2d-x 3.10 project under windows cmd environment. following guide: http://docs.sdkbox.com/en/installer/#get-the-installer after installed python , sdkbox, , used following command project root directory sdkbox import iap i got stuck on screen asking me select android_project_dir i used: sdkbox import -b iap -p e:/projects/slotclient2/slotmatchine/proj.android-studio-vcv but got same result , doesn't matter type, kept showing type quit abort message. i tried sdkbox import facebook , other sdk , got same result. it doesn't matter if put in 0,1,2,3... or actual path, none of works. please point me right direction, lot!

css - Concatenating variables in a Stylus mixin -

i'm trying make mixin generates styles variables, , concatenate 2 variables , can't make work. here example: centersprite($icon) margin-top -(($ico_+$icon+_height) / 2) margin-left -(($ico_+$icon+_width) / 2) i have variable height , width of icon , to put name in arguments of mixin variable , make operation... thanks in advance! i don't know why (maybe bug?) when have minus before parenthesis in property value inside function stylus can't compile: this code doesn't compile: centersprite() margin-top -((5 + 10 + 3) / 2) body centersprite() but 1 without function compile: body margin-top -((5 + 10 + 3) / 2) and have discovered if use colons after property works in function: stylus centersprite() margin-top: -((5 + 10 + 3) / 2) body centersprite() css body { margin-top: -9; }

ios - When renaming Xcode project, I get "images.xcassets missing" -

when renaming project (xcode 8) , following steps shown here: how rename xcode project (i.e. inclusive of folders)? , getting warning saying images.xcassets folder missing. can tell me why might be? tried following steps couple of times, happened every time. how folder files grouped in file system? can't work out.

c# 4.0 - TypeError: this.country.toJS is not a function Angular 2 -

i new angular 2, have following code:- data["country"] = this.country ? this.country.tojs() : null; tojs(data?: any) { data = data === undefined ? {} : data; data["code"] = this.code !== undefined ? this.code : null; data["name"] = this.name !== undefined ? this.name : null; data["currency"] = this.currency ? this.currency.tojs() : null; data["twolettercode"] = this.twolettercode !== undefined ? this.twolettercode : null; data["threelettercode"] = this.threelettercode !== undefined ? this.threelettercode : null; data["numericcode"] = this.numericcode !== undefined ? this.numericcode : null; super.tojs(data); return data; } i getting following error [typeerror: this.country.tojs not function] what doing wrong?

javascript - React ternary operator with array.map return -

in react render function, using array.map return jsx code in array , rendering it. doesn't seem work, read few questions here suggested using return statement inside if/else block won't work in case. want check whether round , duration set on each array element , pass in jsx code.could tell me different approach please. render() { var interviewprocessmapped = interviewprocess.map((item, index) => { return {item.round ? <div classname="row title"> <div classname="__section--left"><span classname="section-title">round {index + 1}</span></div> <div classname="__section--right"> <h3>{item.round}</h3> </div> </div> : null } { item.durationhours > 0 || item.durationminutes > 0 ? <div classname="row"> <div classname="__section--left">d

python - How control DAG cconcurrency in airflow -

i use airflow v1.7.1.3 i have 2 dag, dag_a , dag_b. set 10 dag_a tasks @ 1 time, theoretically should execution 1 one. in reality, 10 dag_a tasks executed in parallel. concurrency parameter doesn't work. can tell me why? here's pseudocode: in dag_a.py dag = dag('dag_a', start_date=datetime.now(), default_args=default_args, schedule_interval=none, concurrency=1, max_active_runs=1) in dag_b.py from fabric.api import local dag = dag('dag_b', start_date=datetime.now(), default_args=default_args, schedule_interval='0 22 */1 * *', concurrency=1, max_active_runs=1) def trigger_dag_a(**context): dag_list = [] rec in rang(1,10): time.sleep(2) cmd = "airflow trigger_dag dag_a" log.info("cmd:%s"%cmd) msg = local(cmd) #"local" function in fabric lo

Wordpress tinymce text formatting -

Image
in wp-admin text editor (tinymce) looks bad. there no spacing , font bigger , weird. it's not problem annoying. not remember when happened; cannot fix this. added custom buttons; should not problem. tried turning them off. no luck. looks screenshot:

patch - USB Hardwares Freezes -

i want ask solution issue. i have windows 7 32 bit system , 8 gb ram. know can not use full ram in 32 bit systems. patched using patchpae , im using full 8 gb ram. happy work in speedy pc :) only problem im facing after pc started, whenever gets plugged in (new mouse/keyboard, printer, pd) usb hardware freezes, mouse & keyboard plugged in before starting pc. after restarting pc can continue work. i think can solved if usb driver uninstalled , reinstalled automatically. need kind of bat file can detect usb freezed & reinstalls driver itself. found scan h/d changes :- powershell -windowstyle hidden -command "& {\"rescan\" | diskpart}" i don't know why standby button not working otherwise may solve issue. power button pc getting restarted. i'm getting new optical mouse see if helps, if not vga switch box mouse. any suggestion on issue or drive tool or program/bat file can trick? thank you.

python - How to save each string to a separate file? -

i have folder including files open , read, extract persian words them separately , join each set of words make sentence. want save each sentence separate .txt file. problem last sentence saved in files. how can fix it? import os import codecs ###opening files folder in directory matches=[] root, dirs, files in os.walk("c:\\users\\maryam\\desktop\\new folder"): file in files: if file.endswith(".pts"): matches.append(os.path.join(root, file)) print(matches) print(len(matches)) ###reading files f in matches: codecs.open(f, "r", "utf-8") fp: text=fp.read().split('\n') #print(text) #print (len(text)) ###converts 1 string strings line in text: line_list=line.split() #print (line_list) ###extracting persian words , removing parantheses list_persian_letters=['ا','آ', 'ب','پ','ت','ث','ج

ext in buildscript can not be recognised by Gradle Kotlin DSL -

in these days, trying write codes experience spring reactive features , kotlin extension in spring 5, , prepared gradle kotlin dsl build.gradle.kt configure gradle build. the build.gradle.kt converted spring boot template codes generated http://start.spring.io . but ext in buildscript can not detected gradle. buildscript { ext { } } the ext cause gradle build error. to make variables in classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinversion") , compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlinversion") work, added variables in hard way. val kotlinversion = "1.1.4" val springbootversion = "2.0.0.m3" but have declare them in global top location , duplicate them in buildscript . code: https://github.com/hantsy/spring-reactive-sample/blob/master/kotlin-gradle/build.gradle.kts is there graceful approach make ext work? update : there ugly approaches: from gradle kotlin dsl example, https://github

string - Checking if a variable is empty on bash in If loop -

i wanted check if value of variable empty in if statement , take action based on result same in bash script. i doing this: if [ -z "${originslotname-}" ] && [ -z "${targetslotname-}" ]; echo "value of both slot not given"; although pass argument originslotname , targetslotname empty, particular iteration not executed rather goes part of bash script expecting both originslotname , targetslotname. does know, might wrong here? or there better way structure script? of have if statement 4 branches. if statement looks following: if (originslotname & originslotname != empty) else if (originslotname = empty & originslotname != empty ) else if (originslotname != empty & originslotname = empty ) else (both originslotname & originslotname = empty ) is there better , more efficient way perform these checks , take relevant action based on result, apart using if? you can write condition : if [[ -z

Bootstrap progress bar with ng-style AngularJS -

i have problem progress bar , ng-style here's code : <div class="progress" > <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" ng-style="width:datas[0].downloading"> <span class="glyphicon glyphicon-download" ></span> </div> </div> my plunker: http://plnkr.co/edit/g1t4pludttiajykttock?p=preview answers in advance! close curly braces like: ng-style="{width:datas[0].downloading}" fixed demo

c# - unity networking: bullets not showing on the server when spawned by the client -

i making simple 2d shooting game. movements appear on both sides of server fine, bullets appear on server if host creates them. if client makes bullets, cannot been seen host (but can seen client), presume not being spawned on server. host works client doesn't, not understand why problem occurs , how works, if explain me, great... looks it's case of creating object on server, perhaps client call initiates process. then, server spawn object, , send object clients also. see here detailed guide: https://docs.unity3d.com/manual/unetspawning.html most notably, check "object creation flow" section.

ios - Perform the segue from table view to the web view error -

i run error when try perform segue table view web view (for youtube videos). attached code both views, error , target output console. seems problem wkwebview class... don't error related that. sender: func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) { let partyrock = partyrocks[indexpath.row] performsegue(withidentifier: "videovc", sender: partyrock) } override func prepare(for segue: uistoryboardsegue, sender: any?) { if let destination = segue.destination as? videovc { if let party = sender as? partyrock { destination.partyrock = party } } } destination: import uikit class videovc: uiviewcontroller { @iboutlet weak var webview: uiwebview! @iboutlet weak var titlelbl: uilabel! private var _partyrock: partyrock! var partyrock: partyrock { { return _partyrock } set { _partyrock = newvalue } } override func viewdidload() { super.viewdidload() titlelb

algorithm - Efficient method for parameterizing distances between points in a 2D -

Image
we have been developing small simple "cad" solution allow parameterize width , length of specific, simple shapes. for instance consider following set of vertices forming triangle. 2 points form line. changing distances between point changing width of line. we have discussing rigorously how approach problem. things have discussed are: maintain list of equations of relationship between vertices. have point a , b , c . let w user-defined parameter. constraint equation shape be bx = ax + w , by = ay , , cx = bx , on. the complexity enormous works. maybe model each vertex node in graph...? what proper approached used in field? i think trying implement simplified geometric constraint solver. basically, points location determined solving set of nonlinear equation (i.e., constraints) boundary conditions (i.e., points location known). if case, not easy when geometries involved 2d points , constraints involved distances between points. anyway, in fie