Posts

java - How to store comma separated argument using scanner -

i taking user input using scanner , want store 2 argument given command line how ever able one. believe hasnextint() returns boolean value if there nextint, when enter non-int value doesnot break loop. i have checked sources online , on stackoverflow before posting questions did not looking for. scanner s = new scanner(system.in); int first = 0; int second = 0; system.out.println("please enter number: "); s.usedelimiter(","); while (s.hasnextint()) { first = s.nextint(); system.out.print("firstargument: " + first + "\n"); second = s.nextint(); system.out.print("secondargument: " + second + "\n"); } the problem code calls s.hasnextint() every odd-numbered input, tries take each even-numbered input without performing check. therefore, requires inputs this: 1,2,3,4,5,6,done 1,2,3,4,done 1,2,done however, inputs result in exception: 1,2,3,4,5,done 1,2,3,done 1,done note non-numeric input ...

Error setting up Kubernetes with Vagrant -

Image
when run kubernetes vagrant setup script: export kubernetes_provider=vagrant curl -ss https://get.k8s.io | bash i get: validating master validating minion-1 waiting each minion registered cloud provider error: couldn't read version server: https://10.245.1.2/api:dial tcp 10.245.1.2:443: connection refused anyone know how can fix this? it looks issue gone, i've tried 1 more time , installation went flawlessly:

Java find object reference -

i have panel more buttons of buttonclass different names. how can find out when click finish button on button clicked first(which object of buttonclass) , modify name ? public class buttonclass extends jbutton{ public string name; public buttonclass(string name){ this.name = name; this.addactionlistener(new buttonlistener()); } public class buttonlistener implements actionlistener { public void actionperformed(actionevent e) { jframe frame = new jframe(); jbutton finish = new jbutton("finish"); finish.addactionlistener(new finish()); panel.add(finish); frame.add(panel); frame.setfocusable(false); frame.setsize(1600,900); frame.setlocationrelativeto(null); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.dispose_on_close); } } } and other actionlistner trying create finish butt...

ios - Removing object added in storyboard -

if want release uicollectionview in uiviewcontroller code, setting self.typecollectionview = nil; enough? no, have remove view hierarchy calling removefromsuperview method [typecollectionview removefromsuperview] the code using sets outlet nil doesn't remove view view hierarchy if outlet weak property/reference have call removefromsuperview . if strong 1 should set outlet nil .

java - Assign a name to every element of an array? -

is possible assign name every element of array? example in array myarr[5] , can give myarr[0] name "first", myarr[1] "second" , on? , if not, might feasible way achieve similar result? use map : map<string, whatever> yourmap = new hashmap<>(); yourmap.put("first", something); yourmap.put("second", somethingelse); then, elements out: system.out.println(yourmap.get("first")); // prints something.tostring() system.out.println(yourmap.get("second")); // prints somethingelse.tostring() // etc. but if you're going use "first" , "second" keys, you're better off using array. maps useful when it's more convenient access things using arbitrary objects rather simple integers keys.

c# - How to change FontFamily for Textbox while defined in Window -

i have issue defining fontfamily textboxes applicationwide, because font family defined @ window level style : <style targettype="window" > <setter property="fontfamily" value="lucida sans unicode"/> <setter property="fontsize" value="10pt"/> </style> i have defined font-family textboxes way : <style targettype="{x:type textbox}"> <setter property="fontfamily" value="arial"/> <setter property="fontsize" value="10pt"/> </style> however, textbox style not applied, , text textboxes still lucida, , not arial. how can ? there css-like !important equivalent in xaml style override previous 1 ? i notice appreciate xaml way perform on resourcedictionaries. thanks answers it working me. defined 2 styles, 1 window, 1 special text box. special style wins , result arial 30pt. if comment special style window style...

delphi - Where is the TIWFile.Filename property? -

i have old program made in delphi 7, using intraweb 80. i'm porting delphi xe8, latest intraweb library xiv. seems tiwfile control last version of intraweb missing tiwfile.filename property. i've been using e.g.: fname := iwfile1.filename; // iwfile1 1 tiwfile control this fails compile due missing property. happened tiwfile.filename property? should use instead?