Posts

Featured post

java - Using an Integer ArrayList in Android -

i needing creating arraylist , adding integers them. essentially, have card game pulls card , saves id (bcid). want add pulled id arraylist, can avoid pulling same card twice. have setup below, keep getting duplicates. know cards pulling correctly, displays fine - repeated cards, unfortunately. any can provide great! have done best include relevant parts. if need additional information, let me know. public static integer bcid1, bcid2, bcid3, bcid4, bcid5, bcdcid; public static list<integer> usedcards = new arraylist<integer>(); in example below, supposed detect duplicate initialize sequence draw different card. public static void setids() { try { bcid1 = integer.parseint(bc1); usedcards.add(bcid1); } catch(numberformatexception nfe) { } try { bcid2 = integer.parseint(bc2); if (usedcards.contains(bcid2)) { try { bluecard2(ctx); } ...

java - Simple conditional on scanned input -

this question has answer here: how compare strings in java? 23 answers i've written simple program check if input letter o or not. reason, when type letter o, program outputs input not letter o. have used eclipse debugger ensure input variable equals "o". import java.util.scanner; public class scannertest { public static void main(string[] args) { scanner scan = new scanner(system.in); system.out.println("give input. tell if input 'o' or not"); string input = scan.next(); if (input == "o"){ system.out.println("your input 'o'"); } else { system.out.println("your input not 'o'"); } } } you need use equals method instead of == operator, this: if(input.equals("o")) using == compares memory address of string objects...

HTML in Google App Engine -

i have been following this example google's site, having trouble understanding of how underlying things work. mostly, when submit text, in mainhandler html, how know use guestbook? assume has <form action="/sign" method=post> , ('/sign', guestbook) i'm not entirely sure how works. from google.appengine.ext import db import webapp2 class greeting(db.model): content = db.stringproperty(multiline=true) date = db.datetimeproperty(auto_now_add=true) class mainhandler(webapp2.requesthandler): def get(self): self.response.write('hello world!') self.response.write('<h1>my guestbook</h1><ol>') #greetings = db.gqlquery("select * greeting") greetings = greeting.all() greeting in greetings: self.response.write('<li> %s' % greeting.content) self.response.write(''' </ol><hr> <for...

Iterating a knockout observable array in javascript -

how iterate knockout observable array bound data knockout js mapping plugin ?. have created this fiddle demonstrate issue. when try value of knockout js array object returns function instead. could please me out in matter ?. code shown below. //sample json array var data = [{"street":"2532 falkark dr", "lat":"39.926295", "lng":"-86.012919", "zipcode":"92256"},{"street":"8558 appleby ln", "lat":"39.922742", "lng":"-86.017637", "zipcode":"92256"}] function viewmodel() { var self = this; self.addresses = ko.observablearray([]); ko.mapping.fromjs(data, {}, self.addresses); } var viewmodel = new viewmodel(); //function binding work order details view $(document).ready(function () { ko.applybindings(viewmodel); gothroughtheobservablearray(viewmodel.addresses()); }); function gothroughtheobservablearray(addressarra...

ruby on rails - How do I disable keep alive with HTTPClient? -

i using httpclient . is there way disable keep-alive/persistent connections when making request? possible if server serves web pages has keep-alive on? if it's not possible httpclient, possible other libraries such net:http or curb?

xcode4.5 - Cocos2D Score Counter will not count score -

i making game in cocos2d. made score counter on screen, , when hit enemy adds point score. when run it, , when hit enemy project terminates. it because of this: format specifies type 'id' argument has type 'int', referring line of code: - (void)addpoint { score = score + 1; // score++; work. [scorelabel setstring:[nsstring stringwithformat:@"%@", score]]; } it says wants me replace @"%@" @"%d", because not make score work, please me fix this. thank you! yes, replace %@ %d. score integer, question has answer..why asked here? [scorelabel setstring:[nsstring stringwithformat:@"%d", score]];