Dev@Free

zJun's Tech Weblog

2006年5月18日

http://ubuntu.dormforce.net/

Ubuntu 12.04 Precise Pangolin:

deb http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse

使用说明
打开Software Manager,点击Edit⇒Software Sources
在Download from中选择Other
选择China⇒mirrors.ustc.edu.cn
点击Choose Server
posted @ 2012-06-05 00:55 zJun's帛罗阁 阅读(1093) | 评论 (0)编辑 收藏
a wonderful Eclipse plugin:  WindowBuilder, which can be used to develope Swing/SWT UI:

WindowBuilder is built as a plug-in to Eclipse and the various Eclipse-based IDEs (RAD, RSA, MyEclipse, JBuilder, etc.). The plug-in builds an abstract syntax tree (AST) to navigate the source code and uses GEF to display and manage the visual presentation.

Develop Java graphical user interfaces in minutes for Swing, SWT, RCP and XWT with WindowBuilder Pro's WYSIWYG, drag-and-drop interface. Use wizards, editors and intelligent layout assist to automatically generate clean Java code, with the visual design and source always in sync.

The project website: http://www.eclipse.org/windowbuilder/

To install the plugin in Eclipse: http://www.eclipse.org/windowbuilder/download.php

posted @ 2012-05-31 18:44 zJun's帛罗阁 阅读(575) | 评论 (0)编辑 收藏
Example:
abc 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
abc 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
tas 3420 3562 2123 1343 2176 7654 3252 8765 5643 3452
aer 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
tas 3420 3562 2123 1343 2176 7654 3252 8765 5643 3452

UNIX:

display the no of occurance and the record
> sort f1.txt|uniq -c
   2 abc 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
   1 aer 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
   2 tas 3420 3562 2123 1343 2176 7654 3252 8765 5643 3452

display only the duplicate records
> sort f1.txt|uniq -d
abc 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
tas 3420 3562 2123 1343 2176 7654 3252 8765 5643 3452

display distinct records
> sort f1.txt|uniq
abc 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
aer 1000 3452 2463 2343 2176 7654 3452 8765 5643 3452
tas 3420 3562 2123 1343 2176 7654 3252 8765 5643 3452

Reference:
How to find Duplicate Records in a text file
Shell: How To Remove Duplicate Text Lines

Windows:

Notepad++ can sort by line, and remove the duplicate lines at the same time.
  1. Open the menu under: TextFX-->TextFX Tools
  2. Make sure "sort outputs only unique..." is checked
  3. select a block of text (ctrl-a to select the entire document).
  4. click "sort lines case sensitive" or "sort lines case insensitive"

posted @ 2012-04-11 12:10 zJun's帛罗阁 阅读(447) | 评论 (0)编辑 收藏

1.安装JAVA环境

sudo apt-get install sun-java5-jre

2.下载tomcat: http://tomcat.apache.org/

3.解压tomcat

$sudo tar zxvf apache-tomcat-7.0.26.tar.gz -C /opt
$sudo mv /opt/apache-tomcat-7.0.26.tar.gz /opt/tomcat

4.启动tomcat

$sudo /opt/tomcat/bin/startup.sh

如果能看到下列提示,就表明启动成功了!

>Using CATALINA_BASE: /opt/tomcat
>Using CATALINA_HOME: /opt/tomcat
>Using CATALINA_TMPDIR: /opt/tomcat/temp
>Using JRE_HOME: /usr/lib/j2sdk1.5-sun

打开Firefox,在地址栏中输入http://localhost:8080,如果出来Tomcat的缺省界面,说明测试通过!

5.停止Tomcat服务

$sudo /opt/tomcat/bin/shutdown.sh

posted @ 2012-03-28 01:18 zJun's帛罗阁 阅读(683) | 评论 (0)编辑 收藏
1.下载安装 RubyInstaller: http://rubyforge.org/frs/?group_id=167&release_id=46588

