Posts

android - Use of Classes in Cocos2d-x to create an "Enemy" to extend Layer -

pretty new cocos2dx , c++ objective-c background. i'm making game can have between 1-10 enemies on screen @ time. each enemy has 1 sprite body , 2 stats (health & damage). in past objective-c i've been able define class.h/class.mm file , fill many variables want (health, speed, height, weight, color, etc), i'm having trouble figuring out how in cocos2dx. here simplified project isolates problem i'm having. i'm sure it's straight forward i'm having trouble looking solution //-----enemy.h #include "cocos2d.h" using_ns_cc; class enemy : public cocos2d::layer{ public: virtual bool init(); create_func(enemy); void sethealth(int val); private: int myhealth; sprite *body; sprite *weapon; }; //-----enemy.cpp #include "enemy.h" using_ns_cc; bool enemy::init() { if ( !layer::init() ) return false; return true; } void sethealth(int newhealth) { //myhealth = newhealth; } //-----hellow...

java - containsValue vs contains method of Hashtable -

whats difference between containsvalue , contains method of hashtable http://docs.oracle.com/javase/7/docs/api/java/util/hashtable.html there isn't one. emphasis mine. returns true if hashtable maps 1 or more keys value. note this method identical in functionality contains (which predates map interface). so can use either one, perfer containsvalue() because bit more self-explanatory, that's me. the reason there 2 different methods same thing because hashtable implements map<k, v> interface. don't know if you've used interfaces yet, classes implement interface required have methods defined in interface . so, because map has definition boolean containsvalue(object value); classes implement (like hashtable ) has have method. that's why containsvalue() exists. then why have have contains() ? well, that's because contains() existed before map interface existed (see documentation snippet above). contains() came first, that...

Merging 2 SQL Server Databases Structures -

Image
my system started life single winforms application single database using entity framework. down line, database branched off encompass new system extended new tables. main employee table renamed person, , associated fk references renamed term person in columns. the existing system has since changed in terms of database structure new tables added. something like: now want bring 2 databases in line, keeping person table on employee. need bring 2 entity frameworks together. need tips , pointers on how this. luckily new system still in uat not live. have base population scripts this. i use nhydrate maintain both entity frameworks - db first. database side of things can cope with. however, unsure of best way bring entity frameworks in line. there tools have used sync databases such red gate's sql compare. vs2013 has nice sql schema compare. i have couple thoughts on different ways this: thought 1 manually add changes through ef database designer generate...

ios - Inserting Subview Below UICollectionView -

when add subview below uicollectionview, subview shows above uicollectionview cells. here subview insertion code: [self.collectionview insertsubview:self.garmentview atindex:0]; not sure if i'm not following best practice or otherwise missing obvious. assistance appreciated. ** edit ** might worth noting happens in landscape, when rightmost cell zoomed in. i think self.garmentview.layer.zposition = -1 [self.collectionview insertsubview:self.garmentview atindex:0]; will solve problem. guess can happen collection view cells gets added lower index garmentview. see question more thorough discussion subview positions.

elasticsearch exclude results with value -

how can perform search excluding results field has specific value? i have database of reddit comments , want find bitcoin mentions, exclude bitcoin subreddit. curl -s -xget 'http://localhost:9200/_search?pretty=true&size=100' -d ' { "filtered": { "query" : { "match": { "body": "bitcoin" } }, "filter": { "not": { "term": { "subreddit": "bitcoin" } } } } }' the error long post here. https://gist.github.com/kylelk/feca416156712eebad3e it silly error, you have include filtered query inside query . here modification post _search { "query": { "filtered": { "query": { "match": { "body": "bitcoin...

javascript - validate login & redirect to success page using jquery validate plugin -

i new advance level of jquery scripting , here using jquery validation login page. if login page success has redirect success page code working fine below code when click submit button . <form id="form1" name="login" method="post" action="mainpage.html"> </form> here code $(function (){ $("#form1").validate({ // specify validation rules rules: { username: { required: true, email: true }, password: { required: true, minlength: 5 } }, // specify validation error messages messages: { username: "please enter valid email address", password: { required: "please provide password", minlength: "your password must @ least 5 characters long" }, submithandler: function (form) { // demo $('#username')....

Meteor js use http.get to retrieve json data from a webpage -

is possible use http.get on client side retrieve json data , store string? i need json site https://blockchain.info/address/15cnko3ztmycba8goaysz6gwfy1vclgfji?format=json , store string later parsing. the above site address wallet chosen @ random. you can perform http.get on client. as per documentation it's available anywhere (client , server) however, example you've provided isn't on same domain app, , hasn't provided access-control-allow-origin headers permit cross-domain requests. so requests client fail. from wikipedia: the same origin policy prevents document or script loaded 1 origin getting or setting properties of document origin. policy dates way netscape navigator 2.0.