JavaMail的常用类介绍
ref:http://www.cn-java.com/www1/?action-viewnews-itemid-2634[@more@]事先说明: 没用过JavaMail的人可能看不懂这些介绍,不过不要紧,后面的文章有具体的实例,到时也可倒回来查看这些类的用法. (1) javax.mail.Properties类 JavaMail需要Properties来创建一个session对象。它将寻找字符串"mail.smtp.host",属性值就是发送邮件的主机. 用法: Properties props = new Properties (); props.put("mail.smtp.host", "smtp.163.com");//可以换上你的smtp主机名。 (2) javax.mail.Session类
将printStackTrace转换为string
将printStackTrace转换为string[@more@]String s = null;try { throw new Exception("An exception thrown!");} catch (Exception e) { Writer w = new StringWriter(); e.printStackTrace(new PrintWriter(w)); s = w.toString(); } System.out.println(s);
[原]Trim of C
C的精华毫无疑问是指针.用活指针,让C程序更具效率.[@more@]char* trim(char *str){char *ptr = NULL;if (str){ptr = str;while ( *ptr == ' ')++ptr;str = ptr;if ( *ptr == '' ) //if the string is blank space, return strreturn str;for (ptr = str; *ptr; ++ptr);for (--ptr; *ptr == ' '; --ptr);*(++ptr) = '';}return str;}
创建用户
1创建用户create user userName identified by password;创建用户 userName,密码为 password[@more@]2给用户授权grant dba to userName; --授予DBA权限grant unlimited tablespace to userName;--授予不限制的表空间grant select any table to userName; --授予查询任何表grant select any dictionary to userName;--授予 查询 任何字典 3 撤权: revoke 权限... from 用户名; 4数据库安装完成后,有两个系统级的用户 : 1) system 默认密码为 :manager 2) sys 默认密码为 :change_on_install 例子:crea
AskTom 关于first_value() last_value()的解释
Hi Tom, a Short question In this query, I expect column "a" and "b" to have the same value select table_name, column_id, column_name, first_Value(column_name) over (partition by table_name order by column_id) a, last_value(column_name) over (partition by table_name order by column_id desc) b from all_tab_columns where table_name='ALL_ALL_TABLES'; TABLE_NAME COLUMN_ID COLUMN_NAME A B ALL_ALL_TABLES 1 OWNER OWNER OWNER ALL_ALL_TABLES 2 TABLE_NAME OWNER TABLE_NAME ... ALL_ALL_TA
相同表结构,如何做联合查询(已解决)
2张表,表结构完全一样,只是存储的数据不同,请问怎样做联合查询;如:table A:name age-------- ------a &n...
fgets,fputs,gets,puts 总结
fgets,fputs,gets,puts 总结[@more@]fgets(由文件中读取一字符串) 相关函数 open,fread,fscanf,getc 表头文件 include<stdio.h> 定义函数 har * fgets(char * s,int size,FILE * stream); 函数说明 fgets()用来从参数stream所指的文件内读入字符并存到参数s所指的内存空间,直到出现换行字符、读到文件尾或是已读了size-1个字符为止,最后会加上NULL作为字符串结束。 返回值 gets()若成功则返回s指针,返回NULL则表示有错误发生。 范例 #include<std
mingw&msys安装过程
mingw&msys安装过程[@more@] 1. 到官网下安装文件mingw-get-inst-20111118.exe;http://sourceforge.net/projects/mingw/files/MinGW/ Wiik:http://www.mingw.org/wiki/Getting_Started2. 安装mingw,并随带安装MSYS.3. 运行C:MinGWmsys1.0msys.bat,下装支持复制的rxvt包: mingw-get install msys-rxvt 或者:mingw-get install msys-mintty4. 修改msys.bat,用rxvt取代cmd窗口 start %WD%rxvt -backspacekey -sl 5000 -fg White -bg "#008B8B" +sb -fn "Consolas-14" -tn msys -geometry 80x30 -e /b
tar命令参数列表
1.压缩一组文件为tar.gz后缀。 # tar cvf backup.tar /etc #gzip -q backup.tar 或 # tar cvfz backup.tar.gz /etc/[@more@]2.释放一个后缀为tar.gz的文件。 #gunzip backup.tar.gz #tar xvf backup.tar 或 # tar xvfz backup.tar.gz 3.用一个命令完成压缩 #tar cvf - /etc/ | gzip -qc > backup.tar.gz 4.用一个命令完成释放 # gunzip -c backup.tar.gz | tar xvf - 5.如何解开tar.Z的文件? # tar xvfz backup.tar.Z 或 # uncompress backup.tar.Z #tar xvf backup.tar 6.如何解开.tgz文件? #gunzip backup.tgz
字符串转化为时间的方法
类似于oracle的to_date.SimpleDateFormat df = new SimpleDateFormat("yyyyMMddhhmmss"); String dateString = "20071128175545"; try { Date date = df.parse(dateString); System.out.println(date.toLocaleString()); } catch (Exception ex) { System.out.println(ex.getMessage());} }[@more@]
决策树的经典构造算法(一)——ID3
ID3算法是1986年由Quilan提出的,它是一个从上到下、分而治之的归纳过程。ID3算法的核心是:在决策树各级结点上选择属性时,通过计算信息增益来选择属性,以使得在每一个非叶结点进行测试时,能获得关于被测试记录最大的类别信息。其具体方法是:检测所有的属性,选择信息增益最大的属性产生决策树结点,由该属性的不同取值建立分支,再对各分支的子集递归调用该方法建立决策树结点的分支,直到所有子集仅包含同一类别的数据为止。最后得到一棵决策树,它可以用来对新的样本进行分类。[@more@] 有关信息增益的定义以及具体的计算方法和
Journey into Partitioning Methods
Partitioning, the best thing that happened to Oracle since sliced bread — perhaps that trite analogy has a grain of truth in this case. Sliced bread gave mankind the ability to tackle the monolithic loaf by breaking it into bite-sized pieces, not unlike what partitioning does for our Oracle tables. The slices hold patties, tomatoes, cheese, and all the relishes you may want to fit in — analogous to data in the table. However, a sandwich made from the slices is still a logical entity — just li
sybase iq中的load语句4
在导入的数据中可能有些是业务系统产生的乱码,但是在抽取的时候没有处理,这时可以在load处理:数据如下:a|111|888|888b|222|2006-12-11|2007-11-13数据结构如下:CREATE TABLE TEST( A char(10), b integer, c date, d date);[@more@]可以看到第一行数据中888是错误的日期数据,我们希望把这个数据处理成日期型的NULL值。Load语句如下:LOAD TABLE test2(a '|',b '|',c '|' null('888'),d 'x0dx0a' null('888') )FROM 'c: est.txt' ESCAPES OFFQUOTES Off format ASCIIWITH CHECKPOINT ON;ref: http://gavin-wu.itpub.net/post/35205/4
[原]IQ 导出操作实例子
关于SybaseIQ导出data的例子很少,在这里分别用三种方法output出data,与大家分享.[@more@]/*select * from gz_user.bill_test;select * from gz_user.bill_test;select 1;output to /home/sybase/billliang/script/bill3.txtformat asciidelimited by '|'quote '';commit;*//*select * from gz_user.bill_test># bill2.datcommit;*/set temporary Option Temp_Extract_Append = 'ON';set temporary option temp_extract_name1 = '/home/sybase/billliang/script/bill3.txt';set temporary option temp_extract_name2 = '';set tempor
Minus Intersect用法
Minus第一个查询结果中与第二个查询结果不相同的记录 Intersect返回第一个查询结果中与第二个查询结果中相同的记录[@more@]SELECT c FROM ATESTWHERE a = 3INTERSECTSELECT c FROM ATESTWHERE a = 7;SELECT c FROM ATESTWHERE a = 3MINUSSELECT c FROM ATESTWHERE a = 7;
ora_rowscn伪列介绍和使用
下面一段英文是官方SQL Reference里的说明:For each row,ORA_ROWSCNreturns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides. You can obtain a more fine-grained approximation of the SCN by creating your tables with row-level dependency tracking.Please
sybase iq load tabe语句5
最近在做sybase iq load数据工作,记录些心得:如果infile是固定长度和格式的文件,可以使用下面的load table方法: [@more@]truncate table gz_user.MSC_RCF;commit;load table gz_user.MSC_RCF( MD_RECORD_TYPE ascii(2),MD_IMSI ascii(15),MD_DIALLED_DIGITS ascii(24),MD_SERVICE_TYPE ascii(2),MD_SERVICE_ID ascii(4),MD_MSC_SMTMSC ascii(15),MD_CELL_ID_ORIG ascii(13),MD_MS_CLASS_MARK ascii(1),MD_START_DATE ascii(6),MD_START_TIME ascii(6),MD_CHARGEABLE_TIME ascii(6),MD_DATA_VOL ascii(6),MD_DATA_VOL_REF ascii(6),MD_PU
Oracle: 表连接提示
1 use_hash 关键点是:驱动表是小表 select /*+ use_hash(e,b) parallel(e,4) parallel(b,4) */ e.name from emp e, bonus b where e.name = b.ename[@more@]2 use_merge 提示强制执行一个排序合并操作 select /*+ use_merge(e,b) parallel(e,4) parallel(b,4) */ e.name from emp e, bonus b where e.name = b.ename3 use_nl 提示强制对目标表执行嵌套循环连接 select /*+ use_nl(e) */ e.name from emp e, bonus b where e.name = b.ename4 star 提示强制使用星形查询计划;前提是查询中至少有三个表,而且在事实表中存在恰当的
dbms_lock的问题
是用dbms_lock.sleep(3);的时候出错提示如:PLS-00201:identifer 'DBMS_LOCK' must be declared请问:dbms_lock不是系统自带的吗?是不是需要另外设置?需要怎样设置?...
How to check and release lock of sysbase table
check locking: sp_iqlocks check connection: sp_iqconnection kill connection: drop connection <ConnHandle_Number>[@more@]