Posts

removing enemy and bullet in collision java -

this question has answer here: iterating through collection, avoiding concurrentmodificationexception when removing in loop 17 answers i making simple 2d game in java. have created controller class , created linked lists zombies(enemies) , bullets. in gamestate class trying use each loops loop through linked lists , detect if there collision bullet , zombie. way laid out below in code example, enemy can removed game, if try remove bullet well, game crashes. wondering if ideas on how can remove both entities after collision occurs. this error when bullet collides enemy exception in thread "thread-1" java.util.concurrentmodificationexception @ java.util.linkedlist$listitr.checkforcomodification(unknown source) @ java.util.linkedlist$listitr.next(unknown source) @ android.game.gamestate.update(gamestate.java:71) @ android.game.game.update(game.java:121) @...

android - Error "java.lang.String cannot be cast to java.lang.Integer" In Custom Adapter -

i have problem custom adapter put hint in spinner. i've made class adapterspinnerhint extends arrayadapter: public class adapterspinnerhint extends arrayadapter { int labelhint; int textviewid; int layout; arraylist<string> mitems; context context; public adapterspinnerhint(context context, int spinner_layout, int field, arraylist<string> list, int label) { super(context, spinner_layout, list); textviewid = field; labelhint = label; layout = spinner_layout; mitems=list; } @override public view getview(int position, view convertview, viewgroup parent) { view v; layoutinflater inflater = (layoutinflater)context.getsystemservice(context.layout_inflater_service); v = inflater.inflate(layout, null); if (position == getcount()) { ((textview)v.findviewbyid(textviewid)).settext(labelhint); ((textview)v.findviewbyid(textviewid)).sethint((integer) getitem(getcount())); //"hint displayed" } return v; ...

Objective-c:How can the object p know the changes of Person class after Person class is changed? -

how can object p know content of person class changed ?like this: before person class changed: #import <foundation/foundation.h> @interface person:nsobject @end int main(){ person *p = [[person alloc] init]; return 0; } after person class changed: #import <foundation/foundation.h> @interface person:nsobject @property int age;/* add new member */ - (void)test; /* add new method */ @end @implememtation person - (void)test { nslog(@"hello"); } @end int main(){ person *p = [[person alloc] init]; return 0; } how can object p know person added new member , new method? use instruments , allocations template , enter "person" in search box. if person object presently in memory in list.

sql - Parent Child over id query -

example data: id parent child total isparent isparentchildthing 1 j na 5 1 1 1 b na -5 0 1 1 j na -10 1 1 1 b na 10 0 1 2 x na -1 1 1 2 y na 1 0 1 3 z na 6 0 1 3 w na 7 0 1 3 p na -6 1 1 3 r na -7 1 1 3 tt yy 500 0 0 desired output: id parent child total 1 j b 5 1 j b -10 2 x y -1 3 p z -6 3 r w -7 in psuedo/english, each "pair" in given id, want parent , parent's total value , "child" goes parent determined isparent = 0 , total = total*-1 isparent = 1 any suggestions welcome according requirement, nee...

javascript - *ngFor | async doesn't work -

there input text each change, service search results. serivce returns : observable contain results. return multiple persons . tamplate.html: <input type="text" id="inputsearch"> ... <tr *ngfor="let person of items$ | async" ... ... code: import { component ,oninit} '@angular/core'; import {control} '@angular/common'; import {personservice} "./person.service"; import {person} "./person.class"; import {observable} "rxjs/rx" @component({ selector: 'contact-table', moduleid: module.id, templateurl: 'contact-table.component.html', styleurls: ['contact-table.component.css'] }) export class contacttable implements oninit { private items$: observable<person[]>; private inputchanged$:observable<{}>; constructor(private _personservice:personservice) {} public ngoninit() { this.inputchanged$=observable.fromevent(document.getelementbyid("i...

Jumbled words in ruby -

i implementing jumbled words game without gui, need in console. i need small console themes moving text , blinking text timeout, etc. need without graphics. i don't have limited questions jumbled words game, if user press ctrl + c or ctrl + d should print score in alert box. also if press ctrl + c or ctrl + d , errors printing in console. don't want print. how do this? here code: class string def black; "\e[30m#{self}\e[0m" end def red; "\e[31m#{self}\e[0m" end def green; "\e[32m#{self}\e[0m" end def brown; "\e[33m#{self}\e[0m" end def blue; "\e[34m#{self}\e[0m" end def magenta; "\e[35m#{self}\e[0m" end def cyan; "\e[36m#{self}\e[0m" end def gray; "\e[37m#{self}\e[0m" end def bg_black; "\e[40m#{self}\e[0m" end def bg_red; "\e[41m#{self}\e[0m" end def bg_green; "\e...

javascript - Rails4 + Bootstrap3 - Modals render but won't show -

i'm using rails 4, bootstrap 3. particular page in question made of 3 haml views. first contains of page content. second contains row of buttons - 1 of needs trigger modal. third contains modal. code first view is: <...bulk of page content...> = render partial: 'shared/buttons', locals: {diagram: @diagram} #showdetail.modal.fade{"aria-labelledby" => "showdetail", :role => dialog, :tabindex => "-1"} code second view ('shared/buttons'): <...links several buttons don't call modals...> = link_to "show detail", show_detail_path(item), class: "btn", data: {"toggle" => "modal", "target" => "#showdetail", "remote" => :true} code third view (items/_show_detail.html.haml, routed 'show_detail_path'): .modal-dialog{:role => "document} .my_popup_contain .container-fluid ...