ice world

          There is nothing too difficult if you put your heart into it.
          posts - 104, comments - 103, trackbacks - 0, articles - 0

          2013年2月22日

          這個(gè)問題很多小伙伴都遇到了,網(wǎng)上搜羅了半天也沒找到太好、太完美的解決辦法,有人說是因?yàn)榘惭bIE11時(shí)聯(lián)網(wǎng)了,導(dǎo)致自動(dòng)打了補(bǔ)丁,這個(gè)補(bǔ)丁可以自動(dòng)檢查IE主頁是否損壞,可以通過卸載相應(yīng)的補(bǔ)丁解決,我同時(shí)又找到了另外一個(gè)通過修改hosts文件的方法,貌似目前解決了我的問題,修改方法如下: 使用記事本打開 C:\Windows\System32\drivers\etc\hosts 文件,在最下面追加一行: 127.0.0.1 ieonline.microsoft.com

          posted @ 2016-08-12 10:47 IceWee 閱讀(888) | 評(píng)論 (0)編輯 收藏

          將JDK中BIN文件夾下的 msvcr71.dll 這個(gè)文件復(fù)制到 TOMCAT 中的 BIN 下

          posted @ 2016-01-18 13:43 IceWee 閱讀(433) | 評(píng)論 (0)編輯 收藏

          有段日子沒做記錄了,這段日子一直在排雷(前人埋下的隱患代碼,或者直接說bug),今天這個(gè)雷讓我排了將近大半天,因?yàn)槭钦缴暇€的系統(tǒng),只能看后臺(tái)日志,不能調(diào)試,打印出的異常信息不完整,種種的條件不充分,導(dǎo)致問題很難定位。標(biāo)題上的兩個(gè)異常,第一個(gè)一看就明白是插入的數(shù)值大于數(shù)據(jù)庫字段長度,第二個(gè)多是因?yàn)镹umber類型的字段導(dǎo)致,比如精度不足。

          我們的這次問題原因是程序員在做除法運(yùn)算時(shí)沒有對(duì)除數(shù)進(jìn)行非零判斷,導(dǎo)致計(jì)算出來的數(shù)值非法,插入數(shù)據(jù)庫失敗,請(qǐng)看代碼:
          public static void main(String[] args) {
                  
          double a = 10;
                  
          double b = 0;
                  
          double c = 0;
                  
                  
          double m = a/c;
                  
          double n = b/c;
                  
                  System.out.println(m);
                  System.out.println(n);
              }

          經(jīng)過計(jì)算后,m和n的值分別是多少?沒在實(shí)際開發(fā)中遇到的可能不知道,或者你有個(gè)好習(xí)慣不會(huì)出現(xiàn)這樣的bug,請(qǐng)看結(jié)果:
          Infinity
          NaN

          被除數(shù)非零,除數(shù)為零做除法的結(jié)果是字符串“Infinity”,翻譯成中文就是“無限”,你的中學(xué)數(shù)學(xué)老師可能說過;
          被除數(shù)為零,除數(shù)為零做觸發(fā)的結(jié)果是字符串“NaN”,即不是有效的數(shù)字。

          就是這個(gè)“Infinity”花費(fèi)了我一小天的時(shí)間才定位。下面詳述問題定位的方法。

          異常1:ORA-01438: value larger than specified precision allowed for this column
          了解點(diǎn)數(shù)據(jù)庫的打眼一看就知道插入的數(shù)值超過了表字段長度,但你知道是哪個(gè)表哪個(gè)字段嗎?我不知道,于是網(wǎng)上查閱了下,Oracle數(shù)據(jù)庫服務(wù)器在Linux上。

          命令行登陸到數(shù)據(jù)庫所在服務(wù)器,進(jìn)入Oracle的安裝目錄,假設(shè)是/opt/oracle/
          進(jìn)入到如下目錄:/opt/oracle/admin/實(shí)例名/udump
          中間的數(shù)據(jù)庫實(shí)例名根據(jù)實(shí)際情況修改,udump目錄下會(huì)有一堆的.trc文件,這些文件記錄了所有操作當(dāng)前數(shù)據(jù)庫出現(xiàn)異常的堆棧信息。為了定位問題,我將該目錄下的所有.trc文件都刪除了(當(dāng)然,刪除之前把udump目錄整個(gè)備份了),再進(jìn)行一次系統(tǒng)的業(yè)務(wù)操作,查看一下udump目錄,發(fā)現(xiàn)立刻生成一個(gè)新 的.trc文件,打開查看(內(nèi)容片段):
          Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
          With the Partitioning
          , Real Application Clusters, OLAP, Data Mining
          and Real Application Testing options
          ORACLE_HOME 
          = /u01/app/oracle/product/10.2/db_1
          System name:    AIX
          Node name
          :    gsdj1
          Release
          :    1
          Version
          :    6
          Machine
          :    00CFD4644C00
          Instance name
          : bjwd1
          Redo thread mounted by this instance: 1
          Oracle process number
          : 132
          Unix process pid
          : 48300280, image: oracle@gsdj1

          *** SERVICE NAME:(bjwd) 2014-03-28 16:48:05.683
          *** SESSION ID:(2969.439612014-03-28 16:48:05.683
          *** 2014-03-28 16:48:05.683
          ksedmp
          : internal or fatal error
          ORA
          -01438: value larger than specified precision allowed for this column
          Current SQL statement 
          for this session:
          insert into CP_TEMP_STOCKTRAN (APPLY_ID, ALIEN, CER_TYPE, CER_NO, TRANS_AM, TRANS_AM_PR, TRANS_TYPE, TRANS_DATE, ENDORSOR, BLIC_TYPE, ALIEN_ID, ENDORSOR_ID, STOCKTRAN_ID) values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13)

          黃色背景紅色字體的SQL就是罪魁禍?zhǔn)祝@僅僅能定位發(fā)生問題的數(shù)據(jù)庫表,字段還得自己排查。異常1讓我定位到了這里,這時(shí)想起了異常2。


          異常2: Could not synchronize database state with session
          之前也搜索過這個(gè)異常,多數(shù)是由于Number類型的字段導(dǎo)致。冷靜的思考一下,平常我們?cè)谧霰碓O(shè)計(jì)時(shí),會(huì)把文字類型的字段設(shè)置大一些,Number類型的精度也會(huì)根據(jù)實(shí)際業(yè)務(wù)進(jìn)行設(shè)計(jì),但往往Number類型的字段最容易出問題:
          1、如果將非Number值插入該字段,比如字符串
          2、如果插入的數(shù)值精度過多,如字段設(shè)計(jì)Number(10,2),也就是最大支持8為整數(shù)和兩位小數(shù),要插入34.121313就會(huì)失敗

          根據(jù)表名定位到hibernate的映射文件以及實(shí)體類,再從業(yè)務(wù)功能入口(一個(gè)action方法)搜索,終于定位到一個(gè)業(yè)務(wù)接口做了該實(shí)體類的保存代碼,定位到了那個(gè)字段,定位到了做除法沒有判斷除數(shù)是否為0。








          posted @ 2014-03-28 18:54 IceWee 閱讀(883) | 評(píng)論 (0)編輯 收藏

          網(wǎng)絡(luò)配置:
          臨時(shí)(重丟失)
          ifconfig eth0 192.168.1.xxx netmask 255.255.xxx.0


          永久(重啟有效)
          vi /etc/network/interfaces

          # This file describes the network interfaces available on your system
          # and how to activate them. For more information, see interfaces(5).

          # The loopback network interface
          auto lo
          iface lo inet loopback

          # The primary network interface
          allow-hotplug eth0
          iface eth0 inet static
                  address 192.168.1.xxx
                  netmask 255.255.xxx.0
                  network 192.168.1.1
                  broadcast 192.168.1.255
                  gateway 192.168.1.1
                  
          # dns-* options are implemented by the resolvconf package, if installed
                  dns-nameservers 202.106.196.115


          由于非法關(guān)機(jī)導(dǎo)致重啟后無法聯(lián)網(wǎng)

          ifconfig eth0 192.168.1.xxx netmask 255.255.xxx.0 

          route add default gw 192.168.1.1

          重啟后配置丟失,所以必須在重啟之前執(zhí)行:
          apt-get update

          apt-get install ifupdown

          不能聯(lián)網(wǎng)是因?yàn)榉欠P(guān)機(jī)導(dǎo)致ifup腳本丟失





          posted @ 2014-01-24 10:50 IceWee 閱讀(911) | 評(píng)論 (0)編輯 收藏

          源機(jī)器:192.168.1.1
          備份機(jī)器:192.168.1.2

          前提條件:
          1、兩臺(tái)機(jī)器的網(wǎng)絡(luò)是連通的
          2、兩臺(tái)機(jī)器必須同時(shí)安裝了SVN服務(wù)器

          假設(shè):
          源機(jī)器上需要同步的庫名為autoSync,訪問地址為:svn://192.168.1.1/autoSync,對(duì)其具備讀寫權(quán)限的賬戶:sync/sync

          備份機(jī)器配置:
          1、創(chuàng)建與源機(jī)器庫名相同的空庫
          # 假設(shè)備份機(jī)器的SVN根目錄建立在 /home/backup/svn/repository下
          svnadmin create /home/backup/svn/repository/autoSync

          2、配置備份機(jī)器上的autoSync
          分別修改conf下的svnserve.conf、passwd、authz,根據(jù)實(shí)際情況配置,假設(shè)創(chuàng)建了用戶sync/sync,對(duì)庫autoSync具備讀寫權(quán)限,配置方法略,配置完成后啟動(dòng)SVN服務(wù)

          3、創(chuàng)建并修改pre-revprop-change文件
          cd /home/backup/svn/repository/autoSync/hooks
          cp pre
          -revprop-change.tmpl pre-revprop-change
          vi pre-revprop-change

          將文件末尾的“exit 1”改為“exit 0”即可,保存退出
          REPOS="$1"
          REV
          ="$2"
          USER
          ="$3"
          PROPNAME
          ="$4"
          ACTION
          ="$5"

          if
          [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi

          echo
          "Changing revision properties other than svn:log is prohibited" >&2
          exit
          0

          增加可執(zhí)行權(quán)限
          chmod 755 pre-revprop-change

          4、初始化
          命令:
          svnsync init --username 用戶名 --password 密碼 備份機(jī)器庫URL 源機(jī)器庫URL

          說明:
          用戶名和密碼是對(duì)源機(jī)器SVN庫具備讀寫權(quán)限的SVN用戶

          示例:
          svnsync init --username sync --password sync svn://192.168.1.2/autoSync svn://192.168.1.1/autoSync

          5、首次同步
          首次同步即為一次全備份過程,在此期間請(qǐng)停止客戶端段源機(jī)器哦一切操作(提交代碼等)
          命令:
          svnsync sync 備份機(jī)器庫URL
          示例:
          svnsync sync svn://192.168.1.2/autoSync

          源機(jī)器配置
          6、增量自動(dòng)同步配置
          創(chuàng)建并修改post-commit文件
          # 假設(shè)源機(jī)器的SVN根目錄建立在 /home/svn/repository下
          cd /home/svn/repository/autoSync/hooks
          cp post
          -commit.tmpl post-commit
          vi post
          -commit

          在文件末尾追加:svnsync sync --non-interactive 備份機(jī)器庫URL --username 用戶名 --password 密碼

          說明:
          用戶名和密碼是對(duì)備份機(jī)器SVN庫具備讀寫權(quán)限的SVN用戶

          示例:
          svnsync sync --non-interactive svn://192.168.1.2/autoSync --username sync --password sync

          7、術(shù)語
          配置完成,今后客戶端再向SVN(192.168.1.1)提交文件時(shí),會(huì)自動(dòng)觸發(fā)源機(jī)器(192.168.1.1)向備份機(jī)器(192.168.1.2)提交更新

          8、版本庫UUID一致性
          首先查看源機(jī)器庫的UUID,假設(shè)得到的是:fcdcbee9-6be3-4575-8d4a-681ec15ad8e0
          svnlook uuid svn://192.168.1.1/autoSync

          更新備份機(jī)器庫的UUID為源機(jī)器庫的UUID
          svnadmin setuuid svn://192.168.1.2/autoSync fcdcbee9-6be3-4575-8d4a-681ec15ad8e0




          posted @ 2014-01-23 11:08 IceWee 閱讀(656) | 評(píng)論 (0)編輯 收藏

          本文記錄的安裝步驟是基于基本安裝后的Debian,啟動(dòng)后漆黑一片,只有命令行,采用在線安裝方式,因此配置中國的鏡像軟件源能提高軟件的下載速度,首先配置軟件源。

          備份源文件
          # cp /etc/apt/sources.list /etc/apt/sources.list.bak

          編輯源文件
          # nano /etc/apt/sources.list

          注釋掉本地光盤源這一行,注釋后如:
          # deb cdrom:[Debian GNU/Linux 6.0.7 _Squeeze_ - Official amd64 NETINST Binary-1 20130223-18:50]/ squeeze main

          取消下面兩行官方源前面的注釋
          deb http://security.debian.org/ squeeze/updates main
          deb-src http://security.debian.org/ squeeze/updates main

          追加163的鏡像源地址
          deb http://mirrors.163.com/debian/ squeeze main non-free contrib
          deb http://mirrors.163.com/debian/ squeeze-proposed-updates main contrib non-free
          deb http://mirrors.163.com/debian-security/ squeeze/updates main contrib non-free
          deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib
          deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main contrib non-free
          deb-src http://mirrors.163.com/debian-security/ squeeze/updates main contrib non-free
          deb http://ftp.sjtu.edu.cn/debian/ squeeze main non-free contrib
          deb http://ftp.sjtu.edu.cn/debian/ squeeze-proposed-updates main contrib non-free
          deb http://ftp.sjtu.edu.cn/debian-security/ squeeze/updates main contrib non-free
          deb-src http://ftp.sjtu.edu.cn/debian/ squeeze main non-free contrib
          deb-src http://ftp.sjtu.edu.cn/debian/ squeeze-proposed-updates main contrib non-free
          deb-src http://ftp.sjtu.edu.cn/debian-security/ squeeze/updates main contrib non-free

          保存修改
          # ctrl + o 回車
          退出
          # ctrl + x

          更新源
          # apt-get update

          更新系統(tǒng)
          # apt-get upgrade

          安裝SVN服務(wù)器
          # apt-get install subversion subversion-tools

          安裝完成后可以運(yùn)行命令查看SVN服務(wù)器版本信息
          # svnserve --version

          配置SVN
          首先創(chuàng)建版本庫的根目錄,如位置:/home/svn/repository,所有項(xiàng)目都將在該目錄下創(chuàng)建相應(yīng)子文件夾
          # mkdir –p /home/svn/repository

          創(chuàng)建項(xiàng)目版本庫test(僅為演示)
          # svnadmin create /home/svn/repository/test


          修改SVN配置文件
          nano /home/svn/repository/test/conf/svnserve.conf

          以下為文件內(nèi)容:
          ### This file controls the configuration of the svnserve daemon, if you
          ### use it to allow access to this repository.  (If you only allow
          ### access through http: and/or file: URLs, then this file is
          ### irrelevant.)

          ### Visit http://subversion.tigris.org/ for more information.

          [general]
          ### These options control access to the repository for unauthenticated
          ### and authenticated users.  Valid values are "write", "read",
          ### and "none".  The sample settings below are the defaults
          # 未授權(quán)配置為禁止訪問none,已授權(quán)配置為可以讀寫write
          anon-access = none
          auth-access = write
          ### The password-db option controls the location of the password
          ### database file.  Unless you specify a path starting with a /,
          ### the file's location is relative to the directory containing
          ### this configuration file.
          ### If SASL is enabled (see below), this file will NOT be used.
          ### Uncomment the line below to use the default password file.
          # 用戶數(shù)據(jù)庫文件,配置授權(quán)用戶,當(dāng)前使用的文件是和svnserve.conf在相同目錄下的passwd文件,也可以指定其他絕對(duì)路徑文件,如:/home/svn/passwd
          password-db = passwd
          ### The authz-db option controls the location of the authorization
          ### rules for path-based access control.  Unless you specify a path
          ### starting with a /, the file's location is relative to the the
          ### directory containing this file.  If you don't specify an
          ### authz-db, no path-based access control is done.
          ### Uncomment the line below to use the default authorization file.
          # 授權(quán)文件,配置如同用戶配置
          authz-db = authz
          ### This option specifies the authentication realm of the repository.
          ### If two repositories have the same authentication realm, they should
          ### have the same password database, and vice versa.  The default realm
          ### is repository's uuid.
          # realm = My First Repository

          [sasl]
          ### This option specifies whether you want to use the Cyrus SASL
          ### library for authentication. Default is false.
          ### This section will be ignored if svnserve is not built with Cyrus
          ### SASL support; to check, run 'svnserve --version' and look for a line
          ### reading 'Cyrus SASL authentication is available.'
          # use-sasl = true
          ### These options specify the desired strength of the security layer
          ### that you want SASL to provide. 0 means no encryption, 1 means
          ### integrity-checking only, values larger than 1 are correlated
          ### to the effective key length for encryption (e.g. 128 means 128-bit
          ### encryption). The values below are the defaults.
          # min-encryption = 0
          # max-encryption = 256


          保存
          # ctrl + o 回車

          退出
          # ctrl + x

          配置用戶
          # nano passwd

          以下為文件內(nèi)容:
          ### This file is an example password file for svnserve.
          ### Its format is similar to that of svnserve.conf. As shown in the
          ### example below it contains one section labelled [users].
          ### The name and password for each user follow, one account per line.

          [users]
          # harry = harryssecret
          # sally = sallyssecret
          IceWee = IceWee

          增加用戶IceWee,密碼也為IceWee,=號(hào)兩側(cè)需要有空格,保存(ctrl + o 回車)退出(ctrl + x)

          配置訪問權(quán)限
          # nano authz

          以下為文件內(nèi)容:
          ### This file is an example authorization file for svnserve.
          ### Its format is identical to that of mod_authz_svn authorization
          ### files.
          ### As shown below each section defines authorizations for the path and
          ### (optional) repository specified by the section name.
          ### The authorizations follow. An authorization line can refer to:
          ###  - a single user,
          ###  - a group of users defined in a special [groups] section,
          ###  - an alias defined in a special [aliases] section,
          ###  - all authenticated users, using the '$authenticated' token,
          ###  - only anonymous users, using the '$anonymous' token,
          ###  - anyone, using the '*' wildcard.
          ###
          ### A match can be inverted by prefixing the rule with '~'. Rules can
          ### grant read ('r') access, read-write ('rw') access, or no access
          ### ('').

          [aliases]
          # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

          [groups]
          # harry_and_sally = harry,sally
          # harry_sally_and_joe = harry,sally,&joe
          developers = IceWee

          # [/foo/bar]
          # harry = rw
          # &joe = r
          # * =

          # [repository:/baz/fuz]
          # @harry_and_sally = rw
          # * = r

          [/]
          * = r
          IceWee = rw
          @developers = rw

          [/tags]
          IceWee = rw

          默認(rèn)所有用戶可讀取根,IceWee可以讀寫根。可以分別對(duì)子目錄進(jìn)行授權(quán),如上的tags目錄,IceWee具有讀寫權(quán)限,以及IceWee所在的組developers也具備讀寫權(quán)限。

          啟動(dòng)SVN服務(wù)器
          # svnserve -d -r /home/svn/repository
          -d含義為后臺(tái)運(yùn)行(daemon),-r指定的根目錄,如訪問test應(yīng)該使用這樣的地址 svn://hostname:port/test

          停止SVN服務(wù)
          # killall svnserve

          備份還原命令,與oracle的備份有些類似
          導(dǎo)出
          # svnadmin dump /home/svn/repository/test > /home/bak/test.dump

          導(dǎo)入
          # svnadmin load /home/svn/repository/demo < /home/bak/demo.dump
          導(dǎo)入前提:
          必須先創(chuàng)建要導(dǎo)入版本庫目錄,如上的demo,則需要做以下操作
          # svnadmin create /home/svn/respository/demo
          修改svnserve.conf、passwd、authz等文件,前面已介紹


           





          posted @ 2014-01-17 15:48 IceWee 閱讀(1232) | 評(píng)論 (0)編輯 收藏


          2013年12月10日
          ---------------------------
          冒泡排序
          void bubble(int[] array) {
                 
          boolean swaped = true;
                 
          for (int t = 1; t < array.length && swaped; t++) {
                      swaped
          = false;
                     
          for (int i = 0; i < array.length - t; i++) {
                         
          if (array[i] > array[i + 1]) {
                            
          int temp = array[i];
                              array[i]
          = array[i + 1];
                              array[i
          + 1] = temp;
                              swaped
          = true;
                          }

                      }

                  }

              }


          2013年11月26日
          ---------------------------
          1、String的split方法
          平常總是這樣用,String str = "a,b,c,d,e"; String[] arr = str.split(",");
          其實(shí)還可以這樣用,String lan = "Java;C#?C++:C"; String si = lan.split("[;?:]"); 返回的是字符串?dāng)?shù)組{"Java", "C#", "C++", "C"}


          2013年11月21日
          ---------------------------

          1、Java對(duì)象池知多少?
          示例:String s1 = "abc"; String s2 = "abc"; s1 == s2 返回ture還是false?只要不是new出來的都先從對(duì)象池中讀取,因此結(jié)果為true,兩個(gè)變量指向的是同一塊內(nèi)存空間地址。

          Java除了String類使用了對(duì)象池以外,還有5個(gè)基本類型的封裝類:Byte、Short、Integer、Long和Character,例如:Integer inA = 20; Integer inB = 20; 那么 inA == inB 的結(jié)果為true,其他類與此相同,不做示例。

          特別注意:
          (1)浮點(diǎn)型的兩個(gè)封裝類Float和Double并沒有參與對(duì)象池;
          (2)整形封裝類(Byte、Short、Integer和Long)只有數(shù)值小于或等于127時(shí)才使用對(duì)象池,例如:Integer x = 128; Integer y = 128; x == y的結(jié)果為false。

          2、Java變量命名規(guī)范
          A. String #name = "Joe";
          B. int $age = 30;
          C. Double _height = 174.4;
          D. float ~temp = 37.6;
          以上A到D,哪個(gè)無法通過編譯?答案是A和D,因?yàn)镴ava變量名只允許字母、下劃線(_)、美元符($)開頭,那么 int _ = 30; String $$ = "I DO";可以嗎?答案是完全可以,但很少有人這樣定義變量名,雖然沒有違法命名規(guī)范,但最后我估計(jì)程序員自己都會(huì)被自己繞暈。

          3、0和1能標(biāo)識(shí)布爾值嗎?
          int flag = 0;
          if (flag) {
              System.out.print("error");
          }
          error會(huì)打印嗎?不會(huì),因?yàn)楦揪筒粫?huì)編譯通過,編譯器會(huì)提示flag是int類型而不是boolean類型,如果你會(huì)有這種想法可能之前學(xué)過C,C總的0和1可以標(biāo)識(shí)布爾的。

          4、靜態(tài)導(dǎo)入
          例:
          ClassA.java
          package bing.test.sub1;

          public class ClassA {
            
          public static final int MAX_INT = Integer.MAX_VALUE;
          }



          ClassB.java
          package bing.test.sub2;

          import static bing.test.sub1.ClassA.MAX_INT;

          public class ClassB {
           
          public static void main(String[] args) {
          System.out.println(MAX_INT);
            }

          }

          輸出:2147483647。不僅僅可以靜態(tài)導(dǎo)入其他類的靜態(tài)屬性還可以導(dǎo)入靜態(tài)方法,這些特性在實(shí)際開發(fā)中很少見。









          posted @ 2013-11-21 12:49 IceWee 閱讀(470) | 評(píng)論 (0)編輯 收藏

          Apache Commons的FTPClient局域網(wǎng)上傳文件速度本應(yīng)該很快的,但卻在實(shí)際開發(fā)中發(fā)現(xiàn)上傳一個(gè)文件蝸牛速度,都是因?yàn)檎{(diào)用了如下API:

          ftpClient.storeFile(fileName, inputStream)

          原因是因?yàn)槟J(rèn)緩沖區(qū)大小是1024,也就是1K,當(dāng)然慢了,在調(diào)用上傳API之前重新修改以下默認(rèn)設(shè)置即可,如將緩沖區(qū)改為10M,API:

          ftpClient.setBufferSize(1024 * 1024 * 10)

          posted @ 2013-09-13 16:32 IceWee 閱讀(6713) | 評(píng)論 (0)編輯 收藏

          第一步,查詢鎖表信息
          --查詢被鎖住的數(shù)據(jù)庫對(duì)象
          select object_name, machine, s.sid, s.serial#
           
          from v$locked_object l, dba_objects o, v$session s
          where l.object_id = o.object_id
            
          and l.session_id = s.sid;


          第二步,殺死數(shù)據(jù)庫會(huì)話
          --殺死數(shù)據(jù)庫會(huì)話
          alter system kill session '207,707'; -- 207為SID, 707為SERIAL#


          第三步,如果第二步無法殺死會(huì)話,報(bào)ORA-00031,那么只能殺死UNIX/LINUX系統(tǒng)進(jìn)程了
          --查詢當(dāng)前操作的系統(tǒng)進(jìn)程ID
          select spid, osuser, s.program
           
          from v$session s, v$process p
          where s.paddr = p.addr
            
          and s.sid = 207; -- 207為SID


          第四步,根據(jù)查詢到的系統(tǒng)PID,殺掉進(jìn)程
          kill -9 24664 // 24664為UNIX/LINUX系統(tǒng)進(jìn)程ID



          posted @ 2013-08-23 10:20 IceWee 閱讀(536) | 評(píng)論 (0)編輯 收藏

               摘要: 備用。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;...  閱讀全文

          posted @ 2013-07-27 11:53 IceWee 閱讀(1449) | 評(píng)論 (0)編輯 收藏

          Java獲取本地IP地址方法網(wǎng)上搜一籮筐,但基本上都是獲得一個(gè)IP,實(shí)際開發(fā)中一臺(tái)電腦很可能有多個(gè)IP地址,如多網(wǎng)卡,或者安裝了VM Ware虛擬機(jī),就會(huì)虛擬出其他的網(wǎng)卡,那么傳統(tǒng)的方法得到的一個(gè)IP地址就不全面了,下面貼出獲取本機(jī)IP列表的方法:
          /**
               * IceWee 2013.07.19
               * 獲取本地IP列表(針對(duì)多網(wǎng)卡情況)
               *
               * 
          @return
               
          */

              
          public static List<String> getLocalIPList() {
                  List
          <String> ipList = new ArrayList<String>();
                  
          try {
                      Enumeration
          <NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
                      NetworkInterface networkInterface;
                      Enumeration
          <InetAddress> inetAddresses;
                      InetAddress inetAddress;
                      String ip;
                      
          while (networkInterfaces.hasMoreElements()) {
                          networkInterface 
          = networkInterfaces.nextElement();
                          inetAddresses 
          = networkInterface.getInetAddresses();
                          
          while (inetAddresses.hasMoreElements()) {
                              inetAddress 
          = inetAddresses.nextElement();
                              
          if (inetAddress != null && inetAddress instanceof Inet4Address) // IPV4
                                  ip = inetAddress.getHostAddress();
                                  ipList.add(ip);
                              }

                          }

                      }

                  }
           catch (SocketException e) {
                      e.printStackTrace();
                  }

                  
          return ipList;
              }




          posted @ 2013-07-19 11:10 IceWee 閱讀(4371) | 評(píng)論 (1)編輯 收藏

          項(xiàng)目開發(fā)組建立后一般要統(tǒng)一開發(fā)環(huán)境,一般是指開發(fā)環(huán)境,開發(fā)工具的版本和設(shè)置,其中編碼設(shè)置是個(gè)較為重要的部分,其重要性不言而喻。以下為eclipse編碼設(shè)置方法(將默認(rèn)編碼改為UTF-8為例):

          1.工作空間的編碼(這樣以后新建的文件也是新設(shè)置的編碼格式) 
             
          eclipse->window->preferences->General->workspaceTypes->Other->UTF-8->OK

          2.工程的編碼

          Project->Properties->General->Resource->Other->UTF-8->OK

          3.某類文件的編碼
           
          eclipse->window->preferences->General->Content Types->右側(cè)找到需要修改的文件的類型(如JAVA,JSP等)->在下面的Default encoding,輸入框中輸入U(xiǎn)TF-8->點(diǎn)擊Update->OK

          4、單個(gè)文件的編碼
           
          在包資源管理器視圖,右鍵點(diǎn)擊文件->屬性,改變文本文件編碼格式為UTF-8

          posted @ 2013-06-17 14:15 IceWee 閱讀(825) | 評(píng)論 (0)編輯 收藏

          進(jìn)來的看官使用的是win7吧?!是64位的吧!?安裝了eclipse的subclipse插件了吧!每次用到SVN插件時(shí)都會(huì)彈出如下的對(duì)話框,雖然不影響使用但是很不爽是不是啊?LZ也是一個(gè)有丁點(diǎn)兒強(qiáng)迫癥的人,我想干掉這個(gè)彈出框!

          稍后上圖,服務(wù)器估計(jì)掛了!!

          解決方法:
          Window-Preferences-Team-SVN,在SVN接口的下拉框可以看到,默認(rèn)選擇的是JavaHL(JNI) Not Available,手動(dòng)更改為SVNKit(Pure Java) SVNKit v1.3.5.7406,OK,enjoy it!

          錯(cuò)誤提示框:


          修改前:


          修改后:

          posted @ 2013-03-18 15:13 IceWee 閱讀(78948) | 評(píng)論 (6)編輯 收藏

          一、Redhat上VNC Server配置
          本文以當(dāng)前Linux系統(tǒng)未安裝VNC服務(wù)器為基本,如果已安裝請(qǐng)?zhí)^第1節(jié)!

          前提:
          1.連接到互聯(lián)網(wǎng),將使用yum在線安裝VNC服務(wù)器
          2. 確認(rèn) SSH 在運(yùn)行

          1.安裝 TigerVNC Server

          # yum search tigervnc-server


          返回大概如下內(nèi)容:

          tigervnc-server.x86_64 : A TigerVNC Server
          tigervnc-server-applet.noarch : Java TigerVNC Viewer applet for TigerVNC Server
          tigervnc-server-module.x86._
          64 : TigerVNC Mode to Xorg
          ...


          第一行即是我們要安裝的VNS服務(wù)器,第二行是客戶端,執(zhí)行

          # yum install tigervnc-server.x86_64


          回車后會(huì)有一次安裝確認(rèn),輸入y后回車即可安裝,安裝完畢后返回到命令行輸入光標(biāo),執(zhí)行

          # vncserver


          會(huì)提示輸入驗(yàn)證密碼,至少6位,該密碼是客戶端連接時(shí)用到的。


          2.配置圖形界面
          修改配置文件,激活圖形界面,執(zhí)行命令:

          # vi /root/.vnc/xstartup


          注釋掉這行

          #twm & // 注釋該行


          末尾增加一行

          gnome-session & // 增加該行


          保存退出


          3.啟動(dòng)VNC服務(wù)
          執(zhí)行命令

          # /etc/init.d/vncserver start

          # service vncserver start


          啟動(dòng)后提示:

          Starting VNC server: no displays configured [FAILED]


          解決方法:
          執(zhí)行命令

          # vim /etc/sysconfig/vncservers


          修改最后兩行如:

          VNCSERVERS="1:root"
          VNCSERVERARGS
          [1]="-geometry 1024x768"


          說明:

          第一行為服務(wù)配置,當(dāng)前只配置了一個(gè)VNC服務(wù),使用用戶root啟動(dòng),如果還需要使用其他用戶登陸,可以修改VNCSERVERS的值如:“1:root 2:tiger”(tiger為系統(tǒng)另一存在用戶)。第二行可以注釋,是配置窗口分辨率的,需要去掉后面的-localhost


          VNC Server隨系統(tǒng)自動(dòng)啟動(dòng)
          執(zhí)行命令

          # sudo chkconfig --level 345 vncserver on


          4.停止VNC服務(wù)

          執(zhí)行命令

          # /etc/init.d/vncserver stop

          # service vncserver stop


          二、Windows借助VNC Viewer訪問Linux
          首先安裝RealVNC,從互聯(lián)網(wǎng)下載獲得
          開始 - Run VNC Viewer,輸入IP地址,后面的:1代表使用root用戶登陸,在RH上配置的1:root,如果想使用其他用戶登陸則調(diào)整冒號(hào)后的數(shù)字即可,密碼就是先前配置的。
           


          解決連接不上問題的方法

          執(zhí)行命令,查看VNC監(jiān)聽的端口是什么,在防火墻中開放端口即可

          # netstat -ntupl|grep vnc


          返回列表如:

          1. tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 4411/Xvnc 
          2. tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 4411/Xvnc 
          3. tcp 0 0 :::6001 :::* LISTEN 4411/Xvnc


          修改防火墻配置文件,開放5901端口即可

          # vi /etc/sysconfig/iptables


          可以復(fù)制22端口一行,黏貼修改即可,重新啟動(dòng)防火墻服務(wù)

          # service iptables restart


           


           

          posted @ 2013-02-22 17:46 IceWee 閱讀(21974) | 評(píng)論 (2)編輯 收藏

          基本信息
          操作系統(tǒng):CentOS Release 6.3 (Final)
          內(nèi)核版本:Kernel Linux 2.6.32-279.el6.x86_64
          JDK版本:Oracle ®Java SE Development Kit 7u15 (1.7.0_15-b03)
          JBoss版本:JBoss Application Server 7.1.1
          安裝包: jdk-7u15-linux-x64.rpm、jboss-as-7.1.1.Final.zip

          安裝準(zhǔn)備
          上傳安裝文件
          將JDK和JBoss安裝文件(先解壓成目錄)上傳到服務(wù)器,目錄隨意,如:/home/下

          開始安裝
          JDK安裝
          使用root登陸系統(tǒng),打開命令行窗口,先為安裝文件授權(quán)

          # chmod 755 jdk-7u15-linux-x64.rpm


          執(zhí)行安裝

          # rpm -ivh jdk-7u15-linux-x64.rpm


          自動(dòng)安裝到目錄 /usr/java 下

           

          JDK配置
          Root登陸執(zhí)行

          # vi /etc/profile


          增加下面內(nèi)容

          JAVA_HOME=/usr/java/jdk1.7.0_15
          CLASSPATH
          =.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
          PATH
          =$JAVA_HOME/bin:$PATH


          保存退出,執(zhí)行如下命令立即生效以上環(huán)境配置

          # source /etc/profile


          JDK版本檢測(cè),執(zhí)行:

          # java – version

          返回JDK版本信息

          JBoss安裝
          JBoss為綠色版本,不需要安裝,解壓即可使用,和Tomcat一樣,下面將JBoss目錄移動(dòng)到一個(gè)相對(duì)規(guī)范的位置,Root登陸執(zhí)行

          # mv /home/jboss-as-7.1.1.Final /usr/jboss-as-7.1.1.Final


          OK,安裝完畢,配置一下環(huán)境變量,執(zhí)行

          # vi /etc/profile


          增加下面內(nèi)容

          JBOSS_HOME=/usr/jboss-as-7.1.1.Final


          啟動(dòng)服務(wù)

          # /usr/jboss-as-7.1.1.Final/bin/standalone.sh

          訪問,在瀏覽器地址欄中輸入:http://127.0.0.1:8080,出現(xiàn)歡迎界面,證明啟動(dòng)成功!

          停止服務(wù)
          可以在啟動(dòng)終端窗口按鍵 CTRL + C,即可完全停止JBoss服務(wù)

          局域網(wǎng)訪問
          http://xxx.xx.xx.xxx:8080是不能訪問的,如果想讓局域網(wǎng)內(nèi)的其他機(jī)器訪問必須要修改JBoss配置,方法如下:
          編輯jboss-as-7.1.1.Final\standalone\configuration\standalone.xml,找到

          <interface name="public">
              <inet-address value
          ="${jboss.bind.address:127.0.0.1}"/>
          </interface>


          127.0.0.1修改為JBoss所在機(jī)器的IP地址即可,但是依舊無法訪問,是因?yàn)長inux防火墻沒有開放8080端口,執(zhí)行:

          # vi /etc/sysconfig/iptables


          發(fā)現(xiàn)有一行

          -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
          復(fù)制它把22改成8080追加該行后面保存退出!

          創(chuàng)建管理員用戶

          # ./add-user.sh

           

          What type of user do you wish to add?
           a) Management User (mgmt-users.properties)
           b) Application User (application-users.properties)
          (a):

          回車

          Enter the details of the new user to add.
          Realm (ManagementRealm) :                      //回車,默認(rèn)
          Username :                                               // 管理員用戶名,如:admin
          Password :                                                // 管理員密碼,如:jboss
          Re-enter Password :                                  // 重復(fù)密碼


          管理員控制臺(tái)訪問

          http://127.0.0.1:9990/console
          如果也想在其他局域網(wǎng)機(jī)器上訪問管理員控制臺(tái),防火墻需要開放端口9990,修改standalone.xml

          <interface name="management">
            <inet-address value
          ="${jboss.bind.address.management:127.0.0.1}"/>
          </interface>


          同樣將127.0.0.1修改為JBoss所在機(jī)器的IP地址

          posted @ 2013-02-22 17:12 IceWee 閱讀(5053) | 評(píng)論 (0)編輯 收藏

          主站蜘蛛池模板: 岳普湖县| 盘山县| 承德县| 开封市| 浦东新区| 吉安县| 天柱县| 宿州市| 武功县| 兰溪市| 正阳县| 资源县| 醴陵市| 明星| 五大连池市| 莫力| 中方县| 兰考县| 修武县| 新民市| 新昌县| 长垣县| 小金县| 和政县| 武功县| 高平市| 固安县| 崇左市| 上栗县| 离岛区| 泸州市| 颍上县| 乡城县| 翁牛特旗| 巧家县| 台东县| 绥宁县| 疏勒县| 长乐市| 聂荣县| 蒲城县|