2. 检查 RubyGems 版本,须高于 1.3.6
gem -v
3.如果版本不是最新,可以通过下面的命令更新至最新版本:
gem update --system
gem uninstall rubygems-update
4.安装 Rails:
gem install rails
posted @ 2012-03-27 18:30 zJun's帛罗阁 阅读(784) | 评论 (0)编辑 收藏
1.按照github上的指南配置(http://help.github.com/win-set-up-git/)基础的git环境。

2.在github上创建一个Repository。

3.在Eclipse中通过“Eclipse Marketplaces”,在Market Places里安装egit。

4.在Eclipse中生public key, 并添加到GitHub Repository中。
Eclipse中通过:performance -> SSH2 -> Key Management -> Gernerate RSA Key 生成 SSH 的 public key。
在GitHub中通过:edit your profile -> ssh key -> Add SSH Key 添加SSH Key, 把上面生成的 public key 拷贝到这里,保存。

5.Eclipse里File菜单,Import,即可从git导入刚添加到git的项目了。

6.修改,并提交。在项目上点右键–>team–>commit。commit是commit到本机的git库,而push才是同步到github。
posted @ 2012-03-27 01:16 zJun's帛罗阁 阅读(2991) | 评论 (0)编辑 收藏
1.下载最新版 Eclipse:
官方下载:http://www.eclipse.org/downloads/

2.解压下载的压缩包:
$sudo tar xvfz eclipse-SDK-3.1.2-linux-gtk.tar.gz -C /opt

这个时候,就可以在 /opt 文件夹中看到出现了一个eclipse的文件夹,双击其中的eclipse文件就可以运行eclipse了。

3.在菜单设置Eclipse选项:
$gedit ~/.local/share/applications/eclipse-user.desktop

插入一下内容:
[Desktop Entry]
Comment=Java IDE
Name=Eclipse
Exec=/opt/eclipse/eclipse
Encoding=UTF-8
Terminal=false
Type=Application
Categories=Application;Development;
Icon=/opt/eclipse/icon.xpm

posted @ 2012-03-27 01:00 zJun's帛罗阁 阅读(617) | 评论 (0)编辑 收藏

方法1: 用SET PASSWORD命令

  mysql -u root

  mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

方法2:用mysqladmin

  mysqladmin -u root password "newpass"

  如果root已经设置过密码,采用如下方法

  mysqladmin -u root password oldpass "newpass"

方法3: 用UPDATE直接编辑user表

  mysql -u root

  mysql> use mysql;

  mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';

  mysql> FLUSH PRIVILEGES;

方法4: 在丢失root密码的时候,可以这样

  mysqld_safe --skip-grant-tables&

  mysql -u root mysql

  mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';

  mysql> FLUSH PRIVILEGES;

---------------------------------------

经测试,方法三修改成功,其他三种方法没有测试。

posted @ 2012-03-17 22:53 zJun's帛罗阁 阅读(492) | 评论 (0)编辑 收藏

一.问题环境:
  Eclipse3.4 + Tomcat6.0.20
二.问题现象:
  在Eclipse下启动Tomcat6时,控制台会有下面警告信息
  警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:...' did not find a matching property.
三.详细解决办法:
   1.打开服务器视图:窗口 > 显示视图 > 服务器 > 服务器
   2.双击服务器列表中的Tomcat,打开“服务器概述”窗口
   3.选中"Publish module contexts to separate XML files"选项。
   小提示:如果Tomcat处于启动状态,请先停止,否则,在保存服务器设置时,提示不能保存。

posted @ 2012-03-17 22:52 zJun's帛罗阁 阅读(823) | 评论 (0)编辑 收藏

Here is a simple way to generate a analyze report by using FindBugs plugins in RSA:

  • Using FindBugs to scan the code and save the result as XML file
  • the XML report is in a bad format for reading, we can use XSL file to make it easy and clear to read:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="summary.xsl"?>
  • Use Internet Explore to open the XML report, now we get a report:
Note: FindBugs provided following xsl files for different format:

1、default.xsl;
2、fancy.xsl;
3、fancy-hist.xsl;
4、plain.xsl;
5、summary.xsl;

posted @ 2012-03-17 22:46 zJun's帛罗阁 阅读(437) | 评论 (0)编辑 收藏
     摘要: GZIP
1. Compressing a File in the GZIP Format
2. Uncompressing a File in the GZIP Format

ZIP
1. Creating a ZIP File
2. Listing the Contents of a ZIP File
3. Retrieving a Compressed File from a ZIP File   阅读全文
posted @ 2008-06-03 23:02 zJun's帛罗阁 阅读(1319) | 评论 (1)编辑 收藏
     摘要: 使用 JSEclipse,JavaScript 程序员现在有了自己的 Eclipse 插件,该插件将提供许多重要功能来辅助开发 JavaScript 应用程序。像 Eclipse 多年来为 Java™ 语言和其他语言提供了易用性一样,JSEclipse 为 JavaScript 开发人员提供了同样的优点。  阅读全文
posted @ 2008-01-29 17:20 zJun's帛罗阁 阅读(12337) | 评论 (1)编辑 收藏
分享一个不错的编写properties文件的Eclipse插件(plugin),有了它我们在编辑一些简体中文、繁体中文等 Unicode文本时,就不必再使用native2ascii编码了。您可以通过Eclipse中的软件升级(Software Update)安装此插件,步骤如下:
1、展开Eclipse的Help菜单,将鼠标移到Software Update子项,在出现的子菜单中点击Find and Install;
2、在Install/Update对话框中选择Search for new features to install,点击Next;
3、在Install对话框中点击New Remote Site;
4、在New Update Site对话框的Name填入“PropEdit”或其它任意非空字符串,在URL中填入http://propedit.sourceforge.jp/eclipse/updates/;
5、在Site to include to search列表中,除上一步加入的site外的其它选项去掉,点击Finsih;
6、在弹出的Updates对话框中的Select the features to install列表中将所有结尾为“3.1.x”的选项去掉(适用于Eclipse 3.2版本的朋友);
7、点击Finish关闭对话框;
8、在下载后,同意安装,再按提示重启Eclipse,在工具条看到形似vi的按钮表示安装成功,插件可用。此时,Eclpise中所有properties文件的文件名前有绿色的P的图标作为标识。
posted @ 2008-01-24 22:41 zJun's帛罗阁 阅读(21851) | 评论 (4)编辑 收藏
     摘要: 在Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....,查找的解决办法如下:  阅读全文
posted @ 2007-10-16 20:55 zJun's帛罗阁 阅读(100440) | 评论 (3)编辑 收藏
     摘要: 要對資料庫管理系統進行操作,最基本的就是使用SQL(Standard Query Language)語句,大部份的資料庫都支援標準的SQL語句,然而也有一些特定於資料庫的SQL語句,應用程式配合SQL語句進行資料庫查詢時,若使用到特定於資料庫的SQL語句,程式本身會有相依於特定資料庫的問題。

使用Hibernate時,即使您不了解SQL的使用與撰寫,也可以使用它所提供的API來進行SQL語句查詢,org.hibernate.Criteria對SQL進行封裝,您可以從Java物件的觀點來組合各種查詢條件,由Hibernate自動為您產生SQL語句,而不用特別管理SQL與資料庫相依的問題。  阅读全文
posted @ 2007-10-11 16:22 zJun's帛罗阁 阅读(15397) | 评论 (0)编辑 收藏

整理自: SpringSide中文论坛


实际执行任务的Class: CourseService
public   class  CourseService 

  
public   void  sendCourseEnrollmentReport()

    System.out.println(
" HelloWorld "
); 
  }
 

}

调度任务的Class: TaskApp
import  org.springframework.beans.factory.BeanFactory; 
import
 org.springframework.beans.factory.xml.XmlBeanFactory; 
