zalex2815 的部落格

SOAP

簡單物件存取協定 (SOAP,全寫為Simple Object Access Protocol) 是一種標準化的通訊規範,主要用於Web服務(web service)中。SOAP的出現是為了簡化網頁伺服器(Web Server)在從XML數據庫中提取資料時,無需花時間去格式化頁面,並能夠讓不同應用程式之間透過HTTP通訊協定,以XML格式互相交換彼此的資料,使其與程式語言、平臺和硬體無關。此標準由IBM、Microsoft、UserLand和DevelopMentor在1998年共同提出,並得到IBM,蓮花(Lotus),康柏(Compaq)等公司的支持,於2000年提交給全球資訊網聯盟(World Wide Web Consortium;W3C),目前 SOAP 1.1 版是業界共同的標準,屬於第二代的XML協定(第一代具主要代表性的技術為XML-RPC以及WDDX)。

· SOAP封裝(envelop),封裝定義了一個描述消息中的內容是什麼,是誰發送的,誰應當接受並處理它以及如何處理它們的框架;

· SOAP編碼規則(encoding rules),用於表示應用程序需要使用的數據類型的實例;

· SOAP RPC表示(RPC representation),表示遠程過程調用和應答的協定;

· SOAP綁定(binding),使用底層協議交換信息。

XSLT

在電腦科學中,XSLT擴展樣式表轉換語言(Extensible Stylesheet Language Transformations)的簡稱,這是一種對XML檔案進行轉化的語言,XSLT中的T代表英語中的“轉換”(transformation)。它是XSL(Extensible stylesheet language)規範的一部分。XSL規範的另外一部分是XSL-FO(FO代表格式化對象Formatting Objects)。

XSLT是把XML檔案轉化為另一檔案的轉換語言,即將源檔案的所有數據或者部分數據,利用XPath進行選擇,生成另外的XML檔案或者其他可直接顯示或列印的文件格式(例如 HTML文件、RTF文件或者TeX文件)。XSLT語言是聲明性的語言,即XSLT程序本身只是包含了一些轉換規則的檔案。而這些規則可以被遞歸地應用到轉換過程中。XSLT處理程序會首先確定使用XSLT中的哪些規則,然後根據優先順序作出相應的轉換操作。

XSLT本身也是一份XML檔案,所以它也必須遵守嚴格的XML規範。其XML名稱空間http://www.w3.org/1999/XSL/Transform

除了XSLT外,還有另外一種轉換語言STX,這是一種旨在提供高速的低記憶體消耗的轉換語言。

 

DTD

XML文件的文檔類型聲明(document type declaration)可以看成一個或者多個XML文件的模板,在這裡可以定義XML文件中的元素、元素的屬性、元素的排列方式、元素包含的內容等等。

DTD (DATA TYPE DEFINE) 概念緣於SGML,每一份SGML文件,均應有相對應的DTD。對XML文件而言,DTD並非特別需要,well-formed XML就不需要有DTD。DTD有四個組成如下:

  • 元素(Elements)
  • 屬性(Attribute)
  • 實體(Entities)
  • 注釋(Comments)
  • 由於DTD限制較多,使用時較不方便,近來已漸被XML Schema所取代。

RSS

RSS是一種用於網上新聞頻道、網誌(weblogs)和其他Web內容的數據交換規範,起源於網景通訊公司(Netscape)的推送技術(push technology),將訂戶訂閱的內容傳送給他們的通訊協同格式(Protocol)。RSS可以是以下三個解釋的其中一個:

  • Really Simple Syndication(RSS 2.0)
  • RDF (Resource Description Framework) Site Summary(RSS 0.91, RSS 1.0)
  • Rich Site Summary (RSS 0.9 and 1.0)

但其實這三個解釋都是指同一種企業聯合組織(Syndication)的技術。

簡單來說,RSS 是一種格式規範,用來傳遞經常更新的網頁內容,例如Blog新聞資訊等。

XPath

XPath即為XML路徑語言(XML Path Language),它是一種用來確定XML文檔中某部分位置的語言。

XPath基於XML的樹狀結構,提供在資料結構樹中找尋節點的能力。起初 XPath 的提出的初衷是將其作為一個通用的、介於XPointerXSL間的語法模型。但是 XPath 很快的被開發者採用來當作小型查詢語言

最常見的XPath表達式是路徑表達式(XPath這一名稱的另一來源)。路徑表達式是從一個XML節點(當前的上下文節點)到另一個節點、或一組節點的書面步驟順序。這些步驟以「/」字元分開,每一步有三個構成成分:

  • 軸描述 (用最直接的方式接近目標節點)
  • 節點測試(用於篩選節點位置和名稱)
  • 節點描述(用於篩選節點的屬性和子節點特徵)

一般情況下,我們使用簡寫後的語法。雖然完整的軸描述是一種更加貼近人類語言,利用自然語言的單詞和語法來書寫的描述方式,但是相比之下也更加羅嗦。

 

最簡單的XPath如下:

  • /A/B/C

在這裡選擇所有符合規矩的C節點:C節點必須是B的子節點(B/C),同時B節點必須是A的子節點(A/B),而A是這個XML文檔的根節點(/A)。此時的這種描述法類似於磁碟中文件的路徑(URI),從盤符開始順著一級一級的目錄最終找到文件。

這裡還有一個複雜一些的例子,包含了全部構成成分:

  • A//B/*[1]

