Posts

Showing posts from June, 2010

Testing Laravel (5.1) console commands with phpunit -

what best way test laravel console commands? here example of command i'm running. takes in value in constructor , in handle method. class dosomething extends command { protected $signature = 'app:do-something'; protected $description = 'does something'; public function __construct(a $a) { ... } public function handle(b $b) { ... } } in test class, can mock both , b, can't figure out how pass $a in. $this->artisan('app:do-something', [$b]); is possible? or going wrong? should pass in thought handle() method? thanks. you have change around how call command in testing, possible mock object passed through. if class used artisan dependency-injected this: public function __construct(actualobject $mocked_a) { // } then write test case this: $mocked_a = mockery::mock('actualobject'); $this->app->instance('actualobject', $mocked_a); $kernel = $this...

javascript - Number value is getting changed in JS -

this question has answer here: what javascript's highest integer value number can go without losing precision? 18 answers is there limitation integer in javascript? [duplicate] 4 answers this post id: var postid = 47213486358396931; var postcomments = "comment"; adding in object var param = { "postid" : postid, "postcomment":postcomments } if print param this. last digit of number changed 0. why getting this. {"postid" : 47213486358396930, "postcomment": "comment"}

javascript - jquery clear the validate error message on reset -

i have jsp follows: <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <script src="${pagecontext.request.contextpath}/jquery/jquery.js"></script> <script src="${pagecontext.request.contextpath}/jquery/jquery.validate.min.js"></script> <script type="text/javascript" language="javascript"> jquery(document).ready(function () { //...... ..../// $("#apiid").validate({ rules: { pinnbr: "required", trandt: "required" }, messages: { pinnbr:"please enter pin number.", trandt: "please enter tran date." } }); $("#resetid").click(function () { var validator = $('#apiid'); validator.resetform(); })...

c++ - How to avoid Outlook Security Alert -

so i'm interning @ company , self teaching myself c++ head start on classes fall. problem have cannot find solution for, how send email without user interaction , avoid security prompts outlook. i have tried different ways send email simplemapi, cmd, vb, cdo, etc nothing seems rid of 'please wait 5 seconds because someones trying send email' prompt, , can't have that. can't install third party software because need program work on company computers. i'm try system.net.mail.mailmessage , see if can figure out. end goal click button, , email sends without knowledge, no security prompts. if needs authentication execute without prompt can implement too. i'm using winapi on 64 bit systems, , have exe run sharepoint pulling network drive if matters. , please don't closeminded using ms office, i'll make want to in meantime, if code sample or link in right direction (not msdn ffs) appreciated. see http://www.outlookcode.com/article.aspx?id...

delphi - How can I modify my EnumWindowNamesProc to work with Lazarus and use a List as a parameter? -

overview i trying enumerate list of visible window names , populate list passed parameter. in delphi able work following: function enumwindownamesproc(whandle: hwnd; list: tstrings): bool; stdcall; var title: array[0..255] of char; begin result := false; getwindowtext(whandle, title, 255); if iswindowvisible(whandle) begin if title <> '' begin list.add(string(title)); end; end; result := true; end; then call above so: enumwindows(@enumwindownamesproc, lparam(fwindownames)); note: fwindownames stringlist created inside custom class. problem i trying make function compatible lazarus/fpc wont accept list: tstrings parameter. the compiler error in lazarus complains type mismatch (i have highlighted important parts): error: incompatible type arg no. 1: got " (address of function( longword;tstrings ):longbool;stdcall) ", expected " (procedure variable type of function( longword;longint ):longbool...

c# - Linq, from list of objects, create list of properties based on another property's value -

i need list of riseperiods bitpos > 2. class bit { public int bitpos { get; set; } public int riseperiod { get; set; } } list<bit> databits; i tried ienumerable<int> rplist = databits .where(bit => bit.bitpos > 2) .select(bit => bit.riseperiod); and ienumerable<int> rplist = bit in databits bit.bitpos > 2 select bit.riseperiod as other ways, each returns entire databits list instead of list of riseperiods. should simple - right? thanks! i've tried , seems working fine, suspected syntax , logic looks correct. try adding call tolist make more clear when inspected list of integers. if not, there must else going on here. here's code suggest: ienumerable<int> rplist = databits .where(bit => bit.bitpos > 2) .select(bit => bit.riseperiod) .tolist();

Spring Data REST Neo4j create a relationship -

i'm building little test app way learn angular , refresh myself on lot of spring stack. have minor experience neo4j, app idea has ground graph db neo4j. the idea pretty simple, ui create characters , stories, , relate characters stories , each other, map individual versions of story , create graphs show character interactions write overall narrative. i've got nodes characters , stories enough , spring stack great giving me rest easy use rest endpoints nodes themselves. can't find concrete examples of creating , maintaining relationships between nodes. for instance, in cypher, can relate character story , tell being's involvement story relationship property with: match(p:being ),(s:story ) id(p) = 7 , id(s) = 16 create (p)-[r:took_part_in{perspective:"i did not know mr. grey better acquaintance, though knew others whom did. not made better because of relationship him."}]->(s) return r then mapping in spring, data rest endpoint gives me ch...

reporting services - SSRS: How to merge 2 header cells in the same column -

i'd header organized way. however, when select 2 cells in same column , right-click, don't see suggestions merging cells. other way accomplish same thing? +-----------+--------------------------------+-- | | | proposed bonus | | name | bureau +-------+-----------+-- | | | (%) | ($) | +-----------+------------+-------+-----------+--- | doe, jane | accounting | 3.1% | $3,177.51 | thanks helping

c# - Creating large amount of tasks/threads and waiting for them all to complete -

i'm writing simple raytracer , i've run runtime limitations because program single-threaded. result i've been finding through google answer type of question 2 or 3 tasks handled. class program { static void main(string[] args) { var tasklist = new list<task>(); tasklist.add(task.factory.startnew(() => dostuff())); tasklist.add(task.factory.startnew(() => dostuff())); tasklist.add(task.factory.startnew(() => dostuff())); task.waitall(tasklist); console.writeline("all threads complete"); } static void dostuff() { //do stuff here } } i'm looking @ atleast 10,000 individual threads, if implemented naively. solution above doesn't seem optimal 1 in scenario. there part of standard library supports this, or there nuget package has implemented? might me baing stupid, , >10,000 threads in list not problem @ all. issue becomes when cutoff is. need 12500000 t...

python - How to add specific axes to matplotlib subplot? -

i trying make matrix plot matplotlib. the individual plots made specific module windrose subclasses polaraxes . there not seem projection defined in module called subplot kwargs. standard polar projection not work since of subclass arguments missing. i have tested several approaches without success (even seaborn map considering post: https://stackoverflow.com/a/25702476/3416205 ). hereunder closest have tried. there way want without creating new matplotlib projection associated specific windroseaxes ? import pandas pd import matplotlib.pyplot plt import matplotlib.gridspec gridspec windrose import windroseaxes df = pd.read_csv('https://raw.githubusercontent.com/antoinegautier/data/master/tmp.csv') fig = plt.figure() gs = gridspec.gridspec(4, 2) def wind_plot(x, y, title=none, axes=none, fig=none): ax = windroseaxes.from_ax() ax.set_position(axes.get_position(fig)) ax.bar(x, y, normed=true, opening=0.8, edgecolor='white', bins=[0, 2.5, 5, 7.5, 1...

How to create a different report for each subset of a data frame with R markdown? -

i have dataset looks like city score count returns dallas 2.9 61 21 phoenix 2.6 52 14 milwaukee 1.7 38 7 chicago 1.2 95 16 phoenix 5.9 96 16 dallas 1.9 45 12 dallas 2.7 75 45 chicago 2.2 75 10 milwaukee 2.6 12 2 milwaukee 4.5 32 0 dallas 1.9 65 12 chicago 4.9 95 13 chicago 5 45 5 phoenix 5.2 43 5 i build report using r markdown; however, each city need build report. reason 1 city cannot see report city. how build report , save pdf of each city? each report need median score , mean count , , mean returns . know using dplyr use finaldat <- dat %>% group_by(city) %>% summarise(score = median(score), count = mean(count) , return= mean(returns)) but frustration comes producing report each city . also, subset of data, not full data. is, report extensive , report of results, systematic, not different each city . it looks parameteriz...

python - ImportError: No module named numpy - Google Cloud Dataproc when using Jupyter Notebook -

when starting jupyter notebook on google dataproc, importing modules fails. have tried install modules using different commands. examples: import os os.sytem("sudo apt-get install python-numpy") os.system("sudo pip install numpy") #after having installed pip os.system("sudo pip install python-numpy") #after having installed pip import numpy none of above examples work , return import error: enter image description here when using command line able install modules, still import error remains. guess installing modules in wrong location. any thoughts? i found solution. import sys sys.path.append('/usr/lib/python2.7/dist-packages') os.system("sudo apt-get install python-pandas -y") os.system("sudo apt-get install python-numpy -y") os.system("sudo apt-get install python-scipy -y") os.system("sudo apt-get install python-sklearn -y") import pandas import numpy import scipy import sklearn...

android - Kotlin by Lazy in Custom Views -

currently, using by lazy in custom view break visualisation in android studio. using iseditmode can't used because available inside method , not @ variable initialisation scope. workaround using lateinit , or delegates.notnull(). is there workaround this? example: class imageviewcirclebg : imageview { private var circlebgcolor = r.color.colorprimary private val paint lazy { paint().apply { style = paint.style.fill isantialias = true } } constructor(context: context) : this(context, null) constructor(context: context, attrs: attributeset?) : this(context, attrs, 0) constructor(context: context, attrs: attributeset?, defstyleattr: int) : super(context, attrs, defstyleattr) { val ta = context.theme.obtainstyledattributes(attrs, r.styleable.imageviewcirclebg, 0, 0) circlebgcolor = ta.getcolor(r.styleable.imageviewcirclebg_roundbgcolor, circlebgcolor) ta.recycle() this.paint.c...

android - No setter/field for while trying to populate a listview on firebase -

i trying retrieve data firebase , display on listview using firebase-ui. code runs fine nothing displayed on list view. logs: w/classmapper: no setter/field -knrxddola9nv6qxxvol found on class com.example.sammie.coreteccontacts.sacco here firebaselistadapter databasereference mdatabasereference = firebasedatabase.getinstance().getreference(); firebaselistadapter<sacco> adapter = new firebaselistadapter<sacco>(getactivity(), sacco.class, android.r.layout.simple_list_item_1, mdatabasereference) { @override protected void populateview(view view, sacco sacco, int i) { ((textview)view.findviewbyid(android.r.id.text1)).settext(sacco.getname()); } }; contactlist.setadapter(adapter); here sacco class: package com.example.sammie.coreteccontacts; public class sacco { string description; string location; static string name; public sacco() { } public sacco(string description, string location, string name) { this.name = name; ...

python - Pandas - Modify string values in each cell -

i have panda dataframe , need modify values in given column. each column contains string value of same length. user provides index want replaced each value: ex: [1:3] , replacement value "aaa" . this replace string values 1 3 value aaa . how can use applymap, map or apply function done? thanks here final solution went off of using answer marked below: import pandas pd df = pd.dataframe({'a':['ffgghh','ffrtss','ffrtds'], #'b':['ffrtss','ssgghh','d'], 'c':['qqttss',' 44','f']}) print df old = ['g', 'r', 'z'] new = ['y', 'b', 'c'] vals = dict(zip(old, new)) pos = 2 old, new in vals.items(): df.ix[df['a'].str[pos] == old, 'a'] = df['a'].str.slice_replace(pos,pos + len(new),new) print df use str.slice_replace : df['b'] = df['b...

unity3d - Windows.Devices.Bluetooth.dll -

for unity-uwp project, want interact ibeacons. i wanted add library project, can't seem locate it. have do, in order use unity project? you need compile dll separately interacts windows.devices.bluetooth.dll include dll in in project under assets/plugins/wsa folder add plugin. once can reference dll in normal .net project if added reference dll. there other requirements beyond (for example need make 2nd version of plugin compiled full .net framework same type names , version number used in-editor), see unity documentation " windows store apps: plugins on .net scripting backend " full details.

xamarin.forms - Azure Mobile App Service Authentication -

using above service xamarin form, have enable authentication oauth (microsoft , google). api call working fine , functions [authorize] , being enforced authentication. however, we're using server side authentication, hence after received user token respective provider, check in our database if user account in there. if not there, call api function, insert account in database , give user demo access our app. hence, should't have authentication on function. how secure function, allow such user creation app , not directly api site? (i'm thinking of using hardcoded key, , pass parameter function if not other secure method available) i covered in blog. see https://shellmonger.com/2016/05/13/30-days-of-zumo-v2-azure-mobile-apps-day-20-custom-api/ first day, , day 21/22 well.

photoshop script - If document name matches regex -

i in situation where, after finishing work on multiple open photoshop documents, want play specific action on few of them. document names match pattern should pretty easy match regex. essentially: -if document name 5 or 6 digits + "f", play action a. -if document name 5 or 6 digits + "fx", play action b. -if document name 5 or 6 digits + "b", play action a. -if document name 5 or 6 digits + "bx", play action b. i gather getbyname works exact string matches, in order use regex need loop through every open doc, check regex .match, play correct action. having trouble achieving desired result. p.s. targeted documents have never been saved , therefor have no extensions, regex pattern not need account this. thanks! i take after regex? try (\d{5,6}f$|\d{5,6}b$) // action (\d{5,6}fx$|\d{5,6}bx$) // action b

perl - Test whether one string contains any of the words in another -

i have perl program code pulls description string hash. i have variable $ui equal variable $uniqueid , want return true if $ui contains words in variable $unqiueid . =~ isn't working. is there smart way of doing this? sub getdescription { $uniqueid = shift; $retval; $ui; foreach $key ( keys %hashlist ) { foreach $ui ( @{ $hashlist{$key}->{uniqueid} }) { if ( $ui eq $uniqueid ) { $retval = $hashlist{$key}->{description}; last; } } last if $retval; } return $retval; } a simple way test if 1 scalar variable contains is: if ($ui =~ /$uniqueid/) { ... } (and @markus laire points out can use /\b$uniqueid\b/ prevent partial word matches.)

objective c - Update Realm database -

i'm trying update realm database, can't figure out. i using [realm addobject:info]; , add same objects realm database existed. so replaced [people createorupdateinrealm:realm withvalue:info]; added last item in array of people information (there 6 people, realm database show sixth person information). not sure i'm doing wrong? people.h: @property (nonatomic) nsstring *fname; @property (nonatomic) nsstring *lname; @property (nonatomic) nsstring *flname; @property (nonatomic) nsstring *email; @property (nonatomic) nsstring *phone; @property (nonatomic) nsstring *video; @property (nonatomic) nsstring *pdf; @property (nonatomic) nsstring *pkey; + (nsstring *)primarykey; people.m: + (nsstring *)primarykey { return @"pkey"; } tableviewcontroller.m: rlmrealm *realm = [rlmrealm defaultrealm]; (id item in responsearray) { [realm beginwritetransaction]; people *info = [[people alloc] init]; info.fname = item[@"fname"]; ...

ios - Keeping Core Data in sync with multiple watches -

i'm writing iphone , watch app. i'm planning on supporting ability pair multiple watches phone. the iphone , watch app both read , write core data datastore, , i'll use watchconnectivity keep them in sync (using transferuserinfo: ). user write/dictate on 1 device, , appear on other. i'm struggling figure out how support multiple watches. given following scenario: user using phone/watcha over course of day, user adds 10 items end of day, switch watchb how watchb in sync phone/watcha? will wksession automatically replay transferuserinfo calls made when watcha paired? do need somehow keep track of watchb needs , replay myself? do send entire sqlite database using transferfile api (that seems bit much)? will wksession automatically replay transferuserinfo calls made when watcha paired? no won't. data gets transferred paired watch. when switch other watch, you'd have arrange update store. do need somehow keep track of ...

How to handle issues when we run out of connections to database? -

i looking commonly used / best practices in industry. assume following hypothetical scenario: if app server accepts 200 user requests, , each of them need db access. db max_connections 100. if 200 users request @ same time, have 100 max_connections, happens other requests, not served max connections ? in real world: will remaining 100 requests stored in sort of queue on apps servers, , kept waiting db connections ? do error out ? basically, if database server can handle 100 connections, , of web connections "require database access," must ensure no more 100 requests allowed active @ 1 instant.   “ruling constraint” of scenario.   (it may 1 of many.) you can accept "up 200 simultaneous connections" on server, must enqueue these requests limit of 100 active requests not exceeded. there many, many ways that:   load balancers, application servers, apache/nginix directives. sometimes, web-page front-end process broken-out among many ...

rdma - Issue in SA query Infiniband -

what parameter context passed function ib_sa_path_rec_get ib_sa ? it common asynchronous functions in kernel accept callback function , context pointer. once handling complete, callback function called passing context pointer 1 of parameters. allows caller identify specific invocation callback being called. in case of ib_sa_path_rec_get , can see example 1 of calls functions in ipoib module . call passes callback function path_rec_completion , context of type struct ipoib_path * . once sa query handling complete, callback function called, , uses context parameter identify ipoib_path struct function being called.

linq - DynamicQueryable .Where for exactly a Date (only, no time) -

i can find >= <= etc. not equal date using system.linq.dynamic dynamicqueryable where. does have example? searched whirled wild web , found nothing yet. example: select * orders convert(date, created) = '2016-07-08' appears slight modification of answer question: dynamic linq datetime comparison string building - linq entities . if want orders specific date (no time involved): dbcontext.orders.where("( created >= datetime(2016, 07, 08) , created < datetime(2016, 07, 09) )") and per article above, if have other columns in clause, you'll have build yourself.

python - Terminology: A user-defined function object attribute? -

according python 2.7.12 documentation, user-defined methods : user-defined method objects may created when getting attribute of class (perhaps via instance of class), if attribute user-defined function object, unbound user-defined method object, or class method object . when attribute user-defined method object, new method object created if class being retrieved same as, or derived class of, class stored in original method object; otherwise, original method object used is. i know in python object, "user-defined method" must identical "user-defined method object ". however, can't understand why there "user-defined function object attribute". say, in following code: class foo(object): def meth(self): pass meth function defined inside class body, , method . why can have "user-defined function object attribute"? aren't attributes defined inside class body? bouns question: provide examples illustr...

r - Combining rows on the x-axis within geom_bar -

Image
i assume asking pretty simple question, not able solve myself. how can create age groups on x-axis in image below. example, 10-20, 20-30, 40-50 etc. within ggplot ? i know create new dataframe, prefer keep worksheet simple , within ggplot . code using: figure1 <- ggplot(newdata, aes(x = factor(leeftijd),)) + geom_bar() + xlab("age") + ylab("loneliness (count)") + ggtitle("overview of distrubtion of lonely people") figure1 thanks! first question didn't ask want answer. i've found better feed dataframe through dplyr , tidyr before goes ggplot. it makes more readable code , makes whole mess simpler when head around it. secondly, want: library(ggplot2) library(tidyr) library(dplyr) ## created dummy data here, want use own, newdata <- data.frame(as.numeric(round(rnorm(1000,50,10)))) colnames(newdata) <- c("leeftijd") figure1 <- ggplot(newdata, aes(x = factor(leeftijd),)) + geom_bar() + xlab("a...

reactjs - I try to make my Material-UI RaisedButton link to an external url without success? -

as question in title state. playing react, react-router , material-ui , in 1 place want make action button in card component link external url, without success. i'm thinking of adding event handler use window.open, must smarter way? i did find solution, before code looked this. <cardactions> <raisedbutton href={this.props.url} label="ok" /> </cardactions> the solution simple: <cardactions> <a href={this.props.url} target="_blank"> <raisedbutton label="ok" /> </a> </cardactions> you can wrap <raisedbutton /> <link /> component internal routing. <link to={this.props.carditem.resourceurl}> <raisedbutton label="ok" /> </link> and wrap simple <a> tag extrenal: <a href={this.props.carditem.resourceurl}> <raisedbutton label="ok" /> </a>

linux - Download github release with Java/Shell -

i want able download github release (a jar file) , put in directory on vps (running ubuntu 16.04). how go doing this? adding "shell" tag think you'd need use shell see discussion: download single files github in past, i've used like: wget -o filename.jar https://github.com/downloads/user/repository/filename.jar?raw=true that place jar file in current directory if run ubunutu vps.

asp.net - Using @html.label in list a of classes -

i trying follow : @{ viewbag.title = "administrator"; } @model list<myproject.dal.myclass> @foreach (var m in model) { @html.labelfor(m=>m.id) } myclass : namespace myproject.dal { using system; using system.collections.generic; public partial class myclass { public int id { get; set; } public string title { get; set; } } } how can make @html.labelfor work in case (list of myclass)? if model class @html.labelfor(m=>m.id) works this should it. @model list<myproject.dal.myclass> @foreach (var item in model) { @html.labelfor(m => item.id) }

python - FFmpeg: ffmpeg binary not found Error -

what have: - have built , installed ffmpeg on windows following documentation ffmpeg . - implementing video upload in python/django project , need accept extensions of videos, convert them mp4 , save , view them in video html element. error get: - first import converter installed library: from converter import converter - error (ffmpegerror: ffmpeg binary not found: ffmpeg) when execute: c = converter() any solution please!

How to declare protocol constrainted generic variable in Swift? -

i need create dictionary variable value of someotherclass class , conforms someprotocol . equals following declaration in objective-c: nsmutabledictionary<someclass *, someotherclass<someprotocol> *> *someotherbysome; so, possible in same simple way using swift? i need because can create func signature: func somefunc<t: someotherclass t: someprotocol>(param: t, otherparam: string) and want values param parameter dictionary without type casting. short answer in swift cannot declare variable of given class and conform protocol . possible solution (?) however given definitions have class someclass: hashable { var hashvalue: int { return 0 } // logic goes here } func ==(left:someclass, right:someclass) -> bool { return true // logic goes here } class someotherclass {} protocol someprotocol {} maybe can solve problem making someotherclass conform someprotocol extension someotherclass: someprotocol { } now can simply ...

javascript - Sleeps, waitUntil, waitForVisible, waitForExist webdriverio -

i coming world of python , bit confused on how can add sleeps test (only been @ js week). understand sleeps not best practice, though learn how can done. have test launches browser fails because load times on page. debugging purposes, pause test couple seconds. have not work. thank responses. var assert = require('assert'); describe('basic login', function() { it('verify user able login', function () { browser.url('http://localhost:3000'); var elem = browser.element('div.accounts-dropdown > div.dropdown-toggle > span'); //elem.waitforvisible(2000); //not working //elem.waitforexist(3000); //not working return browser.waituntil (function async() { elem.click(); browser.setvalue('//input', 'sy7nktvw@localhost'); browser.setvalue('//div[2]/input', 'ku3spn75'); browser.click("//button[@type='submit']"); assert('//li/div/butto...

javascript - Angular2 - Class constructor cannot be invoked without 'new' -

i'm trying integrate angular2-odata library. i'm using @injectable() class myodataconfig extends odataconfiguration{ baseurl="http://localhost:54872/odata/"; } bootstrap(app,[ //some of other providers etc. provide(odataconfiguration, {useclass:myodataconfig}), odataservicefactory, ] problem when try inject odataservicefactory following error: exception: error during instantiation of odataconfiguration! (classservice -> odataservicefactory -> odataconfiguration). original exception: typeerror: class constructor odataconfiguration cannot invoked without 'new' i googled , seems there problem while trying inject extended class, not able find solution this. appreciated. a temporary workaround use new on odataconfiguration class , override baseurl : @component({ templateurl: './categorygridodata.component.html', selector: 'my-category-grid-odata', provider...

python - Sieve of Eratosthenes returning incorrect answers -

i'm beginner trying create function determine whether or not value prime or not. def isprime(number): marked = [] ## create empty list in xrange(2, number+1): if not in marked: ## begin loop remove multiples of in list j in xrange(i * i, number + 1, i): marked.append(j) if == number: ## i'm assuming if ##the program made here, not in marked. print isprime(7) >>> true print isprime(10) >>> none ## should false...ok tried tinkering here. so attempt fix edit last conditional to: if == number: return true else: ## begin new line of code correct false positive return false this line messes though because shows: isprime(7) >>> false edit turns out method entirely bad method go. according comment jean-francois, easier method check primes def is_prime(n): if n<2: return false # handle special case sn = int(n**0.5)+1 in range(2,sn): if...

html5 - How Viewport works in css -

i working in css , using media jqueries make responsive web design. in tutorial on w3schools, add following code: <meta name="viewport" content="width=device-width,initial-scale=1.0" /> but page has no chaned effect if remove tag. i have created following page my created page here , viewport doesn't display expect.

python - Selendroid - Can't connect to Selendroid server, assuming it is not running -

i'm trying automate actions in browser, using selendroid. managed server going. if go http://localhost:4444/wd/hub/status , here's response {"value":{"os":{"name":"linux","arch":"amd64","version":"4.6.4-1-arch"},"build":{"browsername":"selendroid","version":"0.17.0"},"supporteddevices":[{"emulator":false,"screensize":"(480, 800)","serial":"47900eb4d5dc9100","platformversion":"17","model":"gt-i8200","apitargettype":"google"}],"supportedapps":[{"mainactivity":"io.selendroid.androiddriver.webviewactivity","appid":"io.selendroid.androiddriver:0.17.0","basepackage":"io.selendroid.androiddriver"}]},"status":0} showing device recognized. i'm using r...

reactjs - Should I call actions within componentWillReceiveProps? -

my instinct tells me no, i'm having difficultly thinking of better way. currently, have component displays list of items. depending on provided props , list may change (i.e. filtering change or contextual change) for example, given new this.props.type , state updated follows: componentwillreceiveprops(nextprops) { if (nextprops.type == this.state.filters.type) return this.setstate({ filters: { ...this.state.filters, type: nextprops.type, }, items: itemsstore.getitems().filter(item => item.type == nextprops.type) }) } this fine , good, requirements have changed , need add new filter. new filter, must execute api call return list of valid item ids , want display items these ids in same list component. how should go this? i had thought calling appropriate action componentwillreceiveprops , doesn't seem right. componentwillreceiveprops(nextprops) { if (nextprops.t...

android - RecyclerView to be Scrolled horizontally with the width -

i have more items show in cardview horizontally inside recyclerview , have more cards veritically. i tried place cardview inside horizontalscrollview, worked scroll idividual card. wanted scroll entire recyclerview scrolled see right end items. i tried recyclerview inside horizontalscroolview not worked. recyclerview inside nestedscrollview not worked. the recyclerview in fragment. inside viewpager tablayout, 1 of fragment fragment xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <android.support.v7.widget.recyclerview android:id="@+id/record_recycler" android:layout_width="550dp...

Use STDIN during docker build from a Dockerfile -

i'm trying install miniconda in docker image first step, right have: ubuntu:14.04 run apt-get update && apt-get install wget run wget *miniconda download url* && bash file_downloaded.sh when try build image, goes until starts popping following message continously: >>> please answer 'yes' or 'no' @ point need stop docker build. how can fix it? should include in dockerfile? i believe can pass -b flag miniconda shell script avoid manual answering installs miniconda3 4.0.5 -b run install in batch mode (without manual intervention), expected license terms agreed upon -f no error if install prefix exists -h print message , exit -p prefix install prefix, defaults $prefix something that: run wget http://......-x86_64.sh -o miniconda.sh run chmod +x miniconda.sh \ && bash ./miniconda.sh -b

java - How to control the increments of values on the Y-Axis of BarChart -

Image
i attempting make uniform barchart ranges in wide number of values. have attempted adjust tick , other ranges. essentially, increase increments on yaxis fit bars proportionately. ideas? also, should note instead of numberaxis, valueaxis. thanks in advance. so how ended getting values square including setting rangeaxis range dynamically. removed 3d elements on suggestion of @fredk. using defaultcategorydataset (plot categoryplot), code below appropriate these conditions... logaxis yaxis = new logaxis("transaction time (ms)"); yaxis.setbase(10); plot.setrangeaxis(yaxis); yaxis.settickunit(new numbertickunit(1)); yaxis.setminortickmarksvisible(true); yaxis.setautorange(true); plot.setrangeaxis(yaxis); plot.getrangeaxis().setlabelfont(new font("sansserif", font.bold, 14)); plot.getrangeaxis().setticklabelfont(new font("sansserif", font.bold, 12)); double maximum...

matlab - Changing color of plot lines in a loop -

i have question changing color of lines in plot in matlab. have written code want change color of lines in plot embedded in several loops (the code shown below). in code, new plot created (with own figure) when "if loop" condition satisfied. want each plot have lines different colors (from other plots), created variable = "newcolor" increment , change line colors. however, following problem has been occurring: suppose in debug mode , have stopped @ plot command. run next step , plot created blue line. check value of newcolor , find newcolor = 0.1. next, use "run cursor" command step next time plot command activated. when still within "i loop", newcolor has not changed. check editor find newcolor = 0.1. therefore, when run next step blue line should show on current plot. contrary , disbelief orange line shows (in addition blue line). don't understand since in both steps of debugger newcolor = 0.1, , code written color of lines = [0,newco...

java - How can I ask the user for the account number and the amount to deposit in the run deposit method -

how can ask user account number , amount deposit in run deposit method. best way tackle this. not sure on how menu in java , have tried adapt have looked at. appreciate / advice cheers package week8; import java.util.arraylist; import java.util.scanner; public class banktester { public static scanner in = new scanner(system.in); public static void main(string[] args) { customer customer1 = new customer("jim", "brown", "12/1265"); currentaccount currentaccount1 = new currentaccount(0.0, customer1, accounttype.personal, 25.0); arraylist<currentaccount> bank = new arraylist<currentaccount>(); bank.add(currentaccount1); printmenu(bank); } private static void printmenu(arraylist<currentaccount> bank) { system.out.println("\n1)deposit\n2)withdraw\n2)month end\n3)quit"); system.out.println("please select , option: "); in...

c# - How do I launch the web browser after starting my ASP.NET Core application? -

i have asp.net core application used client multiple users. in other words, not hosted on central server , run published executable anytime need use application. in program.cs file there's following: var host = new webhostbuilder() .usekestrel() .usecontentroot(directory.getcurrentdirectory()) .useiisintegration() .usestartup<startup>() .build(); host.run(); i default web browser automatically open avoid redundant step of user having open browser , manually put in http://localhost:5000 address. what best way achieve this? calling program.start after call run() won't work because run blocks thread. you have 2 different problems here: thread blocking host.run() indeed blocks main thread. so, use host.start() (or await startasync on 2.x) instead of host.run() . how start web browser if using asp.net core on .net framework 4.x, microsoft says can use: process.start("http://localhost:5000"); but if targ...