范文一:java 毕业论文外文文献翻译
Advantages of Managed Code
Microsoft intermediate language shares with Java byte code the idea that it is a low-level language with a simple syntax , which can be very quickly translated into native machine code. Having this
well-defined universal syntax for code has significant advantages.
Platform independence
First, it means that the same file containing byte code instructions can be placed on any platform; at runtime the final stage of compilation can then be easily accomplished so that the code will run on that particular platform. In other words, by compiling to IL we obtain platform independence for .NET, in much the same way as compiling to Java byte code gives Java platform independence.
Performance improvement
IL is actually a bit more ambitious than Java byte code. IL is always Just-In-Time compiled (known as JIT), whereas Java byte code was often interpreted. One of the disadvantages of Java was that, on execution, the process of translating from Java byte code to native executable resulted in a loss of performance.
Instead of compiling the entire application in one go (which could lead to a slow start-up time), the JIT compiler simply compiles each portion of code as it is called (just-in-time). When code has been compiled.once, the resultant native executable is stored until the application exits, so that it does not need to be recompiled the next time that portion of code is run. Microsoft argues that this process is more efficient than compiling the entire application code at the start, because of the likelihood that large portions of any application code will not actually be executed in any given run. Using the JIT compiler, such code will never be compiled.
This explains why we can expect that execution of managed IL code will be almost as fast as executing native machine code. What it doesn’t explain is why Microsoft expects that we will get a performance improvement. The reason given for this is that, since the final stage of compilation takes place at runtime, the JIT compiler will know exactly what processor type the program will run on. This means that it can optimize the final executable code to take advantage of any features or particular machine code instructions offered by that particular processor.
实际上, IL 比 Java 字节代码的作用还要大。 IL 总是即时编译的 (简称 JIT) , 而 Java 字节代码常常是解释型的, Java 的一个缺点是,在运行应用程序时,把 Java 字节代码转换为内部可执行代码的过程可可能导致性能的损失。 JIT 编译器并不是把整个应用程序一次编译完 (这样会有很长的启动时间 ) ,而是只编译它调用的那部分代 码。代码编译过一次后,得到的内部可执行代码就存储起来,直到退出该应用程序为止,这样在下次运行这部 分代码时,就不需要重新编译了。 Microsoft 认为这个过程要比一开始就编译整个应用程序代码的效率高得多, 因为任何应用程序的大部分代码实际上并不是在每次运行过程中都执行。使用 JIT 编译器,从来都不会编译这 种代码从来都不会被编译。
这解释了为什么托管 IL 代码的执行几乎和内部机器代码的执行速度一样快,但是并没有说明为什么 Microsoft 认为这会提高性能。其原因是编译过程的最后一部分是在运行时进行的, JIT 编译器确切地知道程序 运行在什么类型的处理器上,利用该处理器提供的任何特性或特定的机器代码指令来优化最后的可执行代码。 传统的编译器会优化代码,但它们的优化过程是独立于代码所运行的特定处理器的。这是因为传统的编译
器是在发布软件之前编译为内部机器可执行的代码。即编译器不知道代码所运行的处理器类型,例如该处理器 是 x86兼容处理器或 Alpha 处理器, 这超出了基本操作的范围。 例如 Visual Studio 6优化了一台一般的 Pentium 机器, 所以它生成的代码就不能利用 Pentium III处理器的硬件特性。 相反, JIT 编译器不仅可以进行 Visual Studio 6所能完成的优化工作,还可以优化代码所运行的特定处理器。
Traditional compilers will optimize the code, but they can only perform optimizations that are independent of the particular processor that the code will run on. This is because traditional compilers compile to native executable before the software is shipped. This means that the compiler doesn’t know what type of processor the code will run on beyond basic generalities, such as that it will be an
x86-compatible processor or an Alpha processor. Visual Studio 6, for example, optimizes for a generic Pentium machine,
so the code that it generates cannot take advantage of hardware features of Pentium III processors. On the other hand, the JIT compiler can do all the optimizations that Visual Studio 6 can, and in addition it will optimize for the particular processor the code is running on.
Language interoperability
The use of IL not only enables platform independence; it also facilitates language interoperability. Simply put, you can compile to IL from one language, and this compiled code should then be interoperable with code that has been compiled to IL from another language.
You’re probably now wondering which languages aside from C# are interoperable with .NET, so let’s briefly discuss how some of the other common languages fit into .NET.
Visual Basic .NET
Visual Basic .NET has undergone a complete revamp from Visual Basic 6 to bring it up-to-date
with .NET. The way that Visual Basic has evolved over the last few years means that in its previous version, Visual Basic 6, it was not a suitable language for running .NET programs. For example, it is heavily integrated into COM and works by exposing only event handlers as source code to the developer — most of the background code is not available as source code. Not only that, it does not support implementation inheritance, and the standard data types Visual Basic 6 uses are incompatible with .NET. Visual Basic 6 was upgraded to Visual Basic .NET, and the changes that were made to the language are so extensive you might as well regard Visual Basic .NET as a new language. Existing Visual Basic 6 code does not compile as Visual Basic .NET code. Converting a Visual Basic 6 program to Visual Basic .NET requires extensive changes to the code. However, Visual Studio .NET (the upgrade of VS for use with .NET) can do most of the changes for you. If you attempt to read a Visual Basic 6 project into Visual Studio .NET, it will upgrade the project for you, which means that it will rewrite the Visual Basic 6 source code into Visual Basic .NET source code. Although this means that the work involved for you is heavily cut down, you will need to check through the new Visual Basic .NET code to make sure that the project still works as intended because the conversion might not be perfect. One side effect of this language upgrade is that it is no longer possible to compile Visual Basic .NET to native executable code. Visual Basic .NET compiles only to IL, just as C# does. If you need to continue coding in Visual Basic 6, you may do so, but the executable code produced will completely ignore the .NET Framework, and you’ll need to keep Visual Studio 6 installed if you want to continue to work in this developer environment.
Visual C++ .NET
Visual C++ 6 already had a large number of Microsoft-specific extensions on Windows. With Visual
C++ .NET, extensions have been added to support the .NET Framework. This means that existing C++ source code will continue to compile to native executable code without modification. It also means, however, that it will run independently of the .NET runtime. If you want your C++ code to run within the .NET Framework, then you can simply add the following line to the beginning of your code:
#using You can also pass the flag /clr to the compiler, which then assumes that you want to compile to managed code, and will hence emit IL instead of native machine code. The interesting thing about C++ is that when you compile to managed code, the compiler can emit IL that contains an embedded native executable. This means that you can mix managed types and unmanaged types in your C++ code. Thus the managed C++ code: class MyClass { defines a plain C++ class, whereas the code: __gc class MyClass { will give you a managed class, just as if you’d written the class in C# or Visual Basic .NET. The advantage of using managed C++ over C# code is that we can call unmanaged C++ classes from managed C++ code without having to resort to COM interop. The compiler raises an error if you attempt to use features that are not supported by .NET on managed types (for example, templates or multiple inheritance of classes). You will also find that you will need to use nonstandard C++ features (such as the __gc keyword shown in the previous code) when using managed classes. Because of the freedom that C++ allows in terms of low-level pointer manipulation and so on, the C++ compiler is not able to generate code that will pass the CLR’s memory type safety tests. If it’s important that your code is recognized by the CLR as memory type safe, then you’ll need to write your source code in some other language (such as C# or Visual Basic .NET). Visual J# .NET The latest language to be added to the mix is Visual J# .NET. Prior to .NET Framework 1.1, users were able to use J# only after making a separate download. Now the J# language is built into the .NET Framework. Because of this, J# users are able to take advantage of all the usual features of Visual Studio .NET. Microsoft expects that most J++ users will find it easiest to use J# if they want to work with .NET. Instead of being targeted at the Java runtime libraries, J# uses the same base class libraries that the rest of the .NET compliant languages use. This means that you can use J# for building ASP.NET Web applications, Windows Forms, XMLWeb services, and everything else that is possible— just as C# and Visual Basic .NET can. Scripting languages Scripting languages are still around, although, in general, their importance is likely to decline with the advent of .NET. JScript, on the other hand, has been upgraded to JScript .NET. We can now write ASP.NET pages in JScript .NET, run JScript .NET as a compiled rather than an interpreted language, and write strongly typed JScript .NET code. With ASP.NET there is no reason to use scripting languages in serverside Web pages. VBA is, however, still used as a language for Microsoft Office and Visual Studio macros. COM and COM+ Technically speaking, COM and COM+ aren’t technologies targeted at .NET, because components based on them cannot be compiled into IL (although it’s possible to do so to some degree using managed C++, if the original COM component was written in C++). However, COM+ remains an important tool, because its features are not duplicated in .NET. Also, COM components will still work— and .NET incorporates COM interoperability features that make it possible for managed code to call up COM components and vice versa (this is discussed in Chapter 29). In general, however, you will probably find it more convenient for most purposes to code new components as .NET components, so that you can take advantage of the .NET base classes as well as the other benefits of running as managed code. 托管代码的优点 Microsoft 中间语言与 Java 字节代码共享一种理念:它们都是一种低级语言,语法很简单,可以非常快速 地转换为机器码。对于代码来说,这种精心设计的通用语法,有很大的优点。 1. 平台无关性 首先,这意味着包含字节代码指令的同一个文件可以放在任一个平台中,运行时编译过程的最后阶段可以 很容易完成,这样代码就可以运行在该特定的平台上。也就是说编译为中间语言就可以获得 .NET 平台无关性, 这与编译为 Java 字节代码就会得到 Java 平台无关性是一样的。 2. 提高性能 实际上, IL 比 Java 字节代码的作用还要大。 IL 总是即时编译的 (简称 JIT) , 而 Java 字节代码常常是解释型的, Java 的一个缺点是,在运行应用程序时,把 Java 字节代码转换为内部可执行代码的过程可可能导致性能的损失。 JIT 编译器并不是把整个应用程序一次编译完 (这样会有很长的启动时间 ) , 而是只编译它调用的那部分代码 (这是其名称由来 ) 。代码编译过一次后,得到的内部可执行代码就存储起来,直到退出该应用程序为止,这样 在下次运行这部分代码时,就不需要重新编译了。 Microsoft 认为这个过程要比一开始就编译整个应用程序代码 的效率高得多,因为任何应用程序的大部分代码实际上并不是在每次运行过程中都执行。使用 JIT 编译器,从 来都不会编译这种代码。 这解释了为什么托管 IL 代码的执行几乎和内部机器代码的执行速度一样快,但是并没有说明为什么 Microsoft 认为这会提高性能。其原因是编译过程的最后一部分是在运行时进行的, JIT 编译器确切地知道程序 运行在什么类型的处理器上,利用该处理器提供的任何特性或特定的机器代码指令来优化最后的可执行代码。 传统的编译器会优化代码,但它们的优化过程是独立于代码所运行的特定处理器的。这是因为传统的编译 器是在发布软件之前编译为内部机器可执行的代码。即编译器不知道代码所运行的处理器类型,例如该处理器 是 x86兼容处理器或 Alpha 处理器, 这超出了基本操作的范围。 例如 Visual Studio 6优化了一台一般的 Pentium 机器, 所以它生成的代码就不能利用 Pentium III处理器的硬件特性。 相反, JIT 编译器不仅可以进行 Visual Studio 6所能完成的优化工作,还可以优化代码所运行的特定处理器。 3. 语言的互操作性 使用 IL 不仅支持平台无关性,还支持语言的互操作性。简言之,就是能将任何一种语言编译为中间代码, 编译好的代码可以与从其他语言编译过来的代码进行交互操作。 那么除了 C#之外,还有什么语言可以通过 .NET 进行交互操作呢?下面就简要讨论其他常见语言如何 与 .NET 交互操作。 (1)VB.NET Visual Basic 6在升级到 Visual Basic .NET时, 经历了一番脱胎换骨的变化。 Visual Basic是在最近的几年中 演化的,其早期版本 Visual Basic 6并不适合运行 .NET 程序。例如,它与 COM 的高度集成,且只把事件处理 程序作为源代码显示给开发人员,大多数后台代码不能用作源代码。另外,它不支持继承, Visual Basic使用的 标准数据类型也与 .NET 不兼容。 Visual Basic 6已经升级为 Visual Basic .NET,对 VB 进行的改变非常大,完全可以把 Visual Basic .NET当 作是一种新语言。现有的 VB6代码不能编译为 VB.NET 代码,把 VB6程序转换为 VB.NET 时,需要对代码进 行大量的改动,但大多数修改工作都可以由 Visual Studio .NET(VS的升级版本,用于与 .NET 一起使用 ) 自动完 成。 如果要把一个 VB6项目读取到 Visual Studio .NET中, Visual Studio .NET就会升级该项目, 也就是说把 VB6源代码重写为 VB.NET 源代码。虽然这意味着其中的工作已大大减轻,但用户仍需要检查新的 VB.NET 代码, 以确保项目仍可正确工作,因为这种转换并不十分完美。 这种语言升级的一个副作用是不能再把 VB.NET 编译为内部可执行代码了。 VB.NET 只编译为中间语言, 就像 C#一样。如果需要继续使用 VB6编写程序,就可以这么做,但生成的可执行代码会完全忽略 .NET Framework ,如果继续把 Visual Studio作为开发环境,就需要安装 Visual Studio 6。 (2)Visual C++ .NET Visual C++ 6有许多 Microsoft 对 Windows 的特定扩展。 通过 Visual C++ .NET, 又加入了更多的扩展内容, 来支持 .NET Framework 。现有的 C++源代码会继续编译为内部可执行代码,不会有修改,但它会独立于 .NET 运行库运行。如果要让 C++代码在 .NET Framework中运行,就要在代码的开头添加下述命令: #using 还要把标记 /clr传递给编译器,编译器假定要编译托管代码,因此会生成中间语言,而不是内部机器码。 C++的一个有趣的问题是在编译托管代码时,编译器可以生成包含内嵌本机可执行代码的 IL 。这表示在 C++代 码中可以把托管类型和非托管类型合并起来,因此托管 C++ 代码: class MyClass { 定义了一个普通的 C++类,而代码: __gc class MyClass { 生成了一个托管类,就好像使用 C#或 VB.NET 编写类一样。实际上,托管 C++比 C#更优越的一点是可以 在托管 C++代码中调用非托管 C++类,而不必采用 COM 交互功能。 如果在托管类型上试图使用 .NET 不支持的特性 (例如,模板或类的多继承 ) ,编译器就会出现一个错误。另 外,在使用托管类时,还需要使用非标准的 C++特性 (例如上述代码中的 __gc关键字 ) 。 因为 C++允许低级指针操作, C++编译器不能生成可以通过 CLR 内存类型安全测试的代码。如果 CLR 把 代码标识为内存类型安全是非常重要的,就需要用其他一些语言编写源代码,例如 C# 或 VB.NET 。 (3)Visual J# 最新添加的语言是 Visual J#。在 .NET Framework 1.1版本推出之前,用户必须下载相应的软件,才能使用 J#。 现在 J#语言内置于 .NET Framework中。 因此, J#用户可以利用 Visual Studio .NET的所有常见特性。 Microsoft 希望大多数 J++用户认为他们在使用 .NET 时,将很容易使用 J#。 J#不使用 Java 运行库,而是使用与其他 .NET 兼容语言一样的基类库。这说明,与 C#和 VB.NET 一样,可以使用 J#创建 ASP.NET Web应用程序、 Windows 窗体、 XML Web服务和其他应用程序。 (4)脚本语言 脚本语言仍在使用之中,但由于 .NET 的推出,一般认为它们的重要性在降低。另一方面, JScript 升级到 JScript.NET 。 ASP.NET 页面可以用 JScript.NET 编写,现在可以把 JScript.NET 当作一种编译语言来运行,而不 是解释性的语言,也可以编写输入量比较大的 JScript.NET 代码。有了 ASP.NET 后,就没有必要在服务器端的 Web 页面上使用脚本语言了,但 VBA 仍用作 Office 文档和 Visual Studio宏语言。 (5)COM 和 COM+ 从技术上讲, COM 和 COM+并不是面向 .NET 的技术,因为基于它们的组件不能编译为 IL(但如果原来的 COM 组件是用 C++编写的,使用托管 C++,在某种程度上可以这么做 ) 。但是, 错误!未找到引用源。 COM+仍然是一个重要的工具,因为其特性没有在 .NET 中完全实现。另外, COM 组件仍可以使用—— .NET 组合了 COM 的互操作性,从而使托管代码可以调用 COM 组件, COM 组件也可以调用托管代码 (见第 29章 ) 。在大多 数情况中,把新组件编写为 .NET 组件,其多数目的是为了更加方便,因为这样可以利用 .NET 基类和托管代码 的其他优点。 毕业设计说明书 Core Java Java核心技术 学生姓名: 学号: 软件学院 学 院: 软件工程 专 业: 指导教师: 2014 年 6 月 Core Java When Java technology first appeared on the scene, the excitement was not about a well-crafted programming language but about the possibility of safely executing applets that are delivered over the Internet (see Volume I, Chapter 10 for more information about applets). Obviously, delivering executable applets is practical only when the recipients are sure that the code can't wreak havoc on their machines. For this reason, security was and is a major concern of both the designers and the users of Java technology. This means that unlike other languages and systems, where security was implemented as an afterthought or a reaction to break-ins, security mechanisms are an integral part of Java technology. Three mechanisms help ensure safety: Language design features (bounds checking on arrays, no unchecked type conversions, no pointer arithmetic, and so on). An access control mechanism that controls what the code can do (such as file access, network access, and so on). Code signing, whereby code authors can use standard cryptographic algorithms to authenticate Java code. Then, the users of the code can determine exactly who created the code and whether the code has been altered after it was signed. Below, you'll see the cryptographic algorithms supplied in the java.security package, which allow for code signing and user authentication. As we said earlier, applets were what started the craze over the Java platform. In practice, people discovered that although they could write animated applets like the famous "nervous text" applet, applets could not do a whole lot of useful stuff in the JDK 1.0 security model. For example, because applets under JDK 1.0 were so closely supervised, they couldn't do much good on a corporate intranet, even though relatively little risk attaches to executing an applet from your company's secure intranet. It quickly became clear to Sun that for applets to become truly useful, it was important for users to be able to assign different levels of security, depending on where the applet originated. If an applet comes from a trusted supplier and it has not been tampered with, the user of that applet can then decide whether to give the applet more privileges. To give more trust to an applet, we need to know two things: ? Where did the applet come from? ? Was the code corrupted in transit? In the past 50 years, mathematicians and computer scientists have developed sophisticated algorithms for ensuring the integrity of data and for electronic signatures. The java.security package contains implementations of many of these algorithms. Fortunately, you don't need to understand the underlying mathematics to use the algorithms in the java.security package. In the next sections, we show you how message digests can detect changes in data files and how digital signatures can prove the identity of the signer. A message digest is a digital fingerprint of a block of data. For example, the so-called SHA1 (secure hash algorithm #1) condenses any data block, no matter how long, into a sequence of 160 bits (20 bytes). As with real fingerprints, one hopes that no two messages have the same SHA1 fingerprint. Of course, that cannot be 160 true—there are only 2SHA1 fingerprints, so there must be some messages with the 160same fingerprint. But 2 is so large that the probability of duplication occurring is negligible. How negligible? According to James Walsh in True Odds: How Risks Affect Your Everyday Life (Merritt Publishing 1996), the chance that you will die from being struck by lightning is about one in 30,000. Now, think of nine other people, for example, your nine least favorite managers or professors. The chance that you and all of them will die from lightning strikes is higher than that of a forged message having the same SHA1 fingerprint as the original. (Of course, more than ten people, none of whom you are likely to know, will die from lightning strikes. However, we are talking about the far slimmer chance that your particular choice of people will be wiped out.) A message digest has two essential properties: ? If one bit or several bits of the data are changed, then the message digest also changes. ? A forger who is in possession of a given message cannot construct a fake message that has the same message digest as the original. The second property is again a matter of probabilities, of course. Consider the following message by the billionaire father:"Upon my death, my property shall be divided equally among my children; however, my son George shall receive nothing." That message has an SHA1 fingerprint of 2D 8B 35 F3 BF 49 CD B1 94 04 E0 66 21 2B 5E 57 70 49 E1 7E The distrustful father has deposited the message with one attorney and the fingerprint with another. Now, suppose George can bribe the lawyer holding the message. He wants to change the message so that Bill gets nothing. Of course, that changes the fingerprint to a completely different bit pattern: 2A 33 0B 4B B3 FE CC 1C 9D 5C 01 A7 09 51 0B 49 AC 8F 98 92 Can George find some other wording that matches the fingerprint? If he had been the proud owner of a billion computers from the time the Earth was formed, each computing a million messages a second, he would not yet have found a message he could substitute. A number of algorithms have been designed to compute these message digests. The two best-known are SHA1, the secure hash algorithm developed by the National Institute of Standards and Technology, and MD5, an algorithm invented by Ronald Rivest of MIT. Both algorithms scramble the bits of a message in ingenious ways. For details about these algorithms, see, for example, Cryptography and Network Security, 4th ed., by William Stallings (Prentice Hall 2005). Note that recently, subtle regularities have been discovered in both algorithms. At this point, most cryptographers recommend avoiding MD5 and using SHA1 until a stronger alternative becomes available.(See HTTP:// www.rsa.com/rsal abs/node.asp?id=2834 for more information.) The Java programming language implements both SHA1 and MD5. The Message-digest class is a factory for creating objects that encapsulate the fingerprinting algorithms. It has a static method, called get instance, that returns an object of a class that extends the MessageDigest class. This means the MessageDigest class serves double duty: ? As a factory class ? As the superclass for all message digest algorithms For example, here is how you obtain an object that can compute SHA fingerprints: MessageDigest alg = MessageDigest.get instance("SHA-1"); (To get an object that can compute MD5, use the string "MD5" as the argument to get instance.) After you have obtained a MessageDigest object, you feed it all the bytes in the message by repeatedly calling the update method. For example, the following code passes all bytes in a file to the alg object just created to do the fingerprinting: Input-stream in = . . . int ch; while ((ch = in.read()) != -1) alg.update((byte) ch); Alternatively, if you have the bytes in an array, you can update the entire array at once: byte[] bytes = . . .; alg.update(bytes); When you are done, call the digest method. This method pads the input—as required by the fingerprinting algorithm—does the computation, and returns the digest as an array of bytes. byte[] hash = alg.digest(); The program in Listing 9-15 computes a message digest, using either SHA or MD5. You can load the data to be digested from a file, or you can type a message in the text area. Message Signing In the last section, you saw how to compute a message digest, a fingerprint for the original message. If the message is altered, then the fingerprint of the altered message will not match the fingerprint of the original. If the message and its fingerprint are delivered separately, then the recipient can check whether the message has been tampered with. However, if both the message and the fingerprint were intercepted, it is an easy matter to modify the message and then recompute the fingerprint. After all, the message digest algorithms are publicly known, and they don't require secret keys. In that case, the recipient of the forged message and the recomputed fingerprint would never know that the message has been altered. Digital signatures solve this problem. To help you understand how digital signatures work, we explain a few concepts from the field called public key cryptography. Public key cryptography is based on the notion of a public key and private key. The idea is that you tell everyone in the world your public key. However, only you hold the private key, and it is important that you safeguard it and don't release it to anyone else. The keys are matched by mathematical relationships, but the exact nature of these relationships is not important for us. (If you are interested, you can look it up in The Handbook of Applied Cryptography at HTTP://WWW.car.math.waterlog.ca/hae/.) The keys are quite long and complex. For example, here is a matching pair of public and private Digital Signature Algorithm (DSA) keys. Public key: Code View: p: fca682ce8e12caba26efccf7110e526db078b05edecbcd1eb4a208f3ae1617ae01f35b91a47e6df63413c5e12ed0899bcd132acd50d99151bdc43ee737592e17 q: 962eddcc369cba8ebb260ee6b6a126d9346e38c5 g:678471b27a9cf44ee91a49c5147db1a9aaf244f05a434d6486931d2d14271b9e35030b71fd73da179069b32e2935630e1c2062354d0da20a6c416e50be794ca4 y: c0b6e67b4ac098eb1a32c5f8c4c1f0e7e6fb9d832532e27d0bdab9ca2d2a8123ce5a8018b8161a760480fadd040b927281ddb22cb9bc4df596d7de4d1b977d50 Private key: Code View: p: fca682ce8e12caba26efccf7110e526db078b05edecbcd1eb4a208f3ae1617ae01f35b91a47e6df63413c5e12ed0899bcd132acd50d99151bdc43ee737592e17 q: 962eddcc369cba8ebb260ee6b6a126d9346e38c5 g: 678471b27a9cf44ee91a49c5147db1a9aaf244f05a434d6486931d2d14271b9e35030b71fd73da179069b32e2935630e1c2062354d0da20a6c416e50be794ca4 x: 146c09f881656cc6c51f27ea6c3a91b85ed1d70a It is believed to be practically impossible to compute one key from the other. That is, even though everyone knows your public key, they can't compute your private key in your lifetime, no matter how many computing resources they have available. It might seem difficult to believe that nobody can compute the private key from the public keys, but nobody has ever found an algorithm to do this for the encryption algorithms that are in common use today. If the keys are sufficiently long, brute force—simply trying all possible keys—would require more computers than can be built from all the atoms in the solar system, crunching away for thousands of years. Of course, it is possible that someone could come up with algorithms for computing keys that are much more clever than brute force. For example, the RSA algorithm (the encryption algorithm invented by Rivest, Sha mir, and Alleman) depends on the difficulty of factoring large numbers. For the last 20 years, many of the best mathematicians have tried to come up with good factoring algorithms, but so far with no success. For that reason, most cryptographers believe that keys with a "modulus" of 2,000 bits or more are currently completely safe from any attack. DSA is believed to be similarly secure. Figure 9-12 illustrates how the process works in practice. Suppose Alice wants to send Bob a message, and Bob wants to know this message came from Alice and not an impostor. Alice writes the message and then signs the message digest with her private key. Bob gets a copy of her public key. Bob then applies the public key to verify the signature. If the verification passes, then Bob can be assured of two facts: ? The original message has not been altered. ? The message was signed by Alice, the holder of the private key that matches the public key that Bob used for verification. You can see why security for private keys is all-important. If someone steals Alice's private key or if a government can require her to turn it over, then she is in trouble. The thief or a government agent can impersonate her by sending messages, money transfer instructions, and so on, that others will believe came from Alice. The X.509 Certificate Format To take advantage of public key cryptography, the public keys must be distributed. One of the most common distribution formats is called X.509. Certificates in the X.509 format are widely used by VeriSign, Microsoft, Netscape, and many other companies, for signing e-mail messages, authenticating program code, and certifying many other kinds of data. The X.509 standard is part of the X.500 series of recommendations for a directory service by the international telephone standards body, the CCITT. The precise structure of X.509 certificates is described in a formal notation, called "abstract syntax notation #1" or ASN.1. Figure 9-13 shows the ASN.1 definition of version 3 of the X.509 format. The exact syntax is not important for us, but, as you can see, ASN.1 gives a precise definition of the structure of a certificate file. The basic encoding rules, or BER, and a variation, called distinguished encoding rules (DER) describe precisely how to save this structure in a binary file. That is, BER and DER describe how to encode integers, character strings, bit strings, and constructs such as SEQUENCE, CHOICE, and OPTIONAL. Java核心技术 当Java技术刚刚问世时,令人激动的并不是因为它是一个设计完美的编程语言,而是因为它能够安全地运行通过因特网传播的各种applet。很显然,只有当用户确信applet的代码不会破坏他的计算机时,用户才会接受在网上传播的可执行的applet。正因为如此,无论过去还是现在,安全都是设计人员和Java技术使用者所关心的一个重大问题。这就意味着,Java技术与其他的语言和系统有所不同,在那些语言和系统中安全是事后才想到要去实现的,或者仅仅是对破坏的一种应对措施,而对Java技术来说,安全机制是一个不可分割的组成部分。 Java技术提供了以下三种确保安全的机制: (1)语言设计特性(对数组的边界进行检查,无不检查类型的转换,无指针算法等)。 (2)访问控制机制,用于控制代码能够执行的功能(比如文件访问,网络访问等)。 (3) 代码签名,利用该特性,代码的作者就能够用标准的加密算法来表明Java代码的身份。这样,该代码的使用者就能够准确地知道谁创建了该代码,以及代码被标识后是否被修改过。 下面,我们要介绍java.security包提供的加密算法,用来进行代码的标识和用户身份认证。 正如我们前面所说,applet 是在Java平台上开始流行起来的。实际上,人们发现尽管他们可以编写像著名的“nervous text”那样栩栩如生的applet,但是在JDK1.0安全模式下无法发挥其一整套非常有用的作用。例如,由于JDK1.0下的applet要受到严密的监督,因此,即使applet在公司安全内部网上运行时的风险相对较小,applet也无法在企业内部网上发挥很大的作用。Sun公司很快就认识到,要使applet真正变得非常有用,用户必须可以根据applet的来源为其分配不同的安全级别。如果applet来自值得信赖的提供商,并且没有被篡改过,那么applet的用户就可以决定是否给applet授予更多的运行特权。 第 1 页 共 7 页 如果要给予applet更多的信赖,你必须知道下面两件事: (1)applet来自哪里, (2)在传输过程中代码是否被破坏, 在过去的50年里,数学家和技术机科学家已经开发出各种各样成熟的算法,用于确保数据和电子签名的完整性,在java.security包中包含了许多这些算法的实现。在下面几节,我们将要介绍消息摘要是如何检测数据文件中的变化的,以及数字签名是如何证明签名者的身份的。 消息摘要是数据块的数字指纹。例如,所谓的SHA1(安全散列算法#1)可将任何数据块,无论其数据有多长,都压缩为160位(20字节)的序列。与真实的指纹一样,人们希望任何两条消息都不会有相同的SHA1指纹。当然这是不 160 可能的—因为只存在2个SHA1指纹,所有肯定会有某些消息具有相同的指纹。 160因为2 是一个很大的数字,所以存在重复指纹的可能性微乎其微,那么这种重复的可能性到底小到什么程度呢,根据James Walsh在他的《True Odds:How Risks Affect Your Everyday Life》,Merritt Publishing出版社1996年出版,一书中所阐述的,你和他们所有的人都死于雷击的概率,比伪造的消息与原来消息具有相同的SHA1指纹的概率还要高。(当然,可能有你不认识的其他10个以上的人会死于雷击,但这里我们讨论的是你选择的特定的人的死亡概率)。 消息摘要具有两个基本属性: (1)如果数据的1位或者几位改变了,那么消息摘要也将改变。 (2)拥有给定消息的伪造者不能创建与原消息具有相同摘要的假消息。 当然,第二个属性又是一个概率问题。让我们来看看下面这位亿万富翁下的遗嘱:“我死了之后,我的财产将由我的孩子平分,但是,我的儿子George应该拿不到一个子。” 这份遗嘱的SHA1指纹为: 2D 8B 35 F3 BF 49 CD B1 94 04 E0 66 21 2B 5E 57 70 49 E1 7E 这位有疑心病的父亲将这份遗嘱交给一位律师保存,而将指纹交给另一位律师保存。现在,假设George能够贿赂那位保存遗嘱的律师,他想修改这份遗嘱,使得Bill一无所得。当然,这需要将原指纹改为下面这样完全不同的位模式: 第 2 页 共 7 页 2A 33 0B 4B B3 FE CC 1C 9D 5C 01 A7 09 51 0B 49 AC 8F 98 92 那么George能够找到与该指纹相匹配的其他文字吗,如果从地球形成之时,他就很自豪地拥有10亿台计算机,每台计算机每秒钟处理一百万条信息,他依然无法找到一个能够替换的遗嘱。 人们已经设计出大量的算法,用于计算这些消息摘要,其中最著名的两种算法是SHAI和MD5。SHAI是由美国国家标准和技术学会开发的加密散列算法,MD5是由麻省理工学院的Ronald Rivest发明的算法。这两种算法都使用了独特巧妙的方法对消息中的各个位进行扰乱。如果要了解这些方法的详细信息,请参阅William Stallings撰写的《Cryptography and Network Security》一书,该书由Prentice Hall出版社于2005年出版口值得注意的是,最近人们在这两种算法中发现了某些微妙的规律性,因此许多密码人员建议最好避免使用MD5,而应该使用SHA1算法,直到有更强的加密算法。(查看HTTP://WWW.ras.com/rsalabs/node.asp?id=2834以了解更多的信息)。 Java编程语言已经实现了SHA1和MD5。MessageDigest类是用于创建封装 instance返回继承了了指纹算法的对象的“工厂”,它的静态方法get- MessageDigest类的某个类的对象。这意味着MessageDigest类能够承担下面的双重职责: (1)作为一个工厂类。 (2)作为所有消息摘要算法的超类。 例如,下面是如何获取一个能够计算SHA指纹的对象的方法: MessageDigest alg = MessageDigest.get-instance(“SHA-1”); instance的(如果要获取计算MD5的对象,请使用字符串“MD5”作为get-参数。) 当你已经获取MessageDigest对象之后,通过反复调用update方法,将信息中的所有字节提供给该对象。例如,下面的代码将文件中的所有字节传给上面建立的alg对象,以执行指纹算法: InputStream in=?. int ch; 第 3 页 共 7 页 while((ch=in.read())!=-1) alg.update((byte) ch); 另外,如果这些字节存放在一个数组中,那就可以一次完成整个数组的更新: byte[] bytes =(((; alg.update(bytes); 当完成上述操作后,调用digest方法。该方法填充输入信息—指纹算法需要的—并且进行相应的计算,然后以字节数组的形式返回消息摘要。 byte[] hash=alg.digest(); 程序清单9-15中的程序计算了一个消息摘要,既可以用SHA,也可以使用MD5来计算。可以从文件加载需要计算摘要的数据,也可以直接将信息输入文本区域。图9-11显示了该应用程序的画面。 消息签名 在上一节中,我们介绍了如何计算原始消息的消息摘要和指纹的方法。如果消息改变了,那么改变后的消息的指纹与原消息的指纹将不匹配。如果消息和它的指纹是分开传送的,那么接收者就可以检查消息是否被篡改过。但是,如果消息和指纹同时被截获了,对消息进行修改,再重新计算指纹,这是一件很容易的事情。毕竟,消息摘要算法是公开的,不需要使用任何密钥。在这种情况下,假消息和新指纹的接收者永远不会知道消息已经被篡改。数字签名解决了这个问题。 为了了解数字签名的工作原理,我们需要解释关于公共密钥加密技术领域中的几个概念。公共密钥加密技术是基于公共密钥和私有密钥这个两个基本概念的。它的设计思想是你可以将公共密钥告诉世界上的任何人,但是,只有自己才拥有私有密钥,重要的是你要保护你的私有密钥,不将它泄漏给其他任何入。这些密钥之间存在一定的数学关系,但是这种关系的具体性质对于实际的编程来说并不重要(如果你有兴趣,可以参阅 HTTP://WWW.cacr.math.uwaterloo.ca/hac/站点上的《The Handbook of Applied Cryptography》 一书)。 密钥非常长,而且很复杂。例如,下面是一对匹配的数字签名算法(DSA)公 第 4 页 共 7 页 共密钥和私有密钥。 公共密钥: p: fca682ce8e12caba26efccf7ll0e526db078b05e6ecbcdleb4a208f3ae1617ae0 lf35b9la47e6df63413c5e12ed0899bcd132acd50d9915lbdc43ee737592el7 q: 962eddcc369cba8ebb260ee6b6a126d9346e38c5 g:67847lb27a9cf44ee9la49c5147dbla9aaf244f05a434d648693ld2d1427lb9 e35030b7lfd73da179069b32e2935630elc2062354d0da20a6c416e50be794ca4 y: c0b6e67b4ac098ebla32c5f8c4clfee7e6fb9d832532e27d0bdab9ca2d2a8123c e5a8018b816la6048efadd040b927281ddb22cb9bc4df596d7de4dlb977dS0 私有密钥: p: fca682ce8e12caba26efccf7ll0e526db078b05edecbcdleb4a208f3ae1617ae0 lf35b9la47e6df63413c5e12ed0899bcd132acd50d9915lbdc43ee737592e17 q: 962eddcc369cba8ebb260ee6b6a126d9346e38c5 g: 67847lb27a9cf44ee9la49c5147dbla9aaf244f05a434d648693ld2d1427lb9e3 5030b7lfd73da179069b32e2935630elc2062354d0da20a6c416e50be794ca4 x: 146c09f881656cc6c5lf27ea6c3a9lb85edld70a 在现实中,几乎不可能用一个密钥去推算出另一个密钥。也就是说,即使 每个人都知道你的公共密钥,不管他们拥有多少计算资源,他们一辈子也无法 计算出你的私有密钥。 任何人都无法根据公共密钥来推算私有密钥,这似乎让人难以置信。但是 时至今日,还没有人能够找到一种算法,来为现在常用的加密算法进行这种推 算。如果密钥足够长,那么要是使用穷举法—也就是直按试验所有可能的密钥 —所需要的计算机将比用太阳系中的所有原子来制造的计算机还要多,而且还 得花费数千年的时间。当然,可能会有人提出比穷举更灵活的计算密钥的算法。 第 5 页 共 7 页 例如,RSA算法(该加密算法由Rivest, Shamir和Adleman发明)就利用了对数值巨大的数字进行因子分解的困难性。在最近20年里,许多优秀的数学家都在尝试提出好的因子分解算法,但是迄今为止都没有成功。据此,大多数密码学者认为,拥有2000位或者更多位“模数”的密钥目前是完全安全的,可以抵御任何攻击。DSA被认为具有类似的安全性。 图9-12展示了这项工作的处理过程。 假设Alice想要给Bob发送一个消息,Bob想知道该消息是否来自Alice,而不是冒名顶替者。Alice写好了消息,并且用她的私有密钥对该消息摘要签名。 Bob得到了她的公共密钥的拷贝,然后Bob用公共密钥对该签名进行校验。如果通过了校验,则Bob可以确认以下两个事实: (1)原始消息没有被篡改过。 (2)该消息是由Alice签名的,她是私有密钥的持有者,该私有密钥就是Bob 与她用于校验的公共密钥相匹配的密钥。 你可以看到私有密钥的安全性为什么是最重要的。如果某个人偷了Alice的私有密钥,或者政府要求她交出私有密钥,那么她就麻烦了。小偷或者政府代表就可以假扮她的身份来发送消息和资金转账指令等等,而其他人则会相信这些消息确实来自于Alice。 X.509证书格式 为了利用公共密钥这种密码系统,必须将公共密钥分发出去。最通用的一种签名证书格式称为X.509格式。X.509格式的证书被VeriSign、微软、网景和其他许多公司广泛应用于对电子邮件消息进行签名,对程序代码进行认证,以及对许多其他类型的数据进行认证等等。 X.509标准是由国际电话标准机构,即国际电报电话咨询委员会(CCITT)提出的用于目录服务的X.500系列建议的组成部分。 X.509证书的具体结构是用一种形式化表示来描述的,称为“抽象语法表示法#1”(abstract syntax notation)即ASN.1。图9-13显示了第3版X.509格式的ASN.1定义。虽然具体的语法对我们并不重要,但是你可以看到,ASN.1为证书文件的结构给出了精确的定义。“基本编码规则”(basic encoding 第 6 页 共 7 页 rules),即BER,精确地描述了如何将该结构保存为二迸制文件。也就是说,BER描述了如何对整数、字符串、位串以及诸如SEQUENCE、CHOICE和OPTIONAL的结构进行编码的方法。 第 7 页 共 7 页 大连交通大学2011届本科生毕业设计(论文)外文翻译 THE TECHNIQUE DEVELOPMENT HISTORY OF JSP By:Kathy Sierra and Bert Bates Source: Servlet&JSP The Java Server Pages( JSP) is a kind of according to web of the script plait distance technique, similar carries the script language of Java in the server of the Netscape company of server- side JavaScript( SSJS) and the Active Server Pages(ASP) of the Microsoft. JSP compares the SSJS and ASP to have better can expand sex, and it is no more exclusive than any factory or some one particular server of Web. Though the norm of JSP is to be draw up by the Sun company of, any factory can carry out the JSP on own system. The After Sun release the JS P( the Java Server Pages) formally, the this kind of new Web application development technique very quickly caused the people's concern. JSP provided a special development environment for the Web application that establishes the high dynamic state. According to the Sun parlance, the JSP can adapt to include the Apache WebServer, IIS4.0 on the market at inside of 85% server product. This chapter will introduce the related knowledge of JSP and Databases, and JavaBean related contents, is all certainly rougher introduction among them basic contents, say perhaps to is a Guide only, if the reader needs the more detailed information, pleasing the book of consult the homologous JSP. 1.1 GENER ALIZE The JSP(Java Server Pages) is from the company of Sun Microsystems initiate, the many companies the participate to the build up the together of the a kind the of dynamic the state web the page technique standard, the it have the 1 大连交通大学2011届本科生毕业设计(论文)外文翻译 it in the construction the of the dynamic state the web page the strong but the do not the especially of the function. JSP and the technique of ASP of the Microsoft is very alike. Both all provide the ability that mixes with a certain procedure code and is explain by the language engine to carry out the procedure code in the code of HTML. Underneath we are simple of carry on the introduction to it. JSP pages are translated into servlets. So, fundamentally, any task JSP pages can perform could also be accomplished by servlets. However, this underlying equivalence does not mean that servlets and JSP pages are equally appropriate in all scenarios. The issue is not the power of the technology, it is the convenience, productivity, and maintainability of one or the other. After all, anything you can do on a particular computer platform in the Java programming language you could also do in assembly language. But it still matters which you choose. JSP provides the following benefits over servlets alone: ? It is easier to write and maintain the HTML. Your static code is ordinary HTML: no extra backslashes, no double quotes, and no lurking Java syntax. ? You can use standard Web-site development tools. Even HTML tools that know nothing about JSP can be used because they simply ignore the JSP tags. ? You can divide up your development team. The Java programmers can work on the dynamic code. The Web developers can concentrate on the presentation layer. On large projects, this division is very important. Depending on the size of your team and the complexity of your project, you can enforce a weaker or stronger separation between the static HTML and the dynamic content. Now, this discussion is not to say that you should stop using servlets and use only JSP instead. By no means. 2 大连交通大学2011届本科生毕业设计(论文)外文翻译 Almost all projects will use both. For some requests in your project, you will use servlets. For others, you will use JSP. For still others, you will combine them with the MVC architecture . You want the apGFDGpropriate tool for the job, and servlets, by themselves, do not complete your toolkit. 1.2 SOURCE OF JSP The technique of JSP of the company of Sun, making the page of Web develop the personnel can use the HTML perhaps marking of XML to design to turn the end page with format. Use the perhaps small script future life of marking of JSP becomes the dynamic state on the page contents.( the contents changes according to the claim of) The Java Servlet is a technical foundation of JSP, and the large Web applies the development of the procedure to need the Java Servlet to match with with the JSP and then can complete, this name of Servlet comes from the Applet, the local translation method of now is a lot of, this book in order not to misconstruction, decide the direct adoption Servlet but don't do any translation, if reader would like to, can call it as" small service procedure". The Servlet is similar to traditional CGI, ISAPI, NSAPI etc. Web procedure development the function of the tool in fact, at use the Java Servlet hereafter, the customer need not use again the lowly method of CGI of efficiency, also need not use only the ability come to born page of Web of dynamic state in the method of API that a certain fixed Web server terrace circulate. Many servers of Web all support the Servlet, even not support the Servlet server of Web directly and can also pass the additional applied server and the mold pieces to support the Servlet. Receive benefit in the characteristic of the Java cross-platform, the Servlet is also a terrace irrelevant, actually, as long as match the norm of Java Servlet, the Servlet is complete to have nothing to do with terrace and is to have nothing to do with server of 3 大连交通大学2011届本科生毕业设计(论文)外文翻译 Web. Because the Java Servlet is internal to provide the service by the line distance, need not start a progress to the each claimses, and make use of the multi-threading mechanism can at the same time for several claim service, therefore the efficiency of Java Servlet is very high. But the Java Servlet also is not to has no weakness, similar to traditional CGI, ISAPI, the NSAPI method, the Java Servlet is to make use of to output the HTML language sentence to carry out the dynamic state web page of, if develop the whole website with the Java Servlet, the integration process of the dynamic state part and the static state page is an evil-foreboding dream simply. For solving this kind of weakness of the Java Servlet, the SUN released the JSP. A number of years ago, Marty was invited to attend a small 20-person industry roundtable discussion on software technology. Sitting in the seat next to Marty was James Gosling, inventor of the Java programming language. Sitting several seats away was a high-level manager from a very large software company in Redmond, Washington. During the discussion, the moderator brought up the subject of Jini, which at that time was a new Java technology. The moderator asked the manager what he thought of it, and the manager responded that it was too early to tell, but that it seemed to be an excellent idea. He went on to say that they would keep an eye on it, and if it seemed to be catching on, they would follow his company's usual "embrace and extend" strategy. At this point, Gosling lightheartedly interjected "You mean disgrace and distend." Now, the grievance that Gosling was airing was that he felt that this company would take technology from other companies and suborn it for their own purposes. But guess what? The shoe is on the other foot here. The Java community did not invent the idea of designing pages as a 4 大连交通大学2011届本科生毕业设计(论文)外文翻译 mixture of static HTML and dynamic code marked with special tags. For example, Cold Fusion did it years earlier. Even ASP (a product from the very software company of the aforementioned manager) popularized this approach before JSP came along and decided to jump on the bandwagon. In fact, JSP not only adopted the general idea, it even used many of the same special tags as ASP did. The JSP is an establishment at the model of Java servlets on of the expression layer technique, it makes the plait write the HTML to become more simple.Be like the SSJS, it also allows you carry the static state HTML contents and servers the script mix to put together the born dynamic state exportation. JSP the script language that the Java is the tacit approval, however, be like the ASP and can use other languages( such as JavaScript and VBScript), the norm of JSP also allows to use other languages. 1.3JSP CHARACTERISTICS Is a service according to the script language in some one language of the statures system this kind of discuss, the JSP should be see make is a kind of script language. However, be a kind of script language, the JSP seemed to be too strong again, almost can use all Javas in the JSP. Be a kind of according to text originally of, take manifestation as the central development technique, the JSP provided all advantages of the Java Servlet, and, when combine with a JavaBeans together, providing a kind of make contents and manifestation that simple way that logic separate. Separate the contents and advantage of logical manifestations is, the personnel who renews the page external appearance need not know the code of Java, and renew the JavaBeans personnel also need not be design the web page of expert in hand, can use to take the page of JavaBeans JSP to define the template of Web, to build up a from have the alike external appearance of the website that page constitute. JavaBeans completes the data 5 大连交通大学2011届本科生毕业设计(论文)外文翻译 to provide, having no code of Java in the template thus, this means that these templates can be written the personnel by a HTML plait to support. Certainly, can also make use of the Java Servlet to control the logic of the website, adjust through the Java Servlet to use the way of the document of JSP to separate website of logic and contents. Generally speaking, in actual engine of JSP, the page of JSP is the edit and translate type while carry out, not explain the type of. Explain the dynamic state web page development tool of the type, such as ASP, PHP3 etc., because speed etc. reason, have already can't satisfy current the large electronic commerce needs appliedly, traditional development techniques are all at to edit and translate the executive way change, such as the ASP ? ASP+;PHP3 ? PHP4. In the JSP norm book, did not request the procedure in the JSP code part( be called the Scriptlet) and must write with the Java definitely. Actually, have some engines of JSP are adoptive other script languages such as the EMAC- Script, etc., but actually this a few script languages also are to set up on the Java, edit and translate for the Servlet to carry out of. Write according to the norm of JSP, have no Scriptlet of relation with Java also is can of, however, mainly lie in the ability and JavaBeans, the Enterprise JavaBeanses because of the JSP strong function to work together, so even is the Scriptlet part not to use the Java, edit and translate of performance code also should is related with Java. 1.4JSP MECHANISM To comprehend the JSP how unite the technical advantage that above various speak of, come to carry out various result easily, the customer must understand the differentiation of" the module develops for the web page of the center" and" the page develops for the web page of the 6 大连交通大学2011届本科生毕业设计(论文)外文翻译 center" first. The SSJS and ASP are all in several year ago to release, the network of that time is still very young, no one knows to still have in addition to making all business, datas and the expression logic enter the original web page entirely heap what better solve the method. This kind of model that take page as the center studies and gets the very fast development easily. However, along with change of time, the people know that this kind of method is unwell in set up large, the Web that can upgrade applies the procedure. The expression logic write in the script environment was lock in the page, only passing to shear to slice and glue to stick then can drive heavy use. Express the logic to usually mix together with business and the data logics, when this makes be the procedure member to try to change an external appearance that applies the procedure but do not want to break with its llied business logic, apply the procedure of maintenance be like to walk the similar difficulty on the eggshell. In fact in the business enterprise, heavy use the application of the module already through very mature, no one would like to rewrite those logics for their applied procedure.HTML and sketch the designer handed over to the implement work of their design the Web plait the one who write, make they have to double work- Usually is the handicraft plait to write, because have no fit tool and can carry the script and the HTML contents knot to the server to put together. Chien but speech, apply the complexity of the procedure along with the Web to promote continuously, the development method that take page as the center limits sex to become to get up obviously. At the same time, the people always at look for the better method of build up the Web application procedure, the module spreads in customer's machine/ server the realm. JavaBeans and ActiveX were published the company to expand to apply the procedure developer 7 大连交通大学2011届本科生毕业设计(论文)外文翻译 for Java and Windows to use to come to develop the complicated procedure quickly by" the fast application procedure development"( RAD) tool. These techniques make the expert in the some realm be able to write the module for the perpendicular application plait in the skill area, but the developer can go fetch the usage directly but need not control the expertise of this realm. Be a kind of take module as the central development terrace, the JSP appeared. It with the JavaBeans and Enterprise JavaBeans( EJB) module includes the model of the business and the data logic for foundation, provide a great deal of label and a script terraces to use to come to show in the HTML page from the contents of JavaBeans creation or send a present in return. Because of the property that regards the module as the center of the JSP, it can drive Java and not the developer of Java uses equally. Not the developer of Java can pass the JSP label( Tags) to use the JavaBeans that the deluxe developer of Java establish. The developer of Java not only can establish and use the JavaBeans, but also can use the language of Java to come to control more accurately in the JSP page according to the expression logic of the first floor JavaBeans. See now how JSP is handle claim of HTTP. In basic claim model, a claim directly was send to JSP page in. The code of JSP controls to carry on hour of the logic processing and module of JavaBeanses' hand over with each other, and the manifestation result in dynamic state bornly, mixing with the HTML page of the static state HTML code. The Beans can be JavaBeans or module of EJBs. Moreover, the more complicated claim model can see make from is request other JSP pages of the page call sign or Java Servlets. The engine of JSP wants to chase the code of Java that the label of JSP, code of Java in the JSP page even all converts into the big piece together with the static state HTML 8 大连交通大学2011届本科生毕业设计(论文)外文翻译 contents actually. These codes piece was organized the Java Servlet that customer can not see to go to by the engine of JSP, then the Servlet edits and translate them automatically byte code of Java. Thus, the visitant that is the website requests a JSP page, under the condition of it is not knowing, an already born, the Servlet actual full general that prepared to edit and translate completes all works, very concealment but again and efficiently. The Servlet is to edit and translate of, so the code of JSP in the web page does not need when the every time requests that page is explain. The engine of JSP need to be edit and translate after Servlet the code end is modify only once, then this Servlet that editted and translate can be carry out. The in view of the fact JSP engine auto is born to edit and translate the Servlet also, need not procedure member begins to edit and translate the code, so the JSP can bring vivid sex that function and fast developments need that you are efficiently. Compared with the traditional CGI, the JSP has the equal advantage. First, on the speed, the traditional procedure of CGI needs to use the standard importation of the system to output the equipments to carry out the dynamic state web page born, but the JSP is direct is mutually the connection with server. And say for the CGI, each interview needs to add to add a progress to handle, the progress build up and destroy by burning constantly and will be a not small burden for calculator of be the server of Web. The next in order, the JSP is specialized to develop but design for the Web of, its purpose is for building up according to the Web applied procedure, included the norm and the tool of a the whole set. Use the technique of JSP can combine a lot of JSP pages to become a Web application procedure very expediently. 9 大连交通大学2011届本科生毕业设计(论文)外文翻译 10 大连交通大学2011届本科生毕业设计(论文)外文翻译 JSP的技术发展历史 作者: Kathy Sierra and Bert Bates 来源: Servlet&JSP Java Server Pages(JSP)是一种基于web的脚本编程技术,类似于网景公司的服务器端Java脚本语言—— server-side JavaScript(SSJS)和微软的Active Server Pages(ASP)。与SSJS和ASP相比,JSP具有更好的可扩展性,并且它不专属于任何一家厂商或某一特定的Web服务器。尽管JSP规范是由Sun公司制定的,但任何厂商都可以在自己的系 统上实现JSP。 在Sun正式发布JSP(Java Server Pages)之后,这种新的Web应用开发技术很快引起了人们的关注。JSP为创建高度动态的Web应用提供了一个独特的开发环境。按照Sun的说法,JSP能够适应市场上包括Apache WebServer、 IIS4.0在内的85%的服务器产品。 本文将介绍JSP相关的知识,以及JavaBean的相关内容,当然都是比较粗略的介绍其中的基本内容,仅仅起到抛砖引玉的作用,如果读者需要更详细的信息,请参考相应的 JSP的书籍。 1.1 概述 JSP(Java Server Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准,其在动态网页的建设中有其强大而特别的功能。JSP与Microsoft的ASP技术非常相似。两者都提供在HTML代码中混合某种程序代码、由语言引擎解释执行程序代码的能力。下面 我们简单的对它进行介绍。 JSP页面最终会转换成servlet。因而,从根本上,JSP页面能够执行的任何任务都可以用servlet来完成。然而,这种底层的等同性并不意味着servlet和JSP页面对于所有的情况都等同适用。问题不在于技术的能力,而是二者在便利性、生产率和可维护性上的不同。毕竟,在特定平台上 11 大连交通大学2011届本科生毕业设计(论文)外文翻译 能够用Java编程语言完成的事情,同样可以用汇编语言来 完成,但是选择哪种语言依旧十分重要。 和单独使用servlet相比,JSP提供下述好处: JSP中HTML的编写与维护更为简单。JSP中可以使用常规的HTML:没有额外的反斜杠,没有额外的双引号,也 没有暗含的Java语法。 能够使用标准的网站开发工具。即使是那些对JSP一无所知的HTML工具,我们也可以使用,因为它们会忽略JSP 标签(JSP tags)。 可以对开发团队进行划分。Java程序员可以致力于动态代码。Web开发人员可以将经理集中在表示层(presentation layer)上。对于大型的项目,这种划分极为重要。依据开发团队的大小,及项目的复杂程度,可以对静态HTML和 动态内容进行弱分离(weaker separation)和强分离 (stronger separation)。 此处的讨论并不是说人们应该放弃使用servlet而仅仅使用JSP。事实上,几乎所有的项目都会同时用到这两种技术。在某些项目中,更适宜选用servlet,而针对项目中的某些请求,我们可能会在MVC构架下组合使用这两项技术。我们总是希望用适当的工具完成相对应的工作,仅仅是 servlet并不一定能够胜任所有工作。 1.2 JSP的由来 Sun公司的JSP技术,使Web页面开发人员可以使用HTML或者XML标识来设计和格式化最终页面。使用JSP标识或者小脚本来生成页面上的动态内容(内容是根据请 求来变化的)。 Java Servlet是JSP技术的基础,而且大型的Web应用程序的开发需要Java Servlet和JSP配合才能完成,Servlet这个名称源于Applet,现在国内的翻译方式很多,本书为了避免误会,决定直接采用Servlet而不做任何翻译,读者如果愿意,可以称之为“小服务程序”。Servlet其实和传统的CGI、ISAPI、NSAPI等Web程序开发工具的作用是相似的,在使用Java Servlet以后,用户不必再使用效率低下的CGI方式,也不必使用只能在某个固定Web服务器平台运行的API方式来动态生成Web页面。许多Web 12 大连交通大学2011届本科生毕业设计(论文)外文翻译 服务器都支持Servlet,即使不直接支持Servlet的Web服务器也可以通过附加的应用服务器和模块来支持Servlet。得益于Java的跨平台的特性,Servlet也是平台无关的,实际上,只要符合Java Servlet规范,Servlet是完全与平台无关且是与Web服务器无关的。由于Java Servlet内部是以线程方式提供服务,不必对于每个请求都启动一个进程,并且利用多线程机制可以同时为多个请求服务,因此 Java Servlet效率非常高。 但Java Servlet也不是没有缺点,和传统的CGI、ISAPI、NSAPI方式相同,Java Servlet是利用输出HTML语句来实现动态网页的,如果用Java Servlet来开发整个网站,动态部分和静态页面的整合过程会非常难以实现。为了解决 Java Servlet的这种缺点,SUN推出了JSP。 许多年前,Marty受到邀请,参加一个有关软件技术的小型研讨会.坐在Marty旁边的人是James Gosling--- Java编程语言的发明者。隔几个位置,是来自华盛顿一家大型软件公司的高级经理。在讨论过程中,研讨会的主席提出了Jini的议题,这在当时是一项新的Java技术。主席向该经理询问他的想法.他回答说,虽然现在言之过早,但这看起来会是非常有前途的一项技术。他们会持续关注这项技术,如果这项技术变得流行起来,他们会遵循公司的“接受并扩充(embrace and extend)”的策略.此时, Gosling随意地插话说“你的意思其实就是不接受且不扩充(disgrace and distend)。” 在此, Gosling的抱怨显示出,他感到这个公司会从其他公司那里拿走技术,用于他们自己的目的.出人意料的是,形势已经完全不同。Java团队并没有发明这一思想----将页面设计成由静态HTML和用特殊标签标记的动态代码混合组成.。ColdFusion多年前就已经这样做了。甚至ASP(来自于前述经理所在公司的一项产品)都在JSP出现之前推广了这种方式。实际上,JSP不只采用了这种通用概念,它 甚至使用许多和ASP相同的特殊标签。 JSP是建立在Java servlets模型之上的表达层技术,它使编写HTML变得更简单。像SSJS一样,它也允许你将静态HTML内容与服务器端脚本混合起来生成动态输出。 13 大连交通大学2011届本科生毕业设计(论文)外文翻译 JSP把Java作为默认的脚本语言,然而,就像ASP可以使用其他语言(如JavaScript和VBScript)一样,JSP规范 也允许使用其他语言。 1.3 JSP的特点 按照脚本语言是服务于某一个子系统的语言这种论述,JSP应当被看作是一种脚本语言。然而,作为一种脚本语言,JSP又显得过于强大了,在JSP中几乎可以使用全部 的Java类。 作为一种基于文本的、以显示为中心的开发技术,JSP提供了Java Servlet的所有好处,并且,当与一个JavaBeans类结合在一起时,JSP提供了一种使内容和显示逻辑分开的简单方式。分开内容和显示逻辑的好处是,更新页面外观的人员不必懂得Java代码,而更新JavaBeans类的人员也不必是设计网页的行家里手,就可以用带JavaBeans类的JSP页面来定义Web模板,以建立一个由具有相似的外观的页面组成的网站。JavaBeans类完成数据提供,这样在模板中就没有Java代码,这意味着这些模板可以由一个HTML编写人员来维护。当然,也可以利用Java Servlet 来控制网站的逻辑,通过Java Servlet调用JSP文件的方 式来将网站的逻辑和内容分离。 一般来说,在实际的JSP引擎中,JSP页面在执行时是编译式,而不是解释式的。解释式的动态网页开发工具如ASP、PHP3等由于速度等原因已经满足不了当前大型电子商务应用的需要了,传统的开发技术都在向编译执行的 方式改变,如ASP?ASP+;PHP3?PHP4。 在JSP规范书中,并没有明确要求JSP中的程序代码部分(称为Scriptlet)一定要用Java来写。实际上,有一些JSP引擎就是采用的其他脚本语言,如EMAC-Script、WebL等,但实际上这几种脚本语言也是构建在Java上面,编译为Servlet来实现的。按照JSP规范书写,和Java没有任何关系的Scriptlet也是可以的,不过,由于JSP的强大功能主要在于能和JavaBeans、Enterprise JavaBeans共同运转,所以即使是Scriptlet部分不使用Java,编译成的执行 代码也应该是与Java相关的。 14 大连交通大学2011届本科生毕业设计(论文)外文翻译 1.4 JSP的机制 要理解JSP怎样联合以上各种所提到的技术的优点,从而轻而易举地实现各种效果,用户必须首先了解“组件为中心 的网页开发”和“页面为中心的网页开发”的区别。 SSJS和ASP都是在几年前推出的,那时网络还很年轻,没有人知道除了把所有的商务、数据和表达逻辑统统堆进原始网页中之外还有什么更好的解决方法。这种以页面为中心的模型容易学习并且得到相当快速的发展。然而,随着时间的推移,人们认识到这种方法不适于构建大型的、可升级的Web应用程序。在脚本环境中书写的表达逻辑被锁在页面内,只有通过剪切和粘贴才能被重用。表达逻辑通常和商务及数据逻辑混在一起,这使得当程序员试图改变一个应用程序的外观而不想破坏与之紧密结合的商务逻辑时,应用程序的维护就变得十分艰难。其事实上,企业中可重用组件的应用早已经很成熟,没有人愿意为它们的应用程序重写那些逻辑。HTML和图形设计师把它们的设计的实施工作交给了Web编写者,使他们不得不加倍工作—— 常常是手工编写,因为没有合适的工具可以把服务器端脚本与HTML内容结合起来。简而言之,随着Web应用程序的复杂性不断提升,以页面为中心的开发方式的局 限性变得明显起来。 与此同时,人们一直在寻找建立Web应用程序的更好方法,组件在客户机/服务器领域流行起来。JavaBeans和ActiveX被“快速应用程序开发”(RAD)工具发行商推广给Java和Windows应用程序开发者用来快速开发复杂的程序。这些技术使某领域内的专家可以为本领域内的垂直应用编写组件,而开发者可以直接拿来使用而不必掌握这一 领域的专门技术。 作为一种以组件为中心的开发平台,JSP出现了。它以JavaBeans和Enterprise JavaBeans(EJB)组件包含商务和数据逻辑的模型为基础,提供大量标签和一个脚本平台用来在HTML页中显示由JavaBeans产生或回送的内容。由于JSP的以组件为中心的性质,它可以被Java和非Java开发者同样使用。非Java开发者可以通过JSP的标签(Tags)来使用高级Java开发者创建的JavaBeans。Java开发者不 15 大连交通大学2011届本科生毕业设计(论文)外文翻译 仅可以创建和使用JavaBeans,还能在JSP页中使用Java语言来更精密地控制基于底层JavaBeans的表达逻辑。 现在来看看JSP是如何处理HTTP请求的。在基本请求模型中,一个请求直接被送到JSP页中。JSP代码控制着进行逻辑处理时与JavaBeans组件的交互,并在动态生成的、混合了静态HTML代码的HTML页中显示结果。Beans 可以是JavaBeans 或EJB组件。另外,更加复杂的请求模型可看作从被请求页呼叫其他JSP页或Java Servlets。 JSP引擎实际上要把JSP标签、JSP页中的Java代码甚至连同静态HTML内容都转换为大块的Java代码。这些代码块被JSP引擎组织到用户看不到的Java Servlet中去,然后Servlet自动把它们编译成Java字节码。这样,当网站的访问者请求一个JSP页时,在它不知道的情况下,一个已经生成的、预编译过的Servlet实际上将完成所有的工作,非常隐蔽而又高效。因为Servlet是编译过的,所以网页中的JSP代码不需要在每次请求该页时被解释一遍。JSP引擎只需在Servlet代码最后被修改后编译一次,然后这个编译过的Servlet就可以被执行了。由于是JSP引擎自动生成并编译Servlet,不用程序员动手编译代码,所以JSP 能带给你高效的性能和快速开发所需的灵活性。 和传统的CGI相比较,JSP有相当的优势。首先,在速度上,传统的CGI程序需要使用系统的标准输入输出设备来实现动态网页的生成,而JSP是直接和服务器相关联的。而且对于CGI来说,每一个访问就需要新增加一个进程来处理,进程不断地建立和销毁对于作为Web服务器的计算机将是不小的负担。其次,JSP是专门为Web开发而设计的,其目的是为了建立基于Web的应用程序,其中包含了一整套的规范和工具。使用JSP技术可以很方便地将一大 堆JSP页面组合成为一个Web应用程序。 16 大连交通大学2011届本科生毕业设计(论文)外文翻译 下面红色字体部分是赠送的散文欣赏摘自网络,不需要的朋友下载后可以编辑删除~~~谢谢~~~ 可依靠的唯有自己 这是发生在一个普通犹太人家庭里,父亲和儿子的故事: 儿子叫约翰,在他4岁那年,有一天他和姐姐在客厅玩捉迷藏。他们玩得正高兴,父亲抱起小约翰,把他放在沙发椅上面,然后伸出双手做出接的姿势,叫他往下跳。小约翰毫不犹豫地往下跳,在即将抓住父亲的瞬间,父亲缩回了双手,约翰摔到了地板上,他号啕大哭起来。小约翰向坐在沙发上的妈妈求助,妈妈若无其事地坐着,并不去扶他,只是微笑着说:“呵,好坏的爸爸~”父亲站在一边,以嘲弄的眼光望着上当受骗的小约翰。 17 大连交通大学2011届本科生毕业设计(论文)外文翻译 这便是犹太家庭教子的方法之一,这样做的目的是灌输给孩子一个理念:社会是复杂的,不要轻信他人,唯一可依赖的就是自己。 犹太家庭的孩子都要回答这样一个问题:“假如有一天房子被烧着了,你将带着什么东西逃跑,”如果孩子回答是钱财,母亲会进一步问:“有一种没有形状、没有颜色、没有气味的宝贝,你知道是什么吗,”如果孩子回答不出来,母亲会告诉他:“孩子,你要带走的不是钱财,而是智慧。因为智慧是任何人都抢不走的,你只要活着,智慧就永远跟着你。” 你对爸爸的爱,远远胜过那部车 一个犹太家庭的父亲,存钱存了很久,终于买了一辆自己向往已久的新车。新车开到家后,他珍爱有加,每天都要洗车打蜡。他5岁的儿子见父亲这么爱车,也常常乐此不疲地帮爸爸一起洗车。 有一天,这位父亲开车回到家后,累得一动也不想动。于是他决定破一次例,改天再洗车,尽管自己的爱车因淋了雨,而显得脏乱不堪。 这时,5岁的儿子见父亲这么累,就自告奋勇地要帮爸爸洗车,见他这么小的年纪,就知道体谅自己,心里甚感欣慰,便放手让儿子去洗。 儿子要动手洗车了,却找不到洗车用的毛巾。于是他走进厨房,立刻便想到母亲平时煮菜洗锅时,都是用钢刷使劲刷才刷干净的,所以既然没有毛巾,就用钢刷吧~他拿起钢刷用力地洗起车来,一遍又一遍,像刷锅一样地刷车。 等他洗完之后,听见“哇”的一声,他失声大哭起来,车子怎么都花了,这下可闯大祸了,他急忙跑去找父亲,边哭边说:“爸爸,对不起,爸爸,你来看~”父亲疑惑地跟着儿子走到车旁,他也“哇”的一声,“我的车,我的车~” 这位父亲怒气冲冲地走进房间,气急败坏地跪在地上祷告:“上帝呀,请你告诉我,我该怎么做,那是我新买的车,一个月不到,就变成这样,我该怎么处罚我的孩子,” 他才祷告完,耳边忽然出现一个声音“世人都是看表面,而我却是看内心~”突然间,他彻悟了。 他走出房门,儿子正害怕地流着泪,动也不敢动。 父亲走上前去,把孩子紧紧地拥在怀里,亲切地说:“谢谢你帮爸爸洗车,爸爸对你的爱,远远胜过对那部车子。” 凡事要透过表面去看本质,当家人或朋友无意间做错了某件事时,我们要理智对待,不要只看事情的表面,而忽略他们内心真实的想法。学会用爱心去包容爱心,家会让你感觉自己的周围,时时洋溢温暖的阳光。 小饭馆的生意很好,因为物美价廉,因为他的谦和和妻子的热情。每天早晨,三四点钟他就早早起来去采购,直到天亮才把所需要的蔬菜、鲜肉拉回家。没有雇人手,两个人忙得像陀螺。常常,因为缺乏睡眠, 18 大连交通大学2011届本科生毕业设计(论文)外文翻译 他的眼睛红红的。 不久,一个推着三轮车的老人来到他门前。她驼背,走路一跛一跛的,用手比划着,想为他提供蔬菜和鲜肉,绝对新鲜,价格还便宜。老人是个哑巴,脸上满是灰尘,额角和眼边的几块疤痕让她看上去面目丑陋。妻子不同意,老人的样子,看上去实在不舒服。可他却不顾妻子的反对,答应下来。不知怎的,眼前的老人让他突然想起了母亲。 老人很讲信用,每次应他要求运来的蔬菜果然都是新鲜的。于是,每天早晨六点钟,满满一三轮车的菜准时送到他的饭馆门前。他偶尔也请老人吃碗面,老人吃得很慢,很享受的样子。他心里酸酸的,对老人说,她每天都可以在这儿吃碗面。老人笑了,一跛一跛地走过来。他看着她,不知怎的,又想起了母亲,突然有一种想哭的冲动。 一晃,两年又过去了,他的饭馆成了酒楼,他也有了一笔数目可观的积蓄,买了房子。可为他送菜的,依旧是那个老人。 又过了半个月,突然有一天,他在门前等了很久,却一直等不到老人。时间已经过了一个小时,老人还没有来。他没有她的联系方式,无奈,只好让工人去买菜。两小时后,工人拉回了菜,仔细看看,他心里有了疙瘩,这车菜远远比不上老人送的莱。老人送来的菜全经过精心挑选,几乎没有干叶子,棵棵都清爽。 只是,从那天后,老人再未出现。 春节就要到了,他包着饺子,突然对妻子说想给老人送去一碗,顺便看看她发生了什么事。怎么一个星期都没有送菜,这可是从没有过的事。妻子点头。 煮了饺子,他拎着,反复打听一个跛脚的送菜老人,终于在离他酒楼两个街道的胡同里,打听到她了。 他敲了半天门,无人应答。门虚掩着,他顺手推开。昏暗狭小的屋子里,老人在床上躺着,骨瘦如柴。老人看到他,诧异地睁大眼,想坐起来,却无能为力。他把饺子放到床边,问老人是不是病了。老人张张嘴,想说什么,却没说出来。他坐下来,打量这间小屋子,突然,墙上的几张照片让他吃惊地张大嘴巴。竟然是他和妈妈的合影~他5岁时,10岁时,17岁时……墙角,一只用旧布包着的包袱,包袱皮上,绣着一朵梅花。他转过头,呆呆地看着老人,问她是谁。老人怔怔地,突然脱口而出:儿啊。 他彻底惊呆了~眼前的老人,不是哑巴,为他送了两年菜的老人,是他的母亲, 那沙哑的声音分明如此熟悉,不是他母亲又能是谁,他呆愣愣地,突然上前,一把抱住母亲,号啕痛哭,母子俩的眼泪沾到了一起。 不知哭了多久,他先抬起头,哽咽着说看到了母亲的坟,以为她去世了,所以才离开家。母亲擦擦眼泪,说是她让邻居这么做的。她做工的爆竹厂发生爆炸,她侥幸活下来,却毁了容,瘸了腿。看看自己的模样,想想儿子进过监狱,家里又穷,以后他一定连媳妇都娶不上。为了不拖累他,她想出了这个主意,说自己去世,让他远走他乡,在异地生根,娶妻生子。得知他离开了家乡,她回到村子。辗转打听,才知道他来到了这个城市。她以捡破烂为生,寻找他四年,终于在这家小饭馆里找到他。她欣喜若狂,看着儿子忙碌,她又感到心痛。为了每天见到儿子,帮他减轻负担,她开始替他买菜,一买就是两年。可现在,她的腿脚不利索,下不了床了,所以,再不能为他送菜。 19 大连交通大学2011届本科生毕业设计(论文)外文翻译 这种信任和理解真的很重要。 这个故事对于众多家长来说有很强的的启迪和警示作用:“你到底爱的是孩子,还是孩子努力的结果,如果是后者,那说明你不会爱~”亦或是“你到底是爱自己的孩子,还是爱那个你心目中的孩子,如果是后者,那说明你不会爱~”,往往,在和孩子互动过程中,我们关注自己的感受,关注孩子是否改错,关注孩子是否优秀,而我们忽略了关注孩子本身,这些都是打着爱的旗号伤害着孩子,但我们往往认为这就是爱。请牢记,孩子本身最重要~ 让孩子去开辟自己的天空 《一个犹太人的家庭教育》讲的是一个伟大的犹太母亲把三个孩子培养成才的理念和方法。这位母亲生在上海,父亲是犹太人,在她12岁那年去世了,随后母亲也离她而去,她成了孤儿。长大后在上海铜厂做女工,结婚后生下三个孩子,但不久后丈夫又离她而去了。为了逃避痛苦,她成为中以建交后第一批回到以色列的犹太后裔。 为了生存,也为了三个孩子能早日回到以色列,她先发奋学习希伯来语,然后,在路边摆了个小摊卖春卷。以色列的官方货币是谢克尔,一谢克尔兑换人民币2块钱,更小的币值是雅戈洛,一谢克尔等于100雅戈洛。她的春卷小摊每天只能赚到十来个谢克尔…… 1993年,她接回了三个孩子,大儿子14岁,二儿子13岁,小女儿11岁。开始她一直秉承再苦不能苦孩子的原则,依旧做着合格的中国式妈妈。把孩子送去学校读书,她卖春卷,孩子放学,她就停止营业,在小炉子上面给他们做馄饨或者面条。这一幕被邻居看到了,就来训斥大儿子:“你已经是大孩子了,你应该学会去帮助你的母亲,而不是看着你母亲忙碌,自己就像废物一样。”然后转过头训斥母亲:“不要把那种落后的中国式教育带到以色列来……” 大儿子和她都很难受,但他们都在慢慢地改变,大儿子不但学会了做春卷,还把春卷带到学校卖,每天,三个小孩子能赚到10个谢克尔,回家交给母亲。母亲觉得很心酸,让他们小小年纪就担起生活的担子,但犹太人不这么认为,在犹太家庭里,孩子们没有免费的食物和照顾,任何东西都是有价格的,每个孩子都必须学会赚钱,才能获得自己需要的一切。 于是妈妈不再提供免费的餐食和服务,同时也给他们赚钱的机会,以每个春卷30雅戈洛的价钱批发给他们,带到学校后,可自行加价出售,利润部分自由支配。 三个孩子卖春卷的方式竟然截然不同。小女儿最老实,按老价钱50雅戈洛一个零售;二儿子则以40雅戈洛的价钱批发给学校餐厅,每天让他送100个春卷;大儿子则举办了一个“带你走进中国”的讲座,讲座的噱头就在于可以免费品尝美味的中国春卷,但需要买入场券,每人10雅戈洛,结果收入1500雅戈洛。 20 大连交通大学2011届本科生毕业设计(论文)外文翻译 随后他们琢磨出了更多更新颖的赚钱方法,他们很努力地去学习和思考,学业并没有受到任何影响。 同样作为父母,是不是应该引起我们的反思,我们每天一睁开眼睛就为了孩子忙活,做饭、洗衣服、接送、辅导作业,然后才是做自己的事情,每天忙的团团转,累得筋疲力尽。一发牢骚,孩子还会心生厌烦,根本不理解我的付出。再回头看看,每一位中国母亲不都是这样吗,这样我们就很伟大吗,我们付出了很多,却造就了一个又一个“小皇帝”、“小公主”…… 我们希望孩子成才,却又过度的保护他们,使得孩子变得无能无法自立;过分的溺爱,带来孩子的无情;过多的干涉,让孩子多了很多无奈;过多的指责,让孩子变得不知所措,找不到前进的方向…… 想要为孩子创造一个无忧无虑,快乐成长的天空,但却发现自己完完全全的占据了创造者的位置,其实,这个位置也要有一部分让孩子承担。现在的照顾,也许会暂时保护着他们,但是他们总有一天会长大,会在长大后遇到许许多多的困难,那个时候,我们是如何也帮不了他们的……也许,让孩子过早的面对金钱面对名利面对社会,会有不舍和心疼,但他们总有一天要面对,总有一天要承担。 我们为何不像那位犹太母亲那样,放开手,让孩子自己去开辟属于他们自己的天空呢, 21 英文文献及中文翻译 Thinking in Java Although it is based on C++, Java is more of a “pure” object-oriented language.Both C++ and Java are hybrid languages, but in Java the designers felt that the hybridization was not as important as it was in C++. A hybrid language allows multiple programming styles; the reason C++ is hybrid is to support backward compatibility with the C language. Because C++ is a superset of the C language, it includes many of that language’s undesirable features, which can make some aspects of C++ overly complicated. The Java language assumes that you want to do only object-oriented programming. This means that before you can begin you must shift your mindset into an object-oriented world (unless it’s already there). The benefit of this initial effort is the ability to program in a language that is simpler to learn and to use than many other OOP languages. In this chapter we’ll see the basic components of a Java program and we’ll learn that everything in Java is an object, even a Java program. Each programming language has its own means of manipulating data. Sometimes the programmer must be constantly aware of what type of manipulation is going on. Are you manipulating the object directly, or are you dealing with some kind of indirect representation (a pointer in C or C++) that must be treated with a special syntax? All this is simplified in Java. You treat everything as an object, using a single consistent syntax. Although you treat everything as an object, the identifier you manipulate is actually a “reference” to an object. You might imagine this scene as a television (the object) with your remote control (the reference). As long as you’re holding this reference, you have a connection to the television, but when someone says “change the channel” or “lower the volume,” what you’re manipulating is the reference, which in turn modifies the object. If you want to move around the room and still control the television, you take the remote/reference with you, not the television. Also, the remote control can stand on its own, with no television. That is, just because you have a reference doesn’t mean there’s necessarily an object connected to it. So if you want to hold a word or sentence, you create a String reference: But here you’ve created only the reference, not an object. If you decided to send a message to s at this point, you’ll get an error (at run time) because s isn’t actually attached to anything (there’s no television). A safer practice, then, is always to initialize a reference when you create it. However, this uses a special Java feature: strings can be initialized with quoted text. Normally, you must use a more general type of initialization for objects When you create a reference, you want to connect it with a new object. You do so, in general, with the new keyword. The keyword new says, “Make me a new one of these objects.” So in the preceding example, you can say: Not only does this mean “Make me a new String ,” but it also gives information about how to make the String by supplying an initial character string. Of course, String is not the only type that exists. Java comes with a plethora of ready-made types. What’s more important is that you can create your own types. In fact, that’s the fundamental activity in Java programming, and it’s what you’ll be learning about in the rest of this book It’s useful to visualize some aspects of how things are laid out while the program is running — in particular how memory is arranged. There are six different places to store data: Registers. This is the fastest storage because it exists in a place different from that of other storage: inside the processor. However, the number of registers is severely limited, so registers are allocated by the compiler according to its needs. You don’t have direct control, nor do you see any evidence in your programs that registers even exist. The stack. This lives in the general random-access memory (RAM) area, but has direct support from the processor via its stack pointer. The stack pointer is moved down to create new memory and moved up to release that memory. This is an extremely fast and efficient way to allocate storage, second only to registers. The Java compiler must know, while it is creating the program, the exact size and lifetime of all the data that is stored on the stack, because it must generate the code to move the stack pointer up and down. This constraint places limits on the flexibility of your programs, so while some Java storage exists on the stack — in particular, object references— Java objects themselves are not placed on the stack. The heap. This is a general-purpose pool of memory (also in the RAM area) where all Java objects live. The nice thing about the heap is that, unlike the stack, the compiler doesn’t need to know how much storage it needs to allocate from the heap or how long that storage must stay on the heap. Thus, there’s a great deal of flexibility in using storage on the heap. Whenever you need to create an object, you simply write the code to create it by using new, and the storage is allocated on the heap when that code is executed. Of course there’s a price you pay for this flexibility. It takes more time to allocate heap storage than it does to allocate stack storage (if you even could create objects on the stack in Java, as you can in C++). Static storage. “Static” is used here in the sense of “in a fixed location” (although it’s also in RAM). Static storage contains data that is available for the entire time a program is running. You can use the static keyword to specify that a particular element of an object is static, but Java objects themselves are never placed in static storage. Constant storage. Constant values are often placed directly in the program code, which is safe since they can never change. Sometimes constants are cordoned off by themselves so that they can be optionally placed in read-only memory (ROM), in embedded systems. Non-RAM storage. If data lives completely outside a program, it can exist while the program is not running, outside the control of the program. The two primary examples of this are streamed objects, in which objects are turned into streams of bytes, generally to be sent to another machine, and persistent objects, in which the objects are placed on disk so they will hold their state even when the program is terminated. The trick with these types of storage is turning the objects into something that can exist on the other medium, and yet can be resurrected into a regular RAM-based object when necessary. Java provides support for lightweight persistence, and future versions of Java might provide more complete solutions for persistence One group of types, which you’ll use quite often in your programming, gets special treatment. You can think of these as “primitive” types. The reason for the special treatment is that to create an object with new— especially a small, simple variable—isn’t very efficient, because new places objects on the heap. For these types Java falls back on the approach taken by C and C++. That is, instead of creating the variable by using new, an “automatic” variable is created that is not a reference. The variable holds the value, and it’s placed on the stack, so it’s much more efficient. Java determines the size of each primitive type. These sizes don’t change from one machine architecture to another as they do in most languages. This size invariance is one reason Java programs are portable Java 编程思想 “尽管以 C++为基础,但 Java 是一种更纯粹的面向对象程序设计语言”。无论 C++还是 Java 都属于杂合语言。但在 Java 中,设计者觉得这种杂合并不象在 C++里那么重 要。杂合语言允许采用多种编程风格;之所以说 C++是一种杂合语言,是因为它支持与 C 语言的向后兼容能力。由于 C++是 C 的一个超集,所以包含的许多特性都是后者不具 备的,这些特性使 C++在某些地方显得过于复杂。 Java语言首先便假定了我们只希望进行面向对象的程序设计。 也就是说, 正式用它 设计之前,必须先将自己的思想转入一个面向对象的世界(除非早已习惯了这个世界的 思维方式) 。只有做好这个准备工作,与其他 OOP 语言相比,才能体会到 Java 的易学易 用。在本章,我们将探讨 Java 程序的基本组件,并体会为什么说 Java 乃至 Java 程序 内的一切都是对象。 每种编程语言都有自己的数据处理方式。有些时候,程序员必须时刻留意准备处理 的是什么类型。您曾利用一些特殊语法直接操作过对象,或处理过一些间接表示的对象 吗(C 或 C++里的指针)? 所有这些在 Java 里都得到了简化,任何东西都可看作对象。因此,我们可采用一 种统一的语法,任何地方均可照搬不误。但要注意,尽管将一切都“看作”对象,但操 纵的标识符实际是指向一个对象的“句柄”(Handle ) 。在其他 Java 参考书里,还可看 到有的人将其称作一个“引用”, 甚至一个“指针”。 可将这一情形想象成用遥控板 (句 柄)操纵电视机(对象) 。只要握住这个遥控板,就相当于掌握了与电视机连接的通道。 但一旦需要“换频道”或者“关小声音”,我们实际操纵的是遥控板(句柄) ,再由遥 控板自己操纵电视机(对象) 。如果要在房间里四处走走,并想保持对电视机的控制, 那么手上拿着的是遥控板,而非电视机。 此外, 即使没有电视机, 遥控板亦可独立存在。 也就是说, 只是由于拥有一个句柄, 并不表示必须有一个对象同它连接。 所以如果想容纳一个词或句子, 可创建一个 String 句柄: 但这里创建的只是句柄,并不是对象。若此时向 s 发送一条消息,就会获得一个错 误(运行期) 。这是由于 s 实际并未与任何东西连接(即“没有电视机”) 。因此,一种 更安全的做法是:创建一个句柄时,记住无论如何都进行初始化:; 然而,这里采用的是一种特殊类型:字串可用加引号的文字初始化。通常,必须为对象 使用一种更通用的初始化类型。 创建句柄时, 我们希望它同一个新对象连接。 通常用 new 关键字达到这一目的。 new 的意思是:“把我变成这些对象的一种新类型”。所以在上面的例子中,可以说: String s = new String( 它不仅指出“将我变成一个新字串”,也通过提供一个初始字串,指出了“如何生 成这个新字串”。 当然,字串(String )并非唯一的类型。 Java 配套提供了数量众多的现成类型。对 我们来讲,最重要的就是记住能自行创建类型。事实上,这应是 Java 程序设计的一项 基本操作,是继续本书后余部分学习的基础。 程序运行时,我们最好对数据保存到什么地方做到心中有数。特别要注意的是内存的分 配。有六个地方都可以保存数据: (1)寄存器。这是最快的保存区域,因为它位于和其他所有保存方式不同的地方:处理器内部。然而,寄存器的数量十分有限,所以寄存器是根据需要由编译器分配。我 们对此没有直接的控制权,也不可能在自己的程序里找到寄存器存在的任何踪迹。 (2)堆栈。驻留于常规 RAM (随机访问存储器)区域,但可通过它的“堆栈指针” 获得处理的直接支持。堆栈指针若向下移,会创建新的内存;若向上移,则会释放那些 内存。这是一种特别快、特别有效的数据保存方式,仅次于寄存器。创建程序时, Java 编译器必须准确地知道堆栈内保存的所有数据的“长度”以及“存在时间”。 这是由于 它必须生成相应的代码, 以便向上和向下移动指针。 这一限制无疑影响了程序的灵活性, 所以尽管有些 Java 数据要保存在堆栈里——特别是对象句柄, 但 Java 对象并不放到其 中。 (3)堆。一种常规用途的内存池(也在 RAM 区域) ,其中保存了 Java 对象。和堆栈 不同,“内存堆”或“堆”(Heap )最吸引人的地方在于编译器不必知道要从堆里分配 多少存储空间,也不必知道存储的数据要在堆里停留多长的时间。因此,用堆保存数据 时会得到更大的灵活性。要求创建一个对象时,只需用 new 命令编制相关的代码即可。 执行这些代码时,会在堆里自动进行数据的保存。当然,为达到这种灵活性,必然会付 出一的代价:在堆里分配存储空间时会花掉更长的时间! (4)静态存储。这儿的“静态”(Static )是指“位于固定位置”(尽管也在 RAM 里) 。程序运行期间,静态存储的数据将随时等候调用。可用 static 关键字指出一个对 象的特定元素是静态的。但 Java 对象本身永远都不会置入静态存储空间。 (5)常数存储。常数值通常直接置于程序代码内部。这样做是安全的,因为它们永 远都不会改变。有的常数需要严格地保护,所以可考虑将它们置入只读存储器(ROM ) 。 (6) 非 RAM 存储。若数据完全独立于一个程序之外,则程序不运行时仍可存在,并 在程序的控制范围之外。其中两个最主要的例子便是“流式对象”和“固定对象”。对 于流式对象,对象会变成字节流,通常会发给另一台机器。而对于固定对象,对象保存 在磁盘中。即使程序中止运行,它们仍可保持自己的状态不变。对于这些类型的数据存 储,一个特别有用的技巧就是它们能存在于其他媒体中。一旦需要,甚至能将它们恢复 成普通的、基于 RAM 的对象。 Java 1.1提供了对 Lightweight persistence 的支持。未 来的版本甚至可能提供更完整的方案。 有一系列类需特别对待;可将它们想象成“基本”、“主要”或者“主” (Primitive )类型,进行程序设计时要频繁用到它们。之所以要特别对待,是由于用 new 创建对象 (特别是小的、 简单的变量) 并不是非常有效, 因为 new 将对象置于“堆” 里。对于这些类型, Java 采纳了与 C 和 C++相同的方法。也就是说,不是用 new 创建变 量, 而是创建一个并非句柄的“自动”变量。 这个变量容纳了具体的值, 并置于堆栈中, 能够更高效地存取。 Java决定了每种主要类型的大小。 就象在大多数语言里那样, 这些大小并不随着机 器结构的变化而变化。这种大小的不可更改正是 Java 程序具有很强移植能力的原因之 一。 附件一: A Rapidly Deployable Manipulator System Author:Christiaan J.J.Paredis,H.Benjamin Brown,Pradeep K.Khosla Abstract: A rapidly deployable manipulator system combines the flexibility of reconfigurable modular hardware with modular programming tools,allowing the user to rapidly create a manipulator which is custom-tailored for a given task.This article describes two main aspects of such a system,namely,the Reconfigurable Modular Manipulator System(RMMS)hardware and the corresponding control software. 1 Introduction Robot manipulators can be easily reprogrammed to perform different tasks,yet the range of tasks that can be performed by a manipulator is limited by mechanicalstructure.Forexample,a manipulator well-suited for precise movement across the top of a table would probably no be capable of lifting heavy objects in the vertical direction.Therefore,to perform a given task,one needs to choose a manipulator with an appropriate mechanical structure. We propose the concept of a rapidly deployable manipulator system to address the above mentioned shortcomings of fixed configuration manipulators.As is illustrated in Figure 1,a rapidly deployable manipulator system consists of software and hardware that allow the user to rapidly build and program a manipulator which is customtailored for a given task. The central building block of a rapidly deployable system is a Reconfigurable Modular Manipulator System(RMMS).The RMMS utilizes a stock of interchangeable link and joint modules of various sizes and performance specifications.One such module is shown in Figure 2.By combining these general purpose modules,a wide range of special purpose manipulators can be assembled.Recently,there has been considerable interest in the idea of modular manipulators,for research applications as well as for industrial applications.However,most of these systems lack the property of reconfigurability,which is key to the concept of rapidly deployable systems.The RMMS is particularly easy to reconfigure thanks to its integrated quick-coupling connectors described in Section 3. Effective use of the RMMS requires,Task Based Design software.This software takes as input descriptions of the task and of the available manipulator modules;it generates as output a modular assembly configuration optimally suited to perform the given task.Several different approaches have been used successfully to solve simpli-fied instances of this A third important building block of a rapidly deployable manipulator system is a framework for the generation of control software.To reduce the complexity of softwaregeneration for real-time sensor-based control systems,a software paradigm called software assembly has been proposed in the Advanced Manipulators Laboratory at CMU.This paradigm combines the concept of reusable and reconfigurable software components,as is supported by the Chimera real-time operating system,with a graphical user interface and a visual programming language,inplemented in Onika. Although the software assembly paradigm provides thesoftware infrastructure for rapidly programming manipulator systems,it does not solve the programming problem itself.Explicit programming of sensor-based manipulator systems is cumbersome due to the extensive amount of detail which must be specified for the robot to perform the task.The software synthesis problem for sensor-based robots can be simplified dramatically,by providing robust robotic skills,that is,encapsulated strategies for accomplishing common tasks in the robots task domain.Such robotic skills can then be used at the task level planning stage without having to consider any of the low-level details As an example of the use of a rapidly deployable system,consider a manipulator in a nuclear environment where it must inspect material and space for radioactive contamination,or assemble and repair equipment.In such an environment,widely varied kinematic(e.g.,workspace)and dynamic(e.g.,speed,payload)performance is required,and these requirements may not be known a priori.Instead of preparing a large set of different manipulators to accomplish these tasks — an expensive solution — one can use a rapidly deployable manipulator system.Consider the following scenario:as soon as a specific task is identified,the task based design software determinesthe task.This optimal configuration is thenassembled from the RMMS modules by a human or,in manipulator.The resulting manipulator is rapidly programmed by using the software assembly paradigm and our library of robotic skills.Finally,the manipulator is deployed to perform its task. Although such a scenario is still futuristic,the development of the reconfigurable modular manipulator system,described in this paper,is a major step forward towards our goal of a rapidly deployable manipulator system. Our approach could form the basis for the next generation of autonomous manipulators,in which the traditional notion of sensor-based autonomy is extended to configuration-based autonomy.Indeed,although a deployed system can have all the sensory and planning information it needs,it may still not be able to accomplish its task because the task is beyond the system’s physical capabilities.A rapidly deployable system,on the other hand,could adapt its physical capabilities based on task specifications and,with advanced sensing,control,and planning strategies,accomplish the task autonomously. 2 Design of self-contained hardware modules In most industrial manipulators,the controller is a separate unit housing the sensor interfaces,power amplifiers,and control processors for all the joints of the manipulator.A large number of wires is necessary to connect this control unit with the sensors,actuators and brakes located in each of the joints of the manipulator.The large number of electrical connections and the non-extensible nature of such a system layout make it infeasible for modular manipulators.The solution we propose is to distribute the control hardware to each individual module of the manipulator.These modules then become self-contained units which include sensors,an actuator,a brake,a transmission,a sensor interface,a motor amplifier,and a communication interface,as is illustrated in Figure 3.As a result,only six wires are required for power distribution and data communication. 2.1 Mechanical design The goal of the RMMS project is to have a wide variety of hardware modules available.So far,we have built four kinds of modules:the manipulator base,a link module,three pivot joint modules(one of which is shown in Figure 2),and one rotate joint module.The base module and the link module have no degrees-of-freedom;the joint modules have degree-of-freedom each.The mechanical design of the joint modules compactly fits a DC-motor,a fail-safe brake,a tachometer,a harmonic drive and a resolver The pivot and rotate joint modules use different outside housings to provide the right-angle or in-line configuration respectively,but are identical internally.Figure 4 shows in cross-section the internal structure of a pivot joint.Each joint module includes a DC torque motor and 100:1 harmonic-drive speed reducer,and is rated at a maximum speed of 1.5rad/s and maximum torque of 270Nm.Each module has a mass of approximately 10.7kg.A single,compact,X-type bearing connects the two joint halves and provides the needed overturning rigidity.A hollow motor shaft passes through all the rotary components,and provides a channel for passage of cabling with minimal flexing. 2.2 Electronic design The custom-designed on-board electronics are also designed according to the principle of modularity.Each RMMS module contains a motherboard which provides the basic functionality and onto which daughtercards can be stacked to add module specific functionality. The motherboard consists of a Siemens 80C166 microcontroller,64K of ROM,64K of RAM,an SMC COM20020 universal local area network controller with an RS-485 driver,and an RS-232 driver.The function of the motherboard is to establish communication with the host interface via an RS-485 bus and to perform the lowlevel control of the module,as is explained in more detail in Section 4.The RS-232 serial bus driver allows for simple diagnostics and software prototyping. A stacking connector permits the addition of an indefinite number of daughtercards with various functions,such as sensor interfaces,motor controllers,RAM expansion etc.In our current implementation,only modules with actuators include a daughtercard.This card contains a 16 bit resolver to digital converter,a 12 bit A/D converter to interface with the tachometer,and a 12 bit D/A converter to control the motor amplifier;we have used an ofthe-shelf motor amplifier(Galil Motion Control model SSA-8/80)to drive the DC-motor.For modules with more than one degree-of-freedom,for instance a wrist module,more than one such daughtercard can be stacked onto由 e s创 ne motherboard. 3 Integrated quick-coupling connectors To make a modular manipulator be reconfigurable,it is necessary that the modules can be easily connected with each other.We have developed a quick-coupling mechanism with which a secure mechanical connection between modules can be achieved by simply turning a ring handtight;no tools are required.As shown in Figure 5,keyed flanges provide precise registration of the two modules.Turning of the locking collar on the male end produces two distinct motions:first the fingers of the locking ring rotate(with the collar)about 22.5 degrees and capture the fingers on the flanges;second,the collar rotates relative to the locking ring,while a cam mechanism forces the fingers inward to securely grip the mating flanges.A ball-transfer mechanism between the collar and locking ring automatically produces this sequence of motions. At the same time the mechanical connection is made,pneumatic and electronic connections are also established.Inside the locking ring is a modular connector that has 30 male electrical pins plus a pneumatic coupler in the middle.These correspond to matching female components on the mating connector.Sets of pins are wired in parallel to carry the 72V-25A power for motors and brakes,and 48V– 6A power for the electronics.Additional pins carry signals for two RS-485 serial communication busses and four video busses.A plastic guide collar plus six alignment pins prevent damage to the connector pins and assure proper alignment.The plastic block holding the female pins can rotate in the housing to accommodate the eight different possible connection orientations(8@45 degrees).The relative orientation is automatically registered by means of an infrared LED in the female connector and eight photodetectors in the male connector. 4 ARMbus communication system Each of the modules of the RMMS communicates with a VME-based host interface over a local area network called the ARMbus;each module is a node of the network.The communication is done in a serial fashion over an RS-485 bus which runs through the length of the manipulator.We use the ARCNET protocol[1]implemented on a dedicated IC(SMC COM20020).ARCNET is a deterministic token-passing network scheme which avoids network collisions and guarantees each node its time to access the network.Blocks information called packets may be sent from any node on the network to any one of the other nodes,or to all nodes simultaneously(broadcast).Each node may send one packet each time it gets the token.The maximum network throughput is 5Mb/s. The first node of the network resides on the host interface card,as is depicted in Figure 6.In addition to a VME address decoder,this card contains essentially the same hardware one can find on a module motherboard.The communication between the VME side of the card and the ARCNET side occurs through dual-port RAM. There are two kinds of data passed over the local area network.During the manipulator initialization phase,the modules connect to the network one by one,starting at the base and ending at the end-effector.On joining the network,each module sends a data-packet to the host interface containing its serial number and its relative orientation with respect to the previous module.This information allows us to automatically determine the current manipulator configuration. During the operation phase,the host interface communicates with each of the nodes at 400Hz.The data that is exchanged depends on the control mode— centralized or distributed.In centralized control mode,the torques for all the joints are computed on the VME-based real-time processing unit(RTPU),assembled into a data-packet by the microcontroller on the host interface card and broadcast over the ARMbus to all the nodes of the network.Each node extracts its torque value from the packet and replies by sending a data-packet containing the resolver and tachometer readings.In distributed control mode,on the other hand,the host computer broadcasts the desired joint values and feed-forward torques.Locally,in each module,the control loop can then be closed at a frequency much higher than 400Hz.The modules still send sensor readings back to the host interface to be used in the computation of the subsequent feed-forward torque. 5 Modular and reconfigurable control software The control software for the RMMS has been developed using the Chimera real-time operating system,which supports reconfigurable and reusable software components.The software components used to control the RMMS are listed in Table 1.The trjjline,dls,and of the RMMS,such as the number of degrees-of-freedom,the Denavit-Hartenberg parameters etc.During the initialization phase,the RMMS interface establishes contact with each of the hardware modules to determine automatically which modules are being used and in which order and orientation they have been assembled.For each module,a data file with a parametric model is read.By combining this information for all the modules,kinematic and dynamic models of the entire manipulator are. After the initialization,the rmms software component operates in a distributed control mode in which the microcontrollers of each of the RMMS modules perform PID control locally at 1900Hz.The communication between the modules and the host interface is at 400Hz,which can differ from the cycle frequency of the rmms software component.Since we use a triple buffer mechanism for the communication through the dual-port RAM on the ARMbus host interface,no synchronization or handshaking is necessary. Because closed form inverse kinematics do not exist for all possible RMMS configurations,we use a damped least-squares kinematic controller to do the inverse kinematics computation numerically. 6 Seamless integration of simulation To assist the user in evaluating whether an RMMS con-figuration can successfully complete a given task,we have built a simulator.The simulator is based on the TeleGrip robot simulation software from Deneb Inc.,and runs on an SGI Crimson which is connected with the real-time processing unit through a Bit3 VME-to-VME adaptor,as is shown in Figure 6.A graphical user interface allows the user to assemble simulated RMMS configurations very much like assembling the real hardware.Completed configurations can be tested and programmed using the TeleGrip functions for robot devices.The configurations can also be interfaced with the Chimera real-time softwarerunning on the same RTPUs used to control the actual hardware.As a result,it is possible to evaluate not only the movements of the manipulator but also the realtime CPU usage and load balancing.Figure 7 shows an RMMS simulation compared with the actual task execution. 7 Summary We have developed a Reconfigurable Modular Manipulator System which currently consists of six hardware modules,with a total of four degrees-of-freedom.These modules can be assembled in a large number of different configurations to tailor the kinematic and dynamic properties of the manipulator to the task at hand.The control software for the RMMS automatically adapts to the assembly configuration by building kinematic and dynamic models of the manipulator;this is totally transparent to the user.To assist the user in evaluating whether a manipulator configuration is well suited for a given task,we have alsobuilt a simulator. Acknowledgment This research was funded in part by DOE under grant DE-F902-89ER14042,by Sandia National Laboratories under contract AL-3020,by the Department of Electrical and Computer Engineering,and by The Robotics Institute,Carnegie Mellon University. The authors would also like to thank Randy Casciola,Mark DeLouis,Eric Hoffman,and Jim Moody for their valuable contributions to the design of the RMMS system. 附件二: 可迅速布置的机械手系统 作者:Christiaan J.J.Paredis,H.Benjamin Brown,Pradeep K.Khosla 摘要: 一个迅速可部署的机械手系统,可以使再组合的标准化的硬件的灵活性用 标准化的编程工具结合,允许用户迅速建立为一项规定的任务来通常地控制机 械手。这篇文章描述这样的一个系统的两个主要方面,即,再组合的标准化的 机械手系统 (RMMS)硬件和相应控制软件。 1介绍 机器人操纵装置可能容易被程序重调执行不同的任务,然而一个机械手可 以执行的任务的范围已经被它的机械结构限制。例如,一个很适合准确的运动 的机械手在一张桌子上部或许将不能朝着垂直的方向举起重物。因此,执行规 定的任务,需要有一个合适的机械结构来选择机械手。 我们提议一个迅速可部署的机械手系统的概念来处理固定构造的机械手的 上述的缺点。一迅速可部署机械手系统由迅速建造的软件和硬件组成,是适合 一规定任务的一个机械手。 一个迅速可部署的系统的中心的组成部分是一个再组合的标准化的机械手 系统 (RMMS)。 RMMS 利用一可交换的连接的和各种尺寸和性能的共同模件。通过 结合这些多功能的模件,大范围专用机械手可以被收集。最近,有相当多的对 机械手标准化的想法的兴趣。但是,对于研究应用以及为工业应用来说,大多 数这些系统缺乏的必要的能力,这是迅速可部署的体制的概念的关键。 有效的使用 RMMS 需要基于任务的设计软件。这软件认为是任务和可得到的 操纵者模件的输入描述;作为一标准化会议构造最佳适合执行规定任务的业务 的产量产生。几种不同的方法已经被成功使用解决这个错综复杂的问题的。 一个迅速可部署的机械手系统的第 3个重要的组成部分是控制软件的代的 一种框架。为实时基于传感器的控制系统降低软件生成的复杂性,一个软件范 例叫软件为会议已经在 CMU 先进的操纵者实验室里被提出。这个范例结合可重 复使用和再组合的软件成分的概念,象妄想实时操作系统支持的那样 , 用一个图 形用户界面和可视程序设计语言而实施。 虽然软件会议范例提供迅速编程操纵者系统的软件基础设施,但是它不解 决编程问题。基于传感器的机械手系统的明确编程由于必须被为机器人指定执 行任务的广大数量的细节是麻烦的。基于传感器的机器人的软件综合问题可以 被简化,通过提供坚固的机器人技能,即,为在机器人任务域完成普通任务封 装策略 . 这样机器人技能能在而不需要考虑任何低级的细节的任务步计划阶段使 用。 作为使用一个迅速可部署的系统的例子,在一种核环境里,在那里它必须 检查材料和放射性污染的空间,或者集合和修理设备考虑一个操纵者。在这样 的一种环境里,广泛改变的动态的 (例如,工作区 ) 和动态的 (例如,速度,净载 重量 ) 性能被要求,并且这些要求可能不被知道 priori 。不得不准备大套要完 成这几次任务的不同操纵者一昂贵解决办法一使用迅速可部署操纵者系统能。 考虑下列脚本:一项具体的任务一被鉴定,基于任务的设计软件就使最佳的标 准化的会议构造下决心进行任务。人们然后从 RMMS 模件装配这个最佳的构造或 者,将来,也许到另一个操纵者。导致的操纵者被迅速通过使用软件装配范例 和我们的机器人技能的信息库编程序。最后,操纵者被有效地使用执行它的任 务。虽然这样的脚本仍然是未来的,再组合的标准化的操纵者系统的发展,在 这篇文章里描述,是向我们的一个迅速可部署的机械手系统的目标的一个向前 的主要的台阶。 我们的方法能为自治机械手的下一代形成基础,其中基于传感器的自治权 的传统的观念被给予基于构造的自治权。的确,虽然一个部署的系统能有它需 要的全部感觉并且计划的信息,它可能仍然不能完成它的任务,因为任务是在 系统的物理能力以外。一个迅速可部署的系统,另一方面,能改编它的基于任 务说明的物理能力和带有先进的感觉,控制,以及计划策略,自动完成任务。 2硬件模块的两种设计 在通常工业机械手里,那些控制器单独接在那些传感器接口,功率放大 器,并且因机械手全部关节那些机械手而控制处理器。许多电线连接这个控制 单位和传感器,位于机械手的每个关节的作动器和刹车是必要的。大量电气装 线和这样的一次系统平面布置的非可扩展性,为标准化的机械手使它不能实 行。我们提出的这个解决办法是将控制硬件分配给操纵者的每个个别的模件。 包括传感器的这些模件然后成为组装组件:制动器,一个刹车,一次输送,一 个传感器接口,一个电动机放大器和一个通信接口。 2.1机械设计 RMMS 工程的目标是有可提供的多种硬件模块。迄今,我们已经建造 4种模 件:操纵者基础,一连接模块,枢共同模件 (一在身材显示 ) ,并且一旋转共同 模件。底部模件和连接模块没有自由度;共同模件各自有一自由度。共同模件 的机械设计紧密适合一台直流电动机,一个有自动防故障设备的刹车,一台转 速表,谐波运动。 那些枢和旋转共同模件在外部使用提供那些直角不同或者成队构造分别, 但是相同内部,在典型地方显示一共同的枢的内部结构。每个共同模件包括一 台直流力矩电动机和 100:1的谐波驾驶速度减压器,并且被在 1.5rad/s和 270纳米的最高转矩的最高速度下。不是每个模件都有块大约 10.7公斤一单 个,小型,耐压的 X 类型提供需要的刚性连结并且相连在一起。一根空的电动 机轴通过全部旋转的零部件,并且为最小的屈曲电信号的传送提供一条通道。 2.2电子设计 通俗设计的舱中的电子也被根据的原则设计。每个 RMMS 模件包含主板,提 供基本的功能性和可以被堆积增加模件具体的功能性。 主板由西门子 80C166组成, 64K ROM, RAM ,一 SMC COM20020的 64 K有一 台 RS-485驱动器和一台 RS-232驱动器的普遍的局部地区网络控制器。主板的 功能是通过一种 RS-485公共系统建立与主接口的联系和进行程序控制模件,象 在第 4部分被更详细解释的那样。 RS-232连续的公共汽车司机考虑到单纯的诊 断和软件原型法。 一个堆积的连接器有各种各样的功能允许模糊的数量的增加,例如传感器 接口,电动机控制器, RAM 扩大器等等,在我们的当今的实施里,只是有作动 器 的 模 件 包 括 daughtercard 。 这 张 卡 片到 数 字 化 的 变 换 器 包含 一 16位 resolver ,要与转速表和一台 12位 D/A变换器接口控制电动机放大器的一台 12位模数转换器;我们已经使用一个 ofthe 架子电动机放大器 (Galil运动控制 模型 SSA 8/80)驱动直流电动机。对有超过一自由度,例如一个腕模件的模件 来说,不止一这样的 daughtercard 可以被堆积到相同的主板上。 3综合连合的连接器 为了使一个标准化的机械手再组合,模件可能容易被彼此连结是必要的。 我们已经 -12-handtight 被取得;没有工具被要求。调整凸缘提供两个模件的 准确的连接。锁住的手腕的转动在末端上产生两种不同的动作:首先,锁住的 手指大约 22.5程度和捕获轮流 (与手腕一起 ) 手指在凸缘上运动;其次,那些手 腕相对于锁住的手指,而凸轮机制强迫那些内在的手指在可靠紧握轮子的凸缘 运动。在领和锁住的手指之间的转动机构自动生产这个运动顺序。 同时机械连接被做成为装满和电子的连接。在每锁住的指里面有 30电别针 以上一装满电子偶合器在中间的一标准化连接器是。这些符合匹配铺席子的连 接器上的凹形零部件。别针被电报告知在方面与平行那些 72 V-25A 去电动机 和刹车和去那些电子的权力 48 V-6A 的权力。 4 ARMbus通信系统 RMMS 的每个模件在一个称为 ARMbus 的局域网上方与一个基于 VME 的主接 口联系;每个模件都是一个网络的节点。通讯被在机械手的长度的一辆 RS-485公共汽车上方用连续方式做。我们使用 ARCNET 协议 [1]在一奉献的 IC(SMC COM20020) 上实现。 ARCNET 是避免网络冲突并且在访问网络的它的时间保证每 个节点的一个决定性的权标传递网络计划。称为包的信息的块可能被在网络上 从任何节点送给其它节点中的任何一个,或者对全部节点同时 (广播 ) 。每当它 得到标志的时候,每个节点可以送一包。 网络的第一个节点保存在主接口卡。除一 VME 地址译码器之外,这卡片包 含基本上相同的硬件一能在模件主板上发现。在这张卡上的 VME 和 ARCNET 之间 的联系边是通过双口 RAM 发生的。有两种数据通过局域网。在机械手预置阶段 期间,模件一个接一个连接网络,在基础启动并且结束最后 effector 。关于参 加网络,每模件寄一数据包给包含它的顺序号和它的与以前的舱有关的有关的 认识新环境的主机接口。这信息允许我们自动确定当今的机械手构造。在运行 阶段,主接口以 400赫兹与每个节点联系。被交换的数据取决于控制模式集中 或者被分配。用集中的控制模式,全部关节的力矩被在基于 VME 的实时工艺设 备 (RTPU)上计算,进一数据包以 microcontroller 集合在主接口卡上和越过 ARMbus 随着的全部网络的节点。每个节点从包中抽出它的力矩价值并且通过使 数据包包含 resolver 和转速表读数回答。用分配的控制模式,另一方面,主机 播送被期望的共同价值和前馈力矩。当地,在每个模件里,控制环然后能被在 比 400赫兹高得多的频率关闭模件仍然把传感器读数回寄给主联接于被在随后 的前馈力矩的计算内使用。 5标准化和再组合的控制软件 对于远程控制软件采用嵌合体的实时操作系统开发的,它支持可重构和可 重用的软件组件主题组成部分需要一定构造 RMMS 的依靠的参数知识,在预置阶 段期间, RMMS 接口建立与每个硬件模块的关系自动确定哪个模件正被使用,并 且他们的命令和定向收集。对每个模件来说,一个数据提交给一个参数模型被 读。通过结合所有模块的信息,建造整个机械手的运动学和动力学模型。 初始化后,应用情况的软件组件运行在分布式控制模式,每个模块的微控 制器的应用情况进行 PID 控制在 1900hz 。的通信模块和主机接口是在 400Hz 之 间发生,这可以和 RMMS 的周期频率不同。由于我们使用三重缓冲机制的通信通 过对 armbus 主机接口的双端口 RAM ,没有同步或握手是必要的。 因为封闭形式的逆运动学不为所有可能存在的缺陷结构,利用阻尼最小二 乘运动控制器做逆运动学计算数值。 6综合模拟 帮助用户评估是否可以成功完成远程控制一个给定的任务,我们已经建立 了一个模拟器。模拟器是基于来自 Deneb 股份有限公司的 TeleGrip 机器人模拟 软件,运行在 SGI 的深红色这是通过一位 VME VME适配器与实时处理单元连 接。图形用户界面允许用户装配模拟远程配置非常喜欢组装真实的硬件。完成 配置可以测试和使用 telegrip 功能的机器人装置。组态,也可以与奇美拉实时 软件用来控制实际的硬件相同的 rtpus 接口。因此,它不仅可以评估的人的运 动臂也实时的 CPU 使用率和负载平衡。 7结束语 我们已经发展目前由 6个硬件模块组成,共有四个自由度。这些模块可以 组装在多个不同的机构里面,以量身定制的运动学和动力学特性的机械手手头 的任务。对于远程控制软件自动适应装配结构通过建立机械手的运动学和动力 学模型,这对用户是完全透明的。为了帮助用户评估机械手配置是否非常适合 一个任务,我们建立一个模拟器。 转载请注明出处范文大全网 » java毕业论文外文文献翻译范文二:java毕业设计外文文献
范文三:java外文文献毕业设计
范文四:java毕业设计外文文献原文及译文
范文五:机械手相关的外文文献