一、利用Serv-U建立个人Ftp服务器
二、花生壳注册免费动态域名 三、端口映射又叫端口转发
1.1解压如下,双击打开 ServUAdmin程序
1.3新建域 右键单击域,添加的新的域
这里特别提出许多人对端口理解的不好,端口就是用来区分数据包属于计算机上哪个应用程序,比如服务器也是其中一个应用程序。
客户端的端口使用介于 1024 和 65535 之间的任何端口
第四步 next
1.4在域的下面右键单击“用户” 建立匿名用户 名称必须用"anonymous" ,匿名用户无需密码即可登录服务器
这样就完成搭建一个ftp服务器了,在局域网可以这么访问 在360浏览器输入ftp://机上本机内网ip地址,如"ftp://192.168.0.102"。
假如这里端口使用的不是默认 21 比如是 8080,那要在网址后面加冒号和端口号。其实平常我们http上网不用输入端口号 www.csnd.com 系统默认在后面帮我们加了80
那么输入网址变成 “ftp:\\192.168.0.102:8080”
我们也可以下 “FlashXp”软件来下载文件 这样也比较方便
package com.lss.mysql.test; import javax.transaction.xa.Xid; /** * * @author SHOUSHEN LUAN * @datetime Mar 3, 20135:44:34 PM * */ public class MyXid implements Xid { int formatId; byte globalTransactionId[]; byte branchQualifier[]; public MyXid() { } public MyXid(int formatId, byte[] globalTransactionId, byte[] branchQualifier) { this.formatId = formatId; this.globalTransactionId = globalTransactionId; this.branchQualifier = branchQualifier; } public int getFormatId() { return this.formatId; } public void setFormatId(int formatId) { this.formatId = formatId; } public byte[] getGlobalTransactionId() { return this.globalTransactionId; } public void setGlobalTransactionId(byte[] globalTransactionId) { this.globalTransactionId = globalTransactionId; } public byte[] getBranchQualifier() { return this.branchQualifier; } public void setBranchQualifier(byte[] branchQualifier) { this.branchQualifier = branchQualifier; } }
package com.lss.test; import com.lss.mysql.test.MyXid; import com.microsoft.sqlserver.jdbc.SQLServerXADataSource; import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.sql.*; import javax.transaction.xa.*; import oracle.jdbc.xa.client.OracleXADataSource; /** * 多数据源事物处理 * @author SHOUSHEN LUAN * @datetime Mar 3, 20135:44:42 PM * */ public class ManyXADataSource { public static void main(String[] args) { ManyXADataSource mdt = new ManyXADataSource(); try { mdt.manyXADataSourceTest(); } catch (Exception ex) { System.out.println("除SQLException、XAException之外的异常: \n"); ex.printStackTrace(); } } public void manyXADataSourceTest() { // 定义所需用到的变量 Connection mysqlConnec = null; Connection msSqlConnec = null; Connection mysql_Connec = null; Connection oracleConnec = null; MysqlXADataSource mysqlXADataSource = null; SQLServerXADataSource msSqlXADataSource = null; MysqlXADataSource mysql_XADataSource = null; OracleXADataSource oracleXADataSource = null; XAConnection mysqlXAConnection = null; XAConnection msSqlXAConnection = null; XAConnection mysql_XAConnection = null; XAConnection oracleXAConnection = null; XAResource mysqlXAResource = null; XAResource msSqlResource = null; XAResource mysql_Resource = null; XAResource oracleResource = null; Xid mysqlXid = null; Xid msSqlXid = null; Xid mysql_Xid = null; Xid oracleXid = null; Statement mysqlStatement = null; Statement msSqlStatement = null; Statement mysql_Statement = null; Statement oracleStatement = null; try { // 获得数据源 mysqlXADataSource = new MysqlXADataSource(); mysqlXADataSource.setURL("jdbc:mysql://localhost:3306/test"); mysql_XADataSource = new MysqlXADataSource(); mysql_XADataSource.setURL("jdbc:mysql://10.10.10.119:3306/test"); msSqlXADataSource = new SQLServerXADataSource(); msSqlXADataSource.setURL("jdbc:sqlserver://10.10.10.119:1433;DatabaseName=RTC;loginTimeout=20;user=sa;password=chgpwd122105"); // sqlDs.setUser("sa"); // sqlDs.setPassword("chgpwd122105"); // sqlDs.setServerName("10.10.10.119"); // sqlDs.setPortNumber(1433); // sqlDs.setDatabaseName("RTC"); oracleXADataSource = new OracleXADataSource(); oracleXADataSource.setURL("jdbc:oracle:thin:@10.10.10.119:1521:WMS"); // 获得连接 mysqlXAConnection = mysqlXADataSource.getXAConnection("root", "123456"); System.out.println("xamysqlCn: " + mysqlXAConnection); msSqlXAConnection = msSqlXADataSource.getXAConnection(); System.out.println("xasqlCn: " + msSqlXAConnection); mysql_XAConnection = mysql_XADataSource.getXAConnection("root", "9999"); System.out.println("xamysqlCn2: " + mysql_XAConnection); oracleXAConnection = oracleXADataSource.getXAConnection("tiger", "tiger"); System.out.println("xaoraCn: " + oracleXAConnection); mysqlConnec = mysqlXAConnection.getConnection(); msSqlConnec = msSqlXAConnection.getConnection(); mysql_Connec = mysql_XAConnection.getConnection(); oracleConnec = oracleXAConnection.getConnection(); mysqlStatement = mysqlConnec.createStatement(); msSqlStatement = msSqlConnec.createStatement(); mysql_Statement = mysql_Connec.createStatement(); oracleStatement = oracleConnec.createStatement(); // 定义XAResource mysqlXAResource = mysqlXAConnection.getXAResource(); msSqlResource = msSqlXAConnection.getXAResource(); mysql_Resource = mysql_XAConnection.getXAResource(); oracleResource = oracleXAConnection.getXAResource(); // 定义Xid mysqlXid = new MyXid(0, new byte[] { 0x01 }, new byte[] { 0x02 }); msSqlXid = new MyXid(0, new byte[] { 0x01 }, new byte[] { 0x03 }); mysql_Xid = new MyXid(0, new byte[] { 0x01 }, new byte[] { 0x04 }); oracleXid = new MyXid(0, new byte[] { 0x01 }, new byte[] { 0x05 }); // 执行Mysql mysqlXAResource.start(mysqlXid, XAResource.TMNOFLAGS); mysqlStatement.executeUpdate("insert into test values(4,'XA','F','Class4')"); mysqlXAResource.end(mysqlXid, XAResource.TMSUCCESS); // 执行SQLServer msSqlResource.start(msSqlXid, XAResource.TMNOFLAGS); msSqlStatement.executeUpdate("insert into test values('444')"); msSqlResource.end(msSqlXid, XAResource.TMSUCCESS); // 执行Mysql mysql_Resource.start(mysql_Xid, XAResource.TMNOFLAGS); mysql_Statement.executeUpdate("insert into test values(4,'XA','F','Class4')"); mysql_Resource.end(mysql_Xid, XAResource.TMSUCCESS); // 执行Oracle System.out.println("xaoraRes: " + oracleResource); oracleResource.start(oracleXid, XAResource.TMNOFLAGS); oracleStatement.executeUpdate("insert into test123 values('4','44','444')"); System.out.println("oraXid: " + oracleXid); oracleResource.end(oracleXid, XAResource.TMSUCCESS); // 准备 int mysqlRes = mysqlXAResource.prepare(mysqlXid); int msSqlRes = msSqlResource.prepare(msSqlXid); int mysql_Res = mysql_Resource.prepare(mysql_Xid); int oracleRes = oracleResource.prepare(oracleXid); // 判断准备就绪与否 提交或回滚 if (mysqlRes == XAResource.XA_OK && mysql_Res == XAResource.XA_OK && oracleRes == XAResource.XA_OK && msSqlRes == XAResource.XA_OK) { mysqlXAResource.commit(mysqlXid, false); System.out.println("Mysql 事务提交成功!"); msSqlResource.commit(msSqlXid, false); System.out.println("SQLServer 事务提交成功!"); mysql_Resource.commit(mysql_Xid, false); System.out.println("Mysql2 事务提交成功!"); oracleResource.commit(oracleXid, false); System.out.println("Oracle 事务提交成功!"); } else { mysqlXAResource.rollback(mysqlXid); msSqlResource.rollback(msSqlXid); mysql_Resource.rollback(mysql_Xid); oracleResource.rollback(oracleXid); System.out.println("事务回滚成功!"); } } catch (SQLException ex) { ex.printStackTrace(); try { mysqlXAResource.rollback(mysqlXid); msSqlResource.rollback(msSqlXid); mysql_Resource.rollback(mysql_Xid); oracleResource.rollback(oracleXid); } catch (XAException e) { System.out.println("回滚也出错咯!~"); e.printStackTrace(); } } catch (XAException ex) { ex.printStackTrace(); } finally { try { // 关闭 mysqlStatement.close(); mysqlConnec.close(); mysqlXAConnection.close(); msSqlStatement.close(); msSqlConnec.close(); msSqlXAConnection.close(); mysql_Statement.close(); mysql_Connec.close(); mysql_XAConnection.close(); oracleStatement.close(); oracleConnec.close(); oracleXAConnection.close(); } catch (SQLException ex) { Logger.getLogger(ManyXADataSource.class.getName()).log(Level.SEVERE, null, ex); } } } }
1. 首先下载AndEngine 源码 和 example和八个扩展,下载后,解压。
2.讲10个解压包导入到eclipse(会有错误),
首先,将AndEngine 选择项目--》 属性,选择java compiler,将右侧的 compiler compliance level 改为 1.6 。
其次,针对AndEngine的八个扩展,同样安装上述方法,把compiler compliance level 改为1.6,然后分别导入刚才编译好的 AndEngine的jar包。
最后,针对example,把compiler compliance level 改为1.6,导入刚才编译好的AndEngine的jar包的同时,还要导入刚才编译好的八个扩展的jar包。
做完以上步骤,仍会有些错误:
错误一:
Description Resource Path Location Type
Type mismatch: cannot convert from void to AnimatedSprite BoundCameraExample.java /AndEngineExamples/src/org/andengine/examples line 220 Java Problem
解决办法:
改为
错误二:
Description Resource Path Location Type
The constructor TextOptions(AutoWrap, float, float, HorizontalAlign) is undefined TextBreakExample.java /AndEngineExamples/src/org/andengine/examples line 106 Java Problem
解决办法:
改为:
错误三:
DrawMode cannot be resolved to a variable
解决办法:
改为: