04 Jan 2013
代码
/**
* @brief GetStatusBarHeight 获取状态栏的高度
*
* @return
*/
public static int GetStatusBarHeight() {
int statusBarHeight = 0;
if (mActivity != null) {
Rect rectgle = new Rect();
Window window = mActivity.getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
statusBarHeight= rectgle.top;
}
return statusBarHeight;
}
17 Dec 2012
1.1 取出最新版本
$ git svn clone -r HEAD svn://svn.linguofeng.com/test/ test
1.2 取出全部
$ git svn clone svn://svn.linguofeng.com/test/
1.3 提交
$ git add -u
$ git commit -m 'update'
$ git svn rebase
$ git svn dcommit
1.4 更新
$ git svn rebase
"https://git.wiki.kernel.org/index.php/Git-svn":https://git.wiki.kernel.org/index.php/Git-svn
07 Dec 2012
1.1 new
#include
int main()
{
try
{
int *pInt = new int();
}
catch (std::bad_alloc e)
{
// new申请内存失败时会抛出bad_alloc异常,而malloc不会
}
return 0;
}
</pre>
1.2 nothrow
#include
#include
int main()
{
int *pInt = new (std::nothrow)int();
if (pInt == NULL)
{
std::cout << "申请内存失败";
}
return 0;
}
</pre>
1.3 new_handler
#include
#include
#include
void __cdecl newhandler()
{
std::cout << "申请内存失败";
exit(0);
}
int main()
{
std::set_new_handler(newhandler);
int *pInt = new int(); // 如果申请内存失败则调用newhandler()函数。
return 0;
}
</pre>
</section>
06 Dec 2012
$ sudo apt-fast install tiled
$ tiled // 启动tiled
$ tmxviewer xxx.tmx // 查看tmx文件
29 Nov 2012
$ sudo add-apt-repository ppa:apt-fast/stable
$ sudo apt-get update
$ sudo apt-get install apt-fast
$ sudo dpkg-reconfigure apt-fast
$ sudo apt-fast install PACKAGE
$ sudo apt-fast upgrade
$ sudo apt-fast build-dep PACKAGE