【转】给Tomcat配置HTTPS访问

 

转载自 http://blog.csdn.net/binyao02123202/archive/2011/01/30/6169723.aspx

由于配置CAS的单点登陆系统,需要先配置Tomcat 的SSL, 在配置tomcat的SSL过程中,我配置的版本是tomcat5.5.20,参考了很多资料,但发现一直不行,后来我换到了5.5.9,结果非常顺利,我于是换了总共4个主要版本,发现SSL的配置还真有些不同,现在我将这些配置记录下来,供下次参考。


参考文档

Keytool使用指南:

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html

Tomcat-ssl配置指南:

http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html

配置过程

1. 生成 server key :[生成keystore文件]

以命令行方式切换到目录%TOMCAT_HOME%,在command命令行输入如下命令(jdk1.4以上带的工具):

keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore -validity 3600

用户名输入域名,如localhost(开发或测试用)或hostname.domainname(用户拥有的域名),其它全部以 enter 跳过,最后确认,此时会在%TOMCAT_HOME%下生成server.keystore 文件。

[这一步对于使用httpclient这样的客户端来请求相当重要,因为再验证证书时是需要检查证书中的name和请求的域名是否相同的,CAS里面客户端就爱遇到这种问题。http://hi.baidu.com/qq295361921/blog/item/489945d174d4f387a1ec9cfb.html]

注:参数 -validity 指证书的有效期(天),缺省有效期很短,只有90天。

2.  将证书导入的JDK的证书信任库中:

这步对于Tomcat的SSL配置不是必须,但对于CAS SSO是必须的,否则会出现如下错误:edu.yale.its.tp.cas.client.CASAuthenticationException: Unable to validate ProxyTicketValidator。。。

导入过程分2步,第一步是导出证书,第二步是导入到证书信任库,命令如下:

keytool -export -trustcacerts -alias tomcat -file server.cer -keystore  server.keystore -storepass changeit

[从server.keystore中导出server.cer ,这里的密码是server.keystore的密码]

keytool -import -trustcacerts -alias tomcat -file server.cer -keystore  %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit

[将server.cer 导入keystore文件cacerts中 ,cacerts是jre自带的keystore文件,注意这里的密码是cacerts的密码,原始密码是changeit]

如果有提示,输入Y就可以了。

其他有用keytool命令(列出信任证书库中所有已有证书,删除库中某个证书):

keytool -list -v -keystore D:/sdks/jdk1.5.0_11/jre/lib/security/cacerts

keytool -delete -trustcacerts -alias tomcat  -keystore  D:/sdks/jdk1.5.0_11/jre/lib/security/cacerts -storepass changeit

3.  配置TOMCAT :

修改%TOMCAT_HOME%\conf\server.xml,以文字编辑器打开,查找这一行:

xml 代码

将之后的那段的注释去掉,并加上 keystorePass及keystoreFile属性。

注意,tomcat不同版本配置是不同的:

Tomcat4.1.34配置:

xml 代码

  1.  
  2.    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" 
  3.            port="8443" enableLookups="true" scheme="https" secure="true" 
  4.            acceptCount="100" 
  5.            useURIValidationHack="false" disableUploadTimeout="true" 
  6.            clientAuth="false" sslProtocol="TLS"   
  7.            keystoreFile="server.keystore"   
  8.            keystorePass="changeit"/> 

Tomcat5.5.9配置:

xml 代码

  1. <Connector port="8443" maxHttpHeaderSize="8192"
  2. maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  3. enableLookups="false" disableUploadTimeout="true"
  4. acceptCount="100" scheme="https" secure="true"
  5. clientAuth="false" sslProtocol="TLS"
  6. keystoreFile="server.keystore"
  7. keystorePass="changeit"/>
Tomcat5.5.20配置(此配置同样可用于Tomcat6.0):

xml 代码

  1. <Connector protocol="org.apache.coyote.http11.Http11Protocol"
  2. port="8443" maxHttpHeaderSize="8192"
  3. maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  4. enableLookups="false" disableUploadTimeout="true"
  5. acceptCount="100" scheme="https" secure="true"
  6. clientAuth="false" sslProtocol="TLS"
  7. keystoreFile="server.keystore"
  8. keystorePass="changeit"/>
Tomcat6.0.10配置:

xml 代码

  1. <Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
  2. port="8443" minSpareThreads="5" maxSpareThreads="75"
  3. enableLookups="true" disableUploadTimeout="true"
  4. acceptCount="100" maxThreads="200"
  5. scheme="https" secure="true" SSLEnabled="true"
  6. clientAuth="false" sslProtocol="TLS"
  7. keystoreFile="D:/tools/apache-tomcat-6.0.10/server.keystore"
  8. keystorePass="changeit"/>

tomcat6支持3种,请参考以下文档:

http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

验证配置

访问 https://localhost:8443/

<connector protocol="org.apache.coyote.http11.Http11NioProtocol"></connector>

Continue reading 【转】给Tomcat配置HTTPS访问

it-e-42 Algorithm Design and Implementation

This course introduces a set of fundamental design principles and problem-solving techniques
for the construction and implementation of computer algorithms. Problem solutions are developed
in a design language such as Pseudocode and then coded in a high-level structured programming
language. (Consult the Computer Science Department for the language currently in use.) Topics
such as problem specification, top-down design with stepwise refinement, standard data types,
control structures, subprograms, modular design, and parameter passing are presented through a
study of specific example algorithms. Style, documentation, solution robustness, and conformance
with specifications are emphasized throughout.
Prerequisites: High school algebra I & II.

The purpose of this course is to present a coherent set of tools and techniques for the
development of computer solutions to simple problems in data manipulation and report
generation. Upon completion of the course, a student should be able to: analyze a problem
statement for completeness and clarity; use the method of top-down, modular, structured design
to develop a hierarchy chart (structure chart) and a set of Pseudocode modules for a problem
solution; convert this solution into source code in the designated high-level language in
accordance with a well-defined set of style rules; debug and test the program; and provide clear
documentation for the result.

the "problem-solving universe"
operational definition of computer (specifically, electronic digital stored-program
computer)
components of a typical computer
fundamental computer capabilities (read, write, store, compute, compare)
formulating precise specifications for a problem and its solution
preconditions and post conditions

specification of user requirements in measurable terms
tools for algorithm development
algorithm design languages (Pseudocode, flowcharts)
top-down design and stepwise refinement (including contrast with bottom-up
design)
structure charts (hierarchy charts)
subprograms (procedures, functions) and the modular design of algorithms
standard control structures:
sequence, decision, loop (pre-test, post-test, count- controlled), module
nested control structures
decision tables, decision trees
identifiers, variables, constants, expressions
typing and structuring of data
standard data types:
numeric (integer vs. real)
character, character string
boolean
file type (for sequential text files)
record types
array types
primitive data structures:
simple variables
record variables
arrays
character strings
some common algorithmic techniques
the Initialize/Process/Terminate (IPT) paradigm
file operations (create, open, close, read, write)
sequential processing of data records
end-of-file testing
report generation (headers, footers, page breaks, simple control breaks)

use of counters and accumulators
numeric computations (evaluating formulas, generating sequences, printing
tables)
exchanging (swapping) data values
complex decisions and branching
testing and validating data
use of 'flag' variables
finding maximum and minimum values
array manipulations (filling, summing, searching, printing)
uses of record variables
communication between modules:
formal parameters, arguments, parameter passing, inheritance
coding algorithms in a high-level language
overall structure of a program (including stylistic layout)
internal and external documentation
nesting of procedures and functions
declarations, formal parameter lists
file variables and file operations
input/output (keyboard and file)
translation of standard control structures
arithmetic expressions
assignment statements, type compatibility
boolean expressions
implementing an algorithm on the computer
transcribing a pseudocode algorithm into a programming language
log-in procedures, customizing the account
creating a source file
compiling the program; compilation errors
generation of test data
executing the program; run-time (execution) errors

 

1, stepwise  ['step,waiz]
adv. 逐步地;阶梯式地

2, clarity  ['klæriti]
n. 清楚,透明

3, refinement  [ri'fainmənt]
n. 精致,高尚,精巧

4, arithmetic  [ə'riθmətik, ,æriθ'metik]
n. 算术,算法

Continue reading it-e-42 Algorithm Design and Implementation

it-e-41 Some Rules for Well-drawn Flow Charts

Well-drawn flow charts are easy to read. Here are a few rules for well-drawn flow charts:
Every flowchart has a START symbol and a STOP symbol.
The flow of sequence is generally from the top of the page to the bottom of the page. This
can vary with loops which need to flow back to an entry point.
Use arrow-heads on connectors where flow direction may not be obvious.
There is only one flow chart per page.
A page should have a page number and a title.
A flow chart on one page should not break and jump to another page.
A flow chart should have no more than around 15 symbols (not including START and
STOP).

Continue reading it-e-41 Some Rules for Well-drawn Flow Charts

web 工具 资源

模板教程综合:

http://pixelcurse.com

模板:

http://www.freecsstemplates.org/

http://templates.arcsin.se/

http://www.stylishtemplate.com/demos/web-template-4426/

http://www.nuviotemplates.com/preview.php?template=simplify-02

http://demo.tutorialzine.com/freebies/free-xhtml-css3-website-template/template.html

http://cssremix.com/

 

扁平UI设计

http://www.gbin1.com/tools/design/20130422-free-flat-ui-design/

 

批量获取css里面的图片

http://www.sswowo.com/getcssimages/

在线编辑html,css,javascript:

http://jsfiddle.net/

http://jsbin.com

http://cssdesk.com/

在线文档分享:

https://app.asana.com

颜色选择器:

http://colorschemedesigner.com/

http://www.techfrom.com/2879.html

免费图标:

http://www.softicons.com/

1、中文图标搜索 http://www.iconpng.com/

2、http://www.fasticon.com/

3、http://dryicons.com/

4、http://www.icotrip.com/

5、提供搜索http://www.icones.pro/

6、国外图标http://weloveicons.com/

7、图标搜索 http://www.iconfinder.com/

9、http://www.freeiconsdownload.com/

10、http://www.freeiconsweb.com/

飘零雾雨css中文手册: http://css.doyoe.com/

 

开发工具:

http://blog.bingo929.com/cheat-sheets-for-web-develop.html

我精选的cheet sheet:

jquery cheetsheet http://www.futurecolors.ru/jquery/

php cheetsheet http://www.cheatography.com/davechild/cheat-sheets/php/

正则 cheetsheet http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

正则在线测试 http://regexpal.com/

linux http://www.cheatography.com/davechild/cheat-sheets/linux-command-line/

mod_rewrite http://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/

 

禅意花园工具集:

http://www.mezzoblue.com/zengarden/resources/

 

禅意花园:

http://www.csszengarden.com

 

css3

http://www.iteye.com/news/25360

 

MarkMan

– 马克鳗 可以很方便的为设计稿添加标记,双击、滚轮、拖动… http://www.getmarkman.com/

 

 

Sublime Text 2

这个是文本编辑器,不过很牛x http://www.iplaysoft.com/sublimetext.html

Continue reading web 工具 资源

html标记判断IE版本的方法

详情看msdn文档http://msdn.microsoft.com/en-us/library/ms537512.aspx

   1. <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
   2. <!--[if IE]> 所有的IE可识别 <![endif]-->
   3. <!--[if IE 5.0]> 只有IE5.0可以识别 <![endif]-->
   4. <!--[if IE 5]> 仅IE5.0与IE5.5可以识别 <![endif]-->
   5. <!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 <![endif]-->
   6. <!--[if IE 6]> 仅IE6可识别 <![endif]-->
   7. <!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
   8. <!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
   9. <!--[if IE 7]> 仅IE7可识别 <![endif]-->
10. <!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
11. <!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]—>

但是这个好像在ie9中无效。

Continue reading html标记判断IE版本的方法

base64数据和@font-face

本文介绍的是边角料技术base64数据和@font-face,因为它们用的比较少。

base64:

先看看这样的样式

div {
width:100px;
height:100px;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAABlBMVEX/AAAAAP9sof2OAAAAIUlEQVR4nGNgGAWjgFTw//8HJF4Dg8CI5aGGxCgYBcQBAMULD/2Zt2wmAAAAAElFTkSuQmCC);
}

另外还可以这样写:

<img src="data:image/png;base64, 
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/ 
//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U 
g9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC"/>

其中

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAABlBMVEX/AAAAAP9sof2OAAAAIUlEQVR4nGNgGAWjgFTw//8HJF4Dg8CI5aGGxCgYBcQBAMULD/2Zt2wmAAAAAElFTkSuQmCC

定义了一张背景图片,而这张图片使用base64编码格式直接嵌入到样式表里面了。

其优点:

1:放在css里面很容易做到缓存效果,大部分应用都是基于这个考虑。

2:css可使用gzip压缩。

3:减少请求次数。

但是缺点如下:

1:ie8以上才支持base64编码。要ie7以下支持,也不是没办法,看这篇文章

2:这样的方式不好重用。

3:放在css里面的话会造成大数据量,css没下载完之前,其他样式也没显示出来。

4:很麻烦。

附base64编码工具

 

@font-face

@font-face {
	font-family: Delicious;
	src: url('Delicious-Roman.otf');
}

FF3.5以上以及其他浏览器都支持这种写法,但是在格式上有区别

ie支持.eot (Embedded OpenType) 和.ote

其他支持TrueType 和OpenType (.ttf, .otf)

也可以配合base64格式

@font-face{
font-family: Gentium;
src: url("data:font/
truetype;base64,…");
}

Continue reading base64数据和@font-face

HTML5 Quick Learning Guide

这是由freehtml5templates.com写的一片关于html5排版的文章,你可以在他的网站上找到许多html5排版的免费模板。

HTML5 Quick Learning Guide
Just what you need to know to quickly
move from HTML / XHTML to HTML5
Brought to you by
http://freehtml5templates.com/
Licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License
HTML5 syntax is compatible with both HTML4 and XHTML1. Want to close
empty elements with a slash? Go for it. Rather not? Then don't. Want to use
lower case? Upper case? Take your pick. In other words, you really don't have
to change the way you handle these things, so don't worry, ok?
HTML5 doctype is much simpler:
New way:
<!doctype html>
Old ways:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Meta charset tag is much simpler:
New way:
<meta charset="UTF-8">
Old way:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-
8" />
Divs are now used for styling rather than structure; HTML5 includes several
new structural elements that help define parts of the document. Let's take a
look at the main new structural elements that you'll probably use right away.
(Note that included in the head is an HTML5 shiv that allows us to style elements in IE,
and a basic CSS style is also included so we can help browsers that aren't caught up yet to
render the new block-level elements as block-level elements. For now, it's easiest just to
automatically include them. Understanding why can come later.)
Licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License
Main Structural Elements You'll Use Most Often in HTML5
<header>
<nav>
<section>
<article>
<aside>
<footer>
Although these sound like “positions” in a document, and very often will be
used in that way, they really are about grouping and not positioning. You might
have 3 <sections> in a page, with each <section> having its own <header> and
<footer> for instance. (Note that these elements – like classes – can be used
more than once on a page).
But to keep things simple, for this document's purpose, let's just think of a
very basic document that contains a top header, a menu for navigation, a
content section that contains a couple of articles, a sidebar, and a footer.
In HTML4 or XHTML, you probably would have used divs, classes and ids to
group each of those areas. You can and should still use divs, classes and ids for
styling reasons, but they may no longer be as necessary as before for
structural purposes. Some documents may be able to get by without them
completely, while most will probably still need them for styling. But again, for
the purposes of learning the quick facts to create a simple HTML5 document,
let's keep this really basic.
Here's a simple way to code a very basic document that contains a top header,
a menu for navigation, a content section that contains a couple of articles, a
sidebar, and a footer in HTML5.
Licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Very Basic Document</title>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>header, footer, section, aside, nav, article {display: block;}</style>
</head>
<body>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</nav>
<header>
<h1><a href="#">Very Basic Document</a></h1>
<h2>A tag line might go here</h2>
</header>
<section>
<article>
<h3><a href="#">First Article Title</a></h3>
<img src="images/flower.jpg" alt="flower">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. </p>
</article>
<article>
<h3><a href="#">Second Article Title</a></h3>
<img src="images/tree.jpg" alt="tree">
<p>Praesent libero. Sed cursus ante dapibus diam.</p>
</article>
</section>
<aside>
<h4>Connect With Us</h4>
<ul>
<li><a href="#">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ul>
</aside>
<footer>
<p>All rights reserved.</p>
</footer>
</body>
</html>
Licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License
As you can see, the structure is fairly simple, and you can style these new
structural elements in the CSS. However, because you may have some of these
structural elements within different groupings on a page (such as several
sections having different headers and footers), you may want to style each
differently. In that case, you can still assign ids and classes just as you would
in HTML4 or XHTML.
The point of the structural elements is to designate structure after all;
presentation is dealt with in the CSS in whatever manner works best for you,
using ids and classes.
So what are the actual definitions of these new structural elements?
<header> represents a group of introductory or navigational aids. (Things
you'd usually wrap in a H1, H2, Hx, etc)
<nav> represents a section of the document intended for navigation. (Like a
menu)
<section> represents a generic document or application section. It can be
used together with the h1, h2, h3, h4, h5, and h6 elements to indicate the
document structure. (Just a logical grouping such as a content section)
<article> represents an independent piece of content of a document, such as
a blog entry or newspaper article. (Independent is the key word here. If the
piece of content could make sense plucked out of this document and placed
somewhere else, it's probably an article)
<aside> represents a piece of content that is only slightly related to the rest
of the page. (Usually a sidebar, but could be another type of content that
isn't directly related to the main content)
<footer> represents a footer for a section and can contain information about
the author, copyright information, et cetera. (You know, like... a footer)
Of course, HTML5 comes with other interesting elements such as the video and
audio elements, plus new and changed elements and attributes, but all of
those belong in a separate cheat sheet. This one is to get you up and running
fast, so there you have it. Just the basics that will let you quickly move from
HTML4 or XHTML to HTML5 right now!
Licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License
If you want to delve into the finer points, I recommend starting with the W3C
draft, entitled HTML5 differences from HTML4 located at
http://dev.w3.org/html5/html4-differences/
This document created by http://freehtml5templates.com/
We'd love to have you follow us at http://twitter.com/html5templates and
please bookmark and share our site within your social networks (twitter,
facebook, stumbleupon, delicious, etc).
Feel free to share this document with others, keeping in mind that
this document is licensed under the Creative Commons
Attribution-Noncommercial-No Derivative Works 3.0 United
States License (http://creativecommons.org/licenses/by-ncnd/
3.0/us/).
Share it; don't sell it. Share it; don't change it.
Pretty simple, yes? :)
Licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License

文章可以转载,但是必须遵循Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United
States License

可以分享不能修改,不能用于商业。

概要:

简明的声明方式

<!doctype html>

<meta charset="UTF-8">
新增结构标签

<header>注意不是<head>

<nav>导航
<section>文档部分,例如第一部分,第二部分
<article>文章,数据应该在这部分显示(Independent数据独立性)
<aside>边,预祝内容无关的元素
<footer>页脚

而div将由原来的排版转向样式用途。

Continue reading HTML5 Quick Learning Guide

it-e-40 Algorithms and Flowcharts

The computer scientist Niklaus Wirth stated that:
Programs = Algorithms + Data
The algorithm is part of the blueprint or plan for the computer program; an algorithm is:
"An effective procedure for solving a problem in a finite number of steps."
It is effective, which means that an answer is found and it finishes, that is it has a finite
number of steps. A well-designed algorithm will always provide an answer, and it may not be the
answer you want but there will be an answer. It may be that the answer is that there is no answer.
A well-designed algorithm is also guaranteed to terminate.
The key features of an algorithm are:
Sequence (also known as Process),
Decision (also known as Selection)
Repetition (also known as Iteration or Looping)
In 1964 the mathematicians Corrado Bohm and Guiseppe Jacopini demonstrated that any
algorithm can be stated using sequence, decision and repetition. The work of Bohm and Jacopini
was of great importance since it eventually led to the disciplines of structured program design
that are much used today.
Sequence means that each step or process in the algorithm is executed in the specified order.
In an algorithm each process must be in the correct place, otherwise the algorithm will most
probably fail.
The Decision constructsIf ... then, If ... then ... else ...
In algorithms the outcome of a decision is either true or false, and there is no in between.
The outcome of the decision is based on some condition that can only result in a true or false
value[1].
The decision takes the form: if proposition then process
A proposition in this sense is a statement, which can only be true or false. It is either true
that today is Wednesday or false that today is Wednesday. It can't be both true and false. If the
proposition is true then the process, which follows the then, is executed.
The decision can also be stated as:
if proposition
then process1
else process2
This is the if ... then ... else ... form of the decision. This means that if the proposition is true

then execute process1 else or otherwise execute process2.
The first form of the decision if proposition then process has a null else, that is, there is no
else.
The Repetition constructsRepeat and While
Repetition takes two forms, the Repeat loop and the While loop.
The repeat loop is used to iterate or repeat a process or sequence of processes until some
condition becomes true. It has the general form:
Repeat
Process1
Process2
ProcessN
Until proposition
The repeat loop does some processing before testing the state of the proposition.
The while loop is used to iterate or repeat a process or sequence of processes while some
condition becomes true. It has the general form:
While proposition
Process1
Process2
ProcessN
The while loop tests the state of the proposition first.
There are four different ways of stating algorithms: Step-Form, Pseudocode, Flowchart, and
Nassi-Schneiderman.
The first two are written forms. The written form is just normal language.[2]A problem with
human language is that it can seem to be imprecise. In terms of meaning, what I write may not be
the same as what you read.[3]Pseudocode is also human language but tends toward more precision
by using a limited vocabulary.
The last two are graphically-oriented, that is they use symbols and language to represent
sequence, decision and repetition.
Flow charts are a graphical method of designing programs and once
the rules are learned they are very easy to draw. A well-drawn flow chart
is also very easy to read.
The major symbols are the DECISION (also known as selection)
and the SEQUENCE (or process) symbols. The START and STOP symbols are called the
terminals. The SUBPROCESS symbol is a variation on the sequence symbol.

1, imprecise  [,impri'sais]
adj. 不精确的;不严密的;不确切的

Continue reading it-e-40 Algorithms and Flowcharts

使用jni调用unrar

rar的官方网站 上有使用各种语言调用unrar.dll解压缩的例子,但是没有使用java的jni的例子。
笔者使用jni写了一个类Unrar,提供最常用的两个功能,解压缩和列出文件信息。

7月28号更新了,原因是有人实验有的rar文件使用junrar报异常,但是winrar是可以打开的,我检查了这个文件
发现解压缩后再用winrar压缩再用junrar解压缩是可以的,说明是原来的文件压缩不规范,unrar报的异常是
“File is not valid RAR archive” 我也做不了别的,只是将这个异常反映到java异常信息中。

jniunrar下载链接

unrar with jni, a java library

Continue reading 使用jni调用unrar

Pagination


Total views.

© 2013 - 2022. All rights reserved.

Powered by Hydejack v6.6.1