??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧美区自拍先锋,最美情侣韩剧在线播放,少妇av在线http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397347.html甜咖?/dc:creator>甜咖?/author>Wed, 03 Apr 2013 04:12:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397347.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/397347.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397347.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/397347.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/397347.html

Java遍历Map
public static void main(String[] args) {

  Map<String, String> map = new HashMap<String, String>();
  map.put("1", "value1");
  map.put("2", "value2");
  map.put("3", "value3");
  
  //W一U:普遍使用Q二ơ取?br />  System.out.println("通过Map.keySet遍历key和valueQ?);
  for (String key : map.keySet()) {
   System.out.println("key= "+ key + " and value= " + map.get(key));
  }
  
  //W二U?br />  System.out.println("通过Map.entrySet使用iterator遍历key和valueQ?);
  Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
  while (it.hasNext()) {
   Map.Entry<String, String> entry = it.next();
   System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
  }
  
  //W三U:推荐Q尤其是定w大时
  System.out.println("通过Map.entrySet遍历key和value");
  for (Map.Entry<String, String> entry : map.entrySet()) {
   System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
  }

  //W四U?/font>
  System.out.println("通过Map.values()遍历所有的valueQ但不能遍历key");
  for (String v : map.values()) {
   System.out.println("value= " + v);
  }
 }

Java遍历Set

?set 的遍? 
1.q代遍历Q? 
Set<String> set = new HashSet<String>();  
Iterator<String> it = set.iterator();  
while (it.hasNext()) {  
  String str = it.next();  
  System.out.println(str);  
}  
  
2.for循环遍历Q? 
for (String str : set) {  
      System.out.println(str);  
}  
  
  
优点q体现在泛型 假如 set中存攄是Object  
  
Set<Object> set = new HashSet<Object>();  
for循环遍历Q? 
for (Object obj: set) {  
      if(obj instanceof Integer){  
                int aa= (Integer)obj;  
             }else if(obj instanceof String){  
               String aa = (String)obj  
             }  
              ........  
}  

当一个h找不到出路的时候,最好的办法是当前能做好的事情做到极_做到无h能及?/div>


]]>ORACLE同一个数据库导入Ӟ数据q保存在原来的表I间?http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397346.html甜咖?/dc:creator>甜咖?/author>Wed, 03 Apr 2013 04:07:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397346.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/397346.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397346.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/397346.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/397346.html今天在研I了一下关于ORACLE的导入导出的功能Q周五快要下班的时候给同事新徏一个表I间Q将同一个数据库中的某个用户下的表导入新的表I间上,建好表空间和用户后,直接?nbsp;exp ,imp 来导入数据到新的表空_查是发现后来导入的数据还在原来的表空间上Q(周五那天的我是用工具~辑DMP文gQ修攚w的表I间名后导入的)Q后来想h了eygle的书上写了关于这个的问题Q于是今天就来试验了一下?/p>

W一U:修改用户的一些权限?/strong>

首先使用sytem帐户登陆

--创徏新表I间的用?/strong>

SQL> create user pangzi identified by pangzi default tablespace pangzi temporary tablespace temp;

用户已创建?/p>

--授给新用户一般的权限

SQL> grant export full database to pangzi;

授权成功?/p>

SQL> grant import full database to pangzi;

授权成功?/p>

SQL> grant connect,resource to pangzi;

授权成功?/p>

SQL> grant create procedure to pangzi;

授权成功?/p>

SQL> grant create job to pangzi;

授权成功?/p>SQL> grant create view to pangzi;

授权成功?/p>

SQL> grant create synonym to pangzi;

授权成功?/p>

--从这里开始将是增加的Qؓ了导入的数据,不放在原来的表空间上

SQL> grant dba to pangzi;

--收回用户的umlimited tablespace权限

SQL> revoke unlimited tablespace from pangzi;

--讄新创建的用户可用syb表空间的大小0Q原数据所在的表空间ؓsybQ?/strong>

SQL> alter user pangzi quota 0 on syb;

--讄新创建的用户可用pangzi表空间的大小不限?/strong>

 

SQL> alter user pangzi quota unlimited on pangzi;

--收回DBA权限

SQL> revoke dba from pangzi;

执行导入数据

C:\Users\dyspangzi>imp pangzi/pangzi@testdev file=syb.dmp full=y

 

Import: Release 10.2.0.3.0 - Production on 星期?nbsp;4?nbsp;21 17:48:54 2012

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

 

q接? Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

 

l由常规路径?nbsp;EXPORT:V10.02.01 创徏的导出文?/p>

 

警告: q些对象?nbsp;SYB 导出, 而不是当前用?/p>

 

已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导?/p>

. 正在?nbsp;SYB 的对象导入到 PANGZI

. . 正在导入?nbsp;                    "ALL_SALES"导入?nbsp;        360 ?/p>

. . 正在导入?nbsp;                      "COUPONS"导入?nbsp;          6 ?/p>

. . 正在导入?nbsp;                    "CUSTOMERS"导入?nbsp;          5 ?/p>

. .中间部分内容省略Q都是导入的信息

 

 

. . 正在导入?nbsp;                     "REG_EXPS"导入?nbsp;          1 ?/p>

. . 正在导入?nbsp;                "SALARY_GRADES"导入?nbsp;          4 ?/p>

卛_启用U束条g...

成功l止导入, 没有出现警告?/p>

导入成功Q我们看导的表已l在新的表空间中?/strong>

SQL> show user
USER ?"PANGZI"
SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
DYSPANGZI                      PANGZI
CUSTOMERS                      PANGZI
PRODUCT_TYPES                  PANGZI
PRODUCTS                       PANGZI
PURCHASES                      PANGZI
EMPLOYEES                      PANGZI
SALARY_GRADES                  PANGZI
PURCHASES_WITH_TIMESTAMP       PANGZI
PURCHASES_TIMESTAMP_WITH_TZ    PANGZI
PURCHASES_WITH_LOCAL_TZ        PANGZI
COUPONS                        PANGZI

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
PROMOTIONS                     PANGZI
ORDER_STATUS                   PANGZI
PRODUCT_CHANGES                PANGZI
MORE_PRODUCTS                  PANGZI
MORE_EMPLOYEES                 PANGZI
DIVISIONS                      PANGZI
JOBS                           PANGZI
EMPLOYEES2                     PANGZI
ALL_SALES                      PANGZI
PRODUCT_PRICE_AUDIT            PANGZI
REG_EXPS                       PANGZI

已选择22行?nbsp;                     

W二U:使用EXPDP和IMPDP来导入和导出

       使用expdp来导出,首先要ؓ一个参数来指定一个\?#8212;—directoryQexpdp是在服务器端工作Q导出的文g需要放在本地目录,q个参数是保存导出文g的位|。这个可以自己创建,也可以是默认的,我自己创Z一个,名字是expdir

SQL> CREATE OR REPLACE DIRECTORY expdir AS '/var/backup';

 

目录已创建?/p>

 

SQL> select * from dba_directories;

 

OWNER        DIRECTORY_NAME      DIRECTORY_PATH

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

SYS             ADMIN_DIR            /ade/aime_10.2_lnx_push/oracle/md/admin

 

SYS             DATA_PUMP_DIR       /usr/app/oracle/product/10.2.0/db_1/rdbms/log/

 

SYS             WORK_DIR             /ade/aime_10.2_lnx_push/oracle/work

 

SYS             EXPDIR                /var/backup

--l用h予读写权?/strong>

 

 

SQL> grant read,write on directory expdir to syb;

开始导出数?/strong>

[oracle@dyspangzi ~]$ expdp dumpfile=syb.dmp directory=expdir;

Export: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012 18:06:46

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "SYB"."SYS_EXPORT_SCHEMA_01":  dumpfile=syb.dmp directory=expdir
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 1.375 MB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
. . exported "SYB"."DYSPANGZI"                           48.50 KB     659 rows
. . exported "SYB"."ALL_SALES"                           13.68 KB     360 rows
       中间导出信息省略

.  . exported "SYB"."REG_EXPS"                            5.437 KB       1 rows
. . exported "SYB"."SALARY_GRADES"                       5.710 KB       4 rows
. . exported "SYB"."PRODUCT_PRICE_AUDIT"                     0 KB       0 rows
Master table "SYB"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYB.SYS_EXPORT_SCHEMA_01 is:
  /var/backup/syb.dmp
Job "SYB"."SYS_EXPORT_SCHEMA_01" successfully completed at 18:07:11

 

导出成功后查看一下刚才创建目录里边的内容

[root@dyspangzi var]# cd backup
[root@dyspangzi backup]# ls -l
总计 720
-rw-r--r-- 1 oracle oinstall   3472 04-21 18:07 export.log
-rw-r----- 1 oracle oinstall 729088 04-21 18:07 syb.dmp

多了两个文gQ一个是日志文g一个是导出的数据文Ӟ在导入的时候需要这两个文g。下面开始导入?/p>

===================================================================================

出现了第一个错?/strong>

[oracle@dyspangzi ~]$ impdp pangzi/pangzi dumpfile=syb.dmp directory=expdir remap_tablespace=syb:pangzi

Import: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012 18:45:35

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name EXPDIR is invalid

出现了错误,后来发现q个是因为新用户pangzi没有对目录的d权限造成的,于是加上权限

SQL> grant read,write on directory expdir to pangzi;

授权成功?/p>

==================================================================================

出现了第二个错误

[oracle@dyspangzi ~]$ impdp pangzi/pangzi dumpfile=syb.dmp directory=expdir remap_tablespace=syb:pangzi

