Posts

ios - Not getting any movement from sprite in Sprite Kit -

ios - Not getting any movement from sprite in Sprite Kit - i trying move sprite node downwards every time touch in area. code have , log showing touches register. doing wrong , there easier way accomplish this? -(void)update:(cftimeinterval)currenttime { cgpoint currentlocation = [currenttouch locationinview:currenttouch.view]; if (currentlocation.y > 500) { cgfloat newy = _bg.position.y - 25; _bg.position = cgpointmake(_bg.position.x, newy); nslog(@"touchtouch"); } try this: -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { (uitouch *touch in touches) { cgpoint currentlocation = [touch locationinnode:self]; if (currentlocation.y > 500) { cgfloat newy = _bg.position.y - 25; _bg.position = cgpointmake(_bg.position.x, newy); nslog(@"touchtouch"); } } } you can utilize skaction have motion animated: skaction *movedown = [skaction movetoy:newy duration:1]; [_bg runac...

model view controller - MVC Rails Planning -

model view controller - MVC Rails Planning - i'm starting rails , i'm building app stores films info, user can watch film , give grade on web application. i have coded cinema model, controller , views. now, have 2 questions: should need create model , controller grading? in case, should create or should wait , create first users model , controller? yes, on model , controller grades. that'd feasible way maintain track of who's graded what. it's create first, i'd start users, since grades depend on both films , users. ruby-on-rails model-view-controller

c++ - How to decouple SDL_Texture from SDL_Renderer? -

c++ - How to decouple SDL_Texture from SDL_Renderer? - i have sprite class uses sdl_texture on sdl_surface in lieu of perfomance. class looks this: class sprite { public: ... private: sdl_texture *m_texture; sdl_rect m_blitrect; int m_x; int m_y; }; now problem when creating sdl_texture need sdl_renderer object sdl_surface create it. this: sdl_texture *texture = sdl_createtexturefromsurface(renderer, surface); the sdl surface can created , disposed of while creating texture however, problem is, want able have rendering object isn't global. want decoupled framework , don't know how accomplish in instance. first thought create renderer class , have constructor argument cannot happen complicate things downwards road , cannot option. there other ways decouple two? if want decouple texture renderer , surface parameter, think best best delay phone call sdl_createtexturefromsurface until these argum...

php - Wordpress Define Variable Plugin -

php - Wordpress Define Variable Plugin - i'm attempting create plugin site in wordpress both practice , execution. in plugin variety of files. want define plugin directory constant use: define('custom_editing__url', plugin_dir_url(__file__)); when include: //folders define('widgets', custom_editing__url . 'widgets/'); require_once(widgets . 'widgets.php'); i'm able file widgets.php , when phone call within of file: echo custom_editing__url; i custom_editing__url. want http://www.example.com/widgets/widget.php can explain i'm missing? edit: more info problem @ hand. right have figured out widgets.php not accepting defined variables. example... calling file able create widget using format of: class foo_widget extends wp_widget { // content } but widgets.php file cannot resolve find wp_widget. so answer. don't have actual documentation explain it. copied of elements akismet plugin work way ne...

java - After Generating webdriver code ,how and where to modify code -

java - After Generating webdriver code ,how and where to modify code - i newbie selenium test cases, uncertainty roam between generated web driver code(java ;j-unit) , how run code changes in code , found errors in project before may know want made alter in code ,what generated already. for eaxmple : i recorded login form page, generated java/junit 4/webdriver code verify link button selenium ide , import bundle eclipse... i add together features or changes in login form , purpously forget maintain link button using selenium test generated before java/junit 4/webdriver code , want print o/p as"link button not found" bundle web; //import java.util.regex.pattern; import java.util.concurrent.timeunit; import org.junit.*; import static org.junit.assert.*; //import static org.hamcrest.corematchers.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.firefoxdriver; //import org.openqa.selenium.support.ui.select; public class webdriver { ...

objective c - AFHTTPRequestOperationManager with HTTP and HTTPS base url -

objective c - AFHTTPRequestOperationManager with HTTP and HTTPS base url - i wondering best alternative (architecture) situation have same api on http , https. there way back upwards http , https requests in same afhttprequestoperationmanager or should have 2 subclasses, 1 http requests , sec https requests? i sense changing baseurl dynamically not best solution you can hold 2 afhttpclient* objects. 1 http , other secure https. here illustration based on requester class. -- requester.h --- #import "foundation/foundation.h" #import "afnetworking.h" typedef enum { multiparttypeimagejpeg, multiparttypeimagepng, multiparttypevideoquicktime } multiparttype; typedef enum { httpmethodget, httpmethodpost, httpmethodput, httpmethoddelete } httpmethod; typedef void (^requestcallback)(nserror *error, nsinteger statuscode, id json); @interface requester : nsobject /** * singleton */ + (instancetype)sharedinstance; ...

java - How to improve Jaxb unmarshaller performance -

java - How to improve Jaxb unmarshaller performance - i want marshal , unmarshal below: want unmarshal xml <keyname>value</keyname> hashmap class a{ private string name; private list<b> list; } class b{ private map <string, string> map; } xml: <a> <name>name</name> <blist> <b> <key>value</key> <key>value</key> </b> </blist> </a> i want unmarshal xml class a. using @xmlanyelement . when unmarshal @ big size xml blist.size=100000 , performance not ideal. should improve performance? this xml snippet according description: <doc> <data> <somekey>somevalue</somekey> <otherkey>othervalue</otherkey> </data> </doc> this class data's type: import java.util.arraylist; import java.util.list; import javax.xml.bind.annotation.xmlaccesstype; import ja...

lotusscript - No "Script Area" in Lotus Notes Agent editor -

lotusscript - No "Script Area" in Lotus Notes Agent editor - i need functionality described here: determining folder contains document in lotus notes without using lotusscript folderreferences property it says: "and next code in script area". there's no script area. there's tree containing "document selection", "(options)", "declarations", "initialize", , , "terminate". you can come in code body of initialize method. create sure maintain code automatically appears when select initialize , come in code in middle sub initialize dim session new notessession dim db notesdatabase dim doc notesdocument dim doc2 notesdocument dim view notesview dim noteid1 string dim noteid2 string dim item notesitem dim collection notesdocumentcollection set db=session.currentdatabase set collection=db.unprocesseddocuments set doc=collection.getfirstdocument ...

java - How to set the JAVA_HOME in Mavericks 10.9? -

java - How to set the JAVA_HOME in Mavericks 10.9? - i checked java installed on system.if come in whereis java shows me the /usr/bin/java i want set java_home , gave path /library/java/javavirtualmachines/jdk1.7.0_09.jdk/contents/home won't work. if come in $java_home returns nothing. if come in command /usr/libexec/java_home -v 1.7 shows me result /library/java/javavirtualmachines/jdk1.7.0_09.jdk/contents/home but while setting local workspace won't work says `/library/java/javavirtualmachines/jdk1.7.0_09.jdk/contents/home` not valid `java_home` how can resolve issue? environment variables such stored in bash , users utilize configuration files set parameters bash environments. for illustration in home directory have 1 or both of .bashrc or .bash_profile file. 1) open file vi ~/.bash_profile 2) add together next line file #default java 1.6 export java_home=`/usr/libexec/java_home -v 1.6` this set $java_home variable...

