There is a string::find function that is pretty straightforward to use. The key thing to note here is that when it's not found the return value is "string::npos".
Reference: http://www.cplusplus.com/reference/string/string/find/
My online tech scrapbook where I keep my notes in case I need to look them up later
Wednesday, April 22, 2015
C++: Constructing a std::string from std::vector
std::vector<char> is actually a vector of the characters that make up the string.
There is a constructor for std::string that can be used for this i.e. std::string s(v.begin(),v.end());
Reference: http://stackoverflow.com/questions/5115166/how-to-construct-a-stdstring-from-a-stdvectorchar
There is a constructor for std::string that can be used for this i.e. std::string s(v.begin(),v.end());
Reference: http://stackoverflow.com/questions/5115166/how-to-construct-a-stdstring-from-a-stdvectorchar
Monday, April 20, 2015
Coco2D-X: long Values on iOS
"long" isn't guaranteed to be 64 bits on iOS. To be sure that there won't be overflow, use int64_t.
Reference http://stackoverflow.com/questions/13604137/definition-of-int64-t
Reference http://stackoverflow.com/questions/13604137/definition-of-int64-t
Saturday, April 18, 2015
C++ Optional Parameter
You can make an optional parameter by giving it a default value. Important note: you need to do it in the header declaration.
Reference: http://stackoverflow.com/questions/2842928/default-value-of-function-parameter
Reference: http://stackoverflow.com/questions/2842928/default-value-of-function-parameter
Friday, April 17, 2015
Cocos2D-X List of Actions
Quick reference here: http://www.cocos2d-x.org/wiki/Actions
Cocos2D-X FadeIn and FadeOut Not Applying to Children of a Sprite
The default behaviour for Cocos2D-X during a FadeIn / FadeOut action is that the only the Sprite will fade in/out, and if it has children, they will be unaffected.
In order for a FadeIn / FadeOut action to apply to the children of a Sprite, call "setCascadeOpacityEnabled(true)" on the parent Sprite.
Reference: http://discuss.cocos2d-x.org/t/fadein-and-fadeout-does-not-apply-to-children-even-in-3-3-final/19079
In order for a FadeIn / FadeOut action to apply to the children of a Sprite, call "setCascadeOpacityEnabled(true)" on the parent Sprite.
Reference: http://discuss.cocos2d-x.org/t/fadein-and-fadeout-does-not-apply-to-children-even-in-3-3-final/19079
Tuesday, April 14, 2015
PostgreSQL Dump Only One Schema
Use the -n option
Reference: http://dba.stackexchange.com/questions/53185/postgresql-how-to-backup-only-one-schema-from-a-database-and-restore-it-on-anot
Reference: http://dba.stackexchange.com/questions/53185/postgresql-how-to-backup-only-one-schema-from-a-database-and-restore-it-on-anot
PostgreSQL Query Grants
SELECT grantee, privilege_type
FROM information_schema.role_table_grants
WHERE table_name='thetable';
|
Reference: http://stackoverflow.com/questions/7336413/query-grants-for-a-table-in-postgres
Tomcat7 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
To solve this, explicitly specify "factory="org.apache.commons.dbcp.BasicDataSourceFactory"" in the "Resource" definition in "context.xml"
References:
References:
Saturday, April 11, 2015
MySQL Dump Schema Only or Data Only
Schema only: "--no-data"
Data only: "--no-create-info"
References:
Data only: "--no-create-info"
References:
Subscribe to:
Posts (Atom)