JAVA方法英文翻译表
Java百度翻译API中文转英文接入
Java百度翻译API中⽂转英⽂接⼊Java 百度翻译 API 中⽂转英⽂接⼊业务上遇到了语⾔国际化的需求,需要将中⽂的 json 字符串翻译成英⽂,通过百度翻译 API 接⼝来实现翻译功能。
1、平台认证登录百度翻译开放平台,找到通⽤翻译模块,提交申请。
申请通过后,就能直接使⽤了,默认为标准版,完全免费:2、Java demo 配置翻译开放平台⾮常友好,提供了许多常⽤语⾔的 demo 下载,稍微修改下便能使⽤了。
demo 配置好 appid 及密钥,运⾏便能看到控制台中⽂成功翻译成了英⽂:3、封装接⼝我的⽬标是将⼀长串的中⽂ json 翻译成英⽂ json, 上⾯的 demo 是满⾜不了需求的,可以创建⼀个 springboot 项⽬,将 demo 代码迁移到项⽬中,封装⼀个接⼝实现业务需求。
项⽬结构如下:3.1、⾃定义接⼝先引⼊fastJson依赖:<!--fastJson--><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.70</version></dependency>接⼝参数接收⼀长串的中⽂ json ,翻译完成后返回英⽂ json:3.1.1、直接创建线程版本package com.lin.translate.controller;import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.JSONArray;import com.lin.translate.config.TransApi;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import java.io.UnsupportedEncodingException;import .URLDecoder;import java.util.List;import java.util.Map;@Controller@RequestMapping("/com/lin")public class TranslateController {// 在平台申请的APP_ID 详见 /api/trans/product/desktop?req=developerprivate static final String APP_ID = "";private static final String SECURITY_KEY = "";@GetMapping("/translate")@ResponseBodypublic Map<String, Map<String, String>> toTranslate(@RequestBody Map<String, Map<String, String>> map) throws InterruptedException {TransApi api = new TransApi(APP_ID, SECURITY_KEY);for(String key : map.keySet()) {Map<String, String> childMap = map.get(key);StringBuilder builder = new StringBuilder();for (String childKey : childMap.keySet()) {//需要翻译的中⽂builder.append(childMap.get(childKey)).append("\n");}//创建线程Thread thread = new Thread() {@Overridepublic void run() {String result = api.getTransResult(builder.toString(), "auto", "en");System.out.println(result);//转成mapMap<String, String> mapResult = JSON.parseObject(result, Map.class);List<Map<String, String>> transResult = (List<Map<String, String>>)JSONArray.parse(JSON.toJSONString(mapResult.get("trans_result"))); int i = 0;for (String childKey : childMap.keySet()) {//获取翻译结果String transQuery = transResult.get(i).get("dst");try {//解码transQuery= URLDecoder.decode(transQuery,"utf-8");} catch (UnsupportedEncodingException e) {e.printStackTrace();}childMap.put(childKey, transQuery);i++;}try {//睡眠⼀秒Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();}}};thread.start();//主线程阻塞,等待⼦线程结束thread.join();}return map;}}3.1.2、线程池版本package com.lin.translate.controller;import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.JSONArray;import com.lin.translate.config.TransApi;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import java.io.UnsupportedEncodingException;import .URLDecoder;import java.util.List;import java.util.Map;import java.util.concurrent.*;@Controller@RequestMapping("/com/lin")public class ExecutorController {// 在平台申请的APP_ID 详见 /api/trans/product/desktop?req=developerprivate static final String APP_ID = "";private static final String SECURITY_KEY = "";@GetMapping("/executorTranslate")@ResponseBodypublic Map<String, Map<String, String>> toTranslate(@RequestBody Map<String, Map<String, String>> map) throws InterruptedException {TransApi api = new TransApi(APP_ID, SECURITY_KEY);//创建线程池,核⼼线程1,最⼤线程数10,存货时间1分钟,任务队列5,默认的线程⼯⼚,拒绝策略为拒绝并抛出异常ExecutorService executorService = new ThreadPoolExecutor(1, 10, 1, TimeUnit.MINUTES,new ArrayBlockingQueue<>(5, true), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());for (String key : map.keySet()) {Map<String, String> childMap = map.get(key);StringBuilder builder = new StringBuilder();for (String childKey : childMap.keySet()) {//需要翻译的中⽂builder.append(childMap.get(childKey)).append("\n");}//执⾏线程executorService.execute(() -> {String result = api.getTransResult(builder.toString(), "auto", "en");System.out.println("result:" + result);//转成mapMap<String, String> mapResult = JSON.parseObject(result, Map.class);List<Map<String, String>> transResult = (List<Map<String, String>>) JSONArray.parse(JSON.toJSONString(mapResult.get("trans_result"))); int i = 0;for (String childKey : childMap.keySet()) {//获取翻译结果String transQuery = transResult.get(i).get("dst");try {//解码transQuery = URLDecoder.decode(transQuery, "utf-8");} catch (UnsupportedEncodingException e) {e.printStackTrace();}childMap.put(childKey, transQuery);i++;}});//线程池等待时间,这⾥即阻塞2秒executorService.awaitTermination(2, TimeUnit.SECONDS);}//任务执⾏完成后关闭线程池executorService.shutdown();return map;}}3.2、demo 配置类代码HttpGet 类代码如下:package com.baidu.translate.demo;import java.io.BufferedReader;import java.io.Closeable;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.UnsupportedEncodingException;import .HttpURLConnection;import .MalformedURLException;import .URL;import .URLEncoder;import java.security.KeyManagementException;import java.security.NoSuchAlgorithmException;import java.security.cert.CertificateException;import java.security.cert.X509Certificate;import java.util.Map;import .ssl.HttpsURLConnection;import .ssl.SSLContext;import .ssl.TrustManager;import .ssl.X509TrustManager;class HttpGet {protected static final int SOCKET_TIMEOUT = 10000; // 10Sprotected static final String GET = "GET";public static String get(String host, Map<String, String> params) {try {// 设置SSLContextSSLContext sslcontext = SSLContext.getInstance("TLS");sslcontext.init(null, new TrustManager[] { myX509TrustManager }, null);String sendUrl = getUrlWithQueryString(host, params);// System.out.println("URL:" + sendUrl);URL uri = new URL(sendUrl); // 创建URL对象HttpURLConnection conn = (HttpURLConnection) uri.openConnection();if (conn instanceof HttpsURLConnection) {((HttpsURLConnection) conn).setSSLSocketFactory(sslcontext.getSocketFactory());}conn.setConnectTimeout(SOCKET_TIMEOUT); // 设置相应超时conn.setRequestMethod(GET);int statusCode = conn.getResponseCode();if (statusCode != HttpURLConnection.HTTP_OK) {System.out.println("Http错误码:" + statusCode);}// 读取服务器的数据InputStream is = conn.getInputStream();BufferedReader br = new BufferedReader(new InputStreamReader(is));StringBuilder builder = new StringBuilder();String line = null;while ((line = br.readLine()) != null) {builder.append(line);}String text = builder.toString();close(br); // 关闭数据流close(is); // 关闭数据流conn.disconnect(); // 断开连接return text;} catch (MalformedURLException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();} catch (KeyManagementException e) {e.printStackTrace();} catch (NoSuchAlgorithmException e) {e.printStackTrace();}return null;}public static String getUrlWithQueryString(String url, Map<String, String> params) { if (params == null) {return url;}StringBuilder builder = new StringBuilder(url);if (url.contains("?")) {builder.append("&");} else {builder.append("?");}int i = 0;for (String key : params.keySet()) {String value = params.get(key);if (value == null) { // 过滤空的keycontinue;}if (i != 0) {builder.append('&');}builder.append(key);builder.append('=');builder.append(encode(value));i++;}return builder.toString();}protected static void close(Closeable closeable) {if (closeable != null) {try {closeable.close();} catch (IOException e) {e.printStackTrace();}}}/*** 对输⼊的字符串进⾏URL编码, 即转换为%20这种形式** @param input 原⽂* @return URL编码. 如果编码失败, 则返回原⽂*/public static String encode(String input) {if (input == null) {return "";}try {return URLEncoder.encode(input, "utf-8");} catch (UnsupportedEncodingException e) {e.printStackTrace();}return input;}private static TrustManager myX509TrustManager = new X509TrustManager() {@Overridepublic X509Certificate[] getAcceptedIssuers() {return null;}@Overridepublic void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { }@Overridepublic void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { }};}MD5 类代码如下:package com.lin.translate.config;import java.io.*;import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;/*** MD5编码相关的类** @author wangjingtao**/public class MD5 {// ⾸先初始化⼀个字符数组,⽤来存放每个16进制字符private static final char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd','e', 'f' };/*** 获得⼀个字符串的MD5值** @param input 输⼊的字符串* @return 输⼊字符串的MD5值**/public static String md5(String input) {if (input == null) {return null;}try {// 拿到⼀个MD5转换器(如果想要SHA1参数换成”SHA1”)MessageDigest messageDigest = MessageDigest.getInstance("MD5");// 输⼊的字符串转换成字节数组byte[] inputByteArray = input.getBytes("utf-8");// inputByteArray是输⼊字符串转换得到的字节数组messageDigest.update(inputByteArray);// 转换并返回结果,也是字节数组,包含16个元素byte[] resultByteArray = messageDigest.digest();// 字符数组转换成字符串返回return byteArrayToHex(resultByteArray);} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {e.printStackTrace();return null;}}/*** 获取⽂件的MD5值** @param file* @returnpublic static String md5(File file) {try {if (!file.isFile()) {System.err.println("⽂件" + file.getAbsolutePath() + "不存在或者不是⽂件");return null;}FileInputStream in = new FileInputStream(file);String result = md5(in);in.close();return result;} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}return null;}public static String md5(InputStream in) {try {MessageDigest messagedigest = MessageDigest.getInstance("MD5");byte[] buffer = new byte[1024];int read = 0;while ((read = in.read(buffer)) != -1) {messagedigest.update(buffer, 0, read);}in.close();String result = byteArrayToHex(messagedigest.digest());return result;} catch (NoSuchAlgorithmException e) {e.printStackTrace();} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}return null;}private static String byteArrayToHex(byte[] byteArray) {// new⼀个字符数组,这个就是⽤来组成结果字符串的(解释⼀下:⼀个byte是⼋位⼆进制,也就是2位⼗六进制字符(2的8次⽅等于16的2次⽅)) char[] resultCharArray = new char[byteArray.length * 2];// 遍历字节数组,通过位运算(位运算效率⾼),转换成字符放到字符数组中去int index = 0;for (byte b : byteArray) {resultCharArray[index++] = hexDigits[b >>> 4 & 0xf];resultCharArray[index++] = hexDigits[b & 0xf];}// 字符数组组合成字符串返回return new String(resultCharArray);}}TransApi 类代码如下:package com.lin.translate.config;import java.util.HashMap;import java.util.Map;public class TransApi {private static final String TRANS_API_HOST = "/api/trans/vip/translate";private String appid;private String securityKey;public TransApi(String appid, String securityKey) {this.appid = appid;this.securityKey = securityKey;public String getTransResult(String query, String from, String to) {Map<String, String> params = buildParams(query, from, to);return HttpGet.get(TRANS_API_HOST, params);}private Map<String, String> buildParams(String query, String from, String to) { Map<String, String> params = new HashMap<String, String>();params.put("q", query);params.put("from", from);params.put("to", to);params.put("appid", appid);// 随机数String salt = String.valueOf(System.currentTimeMillis());params.put("salt", salt);// 签名String src = appid + query + salt + securityKey; // 加密前的原⽂params.put("sign", MD5.md5(src));return params;}}3.3、结果⽰例原中⽂ json:{"login": {"login": "登录","loginLoading": "登录中...","account": "账号","password": "密码","lang": "语⾔","setAddress": "设置服务地址","more": "更多"},"mDns": {"local": "局域⽹","localText": "内的XYMERP服务","useAddress": "当前设置的地址","addressUnAvailable": "⽆法连接此服务器","setAddressTips": "未设置服务地址,⽴刻设置"}}翻译后的英⽂ json:{"login": {"login": "Sign in","loginLoading": "Logging in","account": "account number","password": "password","lang": "language","setAddress": "Set service address","more": "more"},"mDns": {"local": "LAN","localText": "Xymerp service in","useAddress": "Currently set address","addressUnAvailable": "Unable to connect to this server","setAddressTips": "Service address not set, set now"}}以上结果满⾜我的需求了,不满⾜你们需求的就稍微修改下吧。
Java中英翻译
abstract (关键字) 抽象['.bstr.kt]access vt.访问,存取['.kses]'(n.入口,使用权)algorithm n.算法['.lg.riem]Annotation [java]代码注释[.n.u'tei..n]anonymous adj.匿名的[.'n.nim.s]'(反义:directly adv.直接地,立即[di'rektli, dai'rektli])apply v.应用,适用[.'plai]application n.应用,应用程序[,.pli'kei..n]' (application crash 程序崩溃) arbitrary a.任意的['ɑ:bitr.ri]argument n.参数;争论,论据['ɑ:gjum.nt]'(缩写args)assert (关键字) 断言[.'s.:t] ' (java 1.4 之后成为关键字)associate n.关联(同伴,伙伴) [.'s.u.ieit]attribute n.属性(品质,特征) [.'tribju:t]boolean (关键字) 逻辑的, 布尔型call n.v.调用; 呼叫; [k.:l]circumstance n.事件(环境,状况) ['s.:k.mst.ns]crash n.崩溃,破碎[kr..]cohesion内聚,黏聚,结合[k.u'hi:..n](a class is designed with a single, well-focoused purpose. 应该不止这点) command n. 命令,指令[k.'mɑ:nd](指挥, 控制) (command-line 命令行)Comments [java]文本注释['k.ments]compile [java] v.编译[k.m'pail]' Compilation n.编辑[,k.mpi'lei..n] const (保留字)constant n. 常量, 常数, 恒量['k.nst.nt]continue (关键字)coupling耦合,联结['k.pli.]making sure that classes know about other classes only through their APIs. declare [java]声明[di'kl..]default (关键字) 默认值; 缺省值[di'f.:lt]delimiter定义符; 定界符Encapsulation[java]封装(hiding implementation details)Exception [java]例外; 异常[ik'sep..n]entry n.登录项, 输入项, 条目['entri]enum (关键字)execute vt.执行['eksikju:t]exhibit v.显示, 陈列[ig'zibit]exist存在, 发生[ig'zist] '(SQL关键字exists)extends (关键字) 继承、扩展[ik'stend]false (关键字)final (关键字) finally (关键字)fragments段落; 代码块['fr.gm.nt]FrameWork [java]结构,框架['freimw.:k]Generic [java]泛型[d.i'nerik]goto (保留字) 跳转heap n.堆[hi:p]implements (关键字) 实现['implim.nt]import (关键字) 引入(进口,输入)Info n.信息(information [,inf.'mei..n] )Inheritance [java]继承[in'herit.ns] (遗传,遗产)initialize预置初始化[i'iz]instanceof (关键字) 运算符,用于引用变量,以检查这个对象是否是某种类型。
JAVA英文单词翻译对照表!
●我喜欢「式」: (2)●我喜欢「件」:(这是个弹性非常大的可组合字) (2)●我喜欢「器」: (3)●我喜欢「别」: (3)●我喜欢「化」: (4)●我喜欢「型」: (4)●我喜欢「程」: (4)●英中繁简编程术语对照 (4)A (6)B (7)C (9)D (14)E (17)F (19)G (21)H (23)I (24)L (28)M, (29)N (32)O (33)P (34)Q (39)R (39)S (42)T (46)U (48)V (49)W (50)以下是各个"MENU ITEM" (52)●我喜欢「式」:constructor 建构式declaration 宣告式definition 定义式destructor 解构式expression 算式(运算式)function 函式pattern 范式、模式、样式program 程式signature 标记式(签名式/署名式)●我喜欢「件」:(这是个弹性非常大的可组合字)assembly (装)配件component 组件construct 构件control 控件event 事件hardware 硬件object 物件part 零件、部件singleton 单件software 软件work 工件、机件●我喜欢「器」:adapter 配接器allocator 配置器compiler 编译器container 容器iterator 迭代器linker 连结器listener 监听器interpreter 直译器translator 转译器/翻译器●我喜欢「别」:class 类别type 型别●我喜欢「化」:generalized 泛化specialized 特化overloaded 多载化(重载)●我喜欢「型」:polymorphism 多型genericity 泛型●我喜欢「程」:process 行程/进程(大陆用语)thread 绪程/线程(大陆用语)programming 编程●英中繁简编程术语对照英文繁体译词(有些是侯捷个人喜好,普及与否难说)大陆惯用术语-------------------------------------------------------------A--------------------------#define 定义预定义abstract 抽象的抽象的abstraction 抽象体、抽象物、抽象性抽象体、抽象物、抽象性access 存取、取用存取、访问access level 存取级别访问级别access function 存取函式访问函数activate 活化激活active 作用中的adapter 配接器适配器address 位址地址address space 位址空间,定址空间Aaddress-of operator 取址运算子取地址操作符aggregation 聚合algorithm 演算法算法allocate 配置分配allocator (空间)配置器分配器application 应用程式应用、应用程序application framework 应用程式框架、应用框架应用程序框架architecture 架构、系统架构体系结构argument 引数(传给函式的值)。
java毕业设计中英文翻译
java毕业设计中英文翻译篇一:JAVA外文文献+翻译Java and the InternetIf Java is, in fact, yet another computer programming language, you may question why it is so important and why it is being promoted as a revolutionary step in computer programming. The answer isn’t immediately obvious if you’re coming from a traditional programming perspective. Although Java is very useful for solving traditional stand-alone programming problems, it is also important because it will solve programming problems on the World Wide Web.1. Client-side programmingThe Web’s initial server-browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and display them. Basic HTML contains simple mechanisms for data gathering: text-entry boxes, check boxes, radio boxes, lists and drop-down lists, as well as a button that can only be programmed to reset the data on the form or “submit” the data on the form backto the server. This submission passes through the Common Gateway Interface (CGI) provided on all Web servers. The text within the submission tells CGI what to do with it. The most common action is to run a program located on the server in a directory that’s typically called “cgi-bin.” (If you watch the address window at the top of your browser when you push a button on a Web page, you can sometimes see “cgi-bin” within all the gobbledygook there.) These programs can be written in most languages. Perl is a common choice because it is designed for text manipulation and is interpreted, so it can be installed on any server regardless of processor or operating system. Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with it. However, Web sites built on CGI programs can rapidly become overly complicated to maintain, and there is also the problem of response time. The response of a CGI program depends on how much data mustbe sent, as well as the load on both the server and the Internet. (On top of this, starting a CGI program tends to be slow.) The initial designers of the Web didnot foresee how rapidly this bandwidth would be exhausted for the kinds of applications people developed. For example, any sort of dynamic graphing is nearly impossible to perform with consistency because a GIF file must be created and moved from the server to the client for each version of the graph. And you’ve no doubt had direct experience with something as simple as validating the data on an input form. You press the submit button on a page; the data is shipped back to the server; the server starts a CGI program that discovers an error, formats an HTML page informing you of the error, and then sends the page back to you; you must then back up a page and try again. Not only is this slow, it’s inelegant.The solution is client-side programming. Most machines that run Web browsers are powerful engines capable of doing vast work, and with the original static HTML approach they are sitting there, just idly waiting for the server to dish up the next page. Client-side programming means that the Web browser is harnessed to do whatever work it can, and the result for the user is a much speedier and more interactive experience atyour Web site.The problem with discussions of client-side programming is that they aren’t very different from discussions of programming in general. The parameters are almost the same, but the platform is different: a Web browser is like a limited operating system. In the end, you must still program, and this accounts for the dizzying array of problems and solutions produced by client-side programming. The rest of this section provides an overview of the issues and approaches in client-side programming.2.Plug-insOne of the most significant steps forward in client-side programming is the development of the plug-in. This is a way for a programmer to add new functionality to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser “from now on you can perform this new activity.” (You need to download the plug-in only once.) Some fast and powerful behavior is added to browsers via plug-ins, but writing a plug-in is not a trivial task, and isn’t something you’d wantto do as part of the process of building a particular site. The value of the plug-in for client-side programming is that it allows an expert programmer to develop a new language and add that language to a browser without the permission of the browser manufacturer. Thus, plug-ins provide a “back door”that allows the creation of new client-side programming languages (although not all languages are implemented as plug-ins).3.Scripting languagesPlug-ins resulted in an explosion of scripting languages. With a scripting language you embed the source code for your client-side program directly into the HTML page, and the plug-in that interprets that language is automatically activated while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply text that is part of an HTML page, they load very quickly as part of the single server hit required to procure that page. The trade-off is that your code is exposed for everyone to see (and steal). Generally, however, you aren’t doing amazingly sophisticatedthings with scripting languages so this is not too much of a hardship.This points out that the scripting languages used inside Web browsers are really intended to solve specific types of problems, primarily the creation of richer and more interactive graphical user interfaces (GUIs). However, a scripting language might solve 80 percent of the problems encountered in client-side programming. Your problems might very well fit completely within that 80 percent, and since scripting languages can allow easier and faster development, you should probably consider a scripting language before looking at a more involved solution such as Java or ActiveX programming.The most commonly discussed browser scripting languages are JavaScript (which has nothing to do with Java; it’s named that way just to grab some of Java’s marketing momentum), VBScript (which looks like Visual Basic), andTcl/Tk, which comes from the popular cross-platform GUI-building language. There are others out there, and no doubt more in development.JavaScript is probably the most commonly supported. It comes built into both Netscape Navigator and the Microsoft Internet Explorer (IE). In addition, there are probably more JavaScript books available than there are for the other browser languages, and some tools automatically create pages using JavaScript. However, if you’re already fluent in Visual Basic or Tcl/Tk, you’ll be more productive using those scripting languages rather than learning a new one. (You’ll have your hands full dealing with the Web issues already.)4.JavaIf a scripting language can solve 80 percent of the client-side programming problems, what about the other 20 percent—the “really hard stuff?” The most popular solution today is Java. Not only is it a powerful programming language built to be secure, cross-platform, and international, but Java is being continually extended to provide language features and libraries that elegantly handle problems that are difficult in traditional programming languages, such as multithreading, database access, network programming, and distributed computing. Java allowsclient-side programming via the applet.An applet is a mini-program that will run only under a Web browser. The applet is downloaded automatically as part of a Web page (just as, for example, a graphic is automatically downloaded). When the applet is activated it executes a program. This is part of its beauty—it provides you with a way to automatically distribute the client software from the server at the time the user needs the client software, and no sooner. The user gets the latest version of the client software without fail and without difficult reinstallation. Because of the way Java is designed, the programmer needs to create only a single program, and that program automatically works with all computers that have browsers with built-in Java interpreters. (This safely includes the vast majority of machines.) Since Java is a full-fledged programming language, you can do as much work as possible on the client before and after making requests of theserver. For example, you won’t need to send a request form across the Internet to discover that you’ve gotten a date or some other parameter wrong, and yourclient computer can quickly do the work of plotting data instead of waiting for the server to make a plot and ship a graphic image back to you. Not only do you get the immediate win of speed and responsiveness, but the general network traffic and load on servers can be reduced, preventing the entire Internet from slowing down.One advantage a Java applet has over a scripted program is that it’s in compiled form, so the source code isn’t available to the client. On the other hand, a Java applet can be decompiled without too much trouble, but hiding your code is often not an important issue. Two other factors can be important. As you will see later in this book, a compiled Java applet can comprise many modules and take multiple server “hits” (accesses) to download. (In Java 1.1 and higher this is minimized by Java archives, called JAR files, that allow all the required modules to be packaged together and compressed for a single download.) A scripted program will just be integrated into the Web page as part of its text (and will generally be smaller and reduce server hits). This could be important to the responsiveness of your Website. Another factor is the all-important learning curve. Regardless of what you’ve heard, Java is not a trivial language to learn. If you’re a Visual Basic programmer, moving to VBScript will be your fastest solution, and since it will probably solve most typical client/server problems you might be hard pressed to justify learning Java. If you’re experienced with a scripting language you will certainly benefit from looking at JavaScript or VBScript before committing to Java, since they might fit your needs handily and you’ll be more productive sooner.to run its applets withi5.ActiveXTo some degree, the competitor to Java is Microsoft’s ActiveX, although it takes a completely different approach. ActiveX was originally a Windows-only solution, although it is now being developed via an independent consortium to become cross-platform. Effectively, ActiveX says “if your program connects to篇二:JAVA思想外文翻译毕业设计文献来源:Bruce Eckel. Thinking in Java [J]. Pearson Higher Isia Education,XX-2-20.Java编程思想 (Java和因特网)既然Java不过另一种类型的程序设计语言,大家可能会奇怪它为什么值得如此重视,为什么还有这么多的人认为它是计算机程序设计的一个里程碑呢?如果您来自一个传统的程序设计背景,那么答案在刚开始的时候并不是很明显。
计算机java外文翻译外文文献英文文献
英文原文:Title: Business Applications of Java. Author: Erbschloe, Michael, Business Applications of Java -- Research Starters Business, 2008DataBase: Research Starters - BusinessBusiness Applications of JavaThis article examines the growing use of Java technology in business applications. The history of Java is briefly reviewed along with the impact of open standards on the growth of the World Wide Web. Key components and concepts of the Java programming language are explained including the Java Virtual Machine. Examples of how Java is being used bye-commerce leaders is provided along with an explanation of how Java is used to develop data warehousing, data mining, and industrial automation applications. The concept of metadata modeling and the use of Extendable Markup Language (XML) are also explained.Keywords Application Programming Interfaces (API's); Enterprise JavaBeans (EJB); Extendable Markup Language (XML); HyperText Markup Language (HTML); HyperText Transfer Protocol (HTTP); Java Authentication and Authorization Service (JAAS); Java Cryptography Architecture (JCA); Java Cryptography Extension (JCE); Java Programming Language; Java Virtual Machine (JVM); Java2 Platform, Enterprise Edition (J2EE); Metadata Business Information Systems > Business Applications of JavaOverviewOpen standards have driven the e-business revolution. Networking protocol standards, such as Transmission Control Protocol/Internet Protocol (TCP/IP), HyperText Transfer Protocol (HTTP), and the HyperText Markup Language (HTML) Web standards have enabled universal communication via the Internet and the World Wide Web. As e-business continues to develop, various computing technologies help to drive its evolution.The Java programming language and platform have emerged as major technologies for performing e-business functions. Java programming standards have enabled portability of applications and the reuse of application components across computing platforms. Sun Microsystems' Java Community Process continues to be a strong base for the growth of the Java infrastructure and language standards. This growth of open standards creates new opportunities for designers and developers of applications and services (Smith, 2001).Creation of Java TechnologyJava technology was created as a computer programming tool in a small, secret effort called "the Green Project" at Sun Microsystems in 1991. The Green Team, fully staffed at 13 people and led by James Gosling, locked themselves away in an anonymous office on Sand Hill Road in Menlo Park, cut off from all regular communications with Sun, and worked around the clock for18 months. Their initial conclusion was that at least one significant trend would be the convergence of digitally controlled consumer devices and computers. A device-independent programming language code-named "Oak" was the result.To demonstrate how this new language could power the future of digital devices, the Green Team developed an interactive, handheld home-entertainment device controller targeted at the digital cable television industry. But the idea was too far ahead of its time, and the digital cable television industry wasn't ready for the leap forward that Java technology offered them. As it turns out, the Internet was ready for Java technology, and just in time for its initial public introduction in 1995, the team was able to announce that the Netscape Navigator Internet browser would incorporate Java technology ("Learn about Java," 2007).Applications of JavaJava uses many familiar programming concepts and constructs and allows portability by providing a common interface through an external Java Virtual Machine (JVM). A virtual machine is a self-contained operating environment, created by a software layer that behaves as if it were a separate computer. Benefits of creating virtual machines include better exploitation of powerful computing resources and isolation of applications to prevent cross-corruption and improve security (Matlis, 2006).The JVM allows computing devices with limited processors or memory to handle more advanced applications by calling up software instructions inside the JVM to perform most of the work. This also reduces the size and complexity of Java applications because many of the core functions and processing instructions were built into the JVM. As a result, software developersno longer need to re-create the same application for every operating system. Java also provides security by instructing the application to interact with the virtual machine, which served as a barrier between applications and the core system, effectively protecting systems from malicious code.Among other things, Java is tailor-made for the growing Internet because it makes it easy to develop new, dynamic applications that could make the most of the Internet's power and capabilities. Java is now an open standard, meaning that no single entity controls its development and the tools for writing programs in the language are available to everyone. The power of open standards like Java is the ability to break down barriers and speed up progress.Today, you can find Java technology in networks and devices that range from the Internet and scientific supercomputers to laptops and cell phones, from Wall Street market simulators to home game players and credit cards. There are over 3 million Java developers and now there are several versions of the code. Most large corporations have in-house Java developers. In addition, the majority of key software vendors use Java in their commercial applications (Lazaridis, 2003).ApplicationsJava on the World Wide WebJava has found a place on some of the most popular websites in the world and the uses of Java continues to grow. Java applications not only provide unique user interfaces, they also help to power the backend of websites. Two e-commerce giants that everybody is probably familiar with (eBay and Amazon) have been Java pioneers on the World Wide Web.eBayFounded in 1995, eBay enables e-commerce on a local, national and international basis with an array of Web sites-including the eBay marketplaces, PayPal, Skype, and -that bring together millions of buyers and sellers every day. You can find it on eBay, even if you didn't know it existed. On a typical day, more than 100 million items are listed on eBay in tens of thousands of categories. Recent listings have included a tunnel boring machine from the Chunnel project, a cup of water that once belonged to Elvis, and the Volkswagen that Pope Benedict XVI owned before he moved up to the Popemobile. More than one hundred million items are available at any given time, from the massive to the miniature, the magical to the mundane, on eBay; the world's largest online marketplace.eBay uses Java almost everywhere. To address some security issues, eBay chose Sun Microsystems' Java System Identity Manager as the platform for revamping its identity management system. The task at hand was to provide identity management for more than 12,000 eBay employees and contractors.Now more than a thousand eBay software developers work daily with Java applications. Java's inherent portability allows eBay to move to new hardware to take advantage of new technology, packaging, or pricing, without having to rewrite Java code ("eBay drives explosive growth," 2007).Amazon (a large seller of books, CDs, and other products) has created a Web Service application that enables users to browse their product catalog and place orders. uses a Java application that searches the Amazon catalog for books whose subject matches a user-selected topic. The application displays ten books that match the chosen topic, and shows the author name, book title, list price, Amazon discount price, and the cover icon. The user may optionally view one review per displayed title and make a buying decision (Stearns & Garishakurthi, 2003).Java in Data Warehousing & MiningAlthough many companies currently benefit from data warehousing to support corporate decision making, new business intelligence approaches continue to emerge that can be powered by Java technology. Applications such as data warehousing, data mining, Enterprise Information Portals (EIP's), and Knowledge Management Systems (which can all comprise a businessintelligence application) are able to provide insight into customer retention, purchasing patterns, and even future buying behavior.These applications can not only tell what has happened but why and what may happen given certain business conditions; allowing for "what if" scenarios to be explored. As a result of this information growth, people at all levels inside the enterprise, as well as suppliers, customers, and others in the value chain, are clamoring for subsets of the vast stores of information such as billing, shipping, and inventory information, to help them make business decisions. While collecting and storing vast amounts of data is one thing, utilizing and deploying that data throughout the organization is another.The technical challenges inherent in integrating disparate data formats, platforms, and applications are significant. However, emerging standards such as the Application Programming Interfaces (API's) that comprise the Java platform, as well as Extendable Markup Language (XML) technologies can facilitate the interchange of data and the development of next generation data warehousing and business intelligence applications. While Java technology has been used extensively for client side access and to presentation layer challenges, it is rapidly emerging as a significant tool for developing scaleable server side programs. The Java2 Platform, Enterprise Edition (J2EE) provides the object, transaction, and security support for building such systems.Metadata IssuesOne of the key issues that business intelligence developers must solve is that of incompatible metadata formats. Metadata can be defined as information about data or simply "data about data." In practice, metadata is what most tools, databases, applications, and other information processes use to define, relate, and manipulate data objects within their own environments. It defines the structure and meaning of data objects managed by an application so that the application knows how to process requests or jobs involving those data objects. Developers can use this schema to create views for users. Also, users can browse the schema to better understand the structure and function of the database tables before launching a query.To address the metadata issue, a group of companies (including Unisys, Oracle, IBM, SAS Institute, Hyperion, Inline Software and Sun) have joined to develop the Java Metadata Interface (JMI) API. The JMI API permits the access and manipulation of metadata in Java with standard metadata services. JMI is based on the Meta Object Facility (MOF) specification from the Object Management Group (OMG). The MOF provides a model and a set of interfaces for the creation, storage, access, and interchange of metadata and metamodels (higher-level abstractions of metadata). Metamodel and metadata interchange is done via XML and uses the XML Metadata Interchange (XMI) specification, also from the OMG. JMI leverages Java technology to create an end-to-end data warehousing and business intelligence solutions framework.Enterprise JavaBeansA key tool provided by J2EE is Enterprise JavaBeans (EJB), an architecture for the development of component-based distributed business applications. Applications written using the EJB architecture are scalable, transactional, secure, and multi-user aware. These applications may be written once and then deployed on any server platform that supports J2EE. The EJB architecture makes it easy for developers to write components, since they do not need to understand or deal with complex, system-level details such as thread management, resource pooling, and transaction and security management. This allows for role-based development where component assemblers, platform providers and application assemblers can focus on their area of responsibility further simplifying application development.EJB's in the Travel IndustryA case study from the travel industry helps to illustrate how such applications could function. A travel company amasses a great deal of information about its operations in various applications distributed throughout multiple departments. Flight, hotel, and automobile reservation information is located in a database being accessed by travel agents worldwide. Another application contains information that must be updated with credit and billing historyfrom a financial services company. Data is periodically extracted from the travel reservation system databases to spreadsheets for use in future sales and marketing analysis.Utilizing J2EE, the company could consolidate application development within an EJB container, which can run on a variety of hardware and software platforms allowing existing databases and applications to coexist with newly developed ones. EJBs can be developed to model various data sets important to the travel reservation business including information about customer, hotel, car rental agency, and other attributes.Data Storage & AccessData stored in existing applications can be accessed with specialized connectors. Integration and interoperability of these data sources is further enabled by the metadata repository that contains metamodels of the data contained in the sources, which then can be accessed and interchanged uniformly via the JMI API. These metamodels capture the essential structure and semantics of business components, allowing them to be accessed and queried via the JMI API or to be interchanged via XML. Through all of these processes, the J2EE infrastructure ensures the security and integrity of the data through transaction management and propagation and the underlying security architecture.To consolidate historical information for analysis of sales and marketing trends, a data warehouse is often the best solution. In this example, data can be extracted from the operational systems with a variety of Extract, Transform and Load tools (ETL). The metamodels allow EJBsdesigned for filtering, transformation, and consolidation of data to operate uniformly on datafrom diverse data sources as the bean is able to query the metamodel to identify and extract the pertinent fields. Queries and reports can be run against the data warehouse that contains information from numerous sources in a consistent, enterprise-wide fashion through the use of the JMI API (Mosher & Oh, 2007).Java in Industrial SettingsMany people know Java only as a tool on the World Wide Web that enables sites to perform some of their fancier functions such as interactivity and animation. However, the actual uses for Java are much more widespread. Since Java is an object-oriented language like C++, the time needed for application development is minimal. Java also encourages good software engineering practices with clear separation of interfaces and implementations as well as easy exception handling.In addition, Java's automatic memory management and lack of pointers remove some leading causes of programming errors. Most importantly, application developers do not need to create different versions of the software for different platforms. The advantages available through Java have even found their way into hardware. The emerging new Java devices are streamlined systems that exploit network servers for much of their processing power, storage, content, and administration.Benefits of JavaThe benefits of Java translate across many industries, and some are specific to the control and automation environment. For example, many plant-floor applications use relatively simple equipment; upgrading to PCs would be expensive and undesirable. Java's ability to run on any platform enables the organization to make use of the existing equipment while enhancing the application.IntegrationWith few exceptions, applications running on the factory floor were never intended to exchange information with systems in the executive office, but managers have recently discovered the need for that type of information. Before Java, that often meant bringing together data from systems written on different platforms in different languages at different times. Integration was usually done on a piecemeal basis, resulting in a system that, once it worked, was unique to the two applications it was tying together. Additional integration required developing a brand new system from scratch, raising the cost of integration.Java makes system integration relatively easy. Foxboro Controls Inc., for example, used Java to make its dynamic-performance-monitor software package Internet-ready. This software provides senior executives with strategic information about a plant's operation. The dynamic performance monitor takes data from instruments throughout the plant and performs variousmathematical and statistical calculations on them, resulting in information (usually financial) that a manager can more readily absorb and use.ScalabilityAnother benefit of Java in the industrial environment is its scalability. In a plant, embedded applications such as automated data collection and machine diagnostics provide critical data regarding production-line readiness or operation efficiency. These data form a critical ingredient for applications that examine the health of a production line or run. Users of these devices can take advantage of the benefits of Java without changing or upgrading hardware. For example, operations and maintenance personnel could carry a handheld, wireless, embedded-Java device anywhere in the plant to monitor production status or problems.Even when internal compatibility is not an issue, companies often face difficulties when suppliers with whom they share information have incompatible systems. This becomes more of a problem as supply-chain management takes on a more critical role which requires manufacturers to interact more with offshore suppliers and clients. The greatest efficiency comes when all systems can communicate with each other and share information seamlessly. Since Java is so ubiquitous, it often solves these problems (Paula, 1997).Dynamic Web Page DevelopmentJava has been used by both large and small organizations for a wide variety of applications beyond consumer oriented websites. Sandia, a multiprogram laboratory of the U.S. Department of Energy's National Nuclear Security Administration, has developed a unique Java application. The lab was tasked with developing an enterprise-wide inventory tracking and equipment maintenance system that provides dynamic Web pages. The developers selected Java Studio Enterprise 7 for the project because of its Application Framework technology and Web Graphical User Interface (GUI) components, which allow the system to be indexed by an expandable catalog. The flexibility, scalability, and portability of Java helped to reduce development timeand costs (Garcia, 2004)IssueJava Security for E-Business ApplicationsTo support the expansion of their computing boundaries, businesses have deployed Web application servers (WAS). A WAS differs from a traditional Web server because it provides a more flexible foundation for dynamic transactions and objects, partly through the exploitation of Java technology. Traditional Web servers remain constrained to servicing standard HTTP requests, returning the contents of static HTML pages and images or the output from executed Common Gateway Interface (CGI ) scripts.An administrator can configure a WAS with policies based on security specifications for Java servlets and manage authentication and authorization with Java Authentication andAuthorization Service (JAAS) modules. An authentication and authorization service can bewritten in Java code or interface to an existing authentication or authorization infrastructure. Fora cryptography-based security infrastructure, the security server may exploit the Java Cryptography Architecture (JCA) and Java Cryptography Extension (JCE). To present the user with a usable interaction with the WAS environment, the Web server can readily employ a formof "single sign-on" to avoid redundant authentication requests. A single sign-on preserves user authentication across multiple HTTP requests so that the user is not prompted many times for authentication data (i.e., user ID and password).Based on the security policies, JAAS can be employed to handle the authentication process with the identity of the Java client. After successful authentication, the WAS securitycollaborator consults with the security server. The WAS environment authentication requirements can be fairly complex. In a given deployment environment, all applications or solutions may not originate from the same vendor. In addition, these applications may be running on different operating systems. Although Java is often the language of choice for portability between platforms, it needs to marry its security features with those of the containing environment.Authentication & AuthorizationAuthentication and authorization are key elements in any secure information handling system. Since the inception of Java technology, much of the authentication and authorization issues have been with respect to downloadable code running in Web browsers. In many ways, this had been the correct set of issues to address, since the client's system needs to be protected from mobile code obtained from arbitrary sites on the Internet. As Java technology moved from a client-centric Web technology to a server-side scripting and integration technology, it required additional authentication and authorization technologies.The kind of proof required for authentication may depend on the security requirements of a particular computing resource or specific enterprise security policies. To provide such flexibility, the JAAS authentication framework is based on the concept of configurable authenticators. This architecture allows system administrators to configure, or plug in, the appropriate authenticatorsto meet the security requirements of the deployed application. The JAAS architecture also allows applications to remain independent from underlying authentication mechanisms. So, as new authenticators become available or as current authentication services are updated, system administrators can easily replace authenticators without having to modify or recompile existing applications.At the end of a successful authentication, a request is associated with a user in the WAS user registry. After a successful authentication, the WAS consults security policies to determine if the user has the required permissions to complete the requested action on the servlet. This policy canbe enforced using the WAS configuration (declarative security) or by the servlet itself (programmatic security), or a combination of both.The WAS environment pulls together many different technologies to service the enterprise. Because of the heterogeneous nature of the client and server entities, Java technology is a good choice for both administrators and developers. However, to service the diverse security needs of these entities and their tasks, many Java security technologies must be used, not only at a primary level between client and server entities, but also at a secondary level, from served objects. By using a synergistic mix of the various Java security technologies, administrators and developers can make not only their Web application servers secure, but their WAS environments secure as well (Koved, 2001).ConclusionOpen standards have driven the e-business revolution. As e-business continues to develop, various computing technologies help to drive its evolution. The Java programming language and platform have emerged as major technologies for performing e-business functions. Java programming standards have enabled portability of applications and the reuse of application components. Java uses many familiar concepts and constructs and allows portability by providing a common interface through an external Java Virtual Machine (JVM). Today, you can find Java technology in networks and devices that range from the Internet and scientific supercomputers to laptops and cell phones, from Wall Street market simulators to home game players and credit cards.Java has found a place on some of the most popular websites in the world. Java applications not only provide unique user interfaces, they also help to power the backend of websites. While Java technology has been used extensively for client side access and in the presentation layer, it is also emerging as a significant tool for developing scaleable server side programs.Since Java is an object-oriented language like C++, the time needed for application development is minimal. Java also encourages good software engineering practices with clear separation of interfaces and implementations as well as easy exception handling. Java's automatic memory management and lack of pointers remove some leading causes of programming errors. The advantages available through Java have also found their way into hardware. The emerging new Java devices are streamlined systems that exploit network servers for much of their processing power, storage, content, and administration.中文翻译:标题:Java的商业应用。
课程名称英文翻译
课程名称英文翻译自然辩证法natural dialectics英语english language数理统计numeral statistic/numerical statistic人工智能及其体系结构artificial intelligence & its architecture高级数理逻辑advanced numerical logic高级程序设计语言的设计与实现advanced programming language s de sign & implementation软件工程基础foundation of software engineering专业英语specialized english计算机网络computer network高级计算机体系结构advanced computer architectureibm汇编及高级语言的接口ibm assembly & its interfaces with advanc ed programming languages分布式计算机系统distributed computer system / distributed system计算机网络实验computer network experiment高等代数elementary algebra数学分析mathematical analysis中共党史history of the chinese communist party算法语言algorithmic language体育physical education英语english language力学实验mechanics-practical德育moral educationpascal语言pascal language政治经济学political economics电学实验electrical experiment数字逻辑mathematical logic普通物理general physics计算方法computing method离散数学discrete mathematics汇编原理principles of assembly概率与统计probability & statistics数据结构data structure哲学philosophy微机原理principles of microcomputer编译方法compilation method系统结构system structure操作系统原理principles of operating system 文献检索documentation retrieval数据库概论introduction to database网络原理principles of network人工智能artificial intelligence算法分析algorithm analysis毕业论文graduation thesisadvanced computational fluid dynamics 高等计算流体力学advanced mathematics 高等数学advanced numerical analysis 高等数值分析algorithmic language 算法语言analogical electronics 模拟电子电路artificial intelligence programming 人工智能程序设计audit 审计学automatic control system 自动控制系统automatic control theory 自动控制理论auto-measurement technique 自动检测技术basis of software technique 软件技术基础calculus 微积分catalysis principles 催化原理chemical engineering document retrieval 化工文献检索circuitry 电子线路college english 大学英语college english test (band 4) cet-4college english test (band 6) cet-6college physics 大学物理communication fundamentals 通信原理comparative economics 比较经济学complex analysis 复变函数论computational method 计算方法computer graphics 图形学原理computer organization 计算机组成原理computer architecture 计算机系统结构computer interface technology 计算机接口技术contract law 合同法cost accounting 成本会计circuit measurement technology 电路测试技术database principles 数据库原理design & analysis system 系统分析与设计developmental economics 发展经济学discrete mathematics 离散数学digital electronics 数字电子电路digital image processing 数字图像处理digital signal processing 数字信号处理econometrics 经济计量学economical efficiency analysis for chemical technology 化工技术经济分析economy of capitalism 资本主义经济electromagnetic fields & magnetic waves 电磁场与电磁波electrical engineering practice 电工实习enterprise accounting 企业会计学equations of mathematical physics 数理方程experiment of college physics 物理实验experiment of microcomputer 微机实验experiment in electronic circuitry 电子线路实验fiber optical communication system 光纤通讯系统finance 财政学financial accounting 财务会计fine arts 美术functions of a complex variable 单复变函数functions of complex variables 复变函数functions of complex variables & integral transformations 复变函数与积分变换fundamentals of law 法律基础fuzzy mathematics 模糊数学general physics 普通物理graduation project(thesis) 毕业设计(论文)graph theory 图论heat transfer theory 传热学history of chinese revolution 中国革命史industrial economics 工业经济学information searches 情报检索integral transformation 积分变换intelligent robot(s); intelligence robot 智能机器人international business administration 国际企业管理international clearance 国际结算international finance 国际金融international relation 国际关系international trade 国际贸易introduction to chinese tradition 中国传统文化introduction to modern science & technology 当代科技概论introduction to reliability technology 可靠性技术导论java language programming java 程序设计lab of general physics 普通物理实验linear algebra 线性代数management accounting 管理会计学management information system 管理信息系统mechanic design 机械设计mechanical graphing 机械制图merchandise advertisement 商品广告学metalworking practice 金工实习microcomputer control technology 微机控制技术microeconomics & macroeconomics 西方经济学microwave technique 微波技术military theory 军事理论modern communication system 现代通信系统modern enterprise system 现代企业制度monetary banking 货币银行学motor elements and power supply 电机电器与供电moving communication 移动通讯music 音乐network technology 网络技术numeric calculation 数值计算oil application and addition agent 油品应用及添加剂operation & control of national economy 国民经济运行与调控operational research 运筹学optimum control 最优控制petroleum chemistry 石油化学petroleum engineering technique 石油化工工艺学philosophy 哲学physical education 体育political economics 政治经济学principle of compiling 编译原理primary circuit (反应堆)一回路principle of communication 通讯原理principle of marxism 马克思主义原理principle of mechanics 机械原理principle of microcomputer 微机原理principle of sensing device 传感器原理principle of single chip computer 单片机原理principles of management 管理学原理probability theory & stochastic process 概率论与随机过程procedure control 过程控制programming with pascal language pascal语言编程programming with c language c语言编程property evaluation 工业资产评估public relation 公共关系学pulse & numerical circuitry 脉冲与数字电路refinery heat transfer equipment 炼厂传热设备satellite communications 卫星通信semiconductor converting technology 半导体变流技术set theory 集合论signal & linear system 信号与线性系统social research 社会调查software engineering 软件工程spc exchange fundamentals 程控交换原理specialty english 专业英语statistics 统计学stock investment 证券投资学strategic management for industrial enterprises 工业企业战略管理technological economics 技术经济学television operation 电视原理theory of circuitry 电路理论turbulent flow simulation and application 湍流模拟及其应用visual c++ programming visual c++程序设计windows nt operating system principles windows nt操作系统原理word processing 数据处理上文已完。
java 将中文语句转为英语语句的方法
java 将中文语句转为英语语句的方法随着全球化的发展,越来越多的人需要将中文语句翻译成英语语句。
在这个背景下,Java语言作为一种广泛应用于各个领域的编程语言,为中英文翻译提供了便利。
本文将详细介绍如何使用Java将中文语句转为英语语句,并提供一些实践中的技巧和建议。
首先,我们要明确将中文语句翻译成英语语句的必要性。
英语作为世界上最通用的语言,在国际交流中扮演着举足轻重的角色。
将中文语句翻译成英语,不仅可以扩大受众范围,提高信息传播的效率,还能促进跨文化交流,加深各国人民之间的友谊。
接下来,我们来分析Java语言在翻译中的应用。
Java拥有丰富的库和框架,可以方便地进行各种语言的处理和翻译。
在Java中,有专门的库负责处理字符串和文本,如Apache Commons Lang库中的StringEscapeUtils类。
通过使用这些库,我们可以轻松地将中文语句转换为英语语句。
具体来说,使用Java进行中英文翻译的方法如下:1.导入相关库:首先,我们需要导入相应的库,如Apache Commons Lang库。
```javaimport ng3.StringEscapeUtils;```2.编码和解码:在翻译过程中,我们需要确保中英文之间的编码和解码正确。
可以使用Java的`InputStreamReader`和`OutputStreamWriter`类进行编码和解码。
```javaInputStreamReader inputReader = new InputStreamReader(new FileInputStream("chinese.txt"), "UTF-8");OutputStreamWriter outputWriter = new OutputStreamWriter(new FileOutputStream("english.txt"), "UTF-8");```3.中文语句转换为英语语句:使用StringEscapeUtils类的`escape()`方法将中文语句中的特殊字符进行转义,然后将转义后的字符串进行英文翻译。
Java技术介绍-毕业论文外文翻译
Java Technical DescriptionJava as a Programming Platform.Java is certainly a good programming language. There is no doubt that it is one of the better languages available to serious programmers. We think it could potentially have been a great programming language, but it is probably too late for that. Once a language is out in the field, the ugly reality of compatibility with existing code sets in."Java was never just a language. There are lots of programming languages out there, and few of them make much of a splash. Java is a whole platform, with a huge library, containing lots of reusable code, and an execution environment that provides services such as security, portability across operating systems, and automatic garbage collection.As a programmer, you will want a language with a pleasant syntax and comprehensible semantics (i.e., not C++). Java fits the bill, as do dozens of other fine languages. Some languages give you portability, garbage collection, and the like, but they don't have much of a library, forcing you to roll your own if you want fancy graphics or networking or database access. Well, Java has everything—a good language, a high-quality execution environment, and a vast library. That combination is what makes Java an irresistible proposition to so many programmers.Features of Java.1.SimpleWe wanted to build a system that could be programmed easily without a lot of esoteric training and which leveraged today's standard practice. So even though we found that C++ was unsuitable, we designed Java as closely to C++ as possible in order to make the system more comprehensible. Java omits many rarely used, poorly understood, confusing features of C++ that, in our experience, bring more grief than benefit.The syntax for Java is, indeed, a cleaned-up version of the syntax for C++. There is no need for header files, pointer arithmetic (or even a pointer syntax), structures, unions, operator overloading, virtual base classes, and so on. (See the C++ notes interspersed throughout the text for more on the differences between Java and C++.) The designers did not, however, attempt to fix all of the clumsy features of C++. For example, the syntax of the switch statement is unchanged in Java. If you know C++, you will find the transition to the Java syntax easy.If you are used to a visual programming environment (such as Visual Basic), you will not find Java simple. There is much strange syntax (though it does not take long to get the hang of it). More important, you must do a lot more programming in Java. The beauty of Visual Basic is that its visual design environment almost automatically provides a lot of the infrastructure for an application. The equivalent functionality must be programmed manually, usually with a fair bit of code, in Java. There are, however, third-party development environments that provide "drag-and-drop"-style program development.Another aspect of being simple is being small. One of the goals of Java is to enable the construction of software that can run stand-alone in small machines. The size of the basic interpreter and class support is about 40K bytes; adding the basic standard libraries and thread support (essentially a self-contained microkernel) adds an additional 175K.2. Object OrientedSimply stated, object-oriented design is a technique for programming that focuses on the data (= objects) and on the interfaces to that object. To make an analogy with carpentry, an "object-oriented" carpenter would be mostly concerned with the chair he was building, and secondarily with the tools used to make it; a "non-object-oriented" carpenter would think primarily of his tools. The object-oriented facilities of Java are essentially those of C++.Object orientation has proven its worth in the last 30 years, and it is inconceivable that a modern programming language would not use it. Indeed, the object-oriented features of Java are comparable to those of C++. The major differencebetween Java and C++ lies in multiple inheritance, which Java has replaced with the simpler concept of interfaces, and in the Java metaclass model. The reflection mechanism and object serialization feature make it much easier to implement persistent objects and GUI builders that can integrate off-the-shelf components.3. DistributedJava has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP. Java applications can open and access objects across the Net via URLs with the same ease as when accessing a local file system. We have found the networking capabilities of Java to be both strong and easy to use. Anyone who has tried to do Internet programming using another language will revel in how simple Java makes onerous tasks like opening a socket connection. (We cover networking in Volume 2 of this book.) The remote method invocation mechanism enables communication between distributedobjects (also covered in Volume 2).There is now a separate architecture, the Java 2 Enterprise Edition (J2EE), that supports very large scale distributed applications.4. RobustJava is intended for writing programs that must be reliable in a variety of ways. Java puts a lot of emphasis on early checking for possible problems, later dynamic (run-time) checking, and eliminating situations that are error-prone.… The single biggest difference between Java and C/C++ is that Java has a pointer model that eliminates the possibility of overwriting memory and corrupting data.This feature is also very useful. The Java compiler detects many problems that, in other languages, would show up only at run time. As for the second point, anyone who has spent hours chasing memory corruption caused by a pointer bug will be very happy with this feature of Java.If you are coming from a language like Visual Basic that doesn't explicitly use pointers, you are probably wondering why this is so important. C programmers are not so lucky. They need pointers to access strings, arrays, objects, and even files. In Visual Basic, you do not use pointers for any of these entities, nor do you need to worry about memory allocation for them. On the other hand, many data structures aredifficult to implement in a pointerless language. Java gives you the best of both worlds. You do not need pointers for everyday constructs like strings and arrays. You have the power of pointers if you need it, for example, for linked lists. And you always have complete safety, because you can never access a bad pointer, make memory allocation errors, or have to protect against memory leaking away.5. SecureJava is intended to be used in networked/distributed environments. Toward that end, a lot of emphasis has been placed on security. Java enables the construction of virus-free, tamper-free systems.In the first edition of Core Java we said: "Well, one should 'never say never again,'" and we turned out to be right. Not long after the first version of the Java Development Kit was shipped, a group of security experts at Princeton University found subtle bugs in the security features of Java 1.0. Sun Microsystems has encouraged research into Java security, making publicly available the specification and implementation of the virtual machine and the security libraries. They have fixed all known security bugs quickly. In any case, Java makes it extremely difficult to outwit its security mechanisms. The bugs found so far have been very technical and few in number. From the beginning, Java was designed to make certain kinds of attacks impossible, among them:∙Overrunning the runtime stack—a common attack of worms and viruses Corrupting memory outside its own process space Reading or writing files without permission.∙A number of security features have been added to Java over time. Since version1.1, Java has the notion of digitally signed classesWith a signed class, you can be sure who wrote it. Any time you trust the author of the class, the class can be allowed more privileges on your machine.6. Architecture NeutralThe compiler generates an architecture-neutral object file format—the compiled code is executable on many processors, given the presence of the Java runtime system.The Java compiler does this by generating bytecode instructions which have nothing to do with a particular computerarchitecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly.This is not a new idea. More than 20 years ago, both Niklaus Wirth's original implementation of Pascal and the UCSD Pascal system used the same technique. Of course, interpreting bytecodes is necessarily slower than running machine instructions at full speed, so it isn't clear that this is even a good idea. However, virtual machines have the option of translating the most frequently executed bytecode sequences into machine code, a process called just-in-time compilation. This strategy has proven so effective that even Microsoft's .NET platform relies on a virtual machine.The virtual machine has other advantages. It increases security because the virtual machine can check the behavior of instruction sequences. Some programs even produce bytecodes on the fly, dynamically enhancing the capabilities of a running program.7. PortableUnlike C and C++, there are no "implementation-dependent" aspects of the specification. The sizes of the primitive data types are specified, as is the behavior of arithmetic on them.For example, an int in Java is always a 32-bit integer. In C/C++, int can mean a 16-bit integer, a 32-bit integer, or any other size that the compiler vendor likes. The only restriction is that the int type must have at least as many bytes as a short int and cannot have more bytes than a long int. Having a fixed size for number types eliminates a major porting headache. Binary data is stored and transmitted in a fixed format, eliminating confusion about byte ordering. Strings are saved in a standard Unicode format.The libraries that are a part of the system define portable interfaces. For example, there is an abstract Window class and implementations of it for UNIX, Windows, and the Macintosh.As anyone who has ever tried knows, it is an effort of heroic proportions to write a program that looks good on Windows, the Macintosh, and 10 flavors of UNIX. Java1.0 made the heroic effort, delivering a simple toolkit that mapped common user interface elements to a number of platforms.Unfortunately, the result was a library that, with a lot of work, could give barely acceptable results on different systems. (And there were often different bugs on the different platform graphics implementations.) But it was a start. There are many applications in which portability is more important than user interface slickness, and these applications did benefit from early versions of Java. By now, the user interface toolkit has been completely rewritten so that it no longer relies on the host user interface. The result is far more consistent and, we think, more attractive than in earlier versions of Java.8. InterpretedThe Java interpreter can execute Java bytecodes directly on any machine to which the interpreter has been ported. Since linking is a more incremental and lightweight process, the development process can be much more rapid and exploratory.Incremental linking has advantages, but its benefit for the development process is clearly overstated. In any case, we have found Java development tools to be quite slow. If you are used to the speed of the classic Microsoft Visual C++ environment, you will likely be disappointed with the performance of Java development environments. (The current version of Visual Studio isn't as zippy as the classic environments, however. No matter what languageyou program in, you should definitely ask your boss for a faster computer to run the latest development environments. )9. High PerformanceWhile the performance of interpreted bytecodes is usually more than adequate, there are situations where higher performance is required. The bytecodes can be translated on the fly (at run time) into machine code for the particular CPU the application is running on.If you use an interpreter to execute the bytecodes, "high performance" is not the term that we would use. However, on many platforms, there is also another form ofcompilation, the just-in-time (JIT) compilers. These work by compiling the bytecodes into native code once, caching the results, and then calling them again if needed. This approach speeds up commonly used code tremendously because one has to do the interpretation only once. Although still slightly slower than a true native code compiler, a just-in-time compiler can give you a 10- or even 20-fold speedup for some programs and will almost always be significantly faster than an interpreter. This technology is being improved continuously and may eventually yield results that cannot be matched by traditional compilation systems. For example, a just-in-time compiler can monitor which code is executed frequently and optimize just that code for speed.10. MultithreadedThe enefits of multithreading are better interactive responsiveness and real-time behavior.if you have ever tried to do multithreading in another language, you will be pleasantly surprised at how easy it is in Java. Threads in Java also can take advantage of multiprocessor systems if the base operating system does so. On the downside, thread implementations on the major platforms differ widely, and Java makes no effort to be platform independent in this regard. Only the code for calling multithreading remains the same across machines; Java offloads the implementation of multithreading to the underlying operating system or a thread library. Nonetheless, the ease of multithreading is one of the main reasons why Java is such an appealing language for server-side development.11. DynamicIn a number of ways, Java is a more dynamic language than C or C++. It was designed to adapt to an evolving environment. Libraries can freely add new methods and instance variables without any effect on their clients. In Java, finding out run time type information is straightforward.This is an important feature in those situations in which code needs to be added to a running program. A prime example is code that is downloaded from the Internet to run in a browser. In Java 1.0, finding out runtime type information was anything but straightforward, but current versions of Java give the programmer full insight intoboth the structure and behavior of its objects. This is extremely useful for systems that need to analyze objects at run time, such as Java GUI builders, smart debuggers, pluggable components, and object databases.Java技术介绍Java是一种程序设计平台Java是一种优秀的程序设计语言。
计算机专业课程名称英文翻译
计算机专业课程名称英文翻译(计算机科学与技术(教师教育)专业的课程名称和英文名称)4 中国现代史纲要 Outline of Moderm Chinese History5 大学英语 College English6 大学体育 College PE7 心理学 Psychology8 教育学 Pedagogy9 现代教育技术 Modern Technology10 教师口语 Teachers' Oral Skill11 形势与政策 Current Situation and Policy12 大学生就业与指导 Career Guidance13 学科教学法 Course Teaching Methodology14 生理与心理健康教育 Health and Physiology Education15 环境与可持续发展 Environment and Sustainable Development16 文献检索 Literature Retrieval17 大学体育 College PE18 大学语文 College Chinese19 高等数学 Higher Mathematics20 计算机导论 Introduction to ComputerScience21 程序设计基础 Programming Foundations22 程序设计基础实验 Experimentation of ProgrammingFoundations23 线性代数 Linear Algebra24 大学物理 College Physics25 大学物理实验 Experimentation of CollegePhysics26 电路与电子技术 Circuits and Electronics27 电工与电子技术实验 Experimentation of Circuits andElectronics28 数字逻辑电路 Digital Logic Circuit29 数字逻辑电路 Experimentation of DigitalLogic Circuit30 离散数学 Discrete Mathematics31 数据结构 Data Structures32 数据结构实验 Experimentation of DataStructures33 计算机组成与系统结构 Computer Organization and Architecture34 操作系统 Operating System35 操作系统实验 Experimentation of Operating System36 计算机网络 Computer Network37 计算机网络实验 Experimentation of Computer Network38 面向对象程序设计 Object-Oriented Programming39 面向对象程序设计实验 Experimentation of Object-Oriented Programming40 汇编语言程序设计 Assembly Language41 汇编语言程序设计实验 Experimentation of Assembly Language42 概率与数理统计 Probability and Statistics43 JAVA语言 Java Language45 JAVA语言实验 Experimentation of Java Language46 数据库原理 Databases Principles47 数据库原理实验 Experimentation of Databases Pninciples48 专业英语 Discipline English49 人工智能导论 Introduction to Artificial Intelligence50 算法设计与分析 Design and Analysis Of Algorithms51 微机系统与接口 Microcomputer System and Interface52 编译原理 Compiling Principles53 编译原理实验 Experimentation of Compiling54 数学建模 Mathematics Modeling55 软件工程 Software Engineering计算机专业课程名称英文翻译下(2)(计算机科学与技术(教师教育)专业的课程名称和英文名称)56 软件工程实验 Experimentation of Software Engineering57 嵌入式系统 Embedded System58 嵌入式系统实验 Experimentation of Embedded System59 多媒体技术 Multimedia Technology60 Experimentation of Multimedia Technology61 信息系统分析与设计 Object-Oriented Analysis and Design62 UNIX操作系统分析 UNIX System Analysis63 UNIX/Linux操作系统分析 Experimentation of UNIX/Linux SystemAnalysis64 单片机原理 Principles of Single-ChipComputer65 信息安全与保密概论 Introduction to Security andm Cryptography66 Web应用技术 Applications of Web67 高级数据库应用技术Advanced Application of Database Technology68 组网技术 Technology ofBuildingNetwork69 组网技术实验 Technology of Building Network70 计算机图形学 Computer Graphics71 嵌入式接口技术 Embedded Interface72 嵌入式接口技术实验Experimentation of Embedded Interface73 数字图像处理 Digital Images Processing74 数字图像处理实验 Digital Images Processing75 网络应用软件开发 Network Application Development76 XML原理与应用 XML Principle and Application77 XML原理与应用实验 Experimentation ofXML PrincipleandApplication78 计算机系统维护 Maintenance of Computer System79 计算机系统维护实验 Experimentation of ComputerMaintenance80 网络管理技术 Network Management Technology81 网络管理技术实验 Experimentation of NetworkManagement82 数据仓库与数据挖掘 Data Storage and Data Digging83 项目管理 Project Management84 软件开发实例 Cases of Sotiware Development85 企业资源规划( ERP) Enterprise Resource Planning86 新技术 New Technology87 科研创作指导 Supervision in Science ResearchCreation88 电子商务概论 Introduction of ElectronicBusiness89 计算机辅助教学 Computer Aided Teaching另:计算机导论 Introduction to ComputerScience程序设计基础 Foundations ofProgramming电路与电子技术 Circuits and Electronics数字逻辑电路 Digital Logic Circuit离散数学 Discrete Mathematics数据结构 Data Structures计算机组成与系统结构 Computer Organization and Architecture操作系统 Operating System计算机网络 Computer Network面向对象程序设计 Object-Oriented Progjamming数据库原理 Databases Principles。
java泛型(中英文)
第3行的类型转换有些烦人。通常情况下,程序员知道一个特定的 list 里边放的是 什么类型的数据。 但是, 这个类型转换是必须的(essential)。 编译器只能保证 iterator 返回的是 Object 类型。为了保证对 Integer 类型变量赋值的类型安全,必须进行类型 转换。 当然,这个类型转换不仅仅带来了混乱,它还可能产生一个运行时错误(run time error),因为程序员可能会犯错。 程序员如何才能明确表示他们的意图, 把一个 list 中的内容限制为一个特定的数据 类型呢?这是 generics 背后的核心思想。这是上面程序片断的一个泛型版本:
1.
介绍
JDK1.5中引入了对 java 语言的多种扩展,泛型(generics)即其中之一。 这个教程的目标是向您介绍 java 的泛型(generic)。你可能熟悉其他语言的泛型, 最著名的是 C++的模板(templates)。如果这样,你很快就会Байду номын сангаас到两者的相似之处和 重要差异。如果你不熟悉相似的语法结构,那么更好,你可以从头开始而不需要忘记误 解。 Generics 允许对类型进行抽象 (abstract over types)。最常见的例子是集合类 型(Container types),Collection 的类树中任意一个即是。 下面是那种典型用法:
那么 G<Foo>是 G<Bar>的子类型并不成立!! 这可能是你学习泛型中最难理解的部分,因为它和你的直觉相反。 这种直觉的问题在于它假定这个集合不改变。我们的直觉认为这些东西都不可改 变。 举例来说,如果一个交通部 (DMV)提供一个驾驶员里表给人口普查局,这似乎很 合理。我们想,一个 List<Driver> 是一个 List<Person> ,假定 Driver 是 Person 的子类型。实际上,我们传递的是一个驾驶员注册的拷贝。然而,人口普查局可能往驾 驶员 list 中加入其他人,这破坏了交通部的记录。 为了处理这种情况, 考虑一些更灵活的泛型类型很有用。 到现在为止我们看到的规 则限制比较大。
Java词汇大全(非常有用)
JAVA 词汇大全A B C D E F H I J L M O P R S T U V W ________________________________________ A______________________________________________________________________________ Abstract Window Toolkit(AWT)抽象窗口工具集抽象窗口工具集一个用本地图形组件实现的图形接口。
这些组件提供了大部分的本地组件。
这个接口正逐步被Swing 组件所替代,参见Swing Set. Abstract 抽象的一个Java 语言中的关键字,用在类的声明中来指明一个类是不能被实例化的,但是可以被其它类继承。
被其它类继承。
一个抽象类可以使用抽象方法,一个抽象类可以使用抽象方法,一个抽象类可以使用抽象方法,抽象方法不需要实现,抽象方法不需要实现,但是需要在子类中被实现abstract class 抽象类含有一个或多个抽象方法的类,不能被实例化。
定义抽象类的目的是使其他类能够从它继承,并且通过实现抽象方法使这个类具体化abstract method 抽象方法没有实现的方法access control 访问控制控制用户或程序访问资源的权限,保证资源的一致性的方法API 应用程序接口Applica on Programming Interface 的缩写。
指导应用程序开发人员访问类方法和类状态的说明applet 小应用程序通常在Web 浏览器中执行的一个Java 组件,同样可以在其他的支持applet 模型的应用程序或设备中执行Applet container applet 容器一个支持applet 的容器argument 参数在函数调用中使用的数据项。
一个参数可以是常量、变量或表达式array 数组相同类型的数据的集合,每一个数据项通过一个整数唯一标识ASCII American Standard Code for Informa on Interchange 的缩写。
Java调用翻译软件实现英文文档翻译
Java调⽤翻译软件实现英⽂⽂档翻译前⾔:因最近要进⾏OCP的考试准备。
看着⼤堆英⽂⽂档确实有些疼痛。
⼜因⽂档内容有点⼤,⼜需要逐⼀去翻译⼜很费时费⼒。
于是百度了⼀番,找到⼀些可以使⽤Java来调⽤百度翻译软件的API(注:(官⽅标注)每⽉前200万字不要钱,49元/⽉)。
于是就⾃⼰⼿动的修改了⼀番。
然后就使⽤。
Java调⽤百度API实现翻译百度官⽅计费声明:下⾯是Java调⽤百度API实现翻译的具体步骤:⼀、在写代码之前先在在百度翻译平台中,申请APP_ID申请地址申请的详见申请之后,会得到APP_ID和SECURITY_KEY⼆、java代码如下1:代码结构下图2:主要代码如下:BaiduTranslateDemopackage spring;import java.io.BufferedReader;import java.io.InputStream;import java.io.InputStreamReader;import .URLDecoder;import java.util.ArrayList;import java.util.List;import java.util.Random;import mons.codec.digest.DigestUtils;import org.apache.http.Consts;import org.apache.http.HttpEntity;import ValuePair;import org.apache.http.client.entity.UrlEncodedFormEntity;import org.apache.http.client.methods.CloseableHttpResponse;import org.apache.http.client.methods.HttpPost;import org.apache.http.impl.client.CloseableHttpClient;import org.apache.http.impl.client.HttpClients;import org.apache.http.message.BasicNameValuePair;import org.json.JSONArray;import org.json.JSONObject;import org.springframework.context.ApplicationContext;import org.springframework.context.support.FileSystemXmlApplicationContext;/*** 百度翻译引擎java⽰例代码*/public class BaiduTranslateDemo{private static final String UTF8 = "utf-8";//申请者开发者id,实际使⽤时请修改成开发者⾃⼰的appidprivate static final String appId = "⾃⼰注册⼀个appid";//申请成功后的证书token,实际使⽤时请修改成开发者⾃⼰的tokenprivate static final String token = "认证证书信息";private static final String url = "/api/trans/vip/translate";//随机数,⽤于⽣成md5值,开发者使⽤时请激活下边第四⾏代码private static final Random random = new Random();public String translate(String q, String from, String to) throws Exception{//⽤于md5加密//int salt = random.nextInt(10000);//本演⽰使⽤指定的随机数为1435660288int salt = 1435660288;// 对appId+源⽂+随机数+token计算md5值StringBuilder md5String = new StringBuilder();md5String.append(appId).append(q).append(salt).append(token);String md5 = DigestUtils.md5Hex(md5String.toString());//使⽤Post⽅式,组装参数HttpPost httpost = new HttpPost(url);List<NameValuePair> nvps = new ArrayList<NameValuePair>();nvps.add(new BasicNameValuePair("q", q));nvps.add(new BasicNameValuePair("from", from));nvps.add(new BasicNameValuePair("to", to));nvps.add(new BasicNameValuePair("appid", appId));nvps.add(new BasicNameValuePair("salt", String.valueOf(salt)));nvps.add(new BasicNameValuePair("sign", md5));httpost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));//创建httpclient链接,并执⾏CloseableHttpClient httpclient = HttpClients.createDefault();CloseableHttpResponse response = httpclient.execute(httpost);//对于返回实体进⾏解析HttpEntity entity = response.getEntity();InputStream returnStream = entity.getContent();BufferedReader reader = new BufferedReader(new InputStreamReader(returnStream, UTF8));StringBuilder result = new StringBuilder();String str = null;while ((str = reader.readLine()) != null) {result.append(str).append("\n");}//转化为json对象,注:Json解析的jar包可选其它JSONObject resultJson = new JSONObject(result.toString());//开发者⾃⾏处理错误,本⽰例失败返回为nulltry {String error_code = resultJson.getString("error_code");if (error_code != null) {System.out.println("出错代码:" + error_code);System.out.println("出错信息:" + resultJson.getString("error_msg"));return null;}} catch (Exception e) {}//获取返回翻译结果JSONArray array = (JSONArray) resultJson.get("trans_result");JSONObject dst = (JSONObject) array.get(0);String text = dst.getString("dst");text = URLDecoder.decode(text, UTF8);return text;}/*** 实际抛出异常由开发者⾃⼰处理中⽂翻译英⽂* @param q* @return* @throws Exception*/public static String translateZhToEn(String q) throws Exception{ApplicationContext container=new FileSystemXmlApplicationContext("src//spring//resource//baidu.xml"); BaiduTranslateDemo baidu = (BaiduTranslateDemo)container.getBean("baidu");String result = null;try {result = baidu.translate(q, "zh", "en");} catch (Exception e) {e.printStackTrace();}return result;}/*** 实际抛出异常由开发者⾃⼰处理英⽂翻译中⽂* @param q* @return* @throws Exception*/public static String translateEnToZh(String q) throws Exception{ApplicationContext container=new FileSystemXmlApplicationContext("src//spring//resource//baidu.xml"); BaiduTranslateDemo baidu = (BaiduTranslateDemo)container.getBean("baidu");String result = null;try {result = baidu.translate(q, "en", "zh");} catch (Exception e) {e.printStackTrace();}return result;}}Mainpackage spring;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileOutputStream;import java.io.FileReader;import java.io.FileWriter;import java.io.OutputStream;import java.io.OutputStreamWriter;/*** 直接运⾏main⽅法即可输出翻译结果*/public class Main {public static void main(String[] args) throws Exception {// translateZhToEn();// translateEnToZh();translateTxtInfo();}/*** 中⽂翻译为英⽂*/public static void translateZhToEn() {String source = "百度翻译引擎⽰例";String result;try {result = BaiduTranslateDemo.translateZhToEn(source);if (result == null) {System.out.println("翻译出错,参考百度错误代码和说明。
计算机科学与技术Java垃圾收集器中英文对照外文翻译文献
中英文资料中英文资料外文翻译文献原文:How a garbage collector works of Java LanguageIf you come from a programming language where allocating objects on the heap is expensive, you may naturally assume that Java’s scheme of allocating everything (except primitives) on the heap is also expensive. However, it turns out that the garbage collector can have a significant impact on increasing the speed of object creation. This might sound a bit odd at first—that storage release affects storage allocation—but it’s the way some JVMs work, and it means that allocating storage for heap objects in Java can be nearly as fast as creating storage on the stack in other languages.For example, you can think of the C++ heap as a yard where each stakes out its own piece of turf object. This real estate can become abandoned sometime later and must be reused. In some JVMs, the Java heap is quite different; it’s more like a conveyor belt that moves forwardevery time you allocate a new object. This means that object storage allocation is remarkab ly rapid. The “heap pointer” is simply moved forward into virgin territory, so it’s effectively the same as C++’s stack allocation. (Of course, there’s a little extra overhead for bookkeeping, but it’s nothing like searching for storage.)You might observ e that the heap isn’t in fact a conveyor belt, and if you treat it that way, you’ll start paging memory—moving it on and off disk, so that you can appear to have more memory than you actually do. Paging significantly impacts performance. Eventually, after you create enough objects, you’ll run out of memory. The trick is that the garbage collector steps in, and while it collects the garbage it compacts all the objects in the heap so that you’ve effectively moved the “heap pointer” closer to the beginning of the conveyor belt and farther away from a page fault. The garbage collector rearranges things and makes it possible for the high-speed, infinite-free-heap model to be used while allocating storage.To understand garbage collection in Java, it’s helpful le arn how garbage-collection schemes work in other systems. A simple but slow garbage-collection technique is called reference counting. This means that each object contains a reference counter, and every time a reference is attached to that object, the reference count is increased. Every time a reference goes out of scope or is set to null, the reference count isdecreased. Thus, managing reference counts is a small but constant overhead that happens throughout the lifetime of your program. The garbage collector moves through the entire list of objects, and when it finds one with a reference count of zero it releases that storage (however, reference counting schemes often release an object as soon as the count goes to zero). The one drawback is that if objects circularly refer to each other they can have nonzero reference counts while still being garbage. Locating such self-referential groups requires significant extra work for the garbage collector. Reference counting is commonly used to explain one kind of g arbage collection, but it doesn’t seem to be used in any JVM implementations.In faster schemes, garbage collection is not based on reference counting. Instead, it is based on the idea that any non-dead object must ultimately be traceable back to a reference that lives either on the stack or in static storage. The chain might go through several layers of objects. Thus, if you start in the stack and in the static storage area and walk through all the references, you’ll find all the live objects. For each reference that you find, you must trace into the object that it points to and then follow all the references in that object, tracing into the objects they point to, etc., until you’ve moved through the entire Web that originated with the reference on the stack or in static storage. Each object that you move through must still be alive. Note that there is no problem withdetached self-referential groups—these are simply not found, and are therefore automatically garbage.In the approach described here, the JVM uses an adaptive garbage-collection scheme, and what it does with the live objects that it locates depends on the variant currently being used. One of these variants is stop-and-copy. This means that—for reasons that will become apparent—the program is first stopped (this is not a background collection scheme). Then, each live object is copied from one heap to another, leaving behind all the garbage. In addition, as the objects are copied into the new heap, they are packed end-to-end, thus compacting the new heap (and allowing new storage to simply be reeled off the end as previously described).Of course, when an object is moved from one place to another, all references that point at the object must be changed. The reference that goes from the heap or the static storage area to the object can be changed right away, but there can be other references pointing to this object Initialization & Cleanup that will be encountered later during the “walk.” These are fixed up as they are found (you could imagine a table that maps old addresses to new ones).There are two issues that make these so-called “copy collectors” inefficient. The first is the idea that you have two heaps and you slosh all the memory back and forth between these two separate heaps,maintaining twice as much memory as you actually need. Some JVMs deal with this by allocating the heap in chunks as needed and simply copying from one chunk to another.The second issue is the copying process itself. Once your program becomes stable, it might be generating little or no garbage. Despite that, a copy collector will still copy all the memory from one place to another, which is wasteful. To prevent this, some JVMs detect that no new garbage is being generated and switch to a different scheme (this is the “adaptive” part). This other scheme is called mark-and-sweep, and it’s what earlier versions of Sun’s JVM used all the time. For general use, mark-and-sweep is fairly slow, but when you know you’re generating little or no garbage, it’s fast. Mark-and-sweep follows the same logic of starting from the stack and static storage, and tracing through all the references to find live objects.However, each time it finds a live object, that object is marked by setting a flag in it, but the object isn’t collected yet.Only when the marking process is finished does the sweep occur. During the sweep, the dead objects are released. However, no copying happens, so if the collector chooses to compact a fragmented heap, it does so by shuffling objects around. “Stop-and-copy”refers to the idea that this type of garbage collection is not done in the background; Instead, the program is stopped while the garbage collection occurs. In the Sun literature you’llfind many references to garbage collection as a low-priority background process, but it turns out that the garbage collection was not implemented that way in earlier versions of the Sun JVM. Instead, the Sun garbage collector stopped the program when memory got low. Mark-and-sweep also requires that the program be stopped.As previously mentioned, in the JVM described here memory is allocated in big blocks. If you allocate a large object, it gets its own block. Strict stop-and-copy requires copying every live object from the source heap to a new heap before you can free the old one, which translates to lots of memory. With blocks, the garbage collection can typically copy objects to dead blocks as it collects. Each block has a generation count to keep track of whether it’s alive. In the normal case, only the blocks created since the last garbage collection are compacted; all other blocks get their generation count bumped if they have been referenced from somewhere. This handles the normal case of lots of short-lived temporary objects. Periodically, a full sweep is made—large objects are still not copied (they just get their generation count bumped), and blocks containing small objects are copied and compacted.The JVM monitors the efficiency of garbage collection and if it becomes a waste of time because all objects are long-lived, then it switches to mark-and sweep. Similarly, the JVM keeps track of how successful mark-and-sweep is, and if the heap starts to becomefragmented, it switches back to stop-and-copy. This is where the “adaptive” part comes in, so you end up with a mouthful: “Adaptive generational stop-and-copy mark-and sweep.”There are a number of additional speedups possible in a JVM. An especially important one involves the operation of the loader and what is called a just-in-time (JIT) compiler. A JIT compiler partially or fully converts a program into native machine code so that it doesn’t need to be interpreted by the JVM and thus runs much faster. When a class must be loaded (typically, the first time you want to create an object of that class), the .class file is located, and the byte codes for that class are brought into memory. At this point, one approach is to simply JIT compile all the code, but this has two drawbacks: It takes a little more time, which, compounded throughout the life of the program, can add up; and it increases the size of the executable (byte codes are significantly more compact than expanded JIT code), and this might cause paging, which definitely slows down a program. An alternative approach is lazy evaluation, which means that the code is not JIT compiled until necessary. Thus, code that never gets executed might never be JIT compiled. The Java Hotspot technologies in recent JDKs take a similar approach by increasingly optimizing a piece of code each time it is executed, so the more the code is executed, the faster it gets.译文:Java垃圾收集器的工作方式如果你学下过一种因为在堆里分配对象所以开销过大的编程语言,很自然你可能会假定Java 在堆里为每一样东西(除了primitives)分配内存资源的机制开销也会很大。
Java编程语言外文翻译、英汉互译、中英对照
文档从互联网中收集,已重新修正排版,word格式支持编辑,如有帮助欢迎下载支持。
外文翻译原文及译文学院计算机学院专业计算机科学与技术班级学号姓名指导教师负责教师Java(programming language)Java is a general-purpose, concurrent, class-based, object-oriented computer program- -ming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to byte code (class file) that can run on any Java virtual machine(JVM) regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users. Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.The original and reference implementation Java compilers, virtual machines, and class libraries were developed by Sun from 1991 and first released in 1995. As of May 2007, in compliance with the specifications of the Java Community Process, Sun relicensed most of its Java technologies under the GNU General Public License. Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java and GNU Classpath.Java is a set of several computer software products and specifications from Sun Microsystems (which has since merged with Oracle Corporation), that together provide a system for developing application software and deploying it in across-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones on the low end, to enterprise servers and supercomputers on the high end. While less common, Java appletsare sometimes used to provide improved and secure functions while browsing the World Wide Web on desktop computers.Writing in the Java programming language is the primary way to produce code that will be deployed as Java bytecode. There are, however, byte code compilers available forother languages such as Ada, JavaScript, Python, and Ruby. Several new languages have been designed to run natively on the Java Virtual Machine (JVM), such as Scala, Clojure and Groovy.Java syntax borrows heavily from C and C++, but object-oriented features are modeled after Smalltalk and Objective-C. Java eliminates certain low-level constructs such as pointers and has a very simple memory model where every object is allocated on the heap and all variables of object types are references. Memory management is handled through integrated automatic garbage collection performed by the JVM.An edition of the Java platform is the name for a bundle of related programs from Sun that allow for developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather an execution engine (called a virtual machine) and a compiler with a set of libraries that are implemented for various hardware and operating systems so that Java programs can run identically on all of them. The Java platform consists of several programs, each of which provides a portion of its overall capabilities. For example, the Java compiler, which converts Java source code into Java byte code (an intermediate language for the JVM), is provided as part of the Java Development Kit (JDK). The Java Runtime Environment(JRE), complementing the JVM with a just-in-time (JIT) compiler, converts intermediate byte code into native machine code on the fly. An extensive set of libraries are also part of the Java platform.The essential components in the platform are the Java language compiler, the libraries, and the runtime environment in which Java intermediate byte code "executes" according to the rules laid out in the virtual machine specification.In most modern operating systems (OSs), a large body of reusable code is provided to simplify the programmer's job. This code is typically provided as a set of dynamically loadable libraries that applications can call at runtime. Because the Java platform is not dependent on any specific operating system, applications cannot rely on any of the pre-existing OS libraries. Instead, the Java platform provides a comprehensive set of its own standard class libraries containing much of the same reusable functions commonly found in modern operating systems. Most of the system library is also written in Java. For instance, Swing library paints the user interface and handles the events itself, eliminatingmany subtle differences between how different platforms handle even similar components.The Java class libraries serve three purposes within the Java platform. First, like other standard code libraries, the Java libraries provide the programmer a well-known set of functions to perform common tasks, such as maintaining lists of items or performing complex string parsing. Second, the class libraries provide an abstract interface to tasks that would normally depend heavily on the hardware and operating system. Tasks such as network access and file access are often heavily intertwined with the distinctive implementations of each platform. The and java.io libraries implement an abstraction layer in native OS code, then provide a standard interface for the Java applications to perform those tasks. Finally, when some underlying platform does not support all of the features a Java application expects, the class libraries work to gracefully handle the absent components, either by emulation to provide a substitute, or at least by providing a consistent way to check for the presence of a specific feature.The success of Java and its write once, run anywhere concept has led to other similar efforts, notably the .NET Framework, appearing since 2002, which incorporates many of the successful aspects of Java. .NET in its complete form (Microsoft's implementation) is currently only fully available on Windows platforms, whereas Java is fully available on many platforms. .NET was built from the ground-up to support multiple programming languages, while the Java platform was initially built to support only the Java language, although many other languages have been made for JVM since..NET includes a Java-like language called Visual J# (formerly named J++) that is incompatible with the Java specification, and the associated class library mostly dates to the old JDK 1.1 version of the language. For these reasons, it is more a transitional language to switch from Java to the .NET platform, than a first class .NET language. Visual J# was discontinued with the release of Microsoft Visual Studio 2008. The existing version shipping with Visual Studio 2005will be supported until 2015 as per the product life-cycle strategy.In June and July 1994, after three days of brainstorming with John Gage, the Director of Science for Sun, Gosling, Joy, Naughton, Wayne Rosing, and Eric Schmidt, the team re-targeted the platform for the World Wide Web. They felt that with the advent of graphical web browsers like Mosaic, the Internet was on its way to evolving into the samehighly interactive medium that they had envisioned for cable TV. As a prototype, Naughton wrote a small browser, Web Runner (named after the movie Blade Runner), later renamed Hot Java.That year, the language was renamed Java after a trademark search revealed that Oak was used by Oak Technology. Although Java 1.0a was available for download in 1994, the first public release of Java was 1.0a2 with the Hot Java browser on May 23, 1995, announced by Gage at the Sun World conference. His announcement was accompanied by a surprise announcement by Marc Andreessen, Executive Vice President of Netscape Communications Corporation, that Netscape browsers would be including Java support. On January 9, 1996, the Java Soft group was formed by Sun Microsystems to develop the technology.Java编程语言Java是一种通用的,并发的,基于类的并且是面向对象的计算机编程语言,它是为实现尽可能地减少执行的依赖关系而特别设计的。
java 将中文语句转为英语语句的方法
java 将中文语句转为英语语句的方法随着全球化的发展,跨语言交流变得越来越重要。
在这种背景下,将中文语句转为英语语句的需求日益凸显。
Java作为一种广泛应用于各个领域的编程语言,具有丰富的功能和较强的可移植性,为中英文语句转换提供了便利。
本文将详细介绍如何使用Java实现中英文语句转换的方法。
首先,我们需要明确一点,将中文语句准确地翻译成英语并非易事。
这不仅涉及到语言本身的差异,还包括文化、语境等多种因素。
然而,Java编程语言的强大功能为我们提供了一种可能的解决方案。
通过运用Java编程,我们可以实现自动识别、翻译中文语句,并将其转换为英语。
在Java中,实现中英文语句转换的主要方法如下:1.使用翻译API:有许多第三方翻译API提供了中文至英语的翻译服务,如Google翻译API、百度翻译API等。
通过调用这些API,我们可以方便地将中文语句转换为英语。
在使用翻译API时,需要注意API的调用方式、参数传递和访问权限等问题。
2.构建自定义翻译模型:如果想要实现更精确的翻译,可以尝试构建自定义的翻译模型。
这可以通过运用机器学习算法,如神经网络、决策树等,对大量中文-英文平行语料进行训练来实现。
在Java中,可以使用诸如Apache Commons Lang、OpenNLP等库来辅助完成这一任务。
3.利用自然语言处理技术:自然语言处理(NLP)是处理和理解人类语言的一种技术。
在Java中,可以运用NLP技术对中文语句进行分词、词性标注、命名实体识别等操作,从而为翻译提供更精确的输入。
常用的NLP库包括NLTK、Stanford NLP等。
总之,通过运用Java编程,我们可以实现中英文语句的转换。
在实际应用中,这种转换技术可以广泛应用于机器翻译、跨语言信息检索、多语言网站等领域。
然而,需要注意的是,自动翻译仍然存在一定的局限性。
为了获得更高质量的翻译结果,我们可以结合人工校对、领域适应等技术进行优化。
Java毕设论文英文翻译
Java毕设论文英文翻译Java and the InternetIf Java is, in fact, yet another computer programming language, you mayquestion why it is so important and why it is being promoted as a revolutionarystep in computer programming. The answer isn’timmediately obvious if you’re coming from a traditional programming perspective. Although Java is very useful for solving traditional standalone programming problems, it is also important because it will solve programming problems on the World Wide Web.What is the Web?The Web can seem a bit of a mystery at first, with all this talk of “surfing,”helpful to step back and see what it realland “homepages.”It’s“presence,”y is, but to do this you must understand client/server systems, another aspecfull of confusing issues.t of computing that’sClient/Se rver computingThe primary idea of a client/server system is that you have a central repositoryof information—some kind of data, often in a database—that you want todistribute on demand to some set of people or machines. A key to the client/server concept is that the repository of information is centrally located so that it an be changed and so that those changes will propagate out to the information consumers. Taken together, the information repository, the software that distributes the information, and the machine(s) where the information and software reside is called the server. The software that resides on the remote machine, communicates with the server, fetches the information, processes it, and then displays it on the remote machine is called the client.The basic concept of client/server computing, then, is not so complicated. The problems arise because you have a single server trying to serve many clientsat once. Generally, a database management system is involved, so the designer the layout of data into tables for optimal use. In addition, systems oft “balances”en allow a client to insert new information into a server. This means you mustnew datwalk over another client’snew data doesn’tensure that one cl ient’slost in the process of adding it to the database (this is called a, or that data isn’ttransaction processing). As client software changes, it mustbe built, debugged,and installed on the client machines, which turns out to be more complicatedespecially problematic to support muand expensive than you might think. It’sthe all-impoltiple types of computers and operating systems. Finally, there’srtant performance issue: You might have hundreds of clients making requestsof your server at any one time, so any small delay is crucial. To minimize latency, programmers work hard to offload processing tasks, often to the client machine, but sometimes to other machines at the server site, using so-called middleware. (Middleware is also used to improve maintainability.)The simple idea of distributing information has so many layers of complexitcrucial: Cliy that the whole problem can seem hopelessly enigmatic. And yet it’sent/server computing accounts for roughly half of all programming activities. It’s responsible for everything from taking orders and credit-c ar d transactions tothe distribution of any kind of data—stock market, scientific, government, youname it. What we’ve come up with in the past is individual solutions to individual problems, inventing a new solution each time. These were hard to create and hard to use, and the user had to learn a new interface for each one. The entire client/server problem needs to be solved in a big way.The Web asagiant s ervera bit worse than thThe Web is actually one giant client/server system. It’sat, since you have all the servers and clients coexisting on a single network atneed to know that, because all you care about is connecting to a once. You don’tnd interacting with one server at a time (even though you might be hopping around the world in your search for the correct server). Initially it was a simple one-way process. You made a request of a server and it handed you a file, which y browser software (i.e., the client) would interpret by formatting o our machine’snto your local machine. But in short order people began wanting to do morethan just deliver pages from a server. They wanted full client/server capability so that the client could feed information back to the server, for example, to do database lookups on the server, to add new information to the server, or to place an order ( which required more security than the original systems offered). These are thechanges we’ve been seeing in the development of the Web.The Web browser was a big step forward: the concept that one piece of information could be displayed on any type of computer without change. However, br owsers were still rather primitive and rapidly bogged down by the demands plaparticularly interactive, and tended to clog up bothced on them. They weren’tthe server and the Internet because any time you needed to do something that required programming you had to send information back to the server to be pro cessed. It could take many seconds or minutes to find out you had misspelled perf something in your request. Since the browser was just a viewer it couldn’torm even the simplest computing tasks. (On the otherexecute any programs on your local machi hand, it was safe, because it couldn’tne that might contain bugs or viruses.)To solve this problem, different approaches have been taken. To begin with, gr aphics standards have been enhanced to allow better animation and video within browsers. The remainder of the problem can be solved only by incorporating the ability to run programs on the client end, under the browser. This iscalled client-side programming.Client-side programmingThe Web’sinitial server-browser design provided for interactive content, but the interactivity was completely provided by the server. The server produced static pages for the client browser, which would simply interpret and display them. Basic HyperText Markup Language (HTML) contains simple mechanis ms for data gathering: text-entry boxes, check boxes, radio boxes, lists and drop-down lists, as well as a button that can only be programmed to reset the dataon the form or “submit”the data on the form back to the server. This submissio n passes through the Common Gateway Interface (CGI) provided on all Web servers. The text within the submission tells CGI what to do with it. The most common action is to run a program located on the server in a directory th typically called “cgi-b in.” (If you watch the address window at the top ofat’syour browser when you push a button on a Web page, you can sometimes see “cgi-bin” within all the gobbledygook there.) These programs can be written in most languages. Perl has been a common choice because it is designed for text manipulation and is interpreted, so it can be installed on any server regardlessof processor or operating system. However, Python (my favorite—see www.Pyt /doc/4110905303.html,) has been making inroads because of its greater power and simplicity. Many powerful Web sites today are built strictly on CGI, and you can in fact do nearly anything with CGI. However, Web sites built on CGI programs can rapidly become overly complicated to maintain, and there is alsothe problem of respo nse time. The response of a CGI program depends on how much data must be s ent, as well as the load on both the server and the Internet. (On top of this, sta rting a CGI program tends to be slow.) The initial designers of the Web did notforesee how rapidly this bandwidth would be exhausted for the kinds of applic ations people developed. For example, any sort of dynamic graphing is nearly i mpossible to perform with consistency because a Graphics Interchange Format (GIF) file must be created and moved from the server to the client for each ve rsion of the graph. And you’ve no doubt had direct experience with somethingas simple as validating the data on an input form. You press the submit button on a page; the data is shipped back to the server; the server starts a CGI pro gram that discovers an error, formats an HTML page informing you of the error, and then sends the page back to you; you minelegant. The so ust then back up a page and try again. Not only is this slow, it’slution is client-side programming. Most machines that run Web browsers are powerful engines capable of doing vast work, and with the original static HTML approach they are sitting there, just idly waiting for the server to dish up thenext page. Client-side programming means that the Web browser is harnessedto do whatever work it can, and the result for the user is a much speedier andmore interactive experience at your Web site. The problemwith discussionsvery different from discussionsof client-side programmi ng is that they aren’tof programming in general. The parameters are almost the same, but the platform is different; a Web browser is like a limited operating system. In the end,you must still program, and this accounts for the dizzying array of problems and solutions produced by client-side programming. The rest of this section pro vides an overview of the issues and approaches in client-side programming.Plug-insOne of the most significant steps forward in client-side programming is the development of the plug-in. This is a way for a programmer to add new funct ionality to the browser by downloading a piece of code that plugs itself into the appropriate spot in the browser. It tells the browser “from now on you can perf (You need to download the plug-in only once.) Some fast orm this new activity.”and powerful behavior is added to browsers via plug-ins, but writing a plug-inwant to do as part ofsomething you’dis not a trivial task, and isn’tthe process of building a particular site. The value of the plug-in for client-side programming is that it allows an expert programmer todevelop a new language and add that language to a browser without the permission of the browser manufacturer. Thus, plug-ins provide a “back d oor” that allows the creation of new client-side programming languages (although not all languages are implemented as plug-ins).ScriptinglanguagesPlug-ins resulted in an explosion of scripting languages. With a scripting language, you embed the source code for your client-side program directlyinto the HTML page, and the plug-in that interprets that language is automatically activated while the HTML page is being displayed. Scripting languages tend to be reasonably easy to understand and, because they are simply text that is part of an HTML page, they load very quickly as part of the single server hit required to procure that page. The trade-off is that your code is exposed fordoing amazingly so everyone to see (and steal). Generally, however, you aren’tphisticated things with scripting languages, so this is not too much of a hardship.This points out that the scripting languages used inside Web browsers are really intended to solve specific types of problems, primarily the creation of richerand more interactive graphical user interfaces (GUIs).However, a scripting language might solve 80 percent of the problems encountered in client-side prog ramming. Your problems might very well fit completely within that 80 percent,and since scripting languages can allow easier and faster development, you should probably consider a scripting language before looking at a more involved s olution such as Java or ActiveX programming.The most commonly discussed browser scripting languages are JavaScript (named that way just to grab some of Ja which has nothing to do with Java; it’smarketing momentum), VBScript (which looks like Visual BASIC), and Tcl/va’sTk, which comes from the popular cross-platform GUI-building language. There are others out there, and no doubt more in development.JavaScript is probably the most commonly supported. It comes built into bothNetscape Navigator and the Microsoft Internet Explorer (IE). Unfortunately,the flavor of JavaScript on the two browsers can vary widely (the Mozilla browser, freely downloadable from /doc/4110905303.html,, supports the ECMAScript standard, which may one day become universally supported). In addition, there are probably more JavaScript books available than there arefor the other browser languages, and some tools automatically create pages using JavaScript. However, if you’re already fluent in Visual BASIC or Tcl/Tk, you’ll be more pr oductive using those scripting languages rather than learning a new one. (You’ll have your hands full dealing with the Web issues already.)ja va和因特网既然Jav a不过另一种类型的程序设计语言,大家可能会奇怪它为什么值得如此重视,为什么还有这么多的人认为它是计算机程序设计的一个里程碑呢?如果您来自一个传统的程序设计背景,那么答案在刚开始的时候并不是很明显。
JAVA编程术语英语翻译
**********************<JAVA编程术语英语翻译>**********************abstract 抽象的抽象的abstraction 抽象体、抽象物、抽象性抽象体、抽象物、抽象性access 存取、取用存取、访问access level 存取级别访问级别access function 存取函式访问函数activate 活化激活active 作用中的adapter 配接器适配器address 位址地址address space 位址空间,定址空间address-of operator 取址运算子取地址操作符aggregation 聚合algorithm 演算法算法allocate 配置分配allocator (空间)配置器分配器application 应用程式应用、应用程序application framework 应用程式框架、应用框架应用程序框架architecture 架构、系统架构体系结构argument 引数(传给函式的值)。
叁见 parameter 叁数、实质叁数、实叁、自变量array 阵列数组arrow operator arrow(箭头)运算子箭头操作符assembly 装配件assembly language 组合语言汇编语言assert(ion) 断言assign 指派、指定、设值、赋值赋值assignment 指派、指定赋值、分配assignment operator 指派(赋值)运算子 = 赋值操作符associated 相应的、相关的相关的、关联、相应的associative container 关联式容器(对应sequential container)关联式容器atomic 不可分割的原子的attribute 属性属性、特性audio 音讯音频A.I. 人工智慧人工智能background 背景背景(用於图形着色)後台(用於行程)backward compatible 回溯相容向下兼容bandwidth 频宽带宽base class 基础类别基类base type 基础型别 (等同於 base class)batch 批次(意思是整批作业)批处理benefit 利益收益best viable function 最佳可行函式最佳可行函式(从 viable functions 中挑出的最佳吻合者)binary search 二分搜寻法二分查找binary tree 二元树二叉树binary function 二元函式双叁函数binary operator 二元运算子二元操作符binding 系结绑定bit 位元位bit field 位元栏位域bitmap 位元图位图bitwise 以 bit 为单元逐一┅bitwise copy 以 bit 为单元进行复制;位元逐一复制位拷贝block 区块,区段块、区块、语句块boolean 布林值(真假值,true 或 false)布尔值border 边框、框线边框brace(curly brace) 大括弧、大括号花括弧、花括号bracket(square brakcet) 中括弧、中括号方括弧、方括号breakpoint 中断点断点build 建造、构筑、建置(MS 用语)build-in 内建内置bus 汇流排总线business 商务,业务业务buttons 按钮按钮byte 位元组(由 8 bits 组成)字节cache 快取高速缓存call 呼叫、叫用调用callback 回呼回调call operator call(函式呼叫)运算子调用操作符(同 function call operator)candidate function 候选函式候选函数(在函式多载决议程序中出现的候选函式)chain 串链(例 chain of function calls)链character 字元字符check box 核取方块 (i.e. check button) 复选框checked exception 可控式异常(Java)check button 方钮 (i.e. check box) 复选按钮child class 子类别(或称为derived class, subtype)子类class 类别类class body 类别本体类体class declaration 类别宣告、类别宣告式类声明class definition 类别定义、类别定义式类定义class derivation list 类别衍化列类继承列表class head 类别表头类头class hierarchy 类别继承体系, 类别阶层类层次体系class library 类别程式库、类别库类库class template 类别模板、类别范本类模板class template partial specializations类别模板偏特化类模板部分特化class template specializations类别模板特化类模板特化cleanup 清理、善後清理、清除client 客端、客户端、客户客户client-server 主从架构客户/服务器clipboard 剪贴簿剪贴板clone 复制克隆collection 群集集合combo box 复合方块、复合框组合框command line 命令列命令行(系统文字模式下的整行执行命令)communication 通讯通讯compatible 相容兼容compile time 编译期编译期、编译时compiler 编译器编译器component 组件组件composition 复合、合成、组合组合computer 电脑、计算机计算机、电脑concept 概念概念concrete 具象的实在的concurrent 并行并发configuration 组态配置connection 连接,连线(网络,资料库)连接constraint 约束(条件)construct 构件构件container 容器容器(存放资料的某种结构如 list, vector...)containment 内含包容context 背景关系、周遭环境、上下脉络环境、上下文control 控制元件、控件控件console 主控台控制台const 常数(constant 的缩写,C++ 关键字)constant 常数(相对於 variable)常量constructor(ctor)建构式构造函数(与class 同名的一种 member functions)copy (v) 复制、拷贝拷贝copy (n) 复件, 副本cover 涵盖覆盖create 创建、建立、产生、生成创建creation 产生、生成创建cursor 游标光标custom 订制、自定定制data 资料数据database 资料库数据库database schema 数据库结构纲目data member 资料成员、成员变数数据成员、成员变量data structure 资料结构数据结构datagram 资料元数据报文dead lock 死结死锁debug 除错调试debugger 除错器调试器declaration 宣告、宣告式声明deduction 推导(例:template argument deduction)推导、推断default 预设缺省、默认defer 延缓推迟define 定义预定义definition 定义、定义区、定义式定义delegate 委派、委托、委任委托delegation (同上)demarshal 反编列散集dereference 提领(取出指标所指物体的内容)解叁考dereference operator dereference(提领)运算子 * 解叁考操作符derived class 衍生类别派生类design by contract 契约式设计design pattern 设计范式、设计样式设计模式※最近我比较喜欢「设计范式」一词destroy 摧毁、销毁destructor 解构式析构函数device 装置、设备设备dialog 对话窗、对话盒对话框directive 指令(例:using directive) (编译)指示符directory 目录目录disk 碟盘dispatch 分派分派distributed computing 分布式计算 (分布式电算) 分布式计算分散式计算 (分散式电算)document 文件文档dot operator dot(句点)运算子 . (圆)点操作符driver 驱动程式驱动(程序)dynamic binding 动态系结动态绑定efficiency 效率效率efficient 高效高效end user 终端用户entity 物体实体、物体encapsulation 封装封装enclosing class 外围类别(与巢状类别 nested class 有关)外围类enum (enumeration) 列举(一种 C++ 资料型别)枚举enumerators 列举元(enum 型别中的成员)枚举成员、枚举器equal 相等相等equality 相等性相等性equality operator equality(等号)运算子 == 等号操作符equivalence 等价性、等同性、对等性等价性equivalent 等价、等同、对等等价escape code 转义码转义码evaluate 评估、求值、核定评估event 事件事件event driven 事件驱动的事件驱动的exception 异常情况异常exception declaration 异常宣告(ref. C++ Primer 3/e, 11.3)异常声明exception handling 异常处理、异常处理机制异常处理、异常处理机制exception specification 异常规格(ref. C++ Primer 3/e, 11.4)异常规范exit 退离(指离开函式时的那一个执行点)退出explicit 明白的、明显的、显式显式export 汇出引出、导出expression 运算式、算式表达式facility 设施、设备设施、设备feature 特性field 栏位,资料栏(Java)字段, 值域(Java)file 档案文件firmware 韧体固件flag 旗标标记flash memory 快闪记忆体闪存flexibility 弹性灵活性flush 清理、扫清刷新font 字型字体form 表单(programming 用语)窗体formal parameter 形式叁数形式叁数forward declaration 前置宣告前置声明forwarding 转呼叫,转发转发forwarding function 转呼叫函式,转发函式转发函数fractal 碎形分形framework 框架框架full specialization 全特化(ref. partial specialization)function 函式、函数函数function call operator 同 call operatorfunction object 函式物件(ref. C++ Primer 3/e, 12.3)函数对象function overloaded resolution函式多载决议程序函数重载解决(方案)functionality 功能、机能功能function template 函式模板、函式范本函数模板functor 仿函式仿函式、函子game 游戏游戏generate 生成generic 泛型、一般化的一般化的、通用的、泛化generic algorithm 泛型演算法通用算法getter (相对於 setter) 取值函式global 全域的(对应於 local)全局的global object 全域物件全局对象global scope resolution operator全域生存空间(范围决议)运算子 :: 全局范围解析操作符group 群组group box 群组方块分组框guard clause 卫述句 (Refactoring, p250) 卫语句GUI 图形介面图形界面hand shaking 握手协商handle 识别码、识别号、号码牌、权柄句柄handler 处理常式处理函数hard-coded 编死的硬编码的hard-copy 硬拷图屏幕截图hard disk 硬碟硬盘hardware 硬体硬件hash table 杂凑表哈希表、散列表header file 表头档、标头档头文件heap 堆积堆hierarchy 阶层体系层次结构(体系)hook 挂钩钩子hyperlink 超链结超链接icon 图示、图标图标IDE 整合开发环境集成开发环境identifier 识别字、识别符号标识符if and only if 若且唯若当且仅当Illinois 伊利诺伊利诺斯image 影像图象immediate base 直接的(紧临的)上层 base class。
java实现英文翻译程序
java实现英⽂翻译程序本⽂实例为⼤家分享了java实现英⽂翻译程序的具体代码,供⼤家参考,具体内容如下1.功能简介将⽂本⽂件中的英⽂转换为对应的中⽂词库如下:源⽂件:翻译后的⽂件:输⼊源⽂件路径,将翻译后的内容输出到result.txt⽂件中。
2.重要技术(1)如何载⼊词库⽂件因为词库⽂件是 kry=value的形式,所有可以⽤到Properties类的load函数(2)如何将源⽂件中的⼀段英⽂分理处⼀个个的单词可以⽤StringTokenizer类(3)如何进⾏翻译直接⽤中⽂替换相应的英⽂3.项⽬结构(4)代码编写①FileLoader类/*⽂件载⼊类,将源⽂件中的内容输出到字节数组中*/package zhidao3_2;import java.io.FileInputStream;import java.io.File;public class FileLoad {public static byte[] getContent(String fileName)throws Exception{File file = new File(fileName);if(!file.exists()){System.out.println("输⼊有误,该⽂件不存在");}FileInputStream fis = new FileInputStream(file);int length = (int)file.length();byte[] data = new byte[length];fis.read(data);fis.close();return data;}}②TxtTrans类/*⽂件翻译,将字节数组变为字符串,分离出其中的单词,然后翻译为对应的汉字,去掉空格,变为字符串*/ package zhidao3_2;import java.util.StringTokenizer;import java.util.Properties;import java.io.*;public class TxtTrans {private Properties pps;public TxtTrans(){loadCiku();}public void loadCiku(){pps = new Properties();try{FileReader fis = new FileReader("g:/ciku.txt");//以字符载⼊时没有乱码,以字节载⼊时出现了乱码pps.load(fis);fis.close();}catch(Exception ex){ex.printStackTrace(System.out);System.out.println("载⼊词库时出错");}//System.out.println(pps.get("china")) ;}public String trans(byte[] data){String srcTxt = new String(data);String dstTxt = srcTxt;String delim = " ,.!\n\t"; //分隔符可以指定StringTokenizer st = new StringTokenizer(srcTxt,delim,false);String sub,lowerSub,newSub;//int i=0;while(st.hasMoreTokens()){sub = st.nextToken(); //分割出的⼀个个单词lowerSub = sub.toLowerCase();//统⼀转换为⼩写,这样可以简化词库//System.out.println(sub);newSub = pps.getProperty(lowerSub);if(newSub != null){ //如果找到了匹配的汉字,则进⾏替换dstTxt = dstTxt.replaceFirst(sub, newSub); //只替换第⼀个,即只替换了当前的字符串,否则容易造成ch我na的例⼦ //System.out.println(dstTxt);}}return dstTxt.replaceAll(" ", ""); //去掉空格}}③FileOutput类/*将字符串输出到⽂件*/package zhidao3_2;import java.io.File;import java.io.FileOutputStream;public class FileOutput {public static void output(String text,String fileName)throws Exception{File file = new File(fileName);FileOutputStream fos = new FileOutputStream(file);fos.write(text.getBytes());fos.close();}}④主函数package zhidao3_2;import javax.swing.JOptionPane;public class Main {public static void main(String[] args) {String srcFile = JOptionPane.showInputDialog("输⼊源⽂件");try{byte[] data = FileLoad.getContent(srcFile);TxtTrans tt = new TxtTrans();String dString = tt.trans(data);FileOutput.output(dString, "g:/result.txt");}catch(Exception ex){JOptionPane.showMessageDialog(null, "操作异常");System.exit(1);}JOptionPane.showMessageDialog(null, "翻译完毕");}}最后的项⽬结构如下:以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
中文转英文的函数
Java 中文转英文的函数
在 Java 中,可以使用 Google 翻译 API 来实现中文转英文的功能。
Google 翻译 API 提供了非常强大的机器翻译功能,可以支持多种语言之间的翻译。
以下是一个简单的 Java 函数,用于将中文文本转换为英文文本:
这个函数使用了 Google Cloud Translation API,需要先安装 Google Cloud SDK,并设置好相应的环境变量。
函数中定义了一个名为translate 的静态方法,它接受一个字符串参
数text,表示需要翻译的中文文本。
函数内部使用Translate 类来调用Google 翻译 API,将中文文本翻译成英文。
最后返回翻译后的英文文本。
需要注意的是,使用 Google Cloud Translation API 需要先在 Google Cloud Console 上创建一个项目并启用 Translation API 服务,同时需要配置好相应的环境变量和认证信息。
此外,由于 Google Cloud Translation API 是收费的,因此在使用时需要注意控制使用频率和用量,避免产生不必要的费用。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
abstract 抽象的 抽象的
abstraction 抽象体、抽象物、抽象性 抽象体、抽象物、抽象性
access 存取、取用 存取、访问
access level 存取级别 访问级别
access function 存取函式 访问函数
activate 活化 激活
active 作用中的
adapter 配接器 适配器
address 位址 地址
address space 位址空间,定址空间
address-of operator 取址运算子 取地址操作符
aggregation 聚合
algorithm 演算法 算法
allocate 配置 分配
allocator (空间)配置器 分配器
application 应用程式 应用、应用程序
application framework 应用程式框架、应用框架 应用程序框架
architecture 架构、系统架构 体系结构
argument 引数(传给函式的值)。叁见 parameter 叁数、实质叁数、实叁、自变量
part 零件、部件
singleton 单件
software 软件
work 工件、机件
● 单词「器」:
adapter 配接器
allocator 配置器
compiler 编译器
container 容器
iterator 迭代器
linker 连结器
listener 监听器
bitwise copy 以 bit 为单元进行复制;位元逐一复制 位拷贝
block 区块,区段 块、区块、语句块
boolean 布林值(真假值,true 或 false) 布尔值
border 边框、框线 边框
brace(curly brace) 大括弧、大括号 花括弧、花括号
bracket(square brakcet) 中括弧、中括号 方括弧、方括号
design by contract 契约式设计
design pattern 设计范式、设计样式 设计模式
※ 最近我比较喜欢「设计范式」一词
destroy 摧毁、销毁
destructor(dtor) 解构式 析构函数
device 装置、设备 设备
dialog 对话窗、对话盒 对话框
concrete 具象的 实在的
concurrent 并行 并发
configuration 组态 配置
connection 连接,连线(网络,资料库) 连接
constraint 约束(条件)
construct 构件 构件
container 容器 容器
(存放资料的某种结构如 list, vector...)
communication 通讯 通讯
compatible 相容 兼容
compile time 编译期 编译期、编译时
compiler 编译器 编译器
component 组件 组件
composition 复合、合成、组合 组合
computer 电脑、计算机 计算机、电脑
concept 概念 概念
program 程式
signature 标记式(签名式/署名式)
● 单词「件」:(这是个弹性非常大的可组合字)
assembly (装)配件
component 组件
construct 构件
control 控件
event 事件
hardware 硬件
object 物件
assignment operator 指派(赋值)运算子 = 赋值操作符
associated 相应的、相关的 相关的、关联、相应的
associative container 关联式容器(对应 sequential container) 关联式容器
atomic 不可分割的 原子的
attribute 属性 属性、特性
directive 指令(例:using directive) (编译)指示ቤተ መጻሕፍቲ ባይዱ
directory 目录 目录
disk 碟 盘
dispatch 分派 分派
distributed computing 分布式计算 (分布式电算) 分布式计算
分散式计算 (分散式电算)
document 文件 文档
binary tree 二元树 二叉树
binary function 二元函式 双叁函数
binary operator 二元运算子 二元操作符
binding 系结 绑定
bit 位元 位
bit field 位元栏 ? 位域
bitmap 位元图 ? 位图
bitwise 以 bit 为单元逐一┅ ?
base type 基础型别 (等同於 base class)
batch 批次(意思是整批作业) 批处理
benefit 利益 收益
best viable function 最佳可行函式 最佳可行函式
(从 viable functions 中挑出的最佳吻合者)
binary search 二分搜寻法 二分查找
class hierarchy 类别继承体系, 类别阶层 类层次体系
class library 类别程式库、类别库 类库
class template 类别模板、类别范本 类模板
class template partial specializations
类别模板偏特化 类模板部分特化
dot operator dot(句点)运算子 . (圆)点操作符
driver 驱动程式 驱动(程序)
dynamic binding 动态系结 动态绑定
efficiency 效率 效率
2008年02月15日 星期五 15:52
JAVA英文翻译表
● 单词「式」:
constructor 建构式
declaration 宣告式
definition 定义式
destructor 解构式
expression 算式(运算式)
function 函式
pattern 范式、模式、样式
containment 内含 包容
context 背景关系、周遭环境、上下脉络 环境、上下文
control 控制元件、控件 控件
console 主控台 控制台
const 常数(constant 的缩写,C++ 关键字)
constant 常数(相对於 variable) 常量
constructor(ctor) 建构式 构造函数
character 字元 字符
check box 核取方块 (i.e. check button) 复选框
checked exception 可控式异常(Java)
check button 方钮 (i.e. check box) 复选按钮
child class 子类别(或称为derived class, subtype) 子类
array 阵列 数组
arrow operator arrow(箭头)运算子 箭头操作符
assembly 装配件
assembly language 组合语言 汇编语言
assert(ion) 断言
assign 指派、指定、设值、赋值 赋值
assignment 指派、指定 赋值、分配
delegate 委派、委托、委任 委托
delegation (同上)
demarshal 反编列 散集
dereference 提领(取出指标所指物体的内容) 解叁考
dereference operator dereference(提领)运算子 * 解叁考操作符
derived class 衍生类别 派生类
data 资料 数据
database 资料库 数据库
database schema 数据库结构纲目
data member 资料成员、成员变数 数据成员、成员变量
data structure 资料结构 数据结构
datagram 资料元 数据报文
dead lock 死结 死锁
"克隆" 是个可接受的译词,
反正有 "拷贝" 为前例)
如果做为动词译为 "克隆"
做为名词时最好译为 "克隆件"
相映於 copy 之 "复件"
collection 群集 集合 ?
combo box 复合方块、复合框 组合框
command line 命令列 命令行
(系统文字模式下的整行执行命令)
(与class 同名的一种 member functions)
copy (v) 复制、拷贝 拷贝
copy (n) 复件, 副本
cover 涵盖 覆盖
create 创建、建立、产生、生成 创建
creation 产生、生成 创建
cursor 游标 光标
custom 订制、自定 定制
interpreter 直译器
translator 转译器/翻译器
● 单词「别」:
class 类别
type 型别
● 单词「化」:
generalized 泛化
specialized 特化
overloaded 多载化(重载)