.net - Syntax for Entity Framework .Include() -

.net - Syntax for Entity Framework .Include() - i going crazy trying handle on linq include. my main file "application" has guid key of "id" can't figure out syntax without error. public static guid? applicationidget(string papplicationname) { homecoming brunoentities.set<appapplication>().include("id").firstordefault(p => p.loweredname == papplicationname.tolower()).id; //return brunoentities.appapplications.include(a => a.id).firstordefault(p => p.loweredname == papplicationname.tolower()).id; //return brunoentities.appapplications.include("id").firstordefault(p => p.loweredname == papplicationname.tolower()).id; } include want ef load in related entities. don't need normal properties of entity requesting. if want have ef fetch columns database, select function allow command that .net linq entity-framework

python - How can I close the active window but still run the rest of the execution statements in the function? -

python - How can I close the active window but still run the rest of the execution statements in the function? - i have function needs work between 2 different windows. starts off working in 1 active window. want work window until call self.close(true) this close active window, far understand it, terminates more execution statements have within function. execution statements after close phone call (and still in same function) ones want applied newly active window. how can accomplish this? there other close can call? the usual way go have main wxpython programme (i.e. main window). when phone call long running process, can hide main window calling frame's hide() method. when long running process finishes, can re-show main window or instantiate secondary frame , show while keeping main window hidden. secondary frame can show output long running process. another approach hide main frame during long running process , when process finishes, update main frame ,...

