2009年2月26日星期四
2009年2月24日星期二
XToolkit on Solaris/Linux
Starting with release J2SETM 5.0, AWT has been re-implemented on the Solaris and Linux platforms. The new Toolkit implementation provides the following advantages:
- Removes the dependency on Motif and Xt libraries.
- Interoperates better with other GUI Toolkits.
- Provides better performance and quality.
The new Toolkit (XToolkit) is the default on Linux in J2SE 5.0. Solaris will continue to use the MToolkit (Motif-based Toolkit) as the default in J2SE 5.0, but eventually will be replaced with XToolkit.
Explicitly Setting the Toolkit
You can explicitly set the toolkit for an applet or application using an environment variable or a system property. Keep in mind that the environment variable overrides the system property.
- Setting the toolkit for an application:
- Using an environment variable. This needs to be set before starting the VM.
csh:
setenv AWT_TOOLKIT XToolkit #selects the XToolkit
setenv AWT_TOOLKIT MToolkit #selects the MToolkit
ksh/bash:
export AWT_TOOLKIT=XToolkit
export AWT_TOOLKIT=MToolkit
- Using a system property on the command line:
java -Dawt.toolkit=sun.awt.X11.XToolkit MyApp
java -Dawt.toolkit=sun.awt.motif.MToolkit MyApp- Setting the toolkit for an applet:
- Using an environment variable.
If the browser is started from a terminal window, the environment variable must be set in the terminal window before launching the browser. If the browser is launched from a desktop icon or menu, the toolkit for an applet can't be set using an environment variable. The Java Plug-in Control Panel should be used instead.
- Using the Plug-in Control Panel:
- Launch the Java Plug-in Control Panel:
$java_home/bin/ControlPanel
- Add the system property to the Java Runtime Parameters field under the Advanced tab.
-Dawt.toolkit=sun.awt.X11.XToolkit
-Dawt.toolkit=sun.awt.motif.MToolkit
2009年2月7日星期六
N70 with Ubuntu
1)检测手机:
# obexftp -u
输出:
Found 2 USB OBEX interfaces
Interface 0:
Manufacturer: Nokia
Product: Nokia N70
Interface description: SYNCML-SYNC
Interface 1:
Manufacturer: Nokia
Product: Nokia N70
Interface description: PC Suite Services
Use '-u interface_number' to connect
Nothing to do. Use --help for help.
接口1将N70作为一个文件服务器提供出来。
2)查看内存卡内容
# sudo obexftp -u 1 -v -l
以上命令查看有几个分区, 一般是C:和E:两个分区
# sudo obexftp -u 1 -v -l C:/Nokia/3)创建目录
# obexftp -u 1 -v -C E:/Songs
4)上传多个文件
# obexftp -u 1 -v -c E:/Songs -p $HOME/Songs/*.mp3
5) 删除一个目录
# obexftp -u 1 -v -k E:/Songs
thanks to stylesen's Nokia N70 with Debian Etch!
N70 Formatting
2009年2月3日星期二
Balsamiq Mockups: a great web UI mockup tool
我用Linux版本画了一张很随意的界面图
功能和亮点:
- 操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
- 预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
- 界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
- 使用xml语言来记录和保存界面元素和布局,
- 这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
- 可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
- 可以将设计导出成PNG格式的图片;
- 可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
- 跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
- 不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效;
总体而言作者要价$79还是比较公道的。
用import多次截屏后出现崩溃
改用scrot, 暂时没出问题。唯一不便的是执行scrot命令后,鼠标形状没有变化,这一点import做得好一点。
#!/bin/bash
# my screenshot script
TODAY=`date '+%Y%m%d'`
NOW=`date '+%H-%M-%S'`
FNAME=screenshot-${NOW}
EXT=png
SCRDIR=${HOME}/Pictures/screenshot/${TODAY}/
if [ ! -d "${SCRDIR}" ]; then
mkdir -p "${SCRDIR}"
fi
# 延时4秒
# sleep 4
#import -window root "$HOME/Desktop/${FNAME}.${EXT}"
#import "${SCRDIR}${FNAME}.${EXT}"
scrot -s "${SCRDIR}${FNAME}.${EXT}"