Import: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012 18:47:38

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-31655: no data or metadata objects selected for job
ORA-39154: Objects from foreign schemas have been removed from import
Master table "PANGZI"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "PANGZI"."SYS_IMPORT_FULL_01":  pangzi/******** dumpfile=syb.dmp directory=expdir remap_tablespace=syb:pangzi
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Job "PANGZI"."SYS_IMPORT_FULL_01" successfully completed at 18:47:41

q个是由于原来的用户和现在的不一样了Q加上这个参数就好了  remap_schema=syb:pangzi

=====================================================================================================

下面是没有Q何错误的导入?/strong>

[oracle@dyspangzi ~]$ impdp pangzi/pangzi dumpfile=syb.dmp directory=expdir remap_schema=syb:pangzi remap_tablespace=syb:pangzi

Import: Release 10.2.0.1.0 - Production on Saturday, 21 April, 2012 18:49:24

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Master table "PANGZI"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "PANGZI"."SYS_IMPORT_FULL_01":  pangzi/******** dumpfile=syb.dmp directory=expdir remap_schema=syb:pangzi remap_tablespace=syb:pangzi
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "PANGZI"."DYSPANGZI"                        48.50 KB     659 rows
. . imported "PANGZI"."ALL_SALES"                        13.68 KB     360 rows
     中间部分导入信息省略

. . imported "PANGZI"."PURCHASES_WITH_TIMESTAMP"         5.609 KB       1 rows
. . imported "PANGZI"."REG_EXPS"                         5.437 KB       1 rows
. . imported "PANGZI"."SALARY_GRADES"                    5.710 KB       4 rows
. . imported "PANGZI"."PRODUCT_PRICE_AUDIT"                  0 KB       0 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
Job "PANGZI"."SYS_IMPORT_FULL_01" successfully completed at 18:49:37

成功导入Q!Q!

查看默认的表I间

SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
DYSPANGZI                      PANGZI
CUSTOMERS                      PANGZI
PRODUCT_TYPES                  PANGZI
PRODUCTS                       PANGZI
PURCHASES                      PANGZI
EMPLOYEES                      PANGZI
SALARY_GRADES                  PANGZI
PURCHASES_WITH_TIMESTAMP       PANGZI
PURCHASES_TIMESTAMP_WITH_TZ    PANGZI
PURCHASES_WITH_LOCAL_TZ        PANGZI
COUPONS                        PANGZI

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
PROMOTIONS                     PANGZI
ORDER_STATUS                   PANGZI
PRODUCT_CHANGES                PANGZI
MORE_PRODUCTS                  PANGZI
MORE_EMPLOYEES                 PANGZI
DIVISIONS                      PANGZI
JOBS                           PANGZI
EMPLOYEES2                     PANGZI
ALL_SALES                      PANGZI
PRODUCT_PRICE_AUDIT            PANGZI
REG_EXPS                       PANGZI

已选择22行?/p>

此表I间中没有烦引,所以第一U方法也没有报错Q如果出现有索引的第一U方法还得增加几步,{我明天扑ֈ周五那个数据再来再着做试验?/strong>

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

今天Ҏd司找来了那天导的数据库,回来做实验。采用第一U方法不可行Q虽然说可以使用IMP  加indexs参数来导Z些烦引,但是导入的时候L莫名其妙的错误,估计q是我没弄好Q所以ؓ了省事还是直接用W二U吧Q方便,无错?/strong>



]]>
Oracle 把一个表中的数据插入到另外一个表?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397344.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Wed, 03 Apr 2013 04:05:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397344.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/397344.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397344.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/397344.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/397344.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">1.?a target="_blank" title="Oracle" style="color: #b32bd5; ">Oracle</a>中可以用下面两种Q?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">01: <br />     create table newtable   as select * from oldtable;//用于复制前未创徏新表newtable不存在的情况 <br />02: <br />      insert into newtable   select * from oldtable;//已经创徏了新表newtable 的情?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">注意Q第一U方式只是复制了表结构,但是主键什么的q没有复制进去,所以用的时候要心在意?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">2.如果想简单快速的复制表结构,而不需要oldtable里面的数?可以用下面的语句Q?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">    create table newtable   as  select * from oldtable where 1=2;(把数据过滤掉)</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">3.如过newtable 和oldtable的表l构不同Q可以用下面的方式:</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; "> create table newtable  as select  s.c1,s.c2  from oldtable s;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; "> </p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">4.如果想重新命名newtable的列名:</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">在oracle?</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; "> create table  newtable(id,name1) as select  s.c1,s.c2  from oldtable s;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">或?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; "> create table  newtable as select  s.c1 ,s.c2  from oldtable s;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">在mysql中恐怕只能用W二U方式了?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">5.如果是只需要把一部分的oldtable中的数据d到newtable中。可以这P</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; "> create table newtable   as (select * from oldtable where ...);//加whereqo条g</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">6.最常见的情冉|id列新表中要用Qƈ且和旧表中的不同Q用下面的语句可以了Q我们可以重新徏一个sequenceQ?/p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">create table yang(id,name) as select hibernate_sequence.nextval,t.ename from emp t;</p><p style="color: #333333; font-family: tahoma, 宋体; line-height: 22px; background-color: #efefef; ">7.要注意,导出表的时候不能用select...into语句?/p><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/397344.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2013-04-03 12:05 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397344.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ssh 登陆redhat linux时中文显CZؕ码解x?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397345.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Wed, 03 Apr 2013 04:05:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397345.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/397345.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397345.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/397345.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/397345.html</trackback:ping><description><![CDATA[<span style="color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">Ҏ1Q?/span><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">在shell中执行LANG=en 语a设ؓp可以了.SSH下很多中文都不支?</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">Ҏ2Q?/div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">在用sshq程控制redhat服务器时Q中文显CZؓq。这个问题困C好久Q后来发C改i18nq个文g能够修正q?/div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "> </div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">Ҏ如下Q修?etc/sysconfig/i18n文gQ将其改成以下内容:</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">LANG="zh_CN.GB18030"<br style="padding: 0px; margin: 0px; " />LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"<br style="padding: 0px; margin: 0px; " />SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"<br style="padding: 0px; margin: 0px; " />SYSFONT="lat0-sun16"</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">重启机器Q问题应该解决了?/div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">Ҏ3Q?/div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">如果你用的是putty Q你只要在字W编码里选择utf-8正怺</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; "> </div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">补充Q这样做的后果是Q在linux启动Ӟ那些提示文字中文都变成了“Q?#8221;W号。如果不习惯的话ssh昄端改成英文吧。如下:</div><div style="margin: 0px; color: #555555; font-family: 宋体, 'Arial Narrow', arial, serif; line-height: 28px; background-color: #ffffff; ">LANG=en_US  </div><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/397345.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2013-04-03 12:05 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2013/04/03/397345.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java实现DES加密法http://www.aygfsteel.com/weishuangshuang/archive/2013/03/29/397153.html甜咖?/dc:creator>甜咖?/author>Fri, 29 Mar 2013 07:58:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/03/29/397153.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/397153.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/03/29/397153.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/397153.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/397153.html一?/span>java实现DES加密法
Z实现一对密钥对整个目所有加密解密文仉适用的方?采用先生成一对密?保存到xml文g?以后获得U匙和公钥只需要从xml文g中取得就可以?
/**
* 把成生的一对密钥保存到DesKey.xml文g?/span>
*/
public static void saveDesKey(){     
    try {
        SecureRandom sr = new SecureRandom();
        //为我们选择的DES法生成一个KeyGenerator对象
        KeyGenerator kg = KeyGenerator.getInstance ("DES" );
        kg.init (sr);
        FileOutputStream fos = new FileOutputStream("C:/DesKey.xml");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
        //生成密钥
        Key key = kg.generateKey();
      oos.writeObject(key);
      oos.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
}




获取密钥Ҏ如下:

/**

* 获得DES加密的密钥。在交易处理的过E中应该定时?/span>
* 换密钥。需要JCE的支持,如果jdk版本低于1.4Q则需?/span>
* 安装jce-1_2_2才能正常使用?/span>
* @return   Key q回对称密钥
*/
    public static Key getKey() {
        Key kp = null;
        try {
              String fileName = "conf/DesKey.xml";
              InputStream is = DesUtil.class.getClassLoader()
                      .getResourceAsStream(fileName);
              ObjectInputStream oos = new ObjectInputStream(is);
              kp = (Key) oos.readObject();
              oos.close();
        } catch (Exception e) {
              e.printStackTrace();
        }
        return kp;
    }


文g采用DES法加密文g

/**
* 文gfileq行加密q保存目标文件destFile?br />

* @param file
*         
要加密的文g ?/span>c:/test/srcFile.txt
* @param destFile
*         加密后存攄文g?nbsp;如c:/加密后文?/span>.txt
*/

public static void encrypt(String file, String destFile) throws Exception {

        Cipher cipher = Cipher.getInstance("DES");

        cipher.init(Cipher.ENCRYPT_MODE, getKey());

        InputStream is = new FileInputStream(file);

        OutputStream out = new FileOutputStream(dest);

        CipherInputStream cis = new CipherInputStream(is, cipher);

        byte[] buffer = new byte[1024];

        int r;

        while ((r = cis.read(buffer)) > 0) {

              out.write(buffer, 0, r);

        }

        cis.close();

        is.close();

        out.close();

    }


文g采用DES法解密文g


/**
文gfileq行加密q保存目标文件destFile?br />

* @param file
*         
已加密的文g 如c:/加密后文?/span>.txt
* @param destFile
*         解密后存攄文g?nbsp;如c:/ test/解密后文?/span>.txt
*/

public static void decrypt(String file, String dest) throws Exception {
        Cipher cipher = Cipher.getInstance("DES");
        cipher.init(Cipher.DECRYPT_MODE, getKey());
        InputStream is = new FileInputStream(file);
        OutputStream out = new FileOutputStream(dest);
        CipherOutputStream cos = new CipherOutputStream(out, cipher);
        byte[] buffer = new byte[1024];
        int r;
        while ((r = is.read(buffer)) >= 0) {
              cos.write(buffer, 0, r);
        }
        cos.close();
        out.close();
        is.close();
    } 

]]>
linux服务器RPM包制?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2013/03/22/396834.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Fri, 22 Mar 2013 01:59:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2013/03/22/396834.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/396834.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2013/03/22/396834.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/396834.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/396834.html</trackback:ping><description><![CDATA[<strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">1、查看操作系l版本和内核版本</strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#uname –a</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#more /etc/redhat-release</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">2</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">、创建相关目?/strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">/usr/src/redhat/SOURCES //存放源代码,补丁Q图标等文g?/p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/SPECS //存放用于理rpm制作q程的spec文g?/p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/BUILD //解压后的文g存放在这里?/p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/RPMS //存放由rpmbuild制作好的二进制包?/p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "><br style="word-wrap: break-word; " />/usr/src/redhat/SRPMS //存放由rpmbuild制作好的源码包?/p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#mkdir -p /usr/src/redhat/</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#cd /usr/src/redhat/</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#mkdir SOURCES SPECS BUILD RPMS SRPMS</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">3</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">、下?/strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">Nginx</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">源码?/strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">下蝲源码包到SOURCES目录Q不需要解?/p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#wget <a target="_blank" style="word-wrap: break-word; color: #336699; ">http://nginx.org/download/nginx-1.3.9.tar.gz</a></p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><span style="color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">4、手工创建SPEC文g</span><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">׃spec文g是由spec语言~写的,h意spec语言的语法?/p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#cd /usr/src/redhat/SPECS/</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#cat < nginx.spec > EOC</p><table cellspacing="0" style="word-wrap: break-word; empty-cells: show; border-collapse: collapse; border-style: solid; border-color: #e3edf5; table-layout: auto; width: 696px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; font-size: 14px; line-height: 21px; text-align: start; background-color: #ffffff; "><tbody style="word-wrap: break-word; "><tr style="word-wrap: break-word; "><td width="568" style="word-wrap: break-word; padding: 4px; border-style: solid; border-color: #e3edf5; overflow: hidden; ">  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Summary:  High Performance Web Server</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Name:  nginx</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Version:  1.3.9</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Release:  el5</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">License:  GPL</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Group:  Applications/Server</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Source:  <a target="_blank" style="word-wrap: break-word; color: #336699; ">http://nginx.org/download/nginx-1.3.9.tar.gz</a></p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">URL:  <a target="_blank" style="word-wrap: break-word; color: #336699; ">http://nginx.org/</a></p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Distribution:  Linux</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">Packager:  JingSheng <<a href="mailto:jingsheng1@staff.sina.com.cn" target="_blank" style="word-wrap: break-word; color: #336699; ">jingsheng1@staff.sina.com.cn</a>></p>  <br style="word-wrap: break-word; " />  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%description</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">nginx  [engine x] is a HTTP and reverse proxy server</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%prep</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">useradd  nginx -s /sbin/nologin</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">rm -rf  $RPM_BUILD_DIR/nginx-1.3.9</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">zcat  $RPM_SOURCE_DIR/nginx-1.3.9.tar.gz | tar -xvf -</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%build</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">cd  $RPM_BUILD_DIR/nginx-1.3.9</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">./configure  --user=nginx --group=nginx --prefix=/usr/local/nginx/ --with-http_stub_status_module  --with-http_ssl_module</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">make</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%install</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">cd  $RPM_BUILD_DIR/nginx-1.3.9</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">make  install</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%preun</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">if [ -z  "`ps aux | grep nginx | grep -v grep`" ];then</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">killall  nginx >/dev/null</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">exit 0</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">fi</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">%files</p>  <p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; ">/usr/local/nginx</p>  </td></tr></tbody></table><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#:?开头是注释Qrpm会忽略它?br style="word-wrap: break-word; " />SummaryQ简单描qY件?br style="word-wrap: break-word; " />Name Q定义rpm的名U?br style="word-wrap: break-word; " />Version: 定义软g版本<br style="word-wrap: break-word; " />Release: 发行版本<br style="word-wrap: break-word; " />License: 定义许可?br style="word-wrap: break-word; " />Group: 软g分类<br style="word-wrap: break-word; " />Source: 源码下蝲地址<br style="word-wrap: break-word; " />URL: 源码相关|站<br style="word-wrap: break-word; " />Distribution: 发行版系?br style="word-wrap: break-word; " />Packager: 打包人的信息</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">scription:软g详细描述Q可多行<br style="word-wrap: break-word; " />%prep QY件编译之前的处理Q如解压?br style="word-wrap: break-word; " />%build Q开始编译YӞ如make<br style="word-wrap: break-word; " />%install :开始安装YӞ如make install<br style="word-wrap: break-word; " />%files :指定哪些文g需要被打包Q如/usr/local/nginx<br style="word-wrap: break-word; " />%preun :定义卸蝲之前的动作,如杀掉进E?/p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">5</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">、开?/strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">RPM</strong><strong style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">制作</strong><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">在制作RPM包之前,需要安装必要的~译工具</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">#yum install -y gcc rpm-build pcre-devel</p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">开始编译生成rpm?/p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "># rpmbuild-bb nginx.spec</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "></p><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; ">注意Q如果安装生成报错,请将安装q的东东全部去除Q再重新打包</p><br style="word-wrap: break-word; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; " /><p align="left" style="word-wrap: break-word; margin: 0px; padding: 0px; color: #444444; font-family: Tahoma, Helvetica, SimSun, sans-serif; background-color: #ffffff; "># rpm –qpl *.rpm 查看rpm包含哪些</p><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/396834.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2013-03-22 09:59 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2013/03/22/396834.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Xmanagerq程q接Redhat5http://www.aygfsteel.com/weishuangshuang/archive/2013/02/28/395874.html甜咖?/dc:creator>甜咖?/author>Thu, 28 Feb 2013 12:06:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/02/28/395874.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/395874.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/02/28/395874.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/395874.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/395874.html最q一直在折腾linuxQcentos、redhat装了又装Q到最后还是装了redhat?/p>

以前多少接触qlinuxQ但是都不深入(q次虽然也是皮毛Q但是稍微知道了一些东东,现在卖了)Q这ơ从零开始自己折腾linuxQ确实是被linux折腾了。linux跟windows实有很多不同,有机会再l箋介绍Q这ơ先说一下用Xmanagerq程q接Redhat的经历?/p>

Xmanager不多说了Q是一N怸错的理工具。但是,如果要让Xmanagerq程q接redhatQ其实远E连接,主要q是惌做成跟windows的远E桌面一L东西Q图形界面方便啦Q?br />

只是q次配置Xmanager相当痛苦Q按照网上各U资料对redhatq行配置Q然后不停的rebootQ但是,xmanagerLq不上?br />

q其中,修改的文件包括:

/usr/share/gdm/defaults.confq个gdm的配|文Ӟ主要是以下内容:

Enable=true

DisplaysPerHost=10

Port=177

q有/etc/inittab文gQ主要是首先默认U别?Q这个文件貌似在安装的时候就已经默认?了。id:5:initdefault:

然后最后一行的“x:5:respawn:/etc/X11/prefdm -nodaemon”调整为:

x:5:respawn:/usr/sbin/gdm

当然Q还得改Q?/p>

依然?usr/share/gdm/defaults.confQ在[security]中调整以下的|

AllowRoot=true

AllowRemoteRoot=true

AllowRemoteAutoLogin=true

如果开着防火墙,那还是要攑ּ177端口Q我暂时把防火墙关了?/p>

rebootQrebootL很重要的Q?/p>

如果上述调整完成之后Q依然无法连接,我就是这L情况Q连接不上啊Q!Q!

又随便找了几文章,也许跟hosts文g有关pdQ?br />

打开/etc/hosts文g一看,I的Q!Q?/p>

在其中加?27.0.0.1 localhostQrebootQ我L喜欢rebootQ这h较干净Q比较彻底!

在Xstart中配|好相应的参敎ͼ一定要在Commond中选择“GNOME”Q这样再RunQXbrowser久q的redhat桌面打开了!



]]>
SecureCRT使用SSHq接linux时后自动断开http://www.aygfsteel.com/weishuangshuang/archive/2013/02/28/395873.html甜咖?/dc:creator>甜咖?/author>Thu, 28 Feb 2013 12:04:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/02/28/395873.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/395873.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/02/28/395873.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/395873.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/395873.html今天开发的同事Q和我说