import
 org.springframework.core.io.FileSystemResource; 

public   class  TaskApp 


  
public   static   void  main(String[] args)  throws  Exception 

    BeanFactory factory 
=   new  XmlBeanFactory( new  FileSystemResource(  " WebRoot/WEB-INF/classes/scheduleTask.xml "
)); 
    factory.getBean(
" z "
); 
  }
 
    
}
 

配置调度执行任务的配置文件: scheduleTask.xml
<? xml version="1.0" encoding="UTF-8" ?>  
<! DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" >
 
< beans >
 
  
<!-- 起动Bean -->
 
  
< bean  id ="z"  class ="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
 
    
< property  name ="triggers" >
 
      
< list >
 
    
< ref  bean ="cronReportTrigger"   />
 
      
</ list >
 
    
</ property >
 
  
</ bean >
 
  
<!-- 实际的工作Bean -->
 
  
< bean  id ="courseService"  class ="CourseService" >

  
</ bean >  
  
<!-- jobBean用于设定启动时运用的Bean与方法 -->
 
  
< bean  id ="scheduledReportJobDetail"  class ="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" >
 
    
< property  name ="targetObject" >
 
    
< ref  bean ="courseService"   />
 
    
</ property >
 
    
< property  name ="targetMethod" >
 
      
< value > sendCourseEnrollmentReport </ value >
 
    
</ property >
 
  
</ bean >
 
  
<!-- 定时器设定起动频率&启动时间我设的是每5秒起动一次 (0 0 4 * * ?每日四点起动.) -->
 
  
< bean  id ="cronReportTrigger"  class ="org.springframework.scheduling.quartz.CronTriggerBean" >
 
    
< property  name ="jobDetail" >
 
    
< ref  bean ="scheduledReportJobDetail"   />
 
    
</ property >
 
    
< property  name ="cronExpression" >
 
      
< value > 10,15,20,25,30,35,40,45,50,55 * * * * ? </ value >
 
    
</ property >
 
  
</ bean >
 
</ beans >

关于配置文件中参数cronExpression的说明:
字段 允许值 允许的特殊字符 
秒 
0 - 59   ,
 - * / 
分 
0 - 59   ,
 - * / 
小时 
0 - 23   ,
 - * / 
日期 
1 - 31   ,
 - * ? / L W C 
月份 
1 - 12  或者 JAN-DEC  ,
 - * / 
星期 
1 - 7  或者 SUN-SAT  ,
 - * ? / L C # 
年(可选) 留空
,   1970 - 2099   ,  - * / 

表达式意义:
" 0 0 12 * * ? "  每天中午12点触发 
" 0 15 10 ? * * "
 每天上午10:15触发 
" 0 15 10 * * ? "
 每天上午10:15触发 
" 0 15 10 * * ? * "
 每天上午10:15触发 
" 0 15 10 * * ? 2005 "
 2005年的每天上午10:15触发 
" 0 * 14 * * ? "
 在每天下午2点到下午2:59期间的每1分钟触发 
" 0 0/5 14 * * ? "
 在每天下午2点到下午2:55期间的每5分钟触发 
" 0 0/5 14,18 * * ? "
 在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发 
" 0 0-5 14 * * ? "
 在每天下午2点到下午2:05期间的每1分钟触发 
" 0 10,44 14 ? 3 WED "
 每年三月的星期三的下午2:10和2:44触发 
" 0 15 10 ? * MON-FRI "
 周一至周五的上午10:15触发 
" 0 15 10 15 * ? "
 每月15日上午10:15触发 
" 0 15 10 L * ? "
 每月最后一日的上午10:15触发 
" 0 15 10 ? * 6L "
 每月的最后一个星期五上午10:15触发 
" 0 15 10 ? * 6L 2002-2005 "
 2002年至2005年的每月的最后一个星期五上午10:15触发 
" 0 15 10 ? * 6#3 "
 每月的第三个星期五上午10:15触发 
0   6
 * * *          每天早上6点  
0  */ 2
 * * *        每两个小时  
0   23 - 7 / 2 8
 * * *  晚上11点到早上8点之间每两个小时,早上八点  
0   11   4  *  1 - 3
       每个月的4号和每个礼拜的礼拜一到礼拜三的早上11点  
0   4   1   1  *          1月1日早上4点 

Download:
Quartz

相关文档:
http://blog.csdn.net/ezerg/archive/2004/09/24/115894.aspx
http://blog.csdn.net/yujiebo025/archive/2005/09/13/479049.aspx
http://blog.csdn.net/mengz/archive/2005/01/13/252267.aspx
http://blog.csdn.net/jorwang/archive/2005/05/12/374111.aspx
http://blog.csdn.net/Mailbomb/archive/2005/10/26/517128.aspx
http://blog.csdn.net/stonecai/archive/2007/01/06/1475745.aspx
http://landerchan.spaces.live.com/Blog/cns!8759A7C5A9737DC!116.entry
http://hanxinyu.javaeye.com/blog/37000
http://www.onjava.com/pub/a/onjava/2004/03/10/quartz.html
posted @ 2007-09-05 19:40 zJun's帛罗阁 阅读(3812) | 评论 (0)编辑 收藏
     摘要: JDK 5 新增一些特性来简化开发,这些特性包括泛型,for-each 循环,自动装包/拆包,枚举,可变参数, 静态导入 。使用这些特性有助于我们编写更加清晰,精悍,安全的代码。  阅读全文
posted @ 2007-08-17 23:27 zJun's帛罗阁 阅读(850) | 评论 (0)编辑 收藏
< ec:table  items ="itemList"  var ="item"  action ="${pageContext.request.contextPath}/query.do"
retrieveRowsCallback
="limit"  
filterRowsCallback
="limit"
 
sortRowsCallback
="limit"
  >

 