Scala compilation into machine code -

Scala compilation into machine code - how compile scala machine code ? is llvm (http://en.wikipedia.org/wiki/llvm) plausible ? update: such compilation create code run faster in target machine ? https://greedy.github.io/scala-llvm/ geoff reedy working on it. hth scala compilation llvm

duplication - Removing duplicate rows from a SQL query -

duplication - Removing duplicate rows from a SQL query - i have problem writing sql query. have 2 tables: question , candidat_test_answer, formatted follows. question: (id_question) (id_catgorie) | 1 |1 | 2 |1 | 4 |1 candidat_test_answer: id_question || id_answer || id_test || id_candidat || date | 1 || 2 || 17 || 1 ||2014-06-01 | 1 || 3 || 17 || 1 ||2014-06-01 | 2 || 1 || 17 || 1 ||2014-06-01 | 2 || 2 || 17 || 1 ||2014-06-01 | 1 || 2 || 17 || 2 ||2014-06-01 i want display records without duplication in results. id_question || id_test || id_candidat || date | 1 || 17 || 1 ||2014-06-01 | 2 || 17 || 1 ||2014-06-01 here have tried far: select * question q , candidat_test_reponse ctr q.id_qt=ctr.id_qt , ctr.i...

mysql - Weird PHP "Fatal error: Cannot redeclare" Error -

mysql - Weird PHP "Fatal error: Cannot redeclare" Error - my script returning next error... fatal error: cannot redeclare connecttodatabase() (previously declared in /var/www/api/connecttodatabase.php:4) in /var/www/api/connecttodatabase.php on line 6 and next connecttodatabase.php file... <?php function connecttodatabase() { $con = @mysqli_connect("localhost", "name", "password", "database"); homecoming $con; } ?> i don't understand error because line 6 closed curly bracket (}) i think error means thinks declared function connecttodatabase() in different spots didn't. as others have said in comments, because have included connecttodatabase.php twice in code, , defining function twice. don't hung why it's line 6; line 2 more helpful, line 6 function definition ends, , arguably is when function defined. have "one day" whole year calendar on idiosyn...

javascript - Foreman, from the Heroku Toolbelt, exits with Error: write EINVAL every time -

javascript - Foreman, from the Heroku Toolbelt, exits with Error: write EINVAL every time - following heroku's getting started tutorial has been much more frustrating expected be. have right config problem, , can solved in less 10 clicks, don't know clicks , it's driving me wall. foreman won't start. have no experience ruby, or heroku, or foreman, , barely experience web programming, have absolutely no thought what's happening here. here's error message get, running windows 7 64 bit: c:\users\___________\hello_world_basics>foreman start 09:40:17 web.1 | started pid 2408 09:40:18 web.1 | listening on 5000 09:40:18 web.1 | 09:40:18 web.1 | error: write einval 09:40:18 web.1 | @ errnoexception (net.js:904:11) 09:40:18 web.1 | @ socket._write (net.js:645:26) 09:40:18 web.1 | @ dowrite (_stream_writable.js:226:10) 09:40:18 web.1 | @ writeorbuffer (_stream_writable.js:216:5) 09:40:18 web.1 | @ socket.writable.write (_stream_w...

php - Deploying to Elastic Beanstalk - can't find directories -

php - Deploying to Elastic Beanstalk - can't find directories - i pushing deploys new beanstalk app , trying run commands .config file: // .ebextensions/composer.config commands: 01wtf: command: cd /var/app && ls 02wtf: command: cd /var/app/current && ls 01wtf returns . .. /current /support 02wtf returns . .. i trying run commands on /var/app/ondeck (like blog posts , answers say) i can't find on disk! doing wrong? the problem .config file specifying commands: . i should have been using container_commands (docs: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands) my commands running before deployment phase; so, ondeck has...

javascript - Printing a page: Content only on 2nd Page? -

javascript - Printing a page: Content only on 2nd Page? - i need print web content (html/css). 1 of things need print stuff (page number, title of doc) on every page first. is there way create div (or other element) appear on pages >=2? i not have manual page-breaks jquery may used the css @page directive :first apply css first page of html print i give illustration #header , #footer might hep you @media print { @page { /* styles every page other first page */ #header { position: fixed; display: block; top: 0; } #footer { position: fixed; display: block; bottom: 0; } } @page :first { /* override styles first page */ #header { display: none; } #footer { display: none; } } } javascript jquery html css printing

c++ - How to manage escape sequences? -

c++ - How to manage escape sequences? - i'm trying write protocol much simple possible create 2 processes talk through socket. i'd separate command commands raw data. how can this? mean, if sockets carry bytes stream, how can protocol, example, distinguish escape sequence "esc stx" numbers sequence 2734? i've searched bit, not plenty suppose, since i've not yet found how solve problem. thanks in advance. establish message protocol. for example: +---------+-----------+----------+ | command | payload | checksum | | 2 bytes | 252 bytes | 2 bytes | +---------+-----------+----------+ the payload can contain pattern because payload fixed size. for variable length message, message length should added: +---------+----------------+-----------+----------+ | command | message length | payload | checksum | | 2 bytes | 2 bytes | ? bytes | 2 bytes | +---------+----------------+-----------+----------+ the len...

java - A loop that works before but not after -

java - A loop that works before but not after - i have problem strange. have same code 3 buttons works first , not others. how possible? there can explain me? much. can click buttons (b , c) ones , not twice. what's going on? in first case (button a) works show 1 card , not two. @suppresslint("recycle") public class gameactivity extends activity { protected view buttona; protected view buttonb; protected view buttonc; protected view buttond; final int randomint1 = 0; final int randomint2 = 0; int = 0; int b = 0; int c = 0; int d = 0; int e = 0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_game); findviewbyid(r.id.a); resources res = getresources(); string[] stringdeck = getresources().getstringarray(r.array.stringdeck); int[] deckdraw = getresources().getintarray(r.array.deckdraw); final hashmap<string...

c++ - Convert Warning to Error -

c++ - Convert Warning to Error - in windows, vc++ has nifty alternative /we convert specific warning error. every warning emitted vc++ has warning number illustration warning c4265: 'cfoo' : class has virtual functions, destructor not virtual so easy identify number , add together compiler alternative using /we switch /we4265 i checked g++ documentation , found similar (i believe), -werror=, documentation mentions make specified warning error. but question is, given compiler warning /yada/yada/src/inc/module.h:580: warning: 'struct ifoo' has virtual functions non-virtual destructor how convert error using -werror compiler option? that sentence in manual continues, answer: the specifier warning appended; illustration -werror=switch turns warnings controlled -wswitch errors. switch takes negative form, used negate -werror specific warnings; illustration -wno-error=switch makes -wswitch warnings not errors, when -werror ...