博文
阿拉伯数字转中文大写(2008-05-03 15:47:00)
摘要:import java.util.HashMap;public class TestFinal { private final static HashMap hm_upper = new HashMap();//大写 private final static HashMap hm_dw = new HashMap();//单位 private final static String str_upper[] = new String[]{ "零","壹","贰","叁","肆","伍","陆","柒","捌","玖" }; //定位到万亿,够用了 private final static String str_dw[] = new String[]{ "","拾","佰","仟","萬","拾","佰","仟","億", "拾","佰","仟","萬" }; //初始化 static{ //大写 for(int i = 0;i < str_upper.length;i++){ hm_upper.put(i, str_upper[i]); } //单位 for(int i = 1;i <= str_dw.length;i++){ hm_dw.put(i,str_dw[i-1]); } } /** * 转换函数 * @param num * @return */ public String rtnConvertRMB(String num){ char str[] = num.toCharArray(); int j = str.length; String strNum = ""; for(int i = 0;i <......
ORACLE 列转行(2008-01-08 10:16:00)
摘要:--note:利用分析函数功能
SELECT t1.table_name, substr(MAX(sys_connect_by_path(t1.column_name, ';')), 2) column_name --分号分隔FROM (SELECT a.table_name,a.column_name,row_number() over(PARTITION BY a.table_name ORDER BY a.column_id) rn--column_id rnFROM user_tab_cols a--order by table_name,column_idwhere a.table_name='TABLE_NAME') t1START WITH t1.rn = 1CONNECT BY t1.table_name = PRIOR t1.table_nameAND t1.rn - 1 = PRIOR t1.rnGROUP BY t1.table_name;......
oracle 数组使用(2008-01-08 10:06:00)
摘要:--------------------一维数组--------------------------DECLARETYPE emp_ssn_array IS TABLE OF NUMBER --NUMBER为所存数据类型INDEX BY BINARY_INTEGER; --索引下标类型
best_employees emp_ssn_array;worst_employees emp_ssn_array;
BEGINbest_employees(1) := '123456';best_employees(2) := '888888';
worst_employees(1) := '222222';worst_employees(2) := '666666';
FOR i IN 1..best_employees.count LOOPDBMS_OUTPUT.PUT_LINE('i='|| i || ', best_employees= ' ||best_employees(i)|| ', worst_employees= ' ||worst_employees(i));END LOOP;
END;
---------------------- 多维数组 ------------------------ DECLARE
TYPE emp_type IS RECORD --首先申明类型,相当于C++结构体( emp_id employee_table.emp_id%TYPE,emp_name employee_table.emp_name%TYPE,emp_gender employee_table.emp_gender%TYPE );
TYPE emp_type_array......
spring事务配置(2007-09-18 14:47:00)
摘要:<beans
<!--spring数据源配置--> <bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://localhost:3306/test</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value>mysql</value> </property> </bean>
<!--sessionFactory 配置hibernate 映射--> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="DataSource" /> </property> <property name="hi......
常用DOS命令参数的中文详解 (2006-12-28 15:26:00)
摘要:
常用DOS命令参数的中文详解 dir [D:][PATH][NAME][[/A][:attrib]][/o:[sorted][/s][/b][/l][/c[h]
(1)dir /a:attrib 缺省包含所有文件(系统文件.隐含文件)
attrib[:][h/-h]只显示隐含文件或非隐含文件.
[r/-r]只显示只读文件或非只读文件
[s/-s]只显示系统文件或非系统文件
[a/-a]只显示要归档文件或非归档文件
(2)/o[:]sorted:缺省完全按字母顺序,子目录显示在文件之前
/o[n/-n]:按字母顺序或按文件名顺序/反向显示
[e/-e]:按扩展名字母顺序/反向显示
[d/-d]:按时间顺序/反向显示
[s/-s]:按大小从大到小或/反向显示
[g/-g]:按子目录先于文件或文件先于子目录
(3)/s 参数:对当前目录及其子目录中所有文件进行列表
列名:Dir /s/a/o:n c:\>PRN
将c盘上的所有子目录和文件按隶属关系并根据子目录和文件字母顺序打印输出
(4)/B 参数:将只显示文件名与扩展名
(5)/L 参数:将全部用小写字母对文件或子目录进行列表
训练:
dir /a 列当前目录所有文件(含隐含及系统文件)
dir /ah 列隐含文件(包含子目录(隐含的) dir /a-h
dir /as 列系统文件 dir /a-s
dir /ad 列子目录 dir /a-d
dir /o 按字母顺序
dir /B 只显示文件名与扩展名
二、attrib [+r|-r] [+a|-a] [+s|-s] [+h|-h] [d: ] [name] [/s]
缺省 attrib name 显示文件的(文件)属性
attrib io.sys (或子目录)
shr c:\ io.sys 指定为系统(s) 隐含(h) 只读(r)文件
也可以attrib *.sys 显示扩展名为sys的文件属性
参数 [+r|-r] 将文件属性设置或解除 只读属性
[+a|-a] 将文件属性设置或解除 归档属性
[+h|-h] 将文件属性设置或解除 隐含属性 (尤其对子目录也起作用)
/s 参数 将当前及当前子......
命令集(2006-12-28 11:35:00)
摘要:杀windows进程:ntsd -c q -p PID
xp下还有两个好东东tasklist和tskill。tasklist能列出所有的进程,和相应的信息。tskill能查杀进程,语法很简单:tskill 程序名!!
1.取得对方IP地址如XX.XX.XX.XX,方法太多不细讲了。
2.判断对方上网的地点,开个DOS窗口键入 TRACERT XX.XX.XX.XX 第4和第5行反映的信息既是对方的上网地点。
3.得到对方电脑的名称,开个DOS窗口键入 NBTSTAT -A XX.XX.XX.XX 第一行是对方电脑名称 第二行是对方电脑所在工作组 第三行是对方电脑的说明
4.在Windows目录下有一文件名为LMHOSTS.SAM,将其改名为LMHOSTS,删除其内容,将对方的IP及电脑名按以下格式写入文件: XX.XX.XX.XX 电脑名
5.开DOS窗口键入 NBTSTAT -R
6.在开始-查找-电脑中输入对方电脑名,出现对方电脑点击即可进入。
以上方法请不要乱用,本人对你用上面的方法所惹出的麻烦概不负责,请慎重。 对付上面进攻的最好办法就是隐藏你的IP地址。
......
SQL select实例(2006-12-28 09:31:00)
摘要:
-1、查找员工的编号、姓名、部门和出生日期,如果出生日期为空值,--显示日期不详,并按部门排序输出,日期格式为yyyy-mm-dd。select emp_no ,emp_name ,dept ,isnull(convert(char(10),birthday,120),'日期不详') birthdayfrom employeeorder by dept
--2、查找与喻自强在同一个单位的员工姓名、性别、部门和职称select emp_no,emp_name,dept,titlefrom employeewhere emp_name<>'喻自强' and dept in(select dept from employeewhere emp_name='喻自强')
--3、按部门进行汇总,统计每个部门的总工资select dept,sum(salary)from employeegroup by dept
--4、查找商品名称为14寸显示器商品的销售情况,--显示该商品的编号、销售数量、单价和金额select a.prod_id,qty,unit_price,unit_price*qty totpricefrom sale_item a,product bwhere a.prod_id=b.prod_id and prod_name='14寸显示器'
--5、在销售明细表中按产品编号进行汇总,统计每种产品的销售数量和金额select prod_id,sum(qty) totqty,sum(qty*unit_price) totpricefrom sale_itemgroup by prod_id
--6、使用convert函数按客户编号统计每个客户1996年的订单总金额select cust_id,sum(tot_amt) totpricefrom saleswhere convert(char(4),order_date,120)='1996'group by cust_id
--7、查找有销售记录的客户编号、名称和订单总额select a.cust_id,cust_name,sum(tot_amt) totpricefrom customer a,sales bwhere a.cust_id=b.cust_idgroup by a.cu......
Hibernate实现对多个表进行关联查询(2006-12-28 08:58:00)
摘要:Hibernate实现对多个表进行关联查询?
String sTest = "from tBookInfo book, BookSelection sel where book.id = sel.bookId"; Collection result = new ArrayList(); Transaction tx = null; try { Session session = HibernateUtil.currentSession(); tx = session.beginTransaction(); Query query = session.createQuery(sql); result = query.list(); tx.commit(); } catch (Exception e) { throw e; } finally { HibernateUtil.closeSession(); } ArrayList sList = (ArrayList) result; Iterator iterator1 = sList.iterator(); while (iterator1.hasNext()) { Object[] o = (Object[]) iterator1.next(); tBookInfo bookInfo = (tBookInfo) o[0]; BookSelection bookSelect = (BookSelection) o[1]; System.out.println("BookInfo-Title: " + bookInfo.getTitle()); System.out.println("BookSelection-BookSelectionId: " + bookSelect.getId()); } ......
struts的体系结构(2006-12-28 08:57:00)
摘要:struts的体系结构?下面我们就从分别从视图、控制、模型和Struts的配置文件struts-config.xml来介绍struts的体系结构。
(1)视图:主要由JSP建立,Struts自身包含了一组可扩展的自定义标签库(Tag1 ib),可以简化创建用户界面的过程。
(2)模型:模型主要是表示一个系统的状态和业务逻辑。在Struts中,系统的状态主要由ActiomForm Bean体现,对于业务逻辑通常由JavaBean或EJB组件来实现。
(3)控制器:控制器主要由ActionServlet类和Action类来实现,ActionServlet类是Struts框架中的核心组件,主要负责接收HTTP请求信息。根据配置文件struts-config.xml的配置信息,把请求转发合适的Action对象。Action类负责调用模型的方法,更新模型的状态,并帮助控制应用程序的流程。
(4)配置文件struts-config.xml:当ActionServlet接收HTTP请求信息时,如何决定把用户请求转发给哪个Action对象呢?这就需要一些描述用户请求路径和Action映射关系的配置信息。在Struts中.这些配置映射信息都存储在特定的XML 文件Struts—config.xml中,在该配置文件中,每一个Action的映射信息都通过一个(action)元素来配置。这些配置信息在系统启动时会被读入内存,供Struts在运行期间使用,在内存中,每一个(action)元素都对应一个ActionMapping类的实例。......
统计java源代码的物理行,逻辑行,注释行(2006-12-26 17:40:00)
摘要://不是纯注释行的算作逻辑行
package com.regex;import java.io.*;import java.net.URLDecoder;import java.util.regex.*;public class Regex { private int REMARK=0; private int LOGIC=0; private int PHYSIC=0; boolean start=false;
/** * @param args */ public static void main(String[] args) { //测试方法 // TODO Auto-generated method stub Regex re=new Regex(); re.regCount("Regex.java"); System.out.println("remark Line: "+re.REMARK); System.out.println("logic Line: "+re.LOGIC); System.out.println("physic Line: "+re.PHYSIC);
}/** * @author BlueDance * @param s * @deprecated count */ public void regCount(String s){ String url=null; try { url=URLDecoder.decode(this.getClass().getResource(s).getPath(),"UTF-8"); } catch (Exception e) { e.printStackTrace(); // TODO: handle exception&nbs......
