Posts

javascript - Infinte Loop - Adding and Removing Event Listeners -

i have syntaxed checked several times, cannot figure out why functions being recursively called: function updatenewclasses() { function addnewclass() { updatenewclasses(); } window.addeventlistener( "hashchange", addnewclass ); // conditionals being skipped; no loops window.removeeventlistener( "hashchange", addnewclass ); location.href = '#'; window.addeventlistener( "hashchange", addnewclass ); } the program keeps calling hash change function recursively calls updatenewclass leading endless loop. since addeventlistener in updatenewclasses called addnewclass triggered addeventlistener keep adding event listener each time triggered. additionally, updatenewclasses creating "new" addnewclass not removed on subsequent call updatenewclasses . want store function want add/remove outside scope of callback can removed. perhaps mean this: var addnewclass = function() { updatenewclasses(); } var...

java - Remove fields in embeddable (JPA) -

i'm trying remove list in embeddable removing embeddable entity. isn't working.. entities in list still in de database. code: method starts: //attached entity ship ship = findship(); ship.removeitinerary(); ship: @entity @table(name = "ship") public class ship extends domain { @embedded private itinerary itinerary; public void removeitinerary() { this.itinerary = null; } } itinerary: @embeddable public class itinerary implements serializable { //tried orphanremoval , cascade without luck //(since i'm not removing ship it's logic it's not working..) @onetomany @joincolumn(name = "ship_id", referencedcolumnname = "id") private list<stop> stops = new arraylist<>(); } jpa 2.0 if itinerary saved database, need delete it. eg, like public void removeitinerary() { getentitymanager().remove(this.itinerary); this.itinerary = null; }

Get a two-digit hour when renaming a file with a time stamp in Windows command-line? -

i want make sure renaming command puts hours 2 digits. if 9:30 am, want filename add 0930 @ end. altering code below, how can accommodate this? ren c:\progra~1\tsi\edata\advantis\edisave\dillards\846_temp\001_846_tmp.txt "001_846_tmp_%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%%time:~3,2%.txt" ren c:\progra~1\tsi\edata\advantis\edisave\dillards\846_print\001_846_prt.txt "001_846_prt_%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%%time:~3,2%.txt"

ios - SKLabelNode Creating Black Rectangle -

Image
i saw this question , did not have definite solution issue, nor exact same. trying add sklabelnode text. have never had issues reason happening: here code using generate node: var announcelabel = sklabelnode(fontnamed: "baskerville") announcelabel.text = "error loading announcement" announcelabel.fontcolor = uicolor.blackcolor() announcelabel.fontsize = 200 announcelabel.setscale(twitterbutton.frame.height / announcelabel.frame.height) announcelabel.position = cgpoint(x: self.frame.midx, y: self.frame.midy) self.addchild(announcelabel) i testing on iphone 6, , have never had happen while creating label node. have attempted different fonts, positions, , scales no effect. appreciated! thanks! just tested more , found answer. font size big , guess caused bug spritekit. changed font size 50 , worked fine (i have used font size 200 on other label nodes , never had issue): var announcelabel = sklabelnode(fontnamed: "baskerville") announcelabe...

ruby on rails - Allow users to sign in using their username or email address with Devise -

problem i followed tutorial on devise's wiki page , login page broken. continually error saying 'invalid email or password.' neither user_name nor email work logging in. note: user name field user_name not username in tutorial. did miss something? type wrong? part cut , paste. code application controller: ## app/controllers/application_controller.rb class applicationcontroller < actioncontroller::base protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit( :email, :birthday, :password,:password_confirmation, :remember_me) } devise_parameter_sanitizer.for(:sign_in) { |u| u.permit( :login, :user_name, :email, :password, :remember_me ) } devise_parameter_sanitizer.for(:account_update) { |u| u.permit( :first_name, :last_na...

mysql - Error while partitioning. [Err] 1654 - Partition column values of incorrect type -

what's wrong mysql query? result [err] 1654 - partition column values of incorrect type drop table if exists part; create table `part` ( `id` int(11) not null auto_increment, `cnt` varchar(255) default null, `created` datetime not null, primary key (`id`, `created`) ) engine=innodb default charset=latin1 partition range columns (created)( partition p_2015_01 values less ('2015-01-30') engine=innodb, partition p_2015_02 values less ('2015-02-30') engine=innodb, partition p_2015_03 values less ('2015-03-30') engine=innodb, partition p_catchall values less (maxvalue) engine=innodb ); if matters, version 5.5 it took quite long time see obvious: the date '2015-02-30' not exist. presumably converted null or something, therefore message 'incorrect type'. hopefully helps someday.

swift - Two sprites with same categoryBitMask colliding with third sprite -

this code i'm using: func didbegincontact(contact: skphysicscontact) { var firstbody : skphysicsbody? var secondbody : skphysicsbody? var thirdbody : skphysicsbody? var goodkind : sknode? var badkind : sknode? var bullet : sknode? if (contact.bodya.categorybitmask < contact.bodyb.categorybitmask) { firstbody = contact.bodya secondbody = contact.bodyb goodkind = contact.bodyb.node badkind = contact.bodyb.node bullet = contact.bodya.node } else { firstbody = contact.bodyb secondbody = contact.bodya goodkind = contact.bodya.node badkind = contact.bodya.node bullet = contact.bodyb.node } if (firstbody!.categorybitmask == physicscategory.tooth && secondbody!.categorybitmask == physicscategory.food) { goodkind?.removefromparent() counter++ println("\(counter)") } else ...