posts - 17,  comments - 6,  trackbacks - 0
          birt 集成到 weblogic 9中,老是出現問題:

          java.lang.NoSuchMethodError: org.mozilla.javascript.ImporterTopLevel.initStandar
          dObjects(Lorg/mozilla/javascript/Context;Z)V
          at org.eclipse.birt.core.script.ScriptContext.<init>(ScriptContext.java:
          81)
          at org.eclipse.birt.report.engine.executor.ExecutionContext.<init>(Execu
          tionContext.java:248)
          at org.eclipse.birt.report.engine.api.impl.EngineTask.<init>(EngineTask.
          java:118)
          at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.<init>(RunAn
          dRenderTask.java:54)
          at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.createRunA
          ndRenderTask(ReportEngineHelper.java:215)
          at org.eclipse.birt.report.engine.api.ReportEngine.createRunAndRenderTas
          k(ReportEngine.java:258)



          google后,發現兩個解決方案,

          一、替換weblogic.jar中的js.jar文件,
          麻煩,有隱串



          二、在 web應用中加入
          <prefer-web-inf-classes>true</prefer-web-inf-classes>

          導致應用無法發布成功。


          最后自己想出一種方案:
          在weblogic的應動域目錄中,setDomainEnv.cmd文件中, 更改如下:

          @REM SET THE CLASSPATH

          set CLASSPATH=%WL_HOME%\server\lib\mysql5.jar;%WL_HOME%\server\lib\js.jar;%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%


          將js.jar 文件復制到 server/lib目錄中。在類路徑中設置優先載入。

          pdf電子書下載   soa.hntky.com

          posted @ 2008-05-29 16:56 風中的舞者 閱讀(2539) | 評論 (3)編輯 收藏
          向大家推薦一下java pdf下載的網站(全英文章)
          http://soa.hntky.com
          posted @ 2008-03-04 13:01 風中的舞者 閱讀(349) | 評論 (0)編輯 收藏

          soa.hntky.com
          很多的電子書,速度較快,可以搜索

          posted @ 2007-05-25 08:36 風中的舞者 閱讀(927) | 評論 (1)編輯 收藏

          ?


          int ????ret??????
          string?filename
          string?filename2
          string?resume

          filename
          = " d:\smis2\xmk.xls "
          filename2
          = " d:\smis2\2006050120xmk.xls "
          resume
          = " d:\smis2\resume.xlw "
          filedelete(resume)
          oleobject????xlapp,xlsub?????
          xlapp
          = create?oleobject
          ret
          = xlapp.connecttonewobject( " excel.sheet " )???
          // ret=xlapp.connecttonewobject("excel.application")???

          if ????ret < 0 ????then??????
          ?????????????messagebox(
          " 你的電腦未安裝Excel " ,string(ret))??????
          ?????????????
          return ??????
          end????
          if ??????
          xlapp.application.workbooks.open(filename)??????
          xlsub
          = xlapp.application.activeworkbook.worksheets[ 1 ]??????

          xlsub.cells[
          4 , 2 ].value = " 我是吳吳 "

          xlapp.saveas(filename2,
          true )
          messagebox(
          " aa " , " aa " )
          xlapp.application.save(
          ' ? ' )
          // xlapp.application.close()
          xlapp.application.quit()
          xlsub.disconnectobject()
          xlapp.disconnectobject()
          destroy?xlsub
          destroy?xlapp

          posted @ 2006-10-20 10:09 風中的舞者 閱讀(749) | 評論 (0)編輯 收藏
               摘要: Introducing the JavaMail API The JavaMail API is an optional package (standard extension) for reading, composing, and sending electronic messages. You use the package to create Mail User Agent ...  閱讀全文
          posted @ 2006-10-20 09:01 風中的舞者 閱讀(328) | 評論 (0)編輯 收藏

          Javamail操作指南(二)

          作者:Bromon 來源:http://blog.itpub.net (2005-06-28 13:30:54)


          ?

          怎樣才算比較完整的Javamail操作指南?我想應該包括絕大多數基本的email操作,能夠應付一般的應用。在本指南中打算囊括以下內容:

          ?●?發送email:包括文本郵件、HTML郵件、帶附件的郵件、SMTP驗證
          ?●?接收email:pop3遠程連接、收取不同MIME的郵件、處理附件

          ?我想有了上述功能的介紹,應該可以應付很多email的相關應用了。所以請允許我給本文擬了一個比較狂妄的名字,這樣才能保證收視率,。還是那句話,寫這個post的原因就是沒有在網上看到更全面的,你看過的話記得要告訴我。

          ? 下面的所有例子都經過實際測試,你可以說它寫得不夠OO,不夠plugable,但是它的確是可以參考的。自從有了javamail,發垃圾郵件就方便多了。本文代碼多說明少,這倒不是我偷懶,而是很多東西都涉及pop3等協議的規范,如果不了解這些規范的話,由的東西我實在不知道怎么跟你解釋;如果了解的話,那我基本上就不用再解釋。所以本著實用的原則就省略了,由興趣的話自己去翻翻協議規范。

          ?廢話少說,首先需要配置環境。需要的包是mail.jar和activation.jar。高版本的J2SDK?EE自帶。地址嘛,再java.sun.com上搜索一下,很容易找到。放到classpath中就KO。

          ?一、?郵件的發送

          ?下面了弄個發郵件的Hello?World,熱熱身:

          ?/*************
          ?Name:TextMailSender.java
          ?Author:Bromon
          ?Version:1.0
          ?Date:2004-4-26
          ?Note:發送email到bromon@163.com,需要安裝SMTP服務器
          ?*************/
          ?package?org.bromon.mail;
          ?import?javax.mail.*;
          ?import?javax.mail.internet.*;
          ?import?java.util.*;
          ?public?class?TextMailSender
          ?{
          ?public?static?void?main(String?args[])
          ?{
          ??try
          ??{
          ???Properties?prop=new?Properties();
          ???//指定要使用的SMTP服務器為bromon2k
          ???prop.put("mail.smtp.host","bromon2k");
          ???Session?mailSession=Session.getDefaultInstance(prop);

          ???//發件人地址
          ???InternetAddress?from=new?InternetAddress("bromon@bromon2k");
          ???//收件人地址
          ???InternetAddress?to=new?InternetAddress("bromon@163.com");
          ???
          ???MimeMessage?msg=new?MimeMessage(mailSession);
          ???msg.setFrom(from);
          ???msg.addRecipient(javax.mail.Message.RecipientType.TO,to);
          ???//發信日期
          ???msg.setSentDate(new?java.util.Date());
          ???//title
          ???msg.setSubject("你好");
          ???//郵件正文
          ???msg.setText("hello,bromon");
          ???Transport.send(msg);
          ??}catch(Exception?e)
          ??{
          ???System.out.println(e);
          ??}
          ?}
          ?}?


          ? 程序很簡單,但是它是不能運行的(倒)。除非你的機器上安裝了一個SMTP服務器,而且你的機器還叫做bromon2k。寫這么一段不能執行的程序不是為了找打,而是讓各位對javamail有個基本印象,我就懶得改了。下面演示的是如何通過163、sohu等email服務商提供的免費郵箱來發郵件,基本操作和上面的一樣,只是多一個SMTP驗證而已:

          ?/*
          ?*?Created?on?2004-4-26
          ?*/
          ?package?org.bromon.mail;
          ?import?javax.mail.*;
          ?import?java.util.*;
          ?import?javax.mail.internet.*;

          ?/**
          ?*?@author?Bromon
          ?*/
          ?public?class?SenderWithSMTPVer
          ?{
          ?String?host="";
          ?String?user="";
          ?String?password="";

          ?public?void?setHost(String?host)
          ?{
          ??this.host=host;
          ?}

          ?public?void?setAccount(String?user,String?password)
          ?{
          ??this.user=user;
          ??this.password=password;
          ?}

          ?public?void?send(String?from,String?to,String?subject,String?content)
          ?{
          ??Properties?props?=?new?Properties();
          ??props.put("mail.smtp.host",?host);//指定SMTP服務器
          ??props.put("mail.smtp.auth",?"true");//指定是否需要SMTP驗證
          ??try
          ??{
          ???Session?mailSession?=?Session.getDefaultInstance(props);
          ???
          ???mailSession.setDebug(true);//是否在控制臺顯示debug信息
          ???
          ???Message?message=new?MimeMessage(mailSession);
          ???message.setFrom(new?InternetAddress(from));//發件人
          ???message.addRecipient(Message.RecipientType.TO,new?InternetAddress(to));//收件人
          ???
          ???message.setSubject(subject);//郵件主題
          ???message.setText(content);//郵件內容
          ???message.saveChanges();
          ???
          ???Transport?transport?=?mailSession.getTransport("smtp");
          ???transport.connect(host,?user,?password);
          ???transport.sendMessage(message,?message.getAllRecipients());
          ???transport.close();
          ??}catch(Exception?e)
          ??{
          ???System.out.println(e);
          ??}
          ??
          ?}

          ?public?static?void?main(String?args[])
          ?{
          ??SenderWithSMTPVer?sm=new?SenderWithSMTPVer();

          ??sm.setHost("smtp.163.com");//指定要使用的郵件服務器
          ??sm.setAccount("abc","123");//指定帳號和密碼

          ??/*
          ?*?@param?String?發件人的地址
          ???*?@param?String?收件人地址
          ???*?@param?String?郵件標題
          ???*?@param?String?郵件正文
          ??*/
          ??sm.send("abc@163.com","bromon@163.com","標題","內容");
          ?}

          ?}?


          ?這段程序好像也不需要解釋了吧,把SMTP地址、帳號、密碼等配置信息寫到Properties里面,Java里面很多API都需要這么干,比如再程序中加入對代理服務器的支持等。

          ?上面的程序修改一下服務器地址、帳號、密碼就可以使用,非常簡單。

          ?如何發送一個HTML格式的Email呢?也很簡單,再郵件正文中寫入HTML代碼,然后指定郵件的ContentType就OK,下面只給出關鍵代碼:

          ?………..
          ?MimeMessage?msg=new?MimeMessage(mailSession);
          ?msg.setContent(content,"text/html");
          ?msg.setText(“<html><body><h1>下面的,你們好嗎?</body></html>”);
          ?………..

          ?下面是發送帶有附件的email,稍微復雜一點,而且和前面的程序有一些不同,請仔細一點,同時需要一點IO的知識。相同的代碼就不在列出,只寫關鍵部分,誰都想偷懶不是?

          ?import?javax.mail.*;
          ?import?javax.mail.internet.*;
          ?import?javax.activation.*;
          ?import?java.util.*;
          ?……….
          ?MimeMessage?msg=new?MimeMessage(mailSession);
          ?msg.setSentDate(new?Date());
          ?msg.setSubject("hello");

          ?MimeBodyPart?textBodyPart=new?MimeBodyPart();
          ?textBodyPart.setText(“郵件正文”);

          ?MimeBodyPart?fileBodyPart=new?MimeBodyPart();
          ?FileDataSource?fds=new?FileDataSource("GIS.rar");//要發送的附件
          ?fileBodyPart.setDataHandler(new?DataHandler(fds));
          ?fileBodyPart.setFileName(fds.getName());
          ?Multipart?container=new?MimeMultipart();
          ?container.addBodyPart(textBodyPart);
          ?container.addBodyPart(fileBodyPart);
          ?msg.setContent(container);
          ?Transport.send(msg);
          ?…………?


          ?這里的msg由兩個MimeBodyPart構成,這個東西解釋起來基本上比較難,如果不了解相關的規范就不太好解釋,如果了解的話,我就不用解釋了,這個這個………唉。

          二、?郵件的收取

          ?通常情況下我們都使用pop3協議來收郵件,IMAP嘛現在就不涉及了。收郵件的功能雖然我用了很多時間才基本搞清楚,不過講起來就so?easy了,一個程序就可以基本包括。

          ?郵件大致可以分三種:純文本郵件、含有其他數據的文本郵件、含有附件的郵件。


          ?CODE??
          ?/*
          ?*?Created?on?2004-4-26
          ?*/
          ?package?org.bromon.mail;
          ?import?javax.mail.*;
          ?import?java.util.*;
          ?import?java.io.*;

          ?/**
          ?*?@author?Bromon
          ?*/
          ?public?class?Receiver
          ?{
          ?Folder?inbox;
          ?Store?store;

          ?//連接郵件服務器,獲得所有郵件的列表
          ?public?Message[]?getMail(String?host,String?name,String?password)?throws?Exception
          ?{
          ??Properties?prop=new?Properties();
          ??prop.put("mail.pop3.host",host);
          ??Session?session=Session.getDefaultInstance(prop);
          ??store=session.getStore("pop3");
          ??store.connect(host,name,password);
          ??
          ??inbox=store.getDefaultFolder().getFolder("INBOX");
          ??inbox.open(Folder.READ_ONLY);
          ??
          ??Message[]?msg=inbox.getMessages();
          ??
          ??FetchProfile?profile=new?FetchProfile();
          ??profile.add(FetchProfile.Item.ENVELOPE);
          ??inbox.fetch(msg,profile);
          ??
          ??return(msg);
          ?}

          ?//處理任何一種郵件都需要的方法
          ?private?void?handle(Message?msg)?throws?Exception
          ?{
          ??System.out.println("郵件主題:"+msg.getSubject());
          ??System.out.println("郵件作者:"+msg.getFrom()[0].toString());
          ??System.out.println("發送日期:"+msg.getSentDate());
          ?}

          ?//處理文本郵件
          ?public?void?handleText(Message?msg)?throws?Exception
          ?{
          ??this.handle(msg);
          ??System.out.println("郵件內容:"+msg.getContent());
          ?}

          ?//處理Multipart郵件,包括了保存附件的功能
          ?public?void?handleMultipart(Message?msg)?throws?Exception
          ?{
          ??String?disposition;
          ??BodyPart?part;
          ??
          ??Multipart?mp=(Multipart)msg.getContent();
          ??int?mpCount=mp.getCount();//Miltipart的數量,用于除了多個part,比如多個附件
          ??for(int?m=0;m<mpCount;m++)
          ??{
          ???this.handle(msg);
          ???
          ???part=mp.getBodyPart(m);
          ???disposition=part.getDisposition();
          ???if(disposition!=null?&&?disposition.equals(Part.ATTACHMENT))//判斷是否有附件
          ???{
          ????//this.saveAttach(part);//這個方法負責保存附件,注釋掉是因為附件可能有病毒,請清理信箱之后再取掉注釋
          ???}else{
          ????System.out.println(part.getContent());
          ???}
          ??}
          ?}

          ?private?void?saveAttach(BodyPart?part)?throws?Exception
          ?{
          ??String?temp=part.getFileName();//得到未經處理的附件名字
          ??String?s=temp.substring(11,temp.indexOf("?=")-1);//去到header和footer
          ??
          ??//文件名一般都經過了base64編碼,下面是解碼
          ??String?fileName=this.base64Decoder(s);
          ??System.out.println("有附件:"+fileName);
          ??
          ??InputStream?in=part.getInputStream();
          ??FileOutputStream?writer=new?FileOutputStream(new?File(fileName));
          ??byte[]?content=new?byte[255];
          ??int?read=0;
          ??while((read=in.read(content))!=-1)
          ??{
          ???writer.write(content);
          ??}
          ??writer.close();
          ??in.close();
          ?}

          ?//base64解碼
          ?private?String?base64Decoder(String?s)?throws?Exception
          ?{
          ??sun.misc.BASE64Decoder?decoder?=?new?sun.misc.BASE64Decoder();
          ??byte[]?b=decoder.decodeBuffer(s);
          ??
          ??return(new?String(b));
          ?}

          ?//關閉連接
          ?public?void?close()?throws?Exception
          ?{
          ??if(inbox!=null)
          ??{
          ???inbox.close(false);
          ??}
          ??
          ??if(store!=null)
          ??{
          ???store.close();
          ??}
          ?}

          ?public?static?void?main(String?args[])
          ?{
          ??String?host="pop.163.com";
          ??String?name="bromon";
          ??String?password="My?password";
          ??
          ??Receiver?receiver=new?Receiver();
          ??
          ??try
          ??{???
          ???Message[]?msg=receiver.getMail(host,name,password);
          ???
          ???for(int?i=0;i<msg.length;i++)
          ???{
          ????if(msg[i].isMimeType("text/*"))//判斷郵件類型
          ????{
          ?????receiver.handleText(msg[i]);
          ????}else{
          ?????receiver.handleMultipart(msg[i]);
          ????}
          ????System.out.println("****************************");
          ???}
          ???receiver.close();
          ??}catch(Exception?e)
          ??{
          ???System.out.println(e);
          ??}
          ?}
          ?}?


          ? 沒有習慣讀java代碼的兄弟可能會覺得麻煩了一點,其中有個小問題,下載的附件會再文件名后面加上一個”#”符號,不知道這是javamail的特別處理還是pop3的規范。通過程序更改文件名很簡單,就不說了。對于email還有很多其他的操作,可以自己取查看一下javadoc,我就不影響大家探索的樂趣了。在Properties里配置代理服務器,可以讓程序通過代理收發郵件,一般的HTTP、socks?4、socks?5都支持。

          posted @ 2006-10-19 16:10 風中的舞者 閱讀(387) | 評論 (0)編輯 收藏
          http://www.dokeos.com/howto.php
          posted @ 2006-09-19 20:51 風中的舞者 閱讀(373) | 評論 (0)編輯 收藏
          s
          posted @ 2006-08-12 17:26 風中的舞者 閱讀(355) | 評論 (1)編輯 收藏
          在CMP實體BEAN中使用BLOB數據類型
          2005-07-19? ?來源:matrix.org.cn ?作者:matrix.org.cn
          摘要:
          在Oracle這樣的關系數據庫中,CLOB和BLOB類型被用來存放大對象。BOLB表示二進制大對象,這種數據類型通過用來保存圖片,圖象,視頻等。CLOB表示字符大對象,能夠存放大量基于字符的數據。JDBC定義java類型java.sql.Clob 和java.sql.Blob 對應數據庫中的CLOB和BLOB類型。然而這兩種類型并不能在實體BEAN中使用,因為這兩個類沒有被序列化(Serializable)。因此我們不能在CMP實體BEAN中定義java.sql.Clob或java.sql.Bl


          在Oracle這樣的關系數據庫中,CLOB和BLOB類型被用來存放大對象。BOLB表示二進制大對象,這種數據類型通過用來保存圖片,圖象,視頻等。CLOB表示字符大對象,能夠存放大量基于字符的數據。

          JDBC定義java類型java.sql.Clob 和java.sql.Blob 對應數據庫中的CLOB和BLOB類型。然而這兩種類型并不能在實體BEAN中使用,因為這兩個類沒有被序列化(Serializable)。因此我們不能在CMP實體BEAN中定義java.sql.Clob或java.sql.Blob這兩種數據類型。

          如果我們要使用數據庫的BLOB字段,我們必須在實體bean中聲明CMP字段為 byte[] 并映射該字段到數據庫的BLOB字段。如果要使用CLOB字段,我們需要使用定義CMP字段為 java.lang.String or char[] 。

          一個ENTITY的范例
          在一個企業里,處于安全考慮,我們也許要將員工的圖片保存到數據庫中的表里。這里我們使用EmployeePicture 作為范例來代表員工的圖片實體。這個EmployeePictureBean CMP有兩個屬性 empno, picture。 picture 字段被定義成byte[]型 。

          該EmployeePicture實體BEAN被映射到EMPPIC數據表, picture 屬性被映射為EMPPIC 表中的picture 字段,該picture字段是定義為BLOB類型的。

          下面是EmployeePictureBean.java的部分核心代碼:

          public abstract class EmployeePictureBean implements EntityBean
          {
          ? ....
          ? public abstract byte[] getPicture();
          ? public abstract void setPicture(byte[] newPicture);
          ? public Long ejbCreate(Long empno, byte[] newPicture)
          ? {
          ? ? setEmpno(empno);
          ? ? setPicture(newPicture);
          ? ? return empno;
          ? }

          ? public void ejbPostCreate(Long empno, byte[] newPicture)
          ? {
          ? }
          ? ...
          }


          如果我們使用OC4J 9.0.4 ,就需要在orion-ejb-jar.xml中定義實體BEAN屬性到數據表字段的映射。如果使用了其他J2EE容器,就需要在相關廠商的部署描述符中定義O-R映射。下面演示在OC4J中的映射代碼:

          <entity-deployment name="EmployeePicture" data-source="jdbc/OracleDS" table="EMPPIC">
          ? <primkey-mapping>
          ? ? <cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(8)"/>
          ? </primkey-mapping>
          ? <cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(8)"/>
          ? <cmp-field-mapping name="picture" persistence-name="PICTURE" persistence-type="BLOB"/>
          </entity-deployment>



          客戶端:
          CMP實體BEAN的客戶端沒有什么特別的處理。唯一需要注意的是在update數據表時要使用BufferedInputStream 來讀取IMAGE文件,但在檢索數據表時使用OutputStream 。

          下面演示如何讀取一個IMAGE文件,并創建一個BEAN實例:

           // Locate and open the file

          ? ? File imgFile = new File(fileName);

          ? ? long imgFileSize= imgFile.length();

          ? ? // initialize the byte array

          ? ? byte byteValue[] = new byte[(int)imgFileSize];

          ? ? // Read the file into the byte array

          ? ? InputStream is = new BufferedInputStream(new FileInputStream(imgFile));

          ? ? int len = is.read(byteValue);

          ? ? //Add the byte to the entity bean field

          ? ? if(len!=imgFileSize)

          ? ? {

          ? ? ? ? ? ?System.out.println("Read bytes did not equal file size on directory");

          ? ? }

          ? ? else

          ? ? {

          ? ? ? EmployeePictureLocal employeePicture = empHome.create(empNo , byteValue);

          posted @ 2006-06-19 23:51 風中的舞者 閱讀(294) | 評論 (0)編輯 收藏
          weblogic.jdbc.oracle.OracleDriver

          在weblogic 的控制臺下建的連接池,數據源在workshop中無法建實體bean,
          但在workshop中的卻可以。關鍵就是要修改驅動程序如上。
          posted @ 2006-06-17 08:58 風中的舞者 閱讀(230) | 評論 (0)編輯 收藏

          http://www.onlinedown.net/soft/40251.htm

          posted @ 2006-03-27 21:08 風中的舞者 閱讀(217) | 評論 (1)編輯 收藏

          在routeros中,每一個ppoe用戶撥號成功后,都會在服務器上產生一個接口。我們可以在防火墻中阻擋掉對原來數據的轉發,
          iptables -A FORWARD -i ether1 -j DROP
          從而要求用戶必須撥號上網

          或者只對ppoe客戶的地址段進行nat masqu....。只對其地址池。我想沒有撥號的,私自設置地址應不可上網。

          posted @ 2006-03-21 20:25 風中的舞者 閱讀(243) | 評論 (0)編輯 收藏
          將common-loggin.jar log4j.jar 放到 common\lib下
          將log4j.properties 放在 shared\classes 下
          posted @ 2006-02-15 22:25 風中的舞者 閱讀(487) | 評論 (0)編輯 收藏
          http://www.ipointportal.com
          posted @ 2005-11-27 15:07 風中的舞者 閱讀(135) | 評論 (0)編輯 收藏

          http://www.uportal.org

          posted @ 2005-11-24 11:25 風中的舞者 閱讀(157) | 評論 (0)編輯 收藏
          http://www.sakaiproject.org/
          About Sakai

          The Sakai Project is a community source software development effort to design, build and deploy a new Collaboration and Learning Environment (CLE) for higher education. The Project began in January, 2004.

          Goals
          The Sakai Project's primary goal is to deliver the Sakai application framework and associated CMS tools and components that are designed to work together.  These components are for course management, and, as an augmentation of the original CMS model, they also support research collaboration.  The software is being designed to be competitive with the best CMSs available.

          The tools are being built by designers, software architects and developers at different institutions, using an experimental variation of an open source development model called the community source model (see below).  To provide a support system for institutions that want to be involved in the Sakai Project, either by adopting Sakai tools or by developing tools for inter-institutional portability, the Sakai Project  has also formed the Sakai Educational Partners Program (SEPP) and the Sakai Commercial Affiliates Program.

          Origins
          The Sakai Project has its origins at the University of Michigan and Indiana University, where both universities independently began open source efforts to replicate and enhance the functionality of their existing CMSs .  Soon after, MIT and Stanford joined in and, along with the Open Knowledge Initiaitive (OKI) and the uPortal consoritum, and a generous grant from the Mellon Foundation, they formed the Sakai Project. 

          Community Source Development Model
          The Sakai Project follows what is called the community source model, which is an extension to the already successful, economically feasible, open source movement forged by projects such as Apache, Linux, and Mozilla. Based on the goal of addressing the common and unique needs of multiple institutions. community source relies more on defined roles, responsibilities, and funded commitments by community members, than some open source development models.

          Current Progress
          To date, the Sakai Project has put out three major software releases (1.0, 1.5 and 2.0), developed an Educational Partner's Program which now has around  80 members around the world with 14+ active discussion groups  and five commercial affiliates, organized three highly successful SEPP conferences,  and successfully demonstrated a  model for community source software development among colleges and universities.  

          Future
          In the future, the Sakai Project expects to continue its effort to build out its interoperable framework and develop many new tools and extensions. In addition, the Partner's Program will continue to grow and the development model used for Sakai is expected to become more broadly applicable.

          posted @ 2005-11-24 11:24 風中的舞者 閱讀(807) | 評論 (0)編輯 收藏

          Backup your Linux System | 備份你的 Linux 系統

          Author | 作者 : Kreny

          Abstract: Backup your data in Linux system by using shell commands, OpenSSH, etc.

          摘要: 本文結合個人粗淺的 Linux 經驗, 闡述如何使用 shell 命令以及 OpenSSH 等工具備份 Linux 系統和數據。

          一、我們需要備份什么?

          我的 Linux 系統是基于 Redhat 的Redhat Linux 9.0,同時配置了諸如 MySQL、PHP、Apache 等基礎服務,同時又配有 Awstats、MRTG、MT 等應用服務程序,因此,我們需要備份的除了系統本身的重要文件以外,還需要備份數據庫、log文件和統計數據文件等。當然另外一項必不可少的就是編譯各項服務時的 ./configure 參數,這里就不贅述了。

          二、制定備份文件列表。

          這個步驟就是歸納一下需要備份的目錄列表。以下我就依照我所安裝的各項服務作了一個簡單的list。 一些文件的地址是以我的服務器為標準(以"/"開頭),一些則以相對目錄來描述(以"./"開頭)。

          系統:

        1. /etc /usr/local/etc
          包含所有核心配置文件。這其中包括網絡配置、系統名稱、防火墻規則、用戶、組,以及其他全局系統項。
        2. /var
          包含系統守護進程(服務)所使用的信息,包括 DNS 配置、DHCP 租期、郵件緩沖文件、HTTP 服務器文件、db2 實例配置,等等。
        3. /home
          包含所有用戶的默認用戶主目錄。這包括他們的個人設置、已下載的文件和用戶不希望失去的其他信息。
        4. /root
          是根(root)用戶的主目錄。
        5. /opt
          是安裝許多非系統文件的地方。IBM 軟件就安裝在這里。OpenOffice、JDK 和其他軟件在默認情況下也安裝在這里。

          系統中不需要備份的目錄:

        6. /proc
          應該永遠不要備份這個目錄。它不是一個真實的文件系統,而是運行內核和環境的虛擬化視圖。它包括諸如 /proc/kcore 這樣的文件,這個文件是整個運行內存的虛擬視圖。備份這些文件只是在浪費資源。
        7. /dev
          包含硬件設備的文件表示。如果計劃還原到一個空白的系統,那就可以備份 /dev。然而,如果計劃還原到一個已安裝的 Linux 系統,那么備份 /dev 是沒有必要的。

          更多關于目錄的解釋,請查看 Filesystem Hierarchy StandardRed Hat Linux Overview of File System Hierarchy Standard (FHS)

          MySQL:

        8. /usr/local/mysql
          同時要注意版本的保留,在恢復的時候使用相同的版本(或者相同系列的版本)會減少更多不必要的麻煩,例如 “/usr
          /local/mysql-standard-4.1.7-pc-linux-i686”。
        9. /etc/my.cnf
          MySQL 的配置文件。

          Apache:

        10. /usr/local/apache2/logs
          Apache 的 log 文件。這里建議使用 cronolog 來 rotate Apache 的巨大 log??梢詤⒖嘉业?cronolog 雜記
        11. /usr/local/apache2/conf
          Apache 的配置文件,例如: httpd.conf。還是建議在修改此文本的時候使用“#”號 comment 修改的內容,然后添加需要修改的內容。

          PHP:

        12. /usr/local/lib/php.ini
          個人覺得這個就夠了。如果你設定了 php 的 error log 文件,當然那個也是需要的。

          Movable Type:

        13. ./MT-3.0D-full-en_ususr/ 和你的 weblog 目錄
          一般來說 blog 不會太大,不介意的話就整個備份一下。當然最重要的是 ./MT-3.0D-full-en_ususr/db/ 文件夾,里面有所有的數據(如果你沒有用 MySQL 作為 MT 的數據存儲格式的話)。

          Awstats:
        14. /etc/awstats/
          Awstats 的配置文件。諸如:awstats.blog.conf
        15. /var/lib/awstats/
          Awstats 的分析留檔文件。 諸如:awstats082004.blog.txt

          MRTG:

        16. MRTG 的輸出文件夾。內有圖片和諸如 12.34.56.78_12.34.56.78.log 的log文件。

          三、使用 tar 和 crontab 等簡單工具備份。

          以下是使用 tar 的腳本,去掉了多余的說明部分。 您也可以點擊這里下載并修改以適合自己的系統。在腳本中我盡量用更多的方法來進行備份。在實際應用中可以將步驟更加簡化。更多關于 tar 的參數請看 man tar

          #!/bin/sh

          # Date format: 20040626
          DATE=`date -d yesterday +%Y%m%d`

          # MySQL version & directory
          MYSQL_VERSION="4.x.x"
          MYSQL_DIR="/usr/local/mysql/data"

          # MT Blog directory
          MTBLOG_DIR="/path-to-mt/db/"

          # Backup directory & Backup Filelist
          BACKUP_DIR="/path-to-backup/backupfile"
          BACKUP_FILELIST="/path-to-backup/filelist"

          # Backup MySQL
          printf "Backup MySQL data directory, please wait...\n"
          tar -zpcvPf $BACKUP_DIR/mysql-standard-$MYSQL_VERSION-data-$DATE.tgz $MYSQL_DIR | grep "tar:"
          printf "Done! The new backup file is: $BACKUP_DIR/mysql-standard-$MYSQL_VERSION-data-$DATE.tgz\n\n"

          # Backup MT Blog
          printf "Backuping the MT3.0 Weblog data directory, please wait...\n"
          tar -zpcvPf $BACKUP_DIR/MT-db-$DATE.tgz $MTBLOG_DIR | grep "tar:"
          printf "Done! The new backup file is: $BACKUP_DIR/MT-db-$DATE.tgz\n"

          這里引用了『Linux 備份與恢復速成指南』中的一個小技巧,將文件列表寫入一個文件進行操作。查看我的Filelist

          以下是一個文件列表的例子:

          /etc
          /var
          /home
          /usr/local
          /opt (有時會是空目錄)
          以下解釋引自『Linux 備份與恢復速成指南』:

          請注意 tar -T(或 files-from)命令不能接受通配符。文件必須明確地列出。上面的例子展示了一種單獨地引用文件的方法。您還可以執行腳本來搜索系統,然后建立一個列表。下面就是這樣一個腳本的例子:

          #!/bin/sh
          cat MyFiles > TempList
          find /usr/share -iname *.png >> TempList
          find /tmp -iname *.iso >> TempList
          tar -cpzMf /path-to-backup/backupfile -T TempList
          上面的腳本首先將 MyFiles 中的所有現有文件列表復制到 TempList。然后它執行兩個 find 命令來搜索文件系統中匹配某個模式的文件,并將它們附加到 TempList。第一次是搜索 /usr/share 目錄樹中以 .png 結尾的所有文件。第二次是搜索 /tmp 目錄樹中以 .iso 結尾的所有文件。在建立好列表之后,tar 然后在文件設備 /dev/st0 (第一個 SCSI 磁帶設備)上創建 一個新的歸檔文件,該文件使用 gzip 格式來壓縮,并保留所有文件權限。該歸檔文件將跨越多個卷。要歸檔的文件的名稱將從 TempList 文件中提取。

          四、適用于 log 和數據庫的增量備份(incremental backup)。

          對于龐大的 log 或者 數據庫文件,每天進行完全備份似乎不是很能合理高效地實現備份工作。所以在較短的時間周期內,適用增量備份(incremental backup)會是一個不錯的選擇。

          tar 并不是最好的增量備份工具

          tar 并不是最好的增量備份的工具,但是它也可以實現增量備份。參照 『The tar backup program』中的腳本可以實現這個操作。

          簡單地介紹一下其原理:
          首先,制作一個完全備份的時間點文件,例如 "full-date"。其中寫入某次完全備份的時間點,例如 echo $NOW > full-date。
          然后在自定的時間循環期內(例如一周),每次和完全備份時間點(full-date)對比后進行增量備份。
          其中最關鍵的一個語句就是:

          tar --newer $full-date -zcpf $BACKUPDIR/$BACKUPFILE-$NOW.tgz $DIRECTOIES
          其結果就是,在一周中會產生 6 個獨立文件,其內容是前一天內新增的內容。以下是一個例子:
          [root@deep] /# ls -l /backups/

          total 22217
          -rw-r--r-- 1 root root 10731288 Feb 7 11:24 deep-01Feb.tar << 每月月初一次完全備份
          -rw-r--r-- 1 root root 6879 Feb 7 11:24 deep-Fri.tar << 每天的增量備份
          -rw-r--r-- 1 root root 2831 Feb 7 11:24 deep-Mon.tar
          -rw-r--r-- 1 root root 7924 Feb 7 11:25 deep-Sat.tar
          -rw-r--r-- 1 root root 11923013 Feb 7 11:24 deep-Sun.tar << 每周一次完全備份
          -rw-r--r-- 1 root root 5643 Feb 7 11:25 deep-Thu.tar
          -rw-r--r-- 1 root root 3152 Feb 7 11:25 deep-Tue.tar
          -rw-r--r-- 1 root root 4567 Feb 7 11:25 deep-Wed.tar
          drwxr-xr-x 2 root root 1024 Feb 7 11:20 last-full

          tar 中幾個開關的簡介:

        17. The c option specifies that an archive file is begin created.
        18. The p option preserves permissions; file protection information will be remembered.
        19. The N or newer option does an incremental backup and only stores files newer than DATE.
        20. The f option states that the very next argument will be the name of the archive file or device being written.
        21. The z option specifies that an gzip file will be created.
        22. The u option can APPEND more files to a tarball file.
          注意:-u 開關并不是增量備份,而是往原有的 tar 包里面添加新的文件。

          fbackup is a better choice

          在 HP 的論壇上,有關于增量備份的討論--。但是因為我不是 HP 的系統,tar 已經可以滿足現有的備份需求。

          五、使用 ssh 實現安全網絡遠程備份。

          [很抱歉,此段筆者沒有試驗環境,現在之能添加幾篇關于 ssh 遠程傳送的文章。等到經過試驗后,我會添加具體內容。]

        23. 33.8. Backing up and restoring over the network
        24. 輕松進行自主的、安全的、分布式網絡備份

          六、個人使用的 e-mail 簡單備份。

          由于 Yahoo!、Google、Hotmail 相繼推出了 1-2G 的郵箱,因此可是試著使用帶有文件附件的 E-mail 來傳輸小于各個郵箱的單封信件上限大小的文件。 具體需要用到一些諸如 uudecode 的命令,所以需要先安裝一個 Sharutils 。 我在編譯中遇到一些簡單的錯誤,這里是我修改過的 Sharutils。

          在命令行下發送帶附件的郵件時,還是建議使用諸如 MUTT 的 MUA,請查看我的 MUTT 的安裝失敗經歷,也許對新裝的用戶有所幫助。

          安裝完畢后,可以使用 Mutt 的命令行一行解決問題。首先先寫一個郵件文本 mailcontent.txt。

          # cat mailcontent.txt | mutt -s "mailtitle" -a attachfile1 mail@address

          結合上面的 shell 腳本,如果你有企業級郵箱的話,不妨也試試這種方法。僅供參考。

          參考文檔:

        25. 『Windows 到 Linux 之旅:第 8 部分. 備份與恢復 之 Linux 備份與恢復速成指南』

        26. 『在 Linux 上進行自動備份--輕松進行自主的、安全的、分布式網絡備份』

        27. 『在文字模式下用mail如何將文件以附件方式發送』

        28. W. Curtis Preston (2003)《Unix Backup & Recovery》

        29. 『Filesystem Hierarchy Standard』

        30. 『Red Hat Linux Overview of File System Hierarchy Standard (FHS)』

        31. Securing and Optimizing Linux - A Hands on Guide (Red Hat Edition)》 一書的 第 7 章“備份和還原”是另一份不錯的指南,其中包括一個腳本,用于執行基于 tar 的增量備份(incremental backup)。

          Useful Links:

        32. http://www.linux-backup.net/
        33. Sharutils
        34. posted @ 2005-11-12 10:37 風中的舞者 閱讀(359) | 評論 (0)編輯 收藏
          <2005年11月>
          303112345
          6789101112
          13141516171819
          20212223242526
          27282930123
          45678910

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          java技術

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 饶河县| 汕尾市| 广平县| 聂拉木县| 襄垣县| 南康市| 青岛市| 顺平县| 敦化市| 河源市| 吐鲁番市| 大田县| 南阳市| 邵阳市| 炎陵县| 监利县| 崇州市| 南充市| 商城县| 登封市| 扎兰屯市| 察哈| 耒阳市| 大城县| 依兰县| 博湖县| 英山县| 庆元县| 博客| 天津市| 东源县| 奎屯市| 乌拉特后旗| 陆河县| 塔城市| 鄯善县| 南京市| 江山市| 宁陕县| 额敏县| 红原县|