< ec:exportXls  fileName ="CouponList.xls"  tooltip ="导出 Excel" />
< ec:row >
    
< ec:column  property ="rowcount"  cell ="rowCount"  sortable ="false"  title ="序号" />
    
< ec:column  property ="id"  title ="编号" />
    
< ec:column  property ="type"  title ="种类" >
          ${typeMap[item.type]}
    
</ ec:column >
    
< ec:column  property ="name"  title ="名称" />
    
< ec:column  property ="beginDate"  title ="开始时间"  cell ="calendar"  format ="date"   />
    
< ec:column  property ="endDate"  title ="结束时间"  cell ="calendar"  format ="date"   />
    
< ec:column  property ="state"  title ="状态" >
        ${statusmap[coupon.status]}
    
</ ec:column >
    
< ec:column  property ="edit"  title ="操作"  sortable ="false"  viewsAllowed ="html"
                       style
="width: 56px;text-align: center" >
                
< href ="<c:url value=" /security/user.do?method =selectRoles&userId=${user.id}"  /> ">  < img
                        
src ="<c:url value=" /images/icon/16x16/manage.gif" /> " border="0"/>  </ A >

            
</ ec:column >
        
</ ec:row >
    
</ ec:table >

其中:
     
retrieveRowsCallback="limit"
     filterRowsCallback="limit"
     sortRowsCallback="limit"
指定了callback函数 limit

在controller 中的处理:
  /**
  * 列表查看
*/

protected   void  onList(HttpServletRequest request,HttpServletResponse response, ModelAndView mav)  throws  Exception  {
   Limit limit 
=
 ExtremeTablePage.getLimit(request);
   Map map 
=  WebUtils.getParametersStartingWith(request,  " search_ "
);
   Page page
=
service.queryForPage(map,ExtremeTablePage.getSort(limit),limit.getPage(), limit.getCurrentRowsDisplayed());
   mav.addObject(
" itemList "
, page.getResult());
   mav.addObject(
" totalRows "
,page.getTotalCount());
}
posted @ 2007-08-08 00:02 zJun's帛罗阁 阅读(2699) | 评论 (1)编辑 收藏
摘自: chinaunix

SELECT   S.SID SESSION_ID, S.USERNAME, DECODE(LMODE,  0 ' None ' 1 ' Null ' 2 ' Row-S (SS) ' 3 ' Row-X (SX) ' ,   4 ' Share ' 5 ' S/Row-X (SSX) ' ,   6 ' Exclusive ' , TO_CHAR(LMODE)) MODE_HELD, DECODE(REQUEST,  0 ' None ' 1 ' Null ' 2 ' Row-S (SS) ' 3 ' Row-X (SX) ' 4 ' Share ' 5 ' S/Row-X (SSX) ' 6 ' Exclusive ' , TO_CHAR(REQUEST)) MODE_REQUESTED, O.OWNER || ' . ' || O. OBJECT_NAME || '  ( ' || O.OBJECT_TYPE || ' ) ' , S.TYPE LOCK_TYPE, L.ID1 LOCK_ID1, L.ID2 LOCK_ID2 
FROM
 V$LOCK L, SYS.DBA_OBJECTS O, V$SESSION S 
WHERE  L.SID  =  S.SID  AND   L.ID1  =  O. OBJECT_ID

执行上记SQL语句,可以查寻到数据库中的锁的情报.

SESSION_ID, USERNAME,  MODE_HELD,  MODE_REQUESTED, OBJECT_NAME, LOCK_TYPE, LOCK_ID

分别是 拥有锁的SESSION_ID,拥有锁的USERNAME,锁的执行模式MODE_HELD,锁的请求MODE_REQUESTED,锁所在的数据库对象名
,锁的类型,锁的ID
posted @ 2007-07-27 18:23 zJun's帛罗阁 阅读(14595) | 评论 (0)编辑 收藏
     摘要: Java中的多线程使用synchronized关键字实现同步.为了避免线程中使用共享资源的冲突,当线程进入synchronized的共享对象时,将为共享对象加上锁,阻止其他的线程进入该共享对象.但是,正因为这样,当多线程访问多个共享对象时,如果线程锁定对象的顺序处理不当话就有可能线程间相互等待的情况,即常说的: 死锁现象.  阅读全文
posted @ 2007-07-24 19:02 zJun's帛罗阁 阅读(3205) | 评论 (1)编辑 收藏
     摘要: Java Socket简单入门例子.  阅读全文
posted @ 2007-07-24 19:01 zJun's帛罗阁 阅读(2278) | 评论 (1)编辑 收藏
摘自: ziyang之窝


有两个表:

Menu,Privilege,他们是多对多关系,有一个中间表menu_privilege,在Menu中有privileges List字段,而在privilege中则没有menu List字段,因为privilege不想依赖于Menu。但我们要根据Privilege得到其所有的Menu,则HQL应该这样写:

Query query  =  session.createQuery( " select menu from Menu menu left join menu.privileges p where p.id=:id " );
                
query.setParameter(
" id "
, privilege.getId());
return
 query.list();
