Posts

uibutton - cocos2d scene retaining issue -

there scene in application has 2 labels , menu item. when load scene using replacescene method stays 3-4 seconds , gets disappeared or released. want keep until cancel button pressed. how can it? code is: @implementation mylayer + (id)myscene { ccscene *ascene = [ccscene node]; mylayer *mylayer = [mylayer node]; [ascene addchild:mylayer]; return ascene; } - (id) init { if (self = [super init]) { //labels , menu here } return self; } and calling scene this: [[ccdirector shareddirector] replacescene: [mylayer myscene]]; maybe problem it's first scene. should use runwithscene method of ccdirector .

Accidentally pushed commit: change git commit message -

in local repo have 1 commit incorrect commit message. i've published incorrect commit message git push . now remote repo (which github-hosted) has incorrect commit message, too. i've tried git commit --amend , found not work me in situation because i've made additional commits since incorrect one. how fix situation? easiest solution ( but please read whole answer before doing this ): git rebase -i <hash-of-commit-preceding-the-incorrect-one> in editor opens, change pick reword on line incorrect commit. save file , close editor. the editor open again incorrect commit message. fix it. save file , close editor. git push --force update github. this mean publishing modified version of published repository. if pulled or fetched repo between when made mistake incorrect commit message, , when fixed it, experience difficulties later. sure can accept consequence before trying this.

c++ - std::string capacity size -

is capacity size of string multiple value of 15? for example: in cases capacity 15 string s1 = "hello"; string s2 = "hi"; string s3 = "hey"; or random? is capacity size of string multiple value of 15? no; guarantee capacity of std::string s.capacity() >= s.size() . a implementation grow capacity exponentially doubles in size each time reallocation of underlying array required. required std::vector push_back can have amortized constant time complexity, there no such requirement std::string . in addition, std::string implementation can perform small string optimizations strings smaller number of characters stored in std::string object itself, not in dynamically allocated array. useful because many strings short , dynamic allocation can expensive. small string optimization performed if number of bytes required store string smaller number of bytes required store pointers dynamically allocated buffer. whether or not ...

build - How can I prevent submitting an empty Perforce changelist from being an error? -

attempting submit changelist no files considered perforce error ( p4 submit ... returns exit code 1). causes periodic integration build fail on our build server (we're using zutubi's pulse system ); in case rather have build succeed , possibly warning. pulse has exit code remapping functionality, perforce not appear disambiguate between failure submit empty changelist , other submit failure (such validation trigger failure, do want fail build). the obvious (but, in mind, inelegant) solution comes mind wrap execution of p4 submit in batch file first checks see if target changelist empty counting lines of output p4 opened -- or parsing output of p4 submit "no files" message , returning batch file. are there better techniques handling i'm not seeing? there no techniques perforce, if understanding problem correctly. issue, have seen, return codes perforce command line runs are, well, ambiguous. submission of empty changelist error? maybe, ma...

java - How to use getMethod() with primitive types? -

this class: class foo { public void bar(int a, object b) { } } now i'm trying "reflect" method class: class c = foo.class; class[] types = { ... }; // should here? method m = c.getmethod("bar", types); there's int.class . class[] types = { int.class, object.class }; an alternative integer.type . class[] types = { integer.type, object.class }; the same applies on other primitives.

namespaces - Ruby: what does :: prefix do? -

i reading through source of artifice , saw: module artifice net_http = ::net::http # ... end line: https://github.com/wycats/artifice/blob/master/lib/artifice.rb#l6 why not net::http instead of ::net::http , i.e., mean when use :: prefix? the :: scope resolution operator. determines scope module can found under. example: module music module record # perhaps copy of abbey road beatles? end module eighttrack # gloria gaynor, survive! end end module record # adding item database end to access music::record outside of music use music::record . to reference music::record music::eighttrack use record because it's defined in same scope (that of music ). however, access record module responsible interfacing database music::eighttrack can't use record because ruby thinks want music::record . that's when use scope resolution operator prefix, specifying global/main scope: ::record .

advertising - how to Show two creatives simultaneously with DFP Google admanager -

i want show 2 creatives simultaneously on 2 placements on page using google admanager. solutions ? i able find solution issue, , no 1 has answered yet think should answer own question then. you can show 2 creatives every time using admanager setting display creatives property many possible , making sure no other line item in way of higher priority one, in case creatives shown together. a detailed solution can found here display-two-creatives-simultaneously-dfp-admanager