mrjeye's blog
mrjeye · 共 107 篇文章
C++读取lua table
lua_pushnil(tolua_S); int index = lua_gettop(tolua_S); map<string, string> dict; // 现在的栈:-1 => nil; index => table index = index - 1; while (lua_next(tolua_S, index)) { // 现在的栈:-1 => value; -2 => key; index => table // 拷贝一份 key 到栈顶,然后对它做 lua_tostring 就不会改变原始的 key 值了 lua_pushvalue(tolua_S, -2); // 现…
2015-02-02 14:36 · cocos2d-x · 评论(0)
静态库类重复
如果两个静态库冲突的结构是相同的,可以考虑将两个静态库拆分出来进行合并。 查看文件的架构有哪些 $ lipo -info libzbar.a Architectures in the fat file: libzbar.a are: armv7 (cputype (12) cpusubtype (11)) i386 将armv7解压出来 lipo libzbar.a -thin armv7 -output libzbar-armv7.a 新建立一个文件夹出来存放解压的(.o)文件 $ mkdir armv7 $ cd armv7 将静态库中的文件解压 $ ar -x ../libzbar-a…
2015-01-19 19:08 · cocos2d-x · 评论(0)
mongo笔记
db.users.find({$where:function(){return this.age > 30 && this.age < 35;}}) db.users.find({$or:[{name:"mrj6"}, {name:"mrj9"}]}) // 查询 db.users.find({age:{$lt:30}}) db.users.find({$or:[{$where:function(){return this.age > 30 && this.age < 35;}}, {name:"mrj6"}]}) db.users.find({$or:[{$where:function()…
2013-02-05 11:35 · other · 评论(0)
mongo安装配置
下载地址:http://www.mongodb.org/downloads 以CentOS为例 安装参照:http://docs.mongodb.org/manual/tutorial/install-mongodb-on-redhat-centos-or-fedora-linux/ 启动服务器添加权限认证: 编辑 /etc/init.d/mongod 将OPTIONS改为 OPTIONS=" --auth -f $CONFIGFILE" 添加用户: use admin db.addUser("root", "123456") ==================== 如果遇到这个WARNI…
2012-08-08 14:08 · other · 评论(0)
MPMusicPlayerController
.category = AVAudioSessionCategoryAmbient if ( playbackState] == MPMusicPlaybackStatePlaying) 判断ipod是不是在放歌
2012-07-18 17:39 · 评论(0)
iPhone安装gcc
I search a lot on internet how to do this, and I found some info from Anastas Stoyanovsky. Most people posted that if you install libgcc on iOS 4 it will crash at boot but this is not true. Here is what you need to do in order to be able to compile and run a C application on iphone: 1. You will nee…
2012-06-22 00:33 · other · 评论(0)
itunesconnect不能打开同意协议更新
https://developer.apple.com/membercenter/mcUpdateAgreement.action
2012-06-20 14:59 · iphone · 评论(0)
ProgressDialog设置位置
LayoutParams params = recordProgress.getWindow().getAttributes(); params.y = 100; params.gravity = Gravity.TOP; recordProgress.getWindow().setAttributes(params);
2012-06-15 16:28 · android · 评论(0)
CentOS svn安装配置
安装: 查看已安装的包 pm -qa |grep subversion 如果有,卸载 yum remove subversion-1.4.2-4.el5_3.1 yum install subversion.x86_64 创建工作目录 mkdir /svn svnadmin create /svn 按需要修改conf配置文件 passwd:用户-密码 authz:权限控制 启动SVN服务器 svnserve -d -r /svn 附上Eclipse插件更新地址:http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
2012-05-28 12:06 · linux · 评论(0)
JNI中java类型与C/C++类型对应关系
在如下情况下,需要在本地方法中应用java对象的引用,就会用到类型之间的转换: 1)java方法里面将参数传入本地方法; 2)在本地方法里面创建java对象; 3)在本地方法里面return结果给java程序。 分为如下两种情况: 一、Java原始类型 像booleans、integers、floats等从Java程序中传到本地方法中的原始类型可以直接使用,下面是java中的原始类型和本地方法中的类型的对应: Java类型 本地类型 字节(bit) boolean jboolean 8, unsigned byte jbyte 8 char jchar 16, unsigned short …
2012-05-25 14:12 · android · 评论(0)
根据错误编号取得错误描述
NSError *error = [nserror errorwithdomain:nsosstatuserrordomain code:error_code userinfo:nil]; NSLog(@"Error: %@", [error description]);
2012-05-17 14:54 · iphone · 评论(0)
local add, incoming add upon merge
在svn命令行merge之后文件经常会出现local add, incoming add upon merge问题,导致无法提交,可以通过以下命令解决冲突 Summarizing to resolve the tree conflict committing your working dir with svn client 1.6.x you can use: svn resolve --accept working -R . where . is the directory in conflict.
2012-04-16 16:51 · other · 评论(0)
mysql中文字段排序
select * from t_user_info order by convert(user_name USING gbk) COLLATE gbk_chinese_ci
2012-03-31 13:28 · other · 评论(0)
取设备信息
NSLog([[uidevice currentdevice] name]); // Name of the phone as named by user NSLog([[uidevice currentdevice] uniqueIdentifier]); // A GUID like string NSLog([[uidevice currentdevice] systemName]); // "iPhone OS" NSLog([[uidevice currentdevice] systemVersion]); // "2.2.1" NSLog([[uidevice currentde…
2012-03-30 14:11 · iphone · 评论(0)