此時選擇的元素是:在B節點下的第一個節點(B/*[1]),不論節點的名稱如何(*);而B節點必須出現在A節點內,不論和A節點之間相隔幾層節點(//B);與此同時A節點還必須是當前節點的子節點(A,前邊沒有/)。

 

參考網址 http://zh.wikipedia.org/w/index.php?title=XPath&variant=zh-tw

Artificial Intelligence重點整理

Agent: A “device” that responds to stimuli from its environment

– Sensors

– Actuators

The goal of artificial intelligence is to build agents that behave intelligently

 

State Graph: All states and productions

Search Tree: A record of state transitions explored while searching for a goal state

– Breadth-first search

– Depth-first search

Heuristic: A quantitative estimate of the distance to a goal

Associative memory: The retrieval of information relevant to the information at hand

One direction of research seeks to build associative memory using neural networks that when given a partial pattern, transition themselves to a completed pattern.

Database Systems重點整理

A collection of data that is multidimensional in the sense that internal links between its entries make the information accessible from a variety of perspectives

 

Schema: A description of the structure of an entire database, used by database software to maintain the database

 

Subschema: A description of only that portion of the database pertinent to a particular user’s needs, used to prevent sensitive data from being accessed by unauthorized personnel

 

Database Management System (DBMS): A software layer that manipulates a database in response to requests from applications

 Database model: A conceptual view of a database

– Relational database model

– Object-oriented database model

Object-oriented Database: A database constructed by applying the object-oriented paradigm

– Each entity stored as a persistent object

– Relationships indicated by links between objects

– DBMS maintains inter-object links

In random access, a record can be accessed without having to retrieve any records before it. The address of the record must be known.

For random access of a record, an indexed file, consisting of a data file and an index, can be used.

In random file access, the index maps a key to an address, which is then used to retrieve the record from the data file.

 

Collision: The case of two keys hashing to the same bucket

– Major problem when table is over 75% full

– Solution: increase number of buckets and rehash all data

 

 

JSON

JSONJavascript Object Notation)是一種輕量級的資料交換語言,以文字為基礎,且易於讓人閱讀。盡管JSON是在Javascript的一個子集,但JSON是獨立於語言的本文格式,並且採用了關於C語言家族的一些習慣。

由於JSON在語法上是JavaScrip的子集合,所以一般都會使用eval()作為讀取資料的方式,這在JSON資料提供站台與使用站台都屬於可信賴時並不會有問題。但如果資料提供站台不在信任範圍內,將JavaScript程式碼嵌入JSON,則會造成安全上的問題。

JSONXML最大的不同在於XML是一個完整的標記語言,而JSON不是。這使的XML在程式判讀上需要比較多的功夫。主要的原因在於XML的設計理念與JSON不同。XML利用標記語言的特性提供了絕佳的延展性(如XPath),而JSON的重點在於資料的交換。

Programming Languages重點筆記

The only language understood by a computer is machine language.

Assembly Language Characteristics                                                                                                  1.One-to-one correspondence between machine
instructions and assembly instructions
– Programmer must think like the machine
2.Inherently machine-dependent
3.Converted to machine language by a program called an assembler

Converted to machine language by a program called a compiler

Data Types

• Integer: Whole numbers
• Real (float): Numbers with fractions
• Character: Symbols
• Boolean: True/false

Objects and Classes

• Object: Active program unit containing both data and procedures
• Class: A template from which objects are constructed
An object is called an instance of the class.

Components of an Object

• Instance Variable: Variable within an object – Holds information within the object
• Method: Procedure within an object – Describes the actions that the object can perform
• Constructor: Special method used to initialize a new object when it is first constructed

Encapsulation: A way of restricting access to the internal components of an object
– Private versus public

Inheritance: Allows new classes to be defined in terms of previously defined classes

Polymorphism: Allows method calls to be interpreted by the object that receives the call

 

Algorithm 重點筆記

An algorithm is an ordered set of unambiguous,executable stepsthat defines a terminating process.

A collection of primitives constitutes a programming language.

Polyas Problem Solving Steps                                                                      1.Understand the problem.                                                                           2.Devise a plan for solving the problem.                                                      3.Carry out the plan.                                                                                      4.Evaluate the solution for accuracy and its potential as a tool for solving other problems.  

Getting a Foot in the  Door                                                                                                             Try working the problem backwards
Solve an easier related problem
– Relax some of the problem constraints
– Solve pieces of the problem first (bottom up methodology)
Stepwise refinement: Divide the problem into
smaller problems (top-down methodology)   

Sorting, a process to order data, is a basic algorithm.

Selection sort, bubble sort, and insertion sort are
commonly used sorting algorithms.

Searching, a process to locate a target in a list of data,
is a basic algorithm.

Sequential search is used for unordered lists.

Binary search is used for ordered lists.

Recursion                                                                                                       The execution of a procedure leads to another
execution of the procedure.                                                                                 Multiple activations of the procedure are
formed, all but one of which are waiting for
other activations to complete.

Algorithm  Efficiency                                                                                                              Measured as number of instructions executed
Big theta notation: Used to represent efficiency
classes
– Example: Insertion sort is in Θ(n2)
Best, worst, and average case analysis

Dynamic Programming vs. Divide-and-Conquer                                               Similarity
• The instance of a problem is divided into smaller instances.
– Differences
• Divide-and-Conquer
– Top-Down
– Blindly solves the divided instances by using recursion.
– Inefficient when the divided instances are related.
– Inefficient when the divided instances are almost as large as the
original instance.
• Dynamic Programming
– Bottom-Up (solve small instances first, store the results, and later,
whenever we need a result, look it up instead of recomputing it.)
– Programming (the use of an array in which a solution is constructed.)

The Greedy Approach                                                                                                                                                             Philosophy
– A greedy algorithm arrives at a solution by making a
sequence of choices, each of which simply looks the best at
the moment (locally optimal).
• Like Dynamic Programming, Greedy Algorithms are
often used to solve Optimization Problems.
– However, Greedy Algorithms do not guarantee an optimal
solution.
• No Division is required.