posted @ 2007-07-24 18:22 zJun's帛罗阁 阅读(2481) | 评论 (0)编辑 收藏
Dear all:
result love(boy, girl)
{
  if ( boy.有房() and boy.有车() )
   {boy.set(nothing);
    return girl.嫁给(boy); }
  if ( girl.愿意等() )
  {
while( ! (boy.赚钱 > 100,000 and girl.感情 > 8 )
   {for ( day=1; day <=365; day++)
    {if ( day == 情人节 )
     if ( boy.give girl(玫瑰) )
      girl.感情++;
     else
      girl.感情--;
     if( day == girl.生日)
     if ( boy.give girl(玫瑰) )
      girl.感情++;
     else
      girl.感情--;
      boy.拼命赚钱();
      }
     }

  if ( boy.有房() and boy.有车() )
   { boy.set(nothing);
 return girl.嫁给(boy);
 }
    年龄++;
   girl.感情--;
  return girl.goto( another_boy);
}

(注:稍懂点C语言的应该都能看懂吧!)
posted @ 2007-03-09 14:03 zJun's帛罗阁 阅读(906) | 评论 (1)编辑 收藏
     摘要: 组件(Component)类必须在类一级定义@Embeddable注解.

在特定的实体的关联属性上使@Embedded和@AttributeOverride注解可以覆盖该属性对应的嵌入式对象的字段映射:  阅读全文
posted @ 2007-03-07 16:17 zJun's帛罗阁 阅读(2984) | 评论 (0)编辑 收藏
     摘要: 1.简单主键:
使用@Id注解可以将实体bean中的某个属性定义为标识字段.使用 @GeneratedValue注解可以定义标识字段的生成策略:

AUTO - 可以是identity类型的字段,或者sequence类型或者table类型,取决于不同的底层数据库.
TABLE - 使用表保存id值
IDENTITY - identity字段
SEQUENCE - sequence  阅读全文
posted @ 2007-03-07 15:49 zJun's帛罗阁 阅读(2530) | 评论 (0)编辑 收藏
     摘要: 1. 基本属性映射
通过 @Basic 可以声明属性的存取策略:
@Basic(fetch=FetchType.EAGER) 即时获取(默认的存取策略)
@Basic(fetch=FetchType.LAZY) 延迟获取  阅读全文
posted @ 2007-03-07 15:13 zJun's帛罗阁 阅读(2075) | 评论 (0)编辑 收藏
     摘要: Displaytag1.1支持在外部实现大数据量分页。主要有两种方式实现:

Displaytag 1.1 offers two alternative ways for working with partial lists:

the first one uses the valuelist pattern, and requires that the object that you give to displaytag implements the org.displaytag.pagination.PaginatedList interface. You can pass this object to displaytag as an usual list, and it will extract paging and sorting information from it. This way is more recommended if you have to build your backend layer and you can easily  阅读全文
posted @ 2007-02-08 11:35 zJun's帛罗阁 阅读(7423) | 评论 (20)编辑 收藏

1.打开 Google主页

2.把浏览器地址栏清空,再将下面的内容复制到地址栏内:

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);

3.回车....

posted @ 2007-02-02 14:41 zJun's帛罗阁 阅读(714) | 评论 (0)编辑 收藏
     摘要: Launchy,一款免费开源软件实现了键盘快捷启动程序的功能。

你只需要输入程序的名称,Launchy就可以自动帮你匹配出你想要运行的程序:  阅读全文
posted @ 2007-02-02 14:36 zJun's帛罗阁 阅读(1110) | 评论 (0)编辑 收藏
     摘要: Table
Table用来定义entity主表的name,catalog,schema等属性。
元数据属性说明:
name: 表名
catalog: 对应关系数据库中的catalog
schema:对应关系数据库中的schema
UniqueConstraints:定义一个UniqueConstraint数组,指定需要建唯一约束的列   阅读全文
posted @ 2007-01-24 15:46 zJun's帛罗阁 阅读(21961) | 评论 (0)编辑 收藏
     摘要: Apache的Jakata项目的POI子项目,目标是处理ole2对象。 POI可以到 http://www.apache.org/dyn/closer.cgi/jakarta/poi/ 下载。...  阅读全文
posted @ 2007-01-22 17:59 zJun's帛罗阁 阅读(22195) | 评论 (6)编辑 收藏
     摘要: 方法一:循环元素删除
方法二:通过HashSet剔除
方法三:删除ArrayList中重复元素,保持顺序  阅读全文
posted @ 2007-01-18 13:48 zJun's帛罗阁 阅读(4628) | 评论 (0)编辑 收藏
更新列表: http://dev.rubyonrails.org/browser/spinoffs/prototype/CHANGELOG

 下载:  http://dev.rubyonrails.org/browser/trunk/railties/html/javascripts/prototype.js
posted @ 2007-01-17 18:01 zJun's帛罗阁 阅读(740) | 评论 (0)编辑 收藏
     摘要: As per the documentation on MySQL I moved the storage of passwords from using Password() to using MD5(). I read a number of places that stated that this was a method that couldn't be reversed and it was far more secure than the previous method. I was feeling confident that life was about to get a little more secure. While going through my daily RSS feeds and mailing lists for SpikeSource, I happenned upon a thread about someone discussing how easy it was to break MD5 hashes. It was a simple matt  阅读全文
posted @ 2007-01-17 16:22 zJun's帛罗阁 阅读(2568) | 评论 (0)编辑 收藏
     摘要: name="resultList" 将记录集存在session或者request中的键值
pagesize="100" 每页显示100条数据
sort="external" 外部排序
id="row" 表格id值,用于程序得相关的参数
partialList="true" 分段从数据库中读数据
size="resultSize" 记录的总条数,用于计算总页数  阅读全文
posted @ 2007-01-17 15:04 zJun's帛罗阁 阅读(5291) | 评论 (3)编辑 收藏
     摘要: Apache jakarta 各项目主要用途及简单说明 来源出处:http://www.javaworld.com.tw/jute/post/view?bid=11&id=1672 为了让大...  阅读全文
posted @ 2007-01-16 17:07 zJun's帛罗阁 阅读(1421) | 评论 (0)编辑 收藏
一定得是N层结构,
层数越多越好,层少了用户会误会我们不重视,
什么数据访问层呀,实体控制层啊,能给他加上的全加上。
    
程序员一定都得是老鸟,30以下基本不考虑,
还得清一色的外企空降兵,
都有10年以上编程经验的那种,用过的语言越多越好,
编程都不带查MSDN的,牛吧!
程序员个个都配IBM笔记本,
CPU要3G以上的,内存硬盘和屏幕都要最大的,
扩展槽别剩下,能插上的全插上。
能安的操作系统全安上,开机一屏幕上就一堆系统等你选,
倍有面子!
    
系统平台就得是J2EE,人家竞争对手除了C++就是JAVA,
你要用一.NET都不好意思和别人打招呼。
你说这样的系统设计出来得卖多少钱?
我觉得怎么也得100万吧?
100万,那是单机版!
1000万起!
你还别嫌太贵,还不免实施服务费。
你得研究有钱用户得心理,
愿意花1000万买这套软件用的,
根本不在乎再多花上几百万!
    
什么叫软件泡沫你知道么?
软件泡沫就是做都做最复杂的,
用就得用最贵的,还得特难用,显得用户水平高。
所以我们搞软件的口号就是:
不求好用,但求费劲!
posted @ 2007-01-12 17:36 zJun's帛罗阁 阅读(482) | 评论 (0)编辑 收藏
     摘要: 参考文档:使用 Spring 更好地处理 Struts 动作

可以通过三种方式实现Spring管理Struts Action:
1.使用 Spring 的 ActionSupport 类整合 Structs
2.使用 Spring 的 DelegatingRequestProcessor 覆盖 Struts 的 RequestProcessor
3.将 Struts Action 管理委托给 Spring 框架   阅读全文
posted @ 2007-01-08 16:57 zJun's帛罗阁 阅读(1809) | 评论 (0)编辑 收藏
     摘要: DCBP连接池的简单使用方法。  阅读全文
posted @ 2006-11-10 13:49 zJun's帛罗阁 阅读(1193) | 评论 (3)编辑 收藏
     摘要: 元字符及其在正则表达式中行为的列表  阅读全文
posted @ 2006-10-11 13:52 zJun's帛罗阁 阅读(2246) | 评论 (0)编辑 收藏
     摘要: 1.如果存在就更新,不存在就插入用一个语句实;
2.分页算法;
3.抽取/删除重复记录;  阅读全文
posted @ 2006-10-10 16:49 zJun's帛罗阁 阅读(998) | 评论 (2)编辑 收藏
     摘要: EssentialPIM 是一套非常不错的个人时间日程安排软件,它具有相当方便的操作接口,让使用者能够对于所排定的行程一目了然,而每一个事件也都允许使用者进行夹档,让你可以把例如会议结果、计划案等数据附带于该记录中。往后,使用者就能够直接对所输入的数据进行搜寻,让你不论在何时都能够找到该事件发生时的一些特定信息。  阅读全文
posted @ 2006-10-09 15:10 zJun's帛罗阁 阅读(884) | 评论 (0)编辑 收藏
     摘要: Windows Live Writer
MS推出的写日志工具,一个桌面程序,需要在本地安装,并且需要安装 .NET Framework SDK.界面UI十分友好,支持主要的Blog API,包括:Windows Live Spaces,RSD ,Metaweblog API,Movable Type API 和 WordPress.  阅读全文
posted @ 2006-09-30 15:45 zJun's帛罗阁 阅读(589) | 评论 (2)编辑 收藏
     摘要: JSTL包含以下的标签:
常用的标签:如 c:out、c:remove、c:catch、c:set等
条件标签:如 c:if、c:when、c:choose、c:otherwise等
URL标签:如 c:import、c:redirect 和 c:url 等
XML标签:如 xml:out 等
国际化输出标签:如 fmt:timeZone 等
SQL标签:如 sql:query、sql:update、sql:transaction 等  阅读全文
posted @ 2006-09-28 16:12 zJun's帛罗阁 阅读(1949) | 评论 (0)编辑 收藏
     摘要: 在SpringSide里翻到一个好东西: jodd:form  阅读全文
posted @ 2006-09-20 16:21 zJun's帛罗阁 阅读(1818) | 评论 (0)编辑 收藏

 使用forward的話,網址列上並不會出現被轉發的目標位址,而且forward是在Web應用程式之內進行,可以訪問Web應用程式的隱藏目錄,像是WEB-INF,然而forward只能在Web應用程式中進行,不能指定至其它的Web應用程式位址。

 使用redirect的話,是要求客戶端瀏覽器重新發出一個指定的請求位址,因此網址列上會出現被重導的目錄位址,重導的請求是由瀏覽器發出,所以不能訪問Web應用程式中的隱藏目錄,像是WEB-INF,然而重導是重新要求一個網頁,所以可以指定至其它的Web應用程式位址。

posted @ 2006-09-19 18:33 zJun's帛罗阁 阅读(498) | 评论 (0)编辑 收藏
     摘要: Hibernate中支持3种形式实现继承关系:
1. Table per concrete class 表与子类之间独立一对一关系
2. Table per subclass 每个子类对应一张子表,并与主类共享主表
3. Table per class hierarchy 表与类一对多关系  阅读全文
posted @ 2006-08-16 15:15 zJun's帛罗阁 阅读(1153) | 评论 (0)编辑 收藏
     摘要: 数据库中提供了两种字段类型 Blob 和 Clob 用于存储大型字符串或二进制数据(图片)。
Blob 采用单字节存储,适合保存二进制数据,如图片文件。
Clob 采用多字节存储,适合保存大型文本数据。
  阅读全文
posted @ 2006-08-15 16:39 zJun's帛罗阁 阅读(5369) | 评论 (1)编辑 收藏
     摘要: 手机可以有多少创意应用?无疑的,日本绝对是重要的指标,但也别忽略欧洲电信业者的企图,他们不只将手机当做是通话的工具,它可以变成贴身的秘书、全天候无休的最佳伴游,当然也会是帮助你随时掌控周遭动态变化的秘密狗仔,十二种行动生活提案,让你每天的生活更有行动力!  阅读全文
posted @ 2006-08-15 10:44 zJun's帛罗阁 阅读(1166) | 评论 (0)编辑 收藏
     摘要: Oralce中的to_date()函数用于将字符串转换为日期对象,具体使用格式为: to_date( string, [ format_mask ], [ nls_language ] )
1. ORA-01810: format code appears twice
2. ORA-01722: invalid number   阅读全文
posted @ 2006-08-14 18:24 zJun's帛罗阁 阅读(2240) | 评论 (1)编辑 收藏
     摘要: 使用过开源缓存包(如:EHCache)都知道,缓存策略中主要分为FIFO,LRU,LFU等几种。而Jakarta Commons中提供的 org.apache.commons.collections.map.LRUMap 可用来保存最近使用的几条记录,提供了LRU(Least Recently Used)缓存策略的实现。  阅读全文
posted @ 2006-07-31 14:52 zJun's帛罗阁 阅读(2912) | 评论 (1)编辑 收藏
     摘要: Greg Stein并没有忽悠我们,在周四(美国时间)的OSCON大会上,他宣布了这个新服务,Google也于今天推出了新的开源服务,即Project Hosting。这个新服务增加在Google Code里,作为其中一部分。通过这项新服务,用户可以搜索各种开源项目,也可以自己上传新项目。但前提是用户必须拥有一个Gmail帐号。你可以把Project Hosting看作是一个开源代码库。  阅读全文
posted @ 2006-07-28 15:23 zJun's帛罗阁 阅读(488) | 评论 (0)编辑 收藏
     摘要: 在雄杰上看到对搜狗输入法的介绍,就下载了来试试,感觉还不错,和紫光输入法很像,但输入词组的匹配率确实要好些,据说还有一下的特点  阅读全文
posted @ 2006-07-28 15:11 zJun's帛罗阁 阅读(1092) | 评论 (1)编辑 收藏
     摘要: org.apache.commons.lang.StringUtils中提供许多有用的字符串操作方法,了解这些方法,我们可以避免许多不必要的重复工作。下面介绍其中比较有用的几个方法:  阅读全文
posted @ 2006-07-27 16:01 zJun's帛罗阁 阅读(6292) | 评论 (2)编辑 收藏
     摘要: 看到网上有同志的介绍将Java程序作成exe文件的方法,写的不错,但是也许是这篇文章完成的时间比较早,许多内容已经不合适了。我在这里补充几条:  阅读全文
posted @ 2006-07-27 14:54 zJun's帛罗阁 阅读(744) | 评论 (0)编辑 收藏
     摘要: 几种常用数据库的JDBC连接字符串  阅读全文
posted @ 2006-07-27 14:45 zJun's帛罗阁 阅读(854) | 评论 (0)编辑 收藏
     摘要: Google最近推出在线相册服务Picasa Web Album  阅读全文
posted @ 2006-07-26 09:45 zJun's帛罗阁 阅读(916) | 评论 (0)编辑 收藏
     摘要: 本文档从Eclipse软件上整理,是列出了标准的快捷键,未列出Emacs快捷键。
转贴请注明作者和出处。  阅读全文
posted @ 2006-07-25 10:43 zJun's帛罗阁 阅读(738) | 评论 (0)编辑 收藏
     摘要: 原文地址: http://www.blogjava.net/ranxiang/articles/23145.html <!--  Example Server Configuration File  --> ...  阅读全文
posted @ 2006-07-21 09:44 zJun's帛罗阁 阅读(1147) | 评论 (0)编辑 收藏
     摘要: 写过AWT或Swing程序的人一定对桌面程序的事件处理机制印象深刻:通过实现Listener接口的类可以在特定事件(Event)发生时,呼叫特定的方法来对事件进行响应。其实我们在编写JSP/Servle程序时,也有类似的事件处理机制,所不同的是在JSP/Servlet中是在web.xml中注册Listener,由Container在特定事件发生时呼叫特定的实现Listener的类。  阅读全文
posted @ 2006-07-20 14:23 zJun's帛罗阁 阅读(2481) | 评论 (4)编辑 收藏
     摘要: Google推出的服务五花八门,充满创意,有些甚至是异想天开,但是它确实给用户带来了全新的体验,已经改变了许多人的上网习惯,可以毫不夸张的说Google已经融入并改变了googler们的日常生活中.下面是我日常常用的一些Google服务,在这里记录整理如下:  阅读全文
posted @ 2006-07-17 11:51 zJun's帛罗阁 阅读(621) | 评论 (0)编辑 收藏
     摘要: 百度也开始提供Blog空间服务了,有兴趣去看看:百度空间。  阅读全文
posted @ 2006-07-14 09:48 zJun's帛罗阁 阅读(825) | 评论 (2)编辑 收藏
     摘要: 选择排序的思想和插入排序差不多,都是先把排序的对象分作两组,不同点在于选择排序将要排序的对象分作一个是已排序的,一个是未排序的,从后端未排序部份选择一个最小值,并放入前端已排序部份的最后一个。  阅读全文
posted @ 2006-07-13 11:30 zJun's帛罗阁 阅读(445) | 评论 (0)编辑 收藏
     摘要: UUID(Universally Unique Identifier)全局唯一标识符,是指在一台机器上生成的数字,它保证对在同一时空中的所有机器都是唯一的。
在Java中生成UUID主要有以下几种方式:   阅读全文
posted @ 2006-07-12 14:52 zJun's帛罗阁 阅读(9248) | 评论 (1)编辑 收藏
     摘要: Oracle中提供了sequence对象,由系统提供自增长的序列号,通常用于生成数据库数据记录的自增长主键或序号的地方.下面就主要介绍一下关于sequence对象的生成,修改,删除等常用的操作:
  阅读全文
posted @ 2006-07-10 15:43 zJun's帛罗阁 阅读(7660) | 评论 (4)编辑 收藏
     摘要: 插入排序,好比是洗扑克一样,我们将牌分作两堆,每次从后面一堆的牌抽出最前端的牌,然后插入前面一堆牌的适当位置。  阅读全文
posted @ 2006-07-10 14:32 zJun's帛罗阁 阅读(499) | 评论 (0)编辑 收藏
     摘要: 顾名思义,就是排序时,最大的元素会如同气泡一样移至右端,其利用比较相邻元素的方法,将大的元素交换至右端,所以大的元素会不断的往右移动,直到适当的位置为止。  阅读全文
posted @ 2006-07-10 11:35 zJun's帛罗阁 阅读(590) | 评论 (0)编辑 收藏
     摘要: 1. UPDATE STATISTICS FOR TABLE tablename
2."could not do a physical order read to fetch next row"
3."DBSERVERNAME不在sqlhosts文件中"
4.导入导出  阅读全文
posted @ 2006-07-06 16:05 zJun's帛罗阁 阅读(1853) | 评论 (0)编辑 收藏
     摘要: 1. Oracle安装完成后的初始口令?
 internal/oracle
  sys/change_on_install
  system/manager
  scott/tiger
  sysman/oem_temp
2. ORACLE9IAS WEB CACHE的初始默认用户和密码?
administrator/administrator
3. oracle 8.0.5怎么创建数据库?
用orainst。如果有motif界面,可以用orainst /m   阅读全文
posted @ 2006-07-06 15:11 zJun's帛罗阁 阅读(2583) | 评论 (0)编辑 收藏
     摘要: 关于vi的常用命令和使用方法,整理于此,便于查阅。  阅读全文
posted @ 2006-07-05 17:15 zJun's帛罗阁 阅读(2736) | 评论 (1)编辑 收藏
     摘要: 大家期待已久的Eclipse 3.2 版本发布了. 此次发布是开源社区中最大型的一次,Eclipse旗下的10个子项目将一同发布最新版本。从Eclipse 3.1 到 Eclipse 3.2 版本. 总共有30,000 处bugs fix以及提升.  阅读全文
posted @ 2006-07-03 15:56 zJun's帛罗阁 阅读(528) | 评论 (0)编辑 收藏
     摘要: Log4J的配置文件(Configuration File)就是用来设置记录器的级别、存放器和布局的,它可接key=value格式的设置或xml格式的设置信息。通过配置,可以创建出Log4J的运行环境。  阅读全文
posted @ 2006-06-28 16:42 zJun's帛罗阁 阅读(57056) | 评论 (14)编辑 收藏
原文在 这里

//当短信超过70个汉字时短信的第一部分
E0 00 00 00               //4byte 数据总长度
05 00 00 00               //4byte 命令号
3F 38 0B 01               //4byte 流水号
31 3B 6E 0B A2 84 61 F0   //8byte msg_id
30 35 37 37 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  //21byte Dest_Id
00 00 00 00 00 00 00 00 00 00  //10byte  Service_Id
00                        //1byte TP_pid
01                        //1byte TP_udhi
08                        //1byte Msg_Fmt
38 36 31 33 37 35 30 32 34 33 33 30 33 00 00 00 00 00 00 00 00  //21byte Src_terminal_Id
00                        //Registered_Delivery
8B                        //Msg_Length

06 08 04 00 2A      //06表示短信正文内容从6+2的位置开始读取
02                        //超长短信总条数
01                        //序号
00 61 00 61 00 61 00 61 00 61 00 61 00 61 00 61 00 61 00 61 4E 00 4E 2A 4E BA 6C 11 4E 3B 4E 49 52 A1 5B 9E 57 28 8F D9 4E 2A 4E BA 6C 11 4E 3B 4E 49 52 A1 5B 9E 57 28 8F D9 4E 2A 4E BA 6C 11 4E 3B 4E 49 52 A1 5B 9E 57 28 8F D9 4E 2A 4E BA 6C 11 4E 3B 4E 49 52 A1 5B 9E 57 28 8F D9 4E 2A 4E BA 6C 11 4E 3B 4E 49 52 A1 5B 9E 57 28 8F D9 4E 2A 4E BA 6C 11 4E 3B 00 61 00 61 00 61 00 61 00 61 00 61  //短信内容

00 00 00 00 00 00 00 00   //8byte Reserved


//当短信超过70个汉字时短信的第二部分
78 00 00 00
05 00 00 00
49 38 0B 01
31 3B 74 8B A2 84 62 0D
30 35 37 37 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00
00
01
08
38 36 31 33 37 35 30 32 34 33 33 30 33 00 00 00 00 00 00 00 00
00
23
06 08 04 00 2A     //06表示短信正文内容从6+2的位置开始读取
02                       //超长短信总条数
02                       //序号

00 61 00 61 00 61 00 61 00 62 00 62 00 62 00 62 00 62 00 62 00 62 00 62 00 62 00 62  //短信内容
00 00 00 00 00 00 00 00 00 //8byte Reserved

posted @ 2006-05-19 14:55 zJun's帛罗阁 阅读(1430) | 评论 (0)编辑 收藏
     摘要: 转贴自天堂鸟BBS上的一片贴子,详细介绍了CMPP3.0状态报告表,值得收藏,故转贴于此。  阅读全文
posted @ 2006-05-19 14:26 zJun's帛罗阁 阅读(2279) | 评论 (0)编辑 收藏
     摘要: Java作为一种面向对象的开发语言,对实现设计模式提供了良好的支持,并且提供了许多默认的实现,比如:通过Java中的Observable类和Observer接口可以方便的实现观察者模式。  阅读全文
posted @ 2006-05-18 10:54 zJun's帛罗阁 阅读(1916) | 评论 (2)编辑 收藏

导航

<2006年5月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

统计

常用链接

留言簿(15)

随笔分类

随笔档案

相册

收藏夹

博客

文档

站点

论坛

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