Google Reader OSX 皮肤 1.5
Tuesday October 14, 2008
Google Reader OSX 皮肤, 如图,之前有介绍过(1,2),我一直在用的一款 Google reader 的皮肤,很喜欢。
作者已不太想更新此皮肤了,但 Google reader 还在不断的更新,这就导致了新的 bug 的出现,其它还好,最不能容忍的是点击 Feed Settings 时列表不能正常显示,如下图:
Continue reading »

Google Reader OSX 皮肤, 如图,之前有介绍过(1,2),我一直在用的一款 Google reader 的皮肤,很喜欢。
作者已不太想更新此皮肤了,但 Google reader 还在不断的更新,这就导致了新的 bug 的出现,其它还好,最不能容忍的是点击 Feed Settings 时列表不能正常显示,如下图:
Continue reading »
eclipse是我的主力开发工具,熟练掌握一些小技巧和快捷键可以起到事半功倍的作用,其中有一个tpis很吸引我,那就是Ctrl+3 Quick Access
我想很多经常用linux的人都习惯使用命令行来操作,我也不例外,而eclipse中的这个tips就给我这种感觉

Continue reading »
Sun Microsystems亚太区的工程师Lee Chuk Munn写了一篇不错的小文,介绍一个高效程序开发人员的应该有的 7个习惯
1. 明白问题
2. 使用合适的工具
3. 保持简单,简易
4. 保持代码整洁
5. 学习调试
6. 借鉴他人
7. 持续学习
Keep it clean, and keep it simple–that is the maxim software developers should adhere to.
For instance, Lee said, there are different algorithms engineers can use to write a sorting program.
To select the right one to use, developers need to first understand the size of the data–that the sorting program will be administered on–in order to decide which is the right algorithm to use. “Choosing the wrong one would put your application in jeopardy in future,” he said.
Quoting American psychologist Abraham Maslow, Lee read: “If the only tool you have is a hammer, you will see every problem as a nail.”
This Maslow concept has become so popular among software developers that it has been dubbed the “Golden Hammer” rule, which cautions engineers with limited knowledge or training of solutions that they run the risk of using only tools they are familiar with, but that may not be the most appropriate, when they develop a new program.
今天看到一个有意思的程序,写下来
public class FinallyTest { private static int test() { int i=1; try { i=2; return i; } catch (Exception e) { i = 3; return i; } finally { i = 4; } } public static void main(String[] args){ FinallyTest finallyTest = new FinallyTest (); System.out.println("i=" + finallyTest.test()); } }
运行结果是
i=2
为什么呢,不是明明在finally中赋值了i=4吗?
答案是:
Continue reading »
配置web.xml
< ?xml version="1.0" encoding="UTF-8"?> < !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc. //DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web -app> <servlet> </servlet><servlet -name>webwork</servlet> <servlet -class> com.opensymphony.webwork.dispatcher.ServletDispatcher </servlet> <servlet -mapping> </servlet><servlet -name>webwork</servlet> <url -pattern>*.action</url> <taglib> </taglib><taglib -uri>webwork</taglib> <taglib -location>/WEB-INF/lib/webwork-2.1.7.jar</taglib> <resource -ref> <res -ref-name>jdb/sqlserver</res> <res -type>javax.sql.DataSource</res> <res -auth>Container</res> </resource> </web>
webwork, 一 mvc 框架
所需基本类库,从官方 下载, 我采用 webwork2.1.7, 主要是为了配合 webwork in action 这本书
学习要点:
1. 所需类库:
commons-logging.jar ognl.jar oscore.jar velocity-dep.jar webwork-2.1.7.jar xwork.jar
2. action可选择implements Action,也可以选择extends ActionSupport,推荐采用后者,都要实现 execute这个方法,如:
public String execute() { if(name == null || "".equals(name) || "World".equals(name)){ addFieldError("name", "Blank names or names of 'World' are not allowed!"); return INPUT; } message = "hello, " + name + "!"; message += "The time is:"; message += mystring; return SUCCESS; }
下拉列表框中的数据是从字典表中取得的, 实现方法 在 这里
这次是采用js来实现的,代码如下
function atSub() { var index_s =document.add.test.selectedIndex; var content = document.add.test.options[index_s].value; document.add.member.value+= content + " "; }
页面代码如下
<tr>
<td class='small' width="14%" bgcolor="#D8EBF5">
<div align="center">成员:</div>
</td>
<td colspan="3" bgcolor="#D8EBF5" class='small'>
<input type="text" name="member" id="member" size="76.5">
<select style="width: 160; height: 23"
onChange="javascript:atSub();" name="test">
<option value="">选择成员 </option>
<%
Vector mm = UserInfo.getAllUsers();
for(int i=0;i<mm.size();i++){
UserInfo mmall = (UserInfo)mm.get(i);
%>
<option value="<%=mmall.getUserName()%>">
<%=mmall.getUserName()%>
</option>
<%}%>
</select>
</td>
</tr>在最近的一个小系统里要加入一个功能,一个列表框,数据从数据库的字典表中取得,研究了一下,实现了,记录下
只显示一个字段的内容,我采用Vector来实现,代码如下
package com.xx.work.data; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Vector; import com.aheadsoft.work.dao.DBConnect; public class Add { private int ID; private String workType; public int getID() { return ID; } public void setID(int id) { ID = id; } public String getWorkType() { return workType; } public void setWorkType(String workType) { this.workType = workType; } public Add(){ ID = 0; workType = ""; } public Add(int ID, String workType){ this.ID = ID; this.workType = workType; } public void setID(String newID) { if (newID != null) this.ID = Integer.parseInt(newID); } public static Vector excute() throws Exception{ Vector list = new Vector(); String Str = "select * from workType"; DBConnect dbc = null; ResultSet rs = null; try { dbc = new DBConnect(); try{ rs = dbc.executeQuery(Str); while (rs.next()) { Add add = new Add(); add.setWorkType(rs.getString("workType")); list.add(add); } }catch(SQLException e){ e.printStackTrace(); }finally{ if(rs != null) rs.close(); } } catch (SQLException e) { e.printStackTrace(); }finally{ if(dbc != null) dbc.close(); } return list; } public static void main(String [] args){ } }