php完全不懂,迁移论坛花费了不少时间。
php.ini中的
short_open_tag = on
一定要记得打开,然后php-pfm重启一下。
不然discuz中的模版不会执行。
小结一下最近迁移php服务器:
需要安装以下组件:
mysql php php-fpm nginx memcached
php完全不懂,迁移论坛花费了不少时间。
php.ini中的
short_open_tag = on
一定要记得打开,然后php-pfm重启一下。
不然discuz中的模版不会执行。
小结一下最近迁移php服务器:
需要安装以下组件:
mysql php php-fpm nginx memcached
网站准备迁移至aliyun了。
// 添加特效
CCParticleSystemQuad* pSystem=CCParticleSystemQuad::create(“test2.plist”);
//pSystem->setBlendAdditive(true);
// pSystem->setPosition(CCPointMake(50, 50));
addChild(pSystem);
pSystem->setAutoRemoveOnFinish(true);
粒子特效可以使用particle desinger来编辑。价格也不贵,才100块钱。
public static <T> List<T> parseList(String xlsName, String sheetName);
使用时不需要指定泛型类型,参考自guva。
public <T> T newInstantce() {
Type genType = getClass().getGenericSuperclass();
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
Class<T> clazz = (Class) params[0];
T obj = null;
try {
obj = clazz.newInstance();
} catch (Exception e) {
e.printStackTrace();
log.error(“ERROR”, e);
}
return obj;
}
生成泛型的实例。
基于HTTP协议的Connector:
// 默认,性能最差
protocol=”HTTP/1.1″
// 使用java nio,性能很好
protocol=”org.apache.coyote.http11.Http11NioProtocol”
// 使用apr,通过jni调用系统io,性能也是很好
protocol=”org.apache.coyote.http11.Http11AprProtocol”
有时间需要测试nio与apr哪种性能更高。
https://code.google.com/p/psi-probe/
tomcat性能监测工具
最小的集成:
需要自定义loader:
class MyCustomCCLayerLoader:public CCLayerLoader{
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(MyCustomCCLayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(HelloLayer); // 这里添加与ccb中定义对应的类
};
加载ccbi代码:
CCNodeLoaderLibrary* library=CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
library->registerCCNodeLoader(“HelloLayer”, MyCustomCCLayerLoader::loader());
CCBReader* reader=new CCBReader(library);
reader->autorelease();
pDirector->runWithScene(reader->createSceneWithNodeGraphFromFile(“HelloCocosBuilder.ccbi”));
自定义的Layer:
class HelloLayer:public CCLayer,public CCBSelectorResolver,public CCBMemberVariableAssigner,public CCNodeLoaderListener
{
public:
CCLabelTTF* testTTF;
public:
// 点击处理
virtual void pressedClickme(CCObject* target,CCControlEvent* event);
// 这里也没有被调用,原来需要CCNodeLoaderListener,当从ccb文件创建后被调用
virtual void onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader);
// 设置menuItem的调用
virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName);
// 设置button的调用
virtual SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName);
// 设置属性
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode);
// 这是做什么用的?
virtual bool init();
// 创建自动释放的本类对象
CREATE_FUNC(HelloLayer);
// 手工释放掉ccb绑定的对象
~HelloLayer(){
CC_SAFE_RELEASE(testTTF);
}
};
void HelloLayer::pressedClickme(CCObject* target, CCControlEvent *event){
CCLog(“clicked pressed click me”);
CCLog(“ttf text:%s”,testTTF->getString());
}
bool HelloLayer::init(){
if(!CCLayer::init()){
CCLog(“invoke hello layer init return false”);
return false;
}
CCLog(“invoke hello layer init return true”);
return true;
}
SEL_MenuHandler HelloLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName){
//CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, “pressedClickme”, HelloLayer::pressedClickme);
return NULL;
}
SEL_CCControlHandler HelloLayer::onResolveCCBCCControlSelector(CCObject* pTarget, CCString* pSelectorName){
CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, “pressedClickme”, HelloLayer::pressedClickme);
return NULL;
}
bool HelloLayer::onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode){
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, “testTTF”, CCLabelTTF*, testTTF);
return false;
}
void HelloLayer::onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader){
CCLog(“on node loaded”);
}
class SongListHeartLayer:public CCLayer,public CCTableViewDelegate,public CCTableViewDataSource
{
public:
virtual bool init();
CREATE_FUNC(SongListHeartLayer);
virtual void scrollViewDidScroll(cocos2d::extension::CCScrollView* view) {};
virtual void scrollViewDidZoom(cocos2d::extension::CCScrollView* view) {}
virtual void tableCellTouched(CCTableView* table, CCTableViewCell* cell) ;
virtual CCSize cellSizeForTable(CCTableView *table) ;
virtual CCTableViewCell* tableCellAtIndex(CCTableView *table, unsigned int idx) ;
virtual unsigned int numberOfCellsInTableView(CCTableView *table) ;
};
创建tableView
tableView = CCTableView::create(this, CCSizeMake(320,360));
tableView->setDelegate(this);
tableView->setPosition(CCPointMake(0,50));
tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
其它比较重新的代码:
void SongListHeartLayer::tableCellTouched(CCTableView* table,
CCTableViewCell* cell) {
}
CCSize SongListHeartLayer::cellSizeForTable(CCTableView *table) {
return CCSizeMake(320,60);
}
CCTableViewCell* SongListHeartLayer::tableCellAtIndex(CCTableView *table,
unsigned int idx) {
CCTableViewCell* cell = table->dequeueCell();
if (!cell) {
cell = new CCTableViewCell();
cell->autorelease();
//cell->setse
} else {
CCLabelTTF* label = (CCLabelTTF*) cell->getChildByTag(123);
label->setString(str.c_str());
}
return cell;
}
unsigned int SongListHeartLayer::numberOfCellsInTableView(CCTableView *table) {
return musics.size();
}
参考资料:http://www.adobe.com/cn/devnet/air/articles/building-ane-ios-android-pt1.html
参考资料:http://sswilliam.blog.163.com/blog/static/1896963832011910113320334/
近期评论