目录
- 基本思路
- 示例
[一]、基本思路
在FireFox、Chrome浏览器中可以根据document.getElementById(“id_file”).files[0].size 获取上传文件的大小(字节数),而IE浏览器中不支持该属性,只能借助<img>标签[……]
导入source文件的命令:
1 |
mvn install:install-file -DgroupId=tokyotyrant -DartifactId=tokyotyrant -Dversion=0.11 -Dpackaging=jar -Dfile=tokyotyrant-0.11-sources.jar -DgeneratePom=true -Dclassifier=sources |
导入过程如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
d:\>mvn install:install-file -DgroupId=tokyotyrant -DartifactId=tokyotyrant -D version=0.11 -Dpackaging=jar -Dfile=tokyotyrant-0.11-sources.jar -DgeneratePom =true -Dclassifier=sources [INFO] Scanning for projects... [INFO] [INFO] ----------------------------------------------------------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] ----------------------------------------------------------------------- [INFO] [INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone- m --- [INFO] Installing d:\tokyotyrant-0.11-sources.jar to d:\.m2\repository\tokyoty nt\tokyotyrant\0.11\tokyotyrant-0.11-sources.jar [INFO] Installing C:\Users\Michael\AppData\Local\Temp\mvninstall35351970540989 266.pom to d:\.m2\repository\tokyotyrant\tokyotyrant\0.11\tokyotyrant-0.11.pom [INFO] ----------------------------------------------------------------------- [INFO] BUILD SUCCESS [INFO] ----------------------------------------------------------------------- [INFO] Total time: 1.029s [INFO] Finished at: Thu Jun 28 16:56:01 CST 2012 [INFO] Final Memory: 2M/15M [INFO] ----------------------------------------------------------------------- |
导入之前的本地资源库目录结构如下:
1 2 3 4 5 6 7 8 9 10 |
D:\.m2\repository\tokyotyrant>tree /F 卷 work 的文件夹 PATH 列表 卷序列号为 2AF7-9BD9 D:. └─tokyotyrant └─0.11 m2e-lastUpdated.properties tokyotyrant-0.11.jar tokyotyrant-0.11.pom _maven.repositories |
导入之后[……]
目录:
目录
[一]、概述
Apache Ivy是一个优秀的管理(记录、跟踪、解析和报告)项目依赖的工具,可与Apache Ant紧密集成。
官网:http://ant.apache.org/ivy/index.html
截止:2012-06[……]
ant 进行编译时发生如下错误信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
G:\test\ant\hello-ivy>ant Buildfile: G:\test\ant\hello-ivy\build.xml resolve: BUILD FAILED G:\test\ant\hello-ivy\build.xml:38: Problem: failed to create task or type antli b:org.apache.ivy.ant:retrieve Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any <presetdef>/<macrodef> declarations have taken place. No types or tasks have been defined in this namespace yet This appears to be an antlib declaration. Action: Check that the implementing library exists in one of: -D:\ant\bin\..\lib -C:\Users\Michael\.ant\lib -a directory added on the command line with the -lib argument Total time: 0 seconds |
原因:ant的lib目录下缺少ivy相关的jar
解决办法:把ivy的jar包(ivy-2.3.0-rc1.jar) 复制到%ANT_HOME%\lib\下即可。
java代码:EncoderHandler.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
package michael.utils; import java.security.MessageDigest; /** * blog www.micmiu.com * * @author Michael * */ public class EncoderHandler { private static final String ALGORITHM = "MD5"; private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; /** * encode string * * @param algorithm * @param str * @return String */ public static String encode(String algorithm, String str) { if (str == null) { return null; } try { MessageDigest messageDigest = MessageDigest.getInstance(algorithm); messageDigest.update(str.getBytes()); return getFormattedText(messageDigest.digest()); } catch (Exception e) { throw new RuntimeException(e); } } /** * encode By MD5 * * @param str * @return String */ public static String encodeByMD5(String str) { if (str == null) { return null; } try { MessageDigest messageDigest = MessageDigest.getInstance(ALGORITHM); messageDigest.update(str.getBytes()); return getFormattedText(messageDigest.digest()); } catch (Exception e) { throw new RuntimeException(e); } } /** * Takes the raw bytes from the digest and formats them correct. * * @param bytes * the raw bytes from the digest. * @return the formatted bytes. */ private static String getFormattedText(byte[] bytes) { int len = bytes.length; StringBuilder buf = new StringBuilder(len * 2); // 把密文转换成十六进制的字符串形式 for (int j = 0; j < len; j++) { buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]); buf.append(HEX_DIGITS[bytes[j] & 0x0f]); } return buf.toString(); } public static void main(String[] args) { System.out.println("111111 MD5 :" + EncoderHandler.encodeByMD5("111111")); System.out.println("111111 MD5 :" + EncoderHandler.encode("MD5", "111111")); System.out.println("111111 SHA1 :" + EncoderHandler.encode("SHA1", "111111")); } } |
运行结果如下:
1 2 3 |
111111 MD5 :96e79218965eb72c92a549dd5a330112 111111 MD5 :96e79218965eb72c92a549dd5a330112 111111 SHA1 :3d4f2bf07dc1be38b20cd6e46949a1071f9d0e3d |
目录结构:
[一]、基础使用
1.内存中哈希数据库
打开一个终端1,输入以下命令回车即运行:
1 |
[terminal-1]$ ttserver |
默[……]
近期评论