-
The world can change in a day
2009-11-03
-
Android软件:Home Screen Label
2009-10-31
Android与IPhone类似,都是有多个桌面屏幕,用手指划一下就可以左右切换屏幕。Android缺省设置只有3屏,但一些mod可以修改屏幕个数,例如设置为5屏。
在IPhone上,屏幕的数量以及当前处于第几个屏幕是通过界面中下方的小圆点来指示的。但在Android上就没有类似的指示,有时候用户不知道现在正显示的是哪一屏,应该往左还是往右翻屏。
我开发的这个软件 Home Screen Label 可以为Android手机的桌面每个屏幕添加一个文字标签,这样就很清晰的知道当前打开的是哪一屏了。标签位于在屏幕下方的正中位置,并不会影响图标的显示。
Home Screen Label 软件的另外一个作用是设置Android手机的桌面墙纸。Android系统自带的墙纸设置工具需要把图片剪切为4:3比例,无法设置其他比例的墙纸。4:3比例对于缺省的3屏是比较合适的,但当桌面屏幕数量更多的时候,这个比例就显得太窄了,左右切换屏幕时墙纸的画面基本没有多少移动。用 Home Screen Label 来设置墙纸没有4:3比例的限制,可以设置宽屏墙纸。
用作墙纸的图片文件需要存放在SD卡的wallpapers目录中。软件也提供了保存当前墙纸的功能,可将现在正使用的墙纸保存到SD卡上。
这是5个屏幕合成的效果图,可以看出宽屏墙纸画面效果:
软件在Android Market上下载安装,搜索“Home Screen Label”就可以找到。也可以用条码扫描器扫描这个二维码进行安装:
-
WebLogic的classloading
2009-09-26
一直对classloading的了解不是很清晰,每次遇到涉及WebLogic的classpath设置、classloading问题debug时都要去网上搜索资料。现在把资料整理下来。
各层级classloader加载的类的范围
Bootstrap classloader
- Core Java libraries (<jre>/lib)
Extension classloader
- JRE extensions directory (<jre>/lib/ext)
WebLogic Server system classloader
- Classpath
- <domain>/lib
Filtering classloader
- nothing
Application classloader
- EJB JARs
- APP-INF/lib
- APP-INF/classes
- Manifest Class-Path in EJB JARs
Web application classloader
- WAR
- Manifest Class-Path in WAR
类加载的优先级
每个classloader在要加载一个class之前都会先请求它的上层classloader,如此逐级传递。因此效果就是越上层的classloader优先级越高,一个class如果在上层classloader能加载到,就不会让下面的classloader加载。
但是web application classloader是个特例,通过在weblogic.xml中配置<prefer-web-inf-classes>,可以让web application classloader优先在自己war范围内加载类,找不到的类才会请求上层classloader。
Filtering classloader是个特殊的classloader,它并不会加载任何类,而是起到控制类加载优先级的作用。在weblogic-application.xml中配置<prefer-application-packages>,可以限制对于指定的类不再向上层classloader请求,也就是限制在EAR的范围之内加载。
其他
以上仅仅描述了缺省情况下classloading的行为。WebLogic对于一个application (EAR)内的classloader的层次结构是可以自定义的。Shared library和optional package,也会影响到classloading。另外,resource adapter (RAR)也有独立的classloader。还有其他的一些细节,需要查阅Understanding WebLogic Server Application Classloading。
-
准备10km跑
2009-09-24
一直都想体验一下正式的长跑活动,也可以给自己跑步一个动力。得知10月24日在广州大学城Nike举办10公里跑活动,就报名参加了。
上个月感觉腰椎的问题有一点点要复发的迹象,就停止了跑步。接下来9月份都在北京出差,跑鞋也没有带过来。算下来一个月没有跑步了。离活动只剩1个月了,怎么也得训练一下,于是今天去迪卡侬把T-shirt、短裤、袜子、跑鞋买了一套回来,去附近的公园跑步。
开始从住处到公园的500多米没有记录时间,从公园里跑了4.5km平均步速6'03"/km,看来这样的状态10km一小时都进不了 :( 不过速度慢点就慢点,这次我没有速度目标,只是体验一下。我至今还只是跑过两次十公里,平常都是跑5公里距离。但最担心的还是膝痛的问题,最近几个月来每次跑完步左膝外侧都有疼痛的现象。
-
How to setup hg (Mercurial) web access
2009-09-16
(Platform: Windows Vista)
- Mercurial is already installed.
- Install Apache.
- Download mercurial source package to get the file hgwebdir.cgi. This file isn't included in the Windows binary package.
- Copy hgwebdir.cgi into Apache's cgi-bin folder and rename to hgwebdir.py
- Create a file named hgweb.config in the same folder. Config the name and the path of the repositories in this file.
- Install python 2.5 and make sure to check the option to register it as the
default handler of .py file.
The hgwebdir.cgi from Mercurial 1.x requires python 2.5. Error "Invalid Magic Number" will be got when running on other version python. - Extract the file library.zip in Mercurial installation folder into a directory. Use 7zip to unzip, other zip tools might fail.
- In Mercurial installation directory there is a folder named Templates. Move it into the library folder.
- Edit hgwebdir.py, add following lines to add the library folder into python
library path:
import sys
sys.path.insert(0, "C:\Program Files\Mercurial\library") - Start apache, try to access in browser
http://localhost/cgi-bin/hgwebdir.py - If the repositories index page can shown, that's fine. If got 500 internal
error, check apache error log.
If the error information is like this:
The system cannot find the path specified. : couldn't create child process: 720003: hgwebdir.py
it means Apache can't locate the python executer.- Edit Apache's config file httpd.conf, uncomment
the line:
ScriptInterpreterSource registry
This will enable Apache to skip the script's shebang line and use default registered handler.
- Edit Apache's config file httpd.conf, uncomment
the line:
- When the index is successfully shown in browser, edit the .hg\hgrc file in
each repositories to add following lines. It will enable push to repository by
web access (default is read only) and enable push by http (default is requiring
ssl).
[web]
allow_push = *
push_ssl = false - Try to clone a repository by web access and modify something then push back. It should be ok.
- Add a line in Apache http.conf to make the URL more friendly:
ScriptAliasMatch ^/hg(.*) "C:/Program Files/Apache2.2/cgi-bin/hgwebdir.py$1"
Now the url will be:
http://localhost/hg
Just record the installation steps in case I need to do it again some time in the furture. Hope that I haven't missed any step :)
Reference:











