Posts

javascript - Outputting n instances of a React component -

i want create n instances of react component. what terse way give jsx can contain expressions? i trying following: <wrapper> {repeat(n)(i => <mycomponent i={i} />} </wrapper> function repeat(n) { return cb => array(n).fill(null).foreach((_, i) => cb(i)); } you can use javascript als :) render() { const lst = [1, 2, 3, 4]; return ( <div> {lst.map(itm => <span key={itm}>{itm}</span>)} </div> ); } if not have key ready, can use second argument of map callback index in array. more info on mdn . in specific case not have array number: render() { var times = []; (let = 0; < 10; i++) { times.push(<mycomponent key={i} i={i} />); } return <wrapper>{times}</wrapper>; } also check this answer on how use for loops. it's not quite nice works. believe react team has planned make working arrays in jsx more straight forward. if have number, , no...

ssh keys - Rundeck ssh connection refused -

i can't execute remotely on nodes, stored node's private key on /var/lib/rundeck/nodes/backend-01.key , error: execution log: execution failed: 20 in project deployments: [workflow result: , step failures: {1=dispatch failed on 1 nodes: [backend-01: connectionfailure: conexión rehusada (connection refused)]}, node failures: {backend-01=[connectionfailure: conexión rehusada (connection refused)]}, status: failed] my resources.xml: <project> <node name="backend-01" description="backend-01" tags="" hostname="10.10.10.10" osarch=" x86_64" osfamily="unix" osname="linux" osversion="x86_64" username="backend-01" ssh-keypath="/var/lib/rundeck/nodes/backend-01.key" /> </project> i store node private key on /var/lib/rundeck/nodes/backend-01.key i followed tutorial, didn't work...

function - Operator Overloading in Python coming from C++ -

i'm trying overload operators in python class represents mathematical fraction. in particular i'm trying overload * operator can have fraction * fraction, fraction * integer , integer * fraction operations. i've had experience c++ , in case write operator overloads in fraction class: friend fraction operator*(const fraction &f1, const fraction &f2); friend fraction operator*(const fraction &f, int v); friend fraction operator*(int v, const fraction &f); my understanding c++ knows function resolve based on arguments give it. since in python function parameters aren't typed i'm confused how python knows operator overload resolve to? example: def __mul__(self, other): return fraction(self.numerator * other.numerator, self.denominator * other.denominator) def __mul__(self,value): return fraction(self.numerator * value,self.denominator) the first overload work 2 fractions , second fraction , integer, how python know use? i'm new p...

c# - Xamarin Forms Android Release ViewModel not working -

i developing app xamarin forms. when run app in debug mode on device/emulator works fine. when switch on release mode viewmodel bindings stop working. error printed following: binding: 'property' property not found on 'myapp.viewmodel.registerviewmodel', target property: 'xamarin.forms.button.command' anyone had error?

angular - Observable.next() breaks loop -

this piece of code parses triples (not important) , should return 1 parking @ time. problem calling observer.next() breaks loop runs once. console.log doesn't called. i'm missing possible observer.next() breaks loop? there error or feature or plain wrong? return observable.create(observer => { this.fetch.get(dataseturl).then(response => { // subjects parkings const parkingtriples = [], parkings = [], totalspacesparking = [], labels = []; (let index = 0; index < response.triples.length; index++) { if (response.triples[index].object === 'http://vocab.datex.org/terms#urbanparkingsite') { parkingtriples.push(response.triples[index]); } if (response.triples[index].predicate === 'http://vocab.datex.org/terms#parkingnumberofspaces') { totalspacesparking.push(response.triples[index]); } if (response.triples[index].predicate === 'http://www.w3.org/2000/01/rdf-schema#label...

python - implement django user (Staff member) to handle some user's informations -

i developing website allows management of reservation of cars users. created first app manages user accounts such : registration email confirmation / login / logout ...etc i've created special user have staff permissions during registration, each new user must load pdf documents, these documents verified staff user if uploaded documents good, member sends user pdf_contract signed electronically my question is how display files uploaded users staff user, can check , send them pdf document. my code: views.py from mysite.core.forms import signupform, profileform, documentform mysite.core.models import profile mysite.core.tokens import account_activation_token django.views.generic.list import listview django.views.generic.detail import detailview # create views here. def index(request): return render(request, 'index.html') @login_required def home(request): return render(request, 'home.html') def signup(request): if request.method == ...

javascript - How to make timer circle to run according to timer entries -

i have timer, bounded circle. circle moves along running entries timer. if play circle move according seconds, if pause circle gets paused , stop means goes zero. if run timer , change page, timer circle go forward , backward. not running according number of seconds @ present.it taking 2 entries not getting issue arising. please hereby sharing codes please help: html code : <round-progress [current]="current" [max]="3600" [stroke]="6" [radius]="100" [rounded]="false" [responsive]="false" [color]="color" [background]="background" [duration]="800" [animation]="animation"></round-progress> track.ts this.apiservice .runningentries(this.user_id) .subscribe( entries => { if(entries.current) { this.currenttask = entries.current; ...