2012 年文章归档
共 29 篇文章
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
MPMusicPlayerController
.category = AVAudioSessionCategoryAmbient if ( playbackState] == MPMusicPlaybackStatePlaying) 判断ipod是不是在放歌
2012-07-18 17:39
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
itunesconnect不能打开同意协议更新
https://developer.apple.com/membercenter/mcUpdateAgreement.action
2012-06-20 14:59 · iphone
ProgressDialog设置位置
LayoutParams params = recordProgress.getWindow().getAttributes(); params.y = 100; params.gravity = Gravity.TOP; recordProgress.getWindow().setAttributes(params);
2012-06-15 16:28 · android
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
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
根据错误编号取得错误描述
NSError *error = [nserror errorwithdomain:nsosstatuserrordomain code:error_code userinfo:nil]; NSLog(@"Error: %@", [error description]);
2012-05-17 14:54 · iphone
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
mysql中文字段排序
select * from t_user_info order by convert(user_name USING gbk) COLLATE gbk_chinese_ci
2012-03-31 13:28 · other
取设备信息
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
为CoreData添加版本管理
/** Returns the persistent store coordinator for the application. If the coordinator doesn't already exist, it is created and the application's store added to it. */ - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator_ != nil) { return persistentStoreCoordi…
2012-03-30 10:32 · iphone
强引用与弱引用探讨
保留一个对象创建了一个对该对象的“强”引用。一个对象只有在它的所有强引用都被释放后才能被回收。因此,一个对象的生命周期取决于其强引用的所有者。在某些情况下,这种行为可能并不理想。您可能想要引用一个对象而不妨碍对象本身的回收。对于这种情况,您可以获取一个“弱”引用。弱引用是通过存储一个指向对象的指针创建的,而不是保留对象。 弱引用在可能会出现循环引用的情况下是必不可少的。例如,如果对象A和对象B互相通信,两者都需要引用对方。如果每个对象都保留对方对象,那么总有一个先release对方,假如A先release B,那么B就来不及releaseA,那么A就会闲置内存资源,造成浪费。所以弱引用在这里…
2012-03-16 10:51 · iphone
svn merge
创建分支 svn cp proj/trunk proj/branches/proj_branch_1 查看分支创建时的版本 svn log --stop-on-copy proj/branches/proj_branch_1 合并主线到分支 svn merge proj/trunk@1631 proj/trunk 以上为从主线1631开始合并 合并分支到主线类似 参考:http://www.blogjava.net/lingy/archive/2009/06/02/279544.html
2012-03-15 10:39 · other
苛刻的单例
作为设计模式中最简单的一个,单例模式还是在很多系统中都会用到,总有那么一些实例,从始至终只需要它的一个实例,而且任何时候都要总方便的得到,像 Application 对象啦,环境对像啊。 要保持你设计的类别人只会初始出一个实例来,像 Java/C++/C# 中的做法一般希望能保证以下那些: 构造方法藏起来,private 修饰,这样只能通过统一的工厂方法获得实例,因为 new 出来的总是新对象 克隆方法出来的对象仍然是原来的对象 反序列化出的对象也仍然是原来那个唯一的对象(这好像有点难) 一般程序运行期间,该单实例不被释放 一般要求工厂方法是原子性的,也是避免返回了不同的实例 等等.....…
2012-02-24 17:26 · iphone
添加Three20到项目中
省去一切关于Three20的介绍 下载地址:https://github.com/facebook/three20 一.解压压缩包,将src目录copy到工程中. 二.命令行进入到src目录的script. 三.执行命令导入库 python ttmodule.py -p /your_project_path/project.xcodeproj Three20 --xcode-version=4 注: 1.--xcode-version:Set the xcode version you plan to open this project in. By default uses xcodebu…
2012-02-22 14:33 · iphone
记history记住操作时间
sudo vim /etc/bashrc export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S " export HISTFILESIZE=10000000 export HISTSIZE=2000 source /etc/bashrc 清除历史 history -c
2012-02-17 10:25 · linux
接近感应传感器使用
[[uidevice currentdevice] setProximityMonitoringEnabled:YES]; -(void)sensorStateChange:(NSNotificationCenter *)notification { if ([[uidevice currentdevice] proximityState] == YES) { NSLog(@"接近"); audioRouteOverride = kAudioSessionOverrideAudioRoute_None; }else{ NSLog(@"远离"); } } AVAudioPlayer,当用户靠近…
2012-02-16 14:22 · iphone