SecureCRTq接到IDC服务器,老超时断开Q媄响工作了

研究了下?/p>

因ؓ客户端与服务?/strong>之间存在路由器,防火墙以及ؓ了本w的安全性,在超q特定的旉后就会把I闲q接断开。或者是服务器端讄了断开I闲q接?br style="line-height: normal !important; word-break: break-all" />解决ҎQ?/font>
既然会断开时的空闲连接,那么我们应该让客户端与服务器之间的q接“?#8221;hQ方法有两个:
从服务器斚w入手Q?br style="line-height: normal !important; word-break: break-all" />修改/etc/ssh/sshd_config配置文g ClientAliveInterval 300Q默认ؓ0Q?br style="line-height: normal !important; word-break: break-all" />q个参数的是意思是?分钟Q服务器向客L发一个消息,用于保持q接
service sshd reload 生效
从客L入手Q?br style="line-height: normal !important; word-break: break-all" />上面是配|需要服务器权限Q如果没有服务器权限则可以用这个方法,其思想是:客户端向服务器发一个消息,用于保持q接
secureCRT在选项 l端 反空?中设|每隔多秒发送一个字W串Q或者是NO-OP协议?br style="line-height: normal !important; word-break: break-all" />puttyQputty -> Connection -> Seconds between keepalives ( 0 to turn off ), 默认?, 改ؓ300


CentOS 5q程SSHq接时讑֮
操作pȝQCentOS 5.6    SSH版本QOpenSSH_4.3p2
|上很多文章都说Q远ESSHq接的超时设定是?etc/ssh/sshd_config里,使用ClientAliveInterval和ClientAliveCountMax选项Q我原来也这么认为的Q不q一直没配置q超时?/span>
今天配置了一下,发现q个是不对的Q正的配置是在/etc/profile里,使用TMOUT选项q行控制Q如TMOUT=300Q设定超旉隔ؓ300U?/span>


]]>
关于多用戯E桌面的实现——WIN7 ?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393877.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Sun, 06 Jan 2013 08:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393877.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/393877.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/393877.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/393877.html</trackback:ping><description><![CDATA[<p>q程桌面服务使局域网 (LAN) 上的计算机可以连接到服务器(也称E计机Qƈq行位于服务器上的程序。这可以只需要在1台机器上安装应用E序Q其他机器共享用。远E桌面连接用远E桌面服务技术,使一台计机可远E控制另一台计机?/p><p>windows q程l端服务是单用户的,也就是说通过q程d到服务器Ӟ服务器本地将黑屏。如何做C用本地dq是q程dQ同一时刻容许多个用户操作服务器计机?/p><p>首先Q?/p><p>要安装工具包Q需要从微Y下蝲(q程服务器管理工?<a >http://www.microsoft.com/downloads/zh-cn/details.aspx?displaylang=zh-cn&FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d</a> )Q安装升U包后,在控刉?-E序和功?-打开或关闭WINDOWS功能---q程服务器管理工?-角色理工具--q程桌面服务工具Q选中前面的选择框?br />在开?-命o框输入cmd,在弹出的Dos界面输入netstat -na ,如果出现 3389 端口Q就说明q程l端已经启动了?/p><p>然后Q?/p><p>1, 下蝲 补丁UniversalTermsrvPatchQ功能就是去除单用户登陆的限Ӟ允许多h多用户同时ƈ行访问登录?br />2, Ҏ你的pȝq行对应的程序:<br /> 32位系l请q行 UniversalTermsrvPatch-x86.exe;<br /> 64位系l请q行 UniversalTermsrvPatch-x64.exe?br />3, 需要管理员权限。右键点E序Q选择以管理员w䆾q行?br />4, 破解后需要重启生效?br />5, 备䆾文gQ?\windows\system32\termsrv.dll.backup.(如果惌原设|?请将备䆾文g改名为termsrv.dll替换破解的文件即?</p><p>q程桌面的其它可能的讄Q?br /> q行gpedit.msc打开l策略,计算机配|-理模板QWindowslgQ远E桌面服务-q程桌面会话L-q接-“限制q接数量”Q如果将状态设|ؓ“用”?#8220;未配|?#8221;Q则?#8220;l策?#8221;U别上不强制限制q接的数量?/p><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/393877.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2013-01-06 16:00 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393877.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Windows Server2003q程桌面多用戯接的问题http://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393874.html甜咖?/dc:creator>甜咖?/author>Sun, 06 Jan 2013 07:59:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393874.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/393874.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393874.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/393874.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/393874.html在Windows 2003pȝ上的q程桌面实际上就是终端服务,虽然q程桌面最初在Windows XP上就已经存在Q但׃Windows XP的远E桌面功能,只能提供一个用户用计机Q因此用率q不高。而Windows 2003提供的远E桌面功能则可供多用户同时用,在其上可以运行程序、保存文件和使用|络资源Q在很多斚w可以像用终端一Pq且在管理及配置斚w比原来的l端服务更方ѝ要更好地发挥远E桌面的作用p对远E桌面进行相应的配置?www.2cto.com  
  l策略编译器Qgpedit.mscQ配|?/div>
 
使用l策略编译器配置用户q程q接C及用户会话数Q?/div>
1Q?#8220;开?#8221;—>“q行”输入gpedit.msc回R打开l策略编译器->“计算机配|?#8221;->“理模板”->“windowslg”->“l端服务”,右侧鼠标右键选择“限制q接?#8221;打开属性,选择“讄”—>选择“已启?#8221;Q? “TS    允许的最大连接数”填写你所需要的数量Q例如:20。确定完成最大连接数限制讄。双?#8220;会话”->选择“为断开的会话设|时间限?#8221;右键选择属??#8220;讄”->xuanze选择“已启?#8221;-?#8220;l束断开q接会话”填写合适的旉Q五分钟为好?/div>
 
  l端服务配置(Tscc.msc)的?/div>
 
  使用l端服务配置可以更改本地计算Z该连接的属性、添加新q接或设|服务器。打开“控制面板”—?#8220;理工具”Q单?#8220;l端服务器配|?#8221;启动l端服务配置H口?/div>
 
  1 单击左边H口?#8220;q接”,双H口卛_现可选的RDP-TCPq接Q右?#8220;RDP-TCP”Q?#8220;属?#8221;出现RDP-Tcp属性对话框Q主要配|有:
  (1)q接数设|?可在“|卡”选项中更攏V设|更多地q接数可使更多的用户同时d服务器。默认最多同时两个用戯接,如果惌?个以上的用户同时使用q程桌面功能Q则必须安装l端服务Q安装后可以Q意设定用h制? www.2cto.com  
  安装l端服务可通过Windows?#8220;d/删除E序”—?#8220;d/删除Windowslg”中,选中“l端服务?#8221;来添加,Ҏ需要完成相应配|,完成l端服务安装Q重启机器生效?/div>
  ׃每个用户q接q程桌面后最占?2MB左右的内存,因此可根据服务器内存大小来设定用hQ一般用h不要太多Q以免媄响性能。如256MB内存可设定用h8个左叻I512MB内存可设?0~30个?/div>
  (2)调整颜色分L?颜色深度):?#8220;客户端设|?#8221;中。限刉色深度可以增接性能Q尤其是对于慢速链接,q且q可以减L务器负蝲?#8220;q程桌面”q接的当前默认最大颜色深度设|ؓ 16 位?/div>
  选中“颜色深度最大?#8221;Q可修改限定的最大颜色深度ؓ8?5?6?4位。若不选中Q则使用d的客L颜色讄?/div>
  (3)让客戯动登??#8220;d讄”选项卡上。这Ҏ通应用非常方便,可加快登录速度Q提高服务效率?/div>
  要用自动登录,需选中“L使用下列d信息”Q在“用户?#8221;中,键入允许自动d到服务器的用L名称Q在“密码”?#8220;认密码”中,键入该用L密码?q样客户端连接时不用再输入用户名和密码Q而自动进入Windows 2003桌面(注意:若此后再有用L录,那么原来的连接将被断开)。若输入不完_则登录时q会要求输入用户名或密码?/div>
  如要x安全的用服务器Q则应选中“L提示密码”以指定该用户在登录到服务器之前始l要被提C入密码,从而限制客L的自动登录?/div>
  (4)对连接自动限制管?单击“会话”Ҏ讑֮。主要用来设定超时的限制Q以侉K放会话所占用的资源,“l束已断开的会?#8221;?#8220;I闲会话限制”的时_一般应用设?分钟较好。对安全性要求高的也可设?#8220;zd会话限制”的时间?#8220;辑ֈ会话限制或者连接被中断?#8221;下的选项Q最好?#8220;l束会话”Q这栯接所占的资源׃被释放?/div>
  (5)讄加密U别:单击“常规”,可指定在l端服务会话期间Q对于客L与远E计机之间发送的所有数据是否强制加密别。分四个U别:W合 FIPS(最高别的加密)、高(加密数据l过?128 位加密?、客L兼容(加密数据l过客户端支持的最大密钥强度加?和低(从服务器发送到客户端的数据不会被加密)?/div>
  (6)启用l端客户音频:?#8220;客户端设|?#8221;下边,默认为禁用,以节U服务器资源。当用户时 Q单?#8220;音频映射”L被禁用的选项Qɾl端客户能用多媒体讑֤。当Ӟ客户端计机也必装有声卡? www.2cto.com  
  如果有多个用戯接到相同的服务器Q则会以同一个用户名d?/div>
 
  (7)启用驱动器映?此项可方便终端与服务器磁盘间文g的相互传送。启用后本地驱动器将作ؓ|络驱动器显C在l端中?/div>
 
  同样q有打印机、剪贴板、com端口{也可设|映。但每设|一个都要占用一定的pȝ资源;所以,一般用h好禁用?/div>
 
  (8)服务器的安全讄:?#8220;权限”,可选择l或用户Q限制其对终端的配置权限。另外,׃只有Administrators ?Remote Desktop Users l的成员可以使用l端服务q接与远E计机q接Q所以可对不同用户分l管理,对于要求安全性高的,可利用NTFS分区讄不同用户的权限?/div>
 
“服务器设|?#8221;—?#8220;限制每个用户使用一个会?#8221;右键选择属性,去除“限制每个用户使用一个会?#8221;的勾选,认完成讄?/div>
  整个多用Lq程q接讄到此l束?/div>

]]>在Windows Server 2003中安装终端服务器lghttp://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393876.html甜咖?/dc:creator>甜咖?/author>Sun, 06 Jan 2013 07:59:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393876.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/393876.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2013/01/06/393876.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/393876.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/393876.html
在远E管理方面,Windows Server 2003pȝ一个最明显的进步就是增加了“q程桌面”功能。这样一来,从Windows 2000保留下来的终端服务似乎就昑־有点多余了。然而情况ƈ不是q样Q因为在不安?#8220;l端服务?#8221;的前提下Q?#8220;q程桌面”功能的可理性比较有限。搭建终端服务器以后Q对Windows 2000 Server和Windows Server 2003pȝ的远E管理操作将更加灉|?br />在Windows Server 2003QSP1Q中默认没有安装l端服务器组Ӟ用户需要手动添加该lg。安装终端服务组件的步骤如下所qͼ

步骤/Ҏ

  1. W?步,在开始菜单中依次单击“控制面板”→“d或删除程?#8221;菜单,打开“d或删除程?#8221;H口。然后单?#8220;d/删除Windowslg”按钮Q打开“Windowslg向导”对话框。在“lg”列表中选中“l端服务?#8221;复选框Q如?008112107所C?br />?008112107 选中“l端服务?#8221;复选框
    在Windows Server 2003中安装终端服务器lg
  2. W?步,打开“配置警告”对话框,提示用户关于IE安全配置斚w的信息。因为配|终端服务器的目的主要是Zq程理Windows Server 2003服务器,对于览Internet斚w的要求ƈ不高Q因此直接单?#8220;?#8221;按钮。返?#8220;Windowslg”对话框,选中“l端服务器授?#8221;复选框Qƈ单击“下一?#8221;→“下一?#8221;按钮卛_Q如?008112108所C?br />?008112108 “配置警告”对话?/div>
    在Windows Server 2003中安装终端服务器lg
  3. W?步,在打开的ؓ应用E序兼容性选择默认权限对话框中列出两种安装模式Q即“完整安全模式”?#8220;宽松安全模式”。选择不同的模式会应用到Windows Server 2003pȝ的不同安全别。选中“完整安全模式”单选框Qƈ单击“下一?#8221;按钮Q如?008112109所C?br />?008112109 选中“完整安全模式”单选框
    在Windows Server 2003中安装终端服务器lg
  4. W?步,打开指定l端服务器许可证服务器对话框Q提C用戯l端服务器必d120天内与Windows Server 2003l端服务器许可证服务器连接才能保证正怋用。由于在“Windowslg”对话框中选中?#8220;l端服务器授?#8221;复选框Q则意味着q台Windows Server 2003l端服务器将同时作ؓ许可证服务器。因此选中“使用下列许可证服务器”单选框Qƈ在编辑框中输入这台服务器的名U或IP地址。设|完毕单?#8220;下一?#8221;按钮Q如?008112110所C?br />?008112110 输入许可证服务器IP地址
    在Windows Server 2003中安装终端服务器lg
  5. W?步,在打开的终端服务器授权模式对话框中Q要求用h定这台终端服务器使用的授权模式。选中“每设备授权模?#8221;单选框Qƈ单击“下一?#8221;按钮Q如?008112111所C?br />?00811211 选中“每设备授权模?#8221;单选框
    在Windows Server 2003中安装终端服务器lg
  6. W?步,打开“l端服务器授权安装程?#8221;对话框,要求用户选择安装许可证服务器数据库的路径。一般可以保持默认\径,q单?#8220;下一?#8221;按钮Q如?008112112所C?br />?008112112 选择许可证服务器数据库\?/div>
    在Windows Server 2003中安装终端服务器lg
  7. W?步,Windowslg向导开始安装终端服务器和终端服务器授权lgQ在安装q程中要求提供Windows Server 2003QSP1Q系l的安装光盘或指定安装程序\径。完成安装后单击“完成”按钮关闭Windowslg向导Qƈ按照提示重新启动计算机?/div>


]]>SAX解析XMLhttp://www.aygfsteel.com/weishuangshuang/archive/2012/12/25/393468.html甜咖?/dc:creator>甜咖?/author>Tue, 25 Dec 2012 08:52:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2012/12/25/393468.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/393468.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2012/12/25/393468.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/393468.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/393468.htmlpackage com;
  
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.xml.parsers.SAXParser;
  import javax.xml.parsers.SAXParserFactory;
  
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.DefaultHandler;
  
  /**
   * SAX解析XMLQ事仉?/div>
   * 只有两种节点
   * Element Node元素节点
   * Text Node文本节点 
   */
  public class SaxResolveXML {
 
  public static void main(String[] args){
  try {
  SaxResolveXML saxResolveXML = new SaxResolveXML();
  InputStream inStream = new FileInputStream("D:\\xml.xml");
  List<Person> list = saxResolveXML.getList(inStream);
  for(Person person : list){
  System.out.println(person.toString());
  }
  } catch (Exception e) {
  e.printStackTrace();
  }
 
  }
 
  public List<Person> getList(InputStream inStream) throws Exception {
  SAXParserFactory factory = SAXParserFactory.newInstance();
  SAXParser parse = factory.newSAXParser();
  SaxResolve saxResolve = new SaxResolve();
  parse.parse(inStream, saxResolve);
  inStream.close();
  return saxResolve.getPerson();
  }
 
  private final class SaxResolve extends DefaultHandler {
 
  private List<Person> list = null;
  private Person person = null;
  private String tag = null;
 
  public List<Person> getPerson(){
  return list;
  }
 
  //开始文档事?/div>
  public void startDocument() throws SAXException {
  //初始?/div>
  list = new ArrayList<Person>();
  }
  
  //开始元素语法事? 参数说明Q命名空间、不带命名空间的标签名、含有命名空间前~的标{֐、属?/div>
  public void startElement(String uri, String localName, String qName,
  Attributes atts) throws SAXException {
  if("person".equals(qName)){
  person = new Person();
  person.setId(Integer.parseInt(atts.getValue(0)));
  }
  tag = qName;
  }
 
  //触发文本节点事g  参数说明Q整个xml内容的字W串、当前读到文本类型的开始位|、当前读到文本的数据长度
  public void characters(char[] ch, int start, int length)
  throws SAXException {
  if(tag != null){
  String data = new String(ch, start, length);
  if(tag.equals("name")){
  person.setName(data);
  }else if(tag.equals("age")){
  person.setAge(Integer.parseInt(data));
  }
  }
  }
 
  //l束元素语法事g  参数说明Q命名空间、不带命名空间的标签名、含有命名空间前~的标{֐
  public void endElement(String uri, String localName, String qName)
  throws SAXException {
  if("person".equals(qName)){
  list.add(person);
  person = null;
  //对象设ؓI?/div>
  }
  tag = null;
  }
  }
 
 
  /*//开始文档事?/div>
  public void startDocument() throws SAXException {
 
  }
  
  //开始元素语法事? 参数说明Q命名空间、不带命名空间的标签名、含有命名空间前~的标{֐、属?/div>
  public void startElement(String uri, String localName, String qName,
  Attributes atts) throws SAXException {
 
  }
 
  //触发文本节点事g  参数说明Q整个xml内容的字W串、当前读到文本类型的开始位|、当前读到文本的数据长度
  public void characters(char[] ch, int start, int length)
  throws SAXException {
 
  }
 
  //l束元素语法事g  参数说明Q命名空间、不带命名空间的标签名、含有命名空间前~的标{֐
  public void endElement(String uri, String localName, String qName)
  throws SAXException {
 
  }
  
  public void endDocument() throws SAXException {
 
  }
  
  public void endPrefixMapping(String prefix) throws SAXException {
 
  }
  
  public void ignorableWhitespace(char[] ch, int start, int length)
  throws SAXException {
 
  }
  
  public void processingInstruction(String target, String data)
  throws SAXException {
 
  }
  
  public void setDocumentLocator(Locator locator) {
 
  }
  
  public void skippedEntity(String name) throws SAXException {
 
  }
  
  public void startPrefixMapping(String prefix, String uri)
  throws SAXException {
 
  }*/
 
  }
  
 
 
 
 xml文g如下Q?/div>
 <?xml version="1.0" encoding="UTF-8"?>
  <persons>
      <person id="1">
          <name>liming</name>
          <age>23</age>
      </person>
      <person id="2">
          <name>lixiangmei</name>
          <age>24</age>
      </person>
  </persons>
  
 
 
 


]]>linux 安装matlabQ运行时找不到各U文件的解决Ҏhttp://www.aygfsteel.com/weishuangshuang/archive/2012/11/16/391464.html甜咖?/dc:creator>甜咖?/author>Fri, 16 Nov 2012 08:24:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2012/11/16/391464.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/391464.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2012/11/16/391464.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/391464.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/391464.html



export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/runtime/glnx86:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/os/glnx86:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/java/jre/glnx86/jre/lib/i386/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/java/jre/glnx86/jre/lib/i386/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/sys/java/jre/glnx86/jre/lib/i386
export XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v716/X11/app-defaults

把以上两行加入系l的环境变量里面Q具体操作如下:
vi /etc/profile
?i 可以编辑这个文Ӟ开始复?br />把上面两行拷贝到q个文g的最下面然后保存可以了Q?br />保存退出时先按一?#8220;ESC”Q然后再?#8220;:wq”可以保存退ZQ?img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/391464.html" width = "1" height = "1" />

]]>
向oracle数据库存储文Ӟq读出文?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2012/10/19/389866.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Fri, 19 Oct 2012 05:17:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2012/10/19/389866.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/389866.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2012/10/19/389866.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/389866.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/389866.html</trackback:ping><description><![CDATA[<div>/**</div><div> <span style="white-space:pre"> </span> * 从数据库中查询IRI和KLO模型的数据,q下载到本地</div><div> <span style="white-space:pre"> </span> * @param dataTime         时次</div><div> <span style="white-space:pre"> </span> * @param outIRIFilePath   IRI文g下蝲到本地的路径</div><div> <span style="white-space:pre"> </span> * @param outKLOFilePath   KLO文g下蝲到本地的路径</div><div> <span style="white-space:pre"> </span> * @param outAnaFilePath   插值文件下载到本地的\?/div><div> <span style="white-space:pre"> </span> */</div><div> <span style="white-space:pre"> </span>@SuppressWarnings("static-access")</div><div> <span style="white-space:pre"> </span>public static void selectBlogInfo(String dataTime, String outIRIFilePath, String outKLOFilePath, String outAnaFilePath) {</div><div> <span style="white-space:pre"> </span>try {</div><div> <span style="white-space:pre"> </span>Connection con = DBConnectionManager.getInstance().getConnection();</div><div> <span style="white-space:pre"> </span>Statement st = con.createStatement();</div><div> <span style="white-space:pre"> </span>String sql = "select * from MODELTEC where DATATIME=to_date('"+dataTime+"', 'YYYY-mm-dd HH24')";</div><div> <span style="white-space:pre"> </span>ResultSet rs = st.executeQuery(sql);</div><div> <span style="white-space:pre"> </span>if (rs.next()) {</div><div> <span style="white-space:pre"> </span>Blob blod = rs.getBlob("IRIDATA");</div><div> <span style="white-space:pre"> </span>InputStream reader = blod.getBinaryStream();</div><div> <span style="white-space:pre"> </span>dataTime = dataTime.replaceAll("-", "");</div><div> <span style="white-space:pre"> </span>dataTime = dataTime.replaceAll(" ", "");</div><div> <span style="white-space:pre"> </span>String iriFilePath = outIRIFilePath+"\\"+dataTime+"0000.iri.grd";</div><div> <span style="white-space:pre"> </span>File file = new File(iriFilePath);</div><div> <span style="white-space:pre"> </span>OutputStream writer;</div><div> <span style="white-space:pre"> </span>writer = new BufferedOutputStream(new FileOutputStream(file));</div><div> <span style="white-space:pre"> </span>byte buf[] = new byte[1024];</div><div> <span style="white-space:pre"> </span>for (int i = 0; (i = reader.read(buf)) > 0;) {</div><div> <span style="white-space:pre"> </span>writer.write(buf, 0, i);</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>writer.close();</div><div> <span style="white-space:pre"> </span>reader.close();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>blod = rs.getBlob("IRIDATA");</div><div> <span style="white-space:pre"> </span>reader = blod.getBinaryStream();</div><div> <span style="white-space:pre"> </span>String kloFilePath = outKLOFilePath+"\\"+dataTime+"0000.klo.grd";</div><div> <span style="white-space:pre"> </span>file = new File(kloFilePath);</div><div> <span style="white-space:pre"> </span>writer = new BufferedOutputStream(new FileOutputStream(file));</div><div> <span style="white-space:pre"> </span>buf = new byte[1024];</div><div> <span style="white-space:pre"> </span>for (int i = 0; (i = reader.read(buf)) > 0;) {</div><div> <span style="white-space:pre"> </span>writer.write(buf, 0, i);</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>writer.close();</div><div> <span style="white-space:pre"> </span>reader.close();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>blod = rs.getBlob("ANADATA");</div><div> <span style="white-space:pre"> </span>reader = blod.getBinaryStream();</div><div> <span style="white-space:pre"> </span>String anaFilePath = outAnaFilePath+"\\"+dataTime+"0000.grd";</div><div> <span style="white-space:pre"> </span>file = new File(anaFilePath);</div><div> <span style="white-space:pre"> </span>writer = new BufferedOutputStream(new FileOutputStream(file));</div><div> <span style="white-space:pre"> </span>buf = new byte[1024];</div><div> <span style="white-space:pre"> </span>for (int i = 0; (i = reader.read(buf)) > 0;) {</div><div> <span style="white-space:pre"> </span>writer.write(buf, 0, i);</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>writer.close();</div><div> <span style="white-space:pre"> </span>reader.close();</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>DBConnectionManager.closeConnection();</div><div> <span style="white-space:pre"> </span>if(con!=null){con.close();}</div><div> <span style="white-space:pre"> </span>if(st!=null){st.close();}</div><div> <span style="white-space:pre"> </span>if(rs!=null){rs.close();}</div><div> <span style="white-space:pre"> </span>} catch (SQLException e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>} catch (FileNotFoundException e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>} catch (IOException e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>}</div><div> </div><div> <span style="white-space:pre"> </span>/**</div><div> <span style="white-space:pre"> </span> * 把IRI和KLO模型的文件上传到数据库中</div><div> <span style="white-space:pre"> </span> * @param dataTime     时次</div><div> <span style="white-space:pre"> </span> * @param iriFilePath  要上传IRI文g的绝对\?/div><div> <span style="white-space:pre"> </span> * @param kloFilePath  要上传KLO文g的据对\?/div><div> <span style="white-space:pre"> </span> * @param ANAFilePath  要上传插值文件的据对路径</div><div> <span style="white-space:pre"> </span> */</div><div> <span style="white-space:pre"> </span>@SuppressWarnings("static-access")</div><div> <span style="white-space:pre"> </span>public static void insertBlogInfo(String dataTime, String IRIFilePath, String KLOFilePath, String ANAFilePath) {</div><div> <span style="white-space:pre"> </span>try {</div><div> <span style="white-space:pre"> </span>Connection con = DBConnectionManager.getInstance().getConnection();</div><div> <span style="white-space:pre"> </span>// 处理事务</div><div> <span style="white-space:pre"> </span>boolean defaultCommit;</div><div> <span style="white-space:pre"> </span>defaultCommit = con.getAutoCommit();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>con.setAutoCommit(false);</div><div> <span style="white-space:pre"> </span>Statement st = con.createStatement();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>String sql = "select * from MODELTEC where DATATIME=to_date('"+dataTime+"', 'YYYY-mm-dd HH24')";</div><div> <span style="white-space:pre"> </span>ResultSet rs = st.executeQuery(sql);</div><div> <span style="white-space:pre"> </span>if(rs.next()){</div><div> <span style="white-space:pre"> </span>System.out.println(dataTime+"时次已经入库Q?);</div><div> <span style="white-space:pre"> </span>return ;</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>// 插入一个空对象</div><div> <span style="white-space:pre"> </span>sql = "insert into MODELTEC(ID, DATATIME, IRIDATA, KLODATA, ANADATA) values(" +</div><div> <span style="white-space:pre"> </span>"SEQU_MODEL_ID.nextval, " +</div><div> <span style="white-space:pre"> </span>"to_date('"+dataTime+"','YYYY-mm-dd HH24'), " +</div><div> <span style="white-space:pre"> </span>"empty_blob(), " +</div><div> <span style="white-space:pre"> </span>"empty_blob(), " +</div><div> <span style="white-space:pre"> </span>"empty_blob())";</div><div> <span style="white-space:pre"> </span>st.executeUpdate(sql);</div><div> <span style="white-space:pre"> </span>// 用for update方式锁定数据?/div><div> <span style="white-space:pre"> </span>sql = "select IRIDATA,KLODATA,ANADATA from  MODELTEC where DATATIME=to_date('"+dataTime+"', 'YYYY-mm-dd HH24') for update";</div><div> <span style="white-space:pre"> </span>rs = st.executeQuery(sql);</div><div> <span style="white-space:pre"> </span>if (rs.next()) {</div><div> <span style="white-space:pre"> </span>// 得到java.sql.Blob对象Q然后Cast为oracle.sql.BLOB</div><div> <span style="white-space:pre"> </span>BLOB blob = (BLOB) rs.getBlob("IRIDATA");</div><div> <span style="white-space:pre"> </span>// 到数据库的输出流</div><div> <span style="white-space:pre"> </span>OutputStream outStream = blob.getBinaryOutputStream();</div><div> <span style="white-space:pre"> </span>// q里用一个文件模拟输入流</div><div> <span style="white-space:pre"> </span>InputStream fin = new FileInputStream(new File(IRIFilePath));</div><div> <span style="white-space:pre"> </span>// 输入流写到输出?/div><div> <span style="white-space:pre"> </span>byte[] b = new byte[blob.getBufferSize()];</div><div> <span style="white-space:pre"> </span>int len = 0;</div><div> <span style="white-space:pre"> </span>while ((len = fin.read(b)) != -1) {</div><div> <span style="white-space:pre"> </span>outStream.write(b, 0, len);</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>// 依次关闭Q注意顺序)</div><div> <span style="white-space:pre"> </span>fin.close();</div><div> <span style="white-space:pre"> </span>outStream.flush();</div><div> <span style="white-space:pre"> </span>outStream.close();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>// 得到java.sql.Blob对象Q然后Cast为oracle.sql.BLOB</div><div> <span style="white-space:pre"> </span>blob = (BLOB) rs.getBlob("KLODATA");</div><div> <span style="white-space:pre"> </span>// 到数据库的输出流</div><div> <span style="white-space:pre"> </span>outStream = blob.getBinaryOutputStream();</div><div> <span style="white-space:pre"> </span>// q里用一个文件模拟输入流</div><div> <span style="white-space:pre"> </span>fin = new FileInputStream(new File(IRIFilePath));</div><div> <span style="white-space:pre"> </span>// 输入流写到输出?/div><div> <span style="white-space:pre"> </span>b = new byte[blob.getBufferSize()];</div><div> <span style="white-space:pre"> </span>len = 0;</div><div> <span style="white-space:pre"> </span>while ((len = fin.read(b)) != -1) {</div><div> <span style="white-space:pre"> </span>outStream.write(b, 0, len);</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>// 依次关闭Q注意顺序)</div><div> <span style="white-space:pre"> </span>fin.close();</div><div> <span style="white-space:pre"> </span>outStream.flush();</div><div> <span style="white-space:pre"> </span>outStream.close();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>// 得到java.sql.Blob对象Q然后Cast为oracle.sql.BLOB</div><div> <span style="white-space:pre"> </span>blob = (BLOB) rs.getBlob("ANADATA");</div><div> <span style="white-space:pre"> </span>// 到数据库的输出流</div><div> <span style="white-space:pre"> </span>outStream = blob.getBinaryOutputStream();</div><div> <span style="white-space:pre"> </span>// q里用一个文件模拟输入流</div><div> <span style="white-space:pre"> </span>fin = new FileInputStream(new File(ANAFilePath));</div><div> <span style="white-space:pre"> </span>// 输入流写到输出?/div><div> <span style="white-space:pre"> </span>b = new byte[blob.getBufferSize()];</div><div> <span style="white-space:pre"> </span>len = 0;</div><div> <span style="white-space:pre"> </span>while ((len = fin.read(b)) != -1) {</div><div> <span style="white-space:pre"> </span>outStream.write(b, 0, len);</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>// 依次关闭Q注意顺序)</div><div> <span style="white-space:pre"> </span>fin.close();</div><div> <span style="white-space:pre"> </span>outStream.flush();</div><div> <span style="white-space:pre"> </span>outStream.close();</div><div> <span style="white-space:pre"> </span></div><div> <span style="white-space:pre"> </span>con.commit();</div><div> <span style="white-space:pre"> </span>/* 恢复原提交状?*/</div><div> <span style="white-space:pre"> </span>con.setAutoCommit(defaultCommit);</div><div> <span style="white-space:pre"> </span>DBConnectionManager.closeConnection();</div><div> <span style="white-space:pre"> </span>if(con!=null){con.close();}</div><div> <span style="white-space:pre"> </span>if(st!=null){st.close();}</div><div> <span style="white-space:pre"> </span>if(rs!=null){rs.close();}</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>} catch (SQLException e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>} catch (FileNotFoundException e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>} catch (IOException e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>} catch (Exception e) {</div><div> <span style="white-space:pre"> </span>e.printStackTrace();</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>}</div><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/389866.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2012-10-19 13:17 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2012/10/19/389866.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java Data、String、Long三种日期cd之间的相互{?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388712.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Thu, 27 Sep 2012 09:07:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388712.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/388712.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388712.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/388712.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/388712.html</trackback:ping><description><![CDATA[<div>    <span id="wmqeeuq" class="Apple-tab-span" style="white-space:pre"> </span>// datecd转换为Stringcd</div><div> <span style="white-space:pre"> </span>// formatType格式为yyyy-MM-dd HH:mm:ss//yyyyqMM月dd?HH时mm分ssU?/div><div> <span style="white-space:pre"> </span>// data Datecd的时?/div><div> <span style="white-space:pre"> </span>public static String dateToString(Date data, String formatType) {</div><div> <span style="white-space:pre"> </span>return new SimpleDateFormat(formatType).format(data);</div><div> <span style="white-space:pre"> </span>}</div><div> </div><div> <span style="white-space:pre"> </span>// longcd转换为Stringcd</div><div> <span style="white-space:pre"> </span>// currentTime要{换的longcd的时?/div><div> <span style="white-space:pre"> </span>// formatType要{换的stringcd的时间格?/div><div> <span style="white-space:pre"> </span>public static String longToString(long currentTime, String formatType)</div><div> <span style="white-space:pre"> </span>throws ParseException {</div><div> <span style="white-space:pre"> </span>Date date = longToDate(currentTime, formatType); // longcd转成Datecd</div><div> <span style="white-space:pre"> </span>String strTime = dateToString(date, formatType); // datecd转成String</div><div> <span style="white-space:pre"> </span>return strTime;</div><div> <span style="white-space:pre"> </span>}</div><div> </div><div> <span style="white-space:pre"> </span>// stringcd转换为datecd</div><div> <span style="white-space:pre"> </span>// strTime要{换的stringcd的时_formatType要{换的格式yyyy-MM-dd HH:mm:ss//yyyyqMM月dd?/div><div> <span style="white-space:pre"> </span>// HH时mm分ssU,</div><div> <span style="white-space:pre"> </span>// strTime的时间格式必要与formatType的时间格式相?/div><div> <span style="white-space:pre"> </span>public static Date stringToDate(String strTime, String formatType)</div><div> <span style="white-space:pre"> </span>throws ParseException {</div><div> <span style="white-space:pre"> </span>SimpleDateFormat formatter = new SimpleDateFormat(formatType);</div><div> <span style="white-space:pre"> </span>Date date = null;</div><div> <span style="white-space:pre"> </span>date = formatter.parse(strTime);</div><div> <span style="white-space:pre"> </span>return date;</div><div> <span style="white-space:pre"> </span>}</div><div> </div><div> <span style="white-space:pre"> </span>// long转换为Datecd</div><div> <span style="white-space:pre"> </span>// currentTime要{换的longcd的时?/div><div> <span style="white-space:pre"> </span>// formatType要{换的旉格式yyyy-MM-dd HH:mm:ss//yyyyqMM月dd?HH时mm分ssU?/div><div> <span style="white-space:pre"> </span>public static Date longToDate(long currentTime, String formatType)</div><div> <span style="white-space:pre"> </span>throws ParseException {</div><div> <span style="white-space:pre"> </span>Date dateOld = new Date(currentTime); // Ҏlongcd的毫U数生命一个datecd的时?/div><div> <span style="white-space:pre"> </span>String sDateTime = dateToString(dateOld, formatType); // 把datecd的时间{换ؓstring</div><div> <span style="white-space:pre"> </span>Date date = stringToDate(sDateTime, formatType); // 把Stringcd转换为Datecd</div><div> <span style="white-space:pre"> </span>return date;</div><div> <span style="white-space:pre"> </span>}</div><div> </div><div> <span style="white-space:pre"> </span>// stringcd转换为longcd</div><div> <span style="white-space:pre"> </span>// strTime要{换的Stringcd的时?/div><div> <span style="white-space:pre"> </span>// formatType旉格式</div><div> <span style="white-space:pre"> </span>// strTime的时间格式和formatType的时间格式必ȝ?/div><div> <span style="white-space:pre"> </span>public static long stringToLong(String strTime, String formatType)</div><div> <span style="white-space:pre"> </span>throws ParseException {</div><div> <span style="white-space:pre"> </span>Date date = stringToDate(strTime, formatType); // Stringcd转成datecd</div><div> <span style="white-space:pre"> </span>if (date == null) {</div><div> <span style="white-space:pre"> </span>return 0;</div><div> <span style="white-space:pre"> </span>} else {</div><div> <span style="white-space:pre"> </span>long currentTime = dateToLong(date); // datecd转成longcd</div><div> <span style="white-space:pre"> </span>return currentTime;</div><div> <span style="white-space:pre"> </span>}</div><div> <span style="white-space:pre"> </span>}</div><div> </div><div> <span style="white-space:pre"> </span>// datecd转换为longcd</div><div> <span style="white-space:pre"> </span>// date要{换的datecd的时?/div><div> <span style="white-space:pre"> </span>public static long dateToLong(Date date) {</div><div> <span style="white-space:pre"> </span>return date.getTime();</div><div> <span style="white-space:pre"> </span>}</div><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/388712.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2012-09-27 17:07 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388712.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux操作FTP用户http://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388709.html甜咖?/dc:creator>甜咖?/author>Thu, 27 Sep 2012 09:00:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388709.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/388709.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/27/388709.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/388709.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/388709.htmluseradd 用户?gpsin) -g 当前d用户(root) -d 根目?/home/weiss) -s /sbin/nologin(不是用于d)       
passwd 用户?用户创徏密码)
2、删除用?br />userdel 用户?gpsin)
3、修改用h目录
usermod -d 新目?/home/wei) 用户?gpsin)




]]>
命o操作ftphttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/26/388575.html甜咖?/dc:creator>甜咖?/author>Wed, 26 Sep 2012 05:00:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/26/388575.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/388575.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/26/388575.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/388575.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/388575.html一个要执行的bat文g test.bat
文g内容Qftp -n -s:C:\\config.txt 127.0.0.1
另一个操作ftp的命令文?config.txt
文g内容Q?br />user user
pass
ls
put ......
get ...... 
bye

linuxQ只需要一个文件即可也是sh文g
test.sh
文g内容Qftp -i -n 127.0.0.1
user user pass
bin
ls
put ......
get ...... 
bye


ftp -nv 127.0.0.1 <<EOF
user user pass
bin
prompt
lcd /home
put ......
get ......
quit


]]>
c3p0q接?/title><link>http://www.aygfsteel.com/weishuangshuang/archive/2012/09/20/388187.html</link><dc:creator>甜咖?/dc:creator><author>甜咖?/author><pubDate>Thu, 20 Sep 2012 07:21:00 GMT</pubDate><guid>http://www.aygfsteel.com/weishuangshuang/archive/2012/09/20/388187.html</guid><wfw:comment>http://www.aygfsteel.com/weishuangshuang/comments/388187.html</wfw:comment><comments>http://www.aygfsteel.com/weishuangshuang/archive/2012/09/20/388187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/weishuangshuang/comments/commentRss/388187.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/weishuangshuang/services/trackbacks/388187.html</trackback:ping><description><![CDATA[<div><span style="font-size: 8pt; ">package db;</span></div><div></div><div><span style="font-size: 8pt; ">import java.beans.PropertyVetoException;</span></div><div><span style="font-size: 8pt; ">import java.sql.Connection;</span></div><div><span style="font-size: 8pt; ">import java.sql.SQLException;</span></div><div></div><div><span style="font-size: 8pt; ">import com.mchange.v2.c3p0.ComboPooledDataSource;</span></div><div></div><div><span style="font-size: 8pt; ">public class DBPool {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">private ComboPooledDataSource dataSource;</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">public static Connection con;</span></div><div></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">public DBPool() {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">try {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource = new ComboPooledDataSource();</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setUser("test");</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setPassword("test");</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:orcl");</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setDriverClass("oracle.jdbc.driver.OracleDriver");</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setInitialPoolSize(2);</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setMinPoolSize(1);</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setMaxPoolSize(10);</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setMaxStatements(50);</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setMaxIdleTime(60);</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">dataSource.setAcquireRetryAttempts(3);   </span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">} catch (PropertyVetoException e) {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">public final static DBPool getInstance() {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">return new DBPool();</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">public final Connection getConnection() {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">try {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">return dataSource.getConnection();</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">} catch (SQLException e) {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">return null;</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div><br /><span style="font-size: 8pt; ">        //试Ҏ</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">public static void main(String[] args) throws SQLException {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">con = DBPool.getInstance().getConnection();</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">System.out.println(con);</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">try {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">if (con != null){con.close();}</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">} catch (SQLException e) {</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">e.printStackTrace();</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div><span style="white-space:pre"> </span><span style="font-size: 8pt; ">}</span></div><div><span style="font-size: 8pt; ">}</span><br /><br /><br /><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; ">   <span style="font-size: 8pt; ">//初始化时获取三个q接Q取值应在minPoolSize与maxPoolSize之间。Default: 3 initialPoolSize  <br /></span><span style="font-size: 8pt; ">    cpds.setInitialPoolSize(initialPoolSize);   <br /></span><span style="font-size: 8pt; ">    //q接池中保留的最大连接数。Default: 15 maxPoolSize   <br /></span><span style="font-size: 8pt; ">    cpds.setMaxPoolSize(maxPoolSize);<br /></span><span style="font-size: 8pt; ">    //q接池中保留的最连接数?nbsp;  <br /></span><span style="font-size: 8pt; ">    cpds.setMinPoolSize(minPoolSize);<br /></span><span style="font-size: 8pt; ">    //获得q接的最大等待毫U数。Default: 1000 acquireRetryDelay<br /></span><span style="font-size: 8pt; ">    cpds.setAcquireRetryDelay(acquireRetryDelay);<br /></span><span style="font-size: 8pt; ">    //最大空闲时?60U内未用则q接被丢弃。若?则永不丢弃。Default: 0 maxIdleTime   <br /></span><span style="font-size: 8pt; ">    cpds.setMaxIdleTime(maxIdleTime);<br /></span><span style="font-size: 8pt; ">    //当连接池中的q接耗尽的时候c3p0一ơ同时获取的q接数。Default: 3 acquireIncrement   <br /></span><span style="font-size: 8pt; ">    //cpds.setAcquireIncrement(3);   <br /></span><span style="font-size: 8pt; ">    //?0U检查所有连接池中的I闲q接。Default: 0 idleConnectionTestPeriod   <br /></span><span style="font-size: 8pt; ">    //cpds.setIdleConnectionTestPeriod(60);<br /></span><span style="font-size: 8pt; ">    //q接关闭旉认将所有未提交的操作回滚。Default: false autoCommitOnClose   <br /></span><span style="font-size: 8pt; ">    //cpds.setAutoCommitOnClose(true);<br /></span><span style="font-size: 8pt; ">    //JDBC的标准参敎ͼ用以控制数据源内加蝲的PreparedStatements数量。但׃预缓存的statements属于单个connection而不是整个连接池。所以设|这个参数需要考虑到多斚w的因素。如果maxStatements与maxStatementsPerConnection均ؓ0Q则~存被关闭。Default: 0<br /></span><span style="font-size: 8pt; ">    //cpds.setMaxStatements(1);</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-size: 8pt; ">    //maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements?br /></span><span style="font-size: 8pt; ">    //cpds.setMaxStatementsPerConnection(100);</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><span style="font-size: 8pt; ">    //定义所有连接测试都执行的测试语句。在使用q接试的情况下q个一显著提高试速度。注意:试的表必须在初始数据源的时候就存在。Default: null preferredTestQuery  <br /></span><span style="font-size: 8pt; ">    //cpds.setPreferredTestQuery("select sysdate from dual");   <br /></span><span style="font-size: 8pt; ">    // 因性能消耗大请只在需要的时候用它。如果设为true那么在每个connection提交?nbsp;  <br /></span><span style="font-size: 8pt; ">    // 时候都校验其有效性。徏议用idleConnectionTestPeriod或automaticTestTable   <br /></span><span style="font-size: 8pt; ">    // {方法来提升q接试的性能。Default: false testConnectionOnCheckout   <br /></span><span style="font-size: 8pt; ">    //cpds.setTestConnectionOnCheckout(true);<br /></span><span style="font-size: 8pt; ">    //如果设ؓtrue那么在取得连接的同时校验连接的有效性。Default: false testConnectionOnCheckin   <br /></span><span style="font-size: 8pt; ">    //cpds.setTestConnectionOnCheckin(true);   <br /></span><span style="font-size: 8pt; ">    //定义在从数据库获取新q接p|后重复尝试的ơ数。Default: 30 acquireRetryAttempts   <br /></span><span style="font-size: 8pt; ">    //cpds.setAcquireRetryAttempts(30);     <br /></span><span style="font-size: 8pt; ">    //获取q接p|会引v所有等待连接池来获取连接的U程抛出异常。但是数据源仍有?nbsp;  <br /></span><span style="font-size: 8pt; ">    //保留Qƈ在下ơ调用getConnection()的时候l尝试获取连接。如果设为trueQ那么在试   <br /></span><span style="font-size: 8pt; ">    //获取q接p|后该数据源将x已断开q永久关闭。Default: false breakAfterAcquireFailure   <br /></span><span style="font-size: 8pt; ">    //cpds.setBreakAfterAcquireFailure(false);   </span></p><div>  <span style="font-size: 8pt; ">//两次q接中间隔时_单位毫秒。Default: 1000 acquireRetryDelay</span></div><div><span style="font-size: 8pt; ">  cpds.setAcquireRetryDelay(60000);</span></div><div></div><br /><div clearfix"=""><h2><span style="font-size: 8pt; ">java.lang.AbstractMethodError: oracle.jdbc.driver.OracleResultSetImpl.getClob(异常解决办法</span></h2></div> <div class="wmqeeuq" id="content" mod-cs-content="" text-content="" clearfix"=""> <p><span style="font-size: 8pt; ">最q遇C一个头痛的问题Q可能大家也遇到q。经q多番的询问与查找,l于知道问题原因的所在:异常内容如下Q?/span></p> <p><span style="font-size: 8pt; ">java.lang.AbstractMethodError: oracle.jdbc.driver.OracleResultSetImpl.getClob(Ljava/lang/String;)Ljava/sql/Clob;</span></p> <p><span style="font-size: 8pt; ">问题原因QOracle驱动版本不对</span></p> <p><span style="font-size: 8pt; ">解决办法Q在Oracle服务器上扑ֈq个驱动Q然后cp到Apache的lib目录下,q同是修改环境变量classpathQ保证这个lib/classes12.jar在最前面Q修改完后,重新启动服务Q问题就可以解决?br /></span></p><div>Qojdbc14.jar?span style="font-size: 12px; ">classes12.jar前面Q?/span></div><p> </p></div></div><img src ="http://www.aygfsteel.com/weishuangshuang/aggbug/388187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/weishuangshuang/" target="_blank">甜咖?/a> 2012-09-20 15:21 <a href="http://www.aygfsteel.com/weishuangshuang/archive/2012/09/20/388187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>redhat新徏用户作ؓftp用户http://www.aygfsteel.com/weishuangshuang/archive/2012/09/19/388067.html甜咖?/dc:creator>甜咖?/author>Wed, 19 Sep 2012 06:25:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/19/388067.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/388067.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/19/388067.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/388067.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/388067.htmluseradd gpsin -g root -d /inraw -s /sbin/nologin     #该用户仅用来支持FTP服务Q因此不必让他登录系l?br />gpsin是ftpd的用户名Qroot指定哪个用户可以使用该ftp用户Q?d /inraw 指定ftp的根目录Q?s /sbin/nologin不用于登?br />

passwd gpsin    lgpsin用户讄密码


]]>RedHat 安装rarhttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/19/388066.html甜咖?/dc:creator>甜咖?/author>Wed, 19 Sep 2012 06:21:00 GMThttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/19/388066.htmlhttp://www.aygfsteel.com/weishuangshuang/comments/388066.htmlhttp://www.aygfsteel.com/weishuangshuang/archive/2012/09/19/388066.html#Feedback0http://www.aygfsteel.com/weishuangshuang/comments/commentRss/388066.htmlhttp://www.aygfsteel.com/weishuangshuang/services/trackbacks/388066.html1.下蝲

rarlinux-3.7.1.tar.zip

#unzip rarlinux-3.7.1.tar.zip

#cd rar

#make

#make install

q行 rar --help 可以看到帮助信息Q如果出C列信息:
 #rar: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by rar)
 #rar: /lib/tls/libc.so.6: version `GLIBC_2.7' not found (required by rar)
 则执行:
 #cp -f rar_static /usr/local/bin/rar
 q样可以用rar 命o了?/div>



]]> վ֩ģ壺 | | ɽ| ˳| ˮ| | ר| | | | | ڰ| | ɼ| ͨμ| Ϋ| | | ²| | ƽ| | ͨ| | ʡ| | ֶ| | ԭ| ڳ| ʶ| | | | | Ȫ| ˳| | | ³ľ| Ϫ|