Menu Home


Apache Virtual Host

OS: ubuntu 12.04 Apache: 2.2.22 Configure file: /etc/apache2/sites-available/default NameVirtualHost [IP Address] <VirtualHost [IP Address]> ServerName ServerAdmin [email protected] DocumentRoot /var/www/asite <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/asite> #Options Indexes FollowSymLinks MultiViews Options -Indexes AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory “/usr/lib/cgi-bin”> AllowOverride All […]


把需要增加的图片资源放到 frameworks/base/core/res/res/drawable-nodpi,如果就这样直接应用这个资源,会出现找不到资源的错误。实际上在增加完资源后还需要在 frameworks/base/core/res/res/values/symbols.xml文件中做相应的注册,比如: <java-symbol type=”drawable” name=”my_wallpaper” /> 重新编译framework-res后就可以使用这个资源了:


XPath xp = XPathFactory.newInstance().newXPath(); NodeList nl = null; try { nl = (NodeList) xp.evaluate(“//text()[normalize-space(.)=”]”, mDocument, XPathConstants.NODESET); } catch (XPathExpressionException e) { e.printStackTrace(); } for (int i = 0; i < nl.getLength(); ++i) { Node node = nl.item(i); node.getParentNode().removeChild(node); }


extract()方法会根据一个Array创建相应的变量,并且会覆盖同名变量的值。幸运的是extract()提供了第二个参数,一个标志符。 EXTR_OVERWRITE   If there is a collision, overwrite the existing variable. EXTR_SKIP   If there is a collision, don’t overwrite the existing variable. EXTR_PREFIX_SAME   If there is a collision, prefix the variable name with prefix. EXTR_PREFIX_ALL   Prefix all variable names with prefix. EXTR_PREFIX_INVALID   Only prefix invalid/numeric variable names with prefix. EXTR_IF_EXISTS […]

Android: 获取StatusBar和NavigationBar的高度

在Activity中 int getStatusBarHeight { Rect frame = new Rect(); getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); return; } 在View中 int getStatusBarHeight { Rect frame = new Rect(); (Activity(mContext)).getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); return; } 这种基于Window的方法可能不适用对话框窗口。 还有一种简单直接的方法: private int getStatusBarHeight() { return mContext.getResources().getDimensionPixelSize(; } 或者: static final int mStatusBarHeight = (int) Resources.getSystem().getDimensionPixelSize(; static final int mNavigationBarHeight = (int) […]

Boost Serialization : Use Non-Default Constructors

#include <fstream> #include <cstring> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> class gps_position { public: gps_position(int size) { std::cout << “constructor: one” << std::endl; m_size = size; buf = (unsigned char *)malloc(size); memset(buf, 0, sizeof(buf)); } gps_position(int d, int m, float s, int bufSZ) : degrees(d), minutes(m), seconds(s) { std::cout << “constructor: two” […]