Nội dung đề tài: Sử dụng hệ thống dịch tự động Anh-Việt để dịch tự động văn bản tiếng Anh ra văn bản tiếng Việt. Từ văn bản tiếng Việt này, hệ thống tiến hành rút bộ từ khóa và đưa vào bộ máy tìm kiếm Google để rút ra tập liên kết đến các văn bản có chứa bộ từ khóa này. Từ các văn bản tìm kiếm được, chương trình tiến hành đánh giá mức độ tương đồng giữa hai văn bản để xác định văn bản có khả năng cao nhất là văn bản dịch của văn bản tiếng Anh ban đầu.
Saturday, January 12, 2008
Tìm kiếm tự động văn bản song ngữ Anh-Việt từ Internet
Nội dung đề tài: Sử dụng hệ thống dịch tự động Anh-Việt để dịch tự động văn bản tiếng Anh ra văn bản tiếng Việt. Từ văn bản tiếng Việt này, hệ thống tiến hành rút bộ từ khóa và đưa vào bộ máy tìm kiếm Google để rút ra tập liên kết đến các văn bản có chứa bộ từ khóa này. Từ các văn bản tìm kiếm được, chương trình tiến hành đánh giá mức độ tương đồng giữa hai văn bản để xác định văn bản có khả năng cao nhất là văn bản dịch của văn bản tiếng Anh ban đầu.
Sunday, January 6, 2008
SOA - Kiến trúc định hướng dịch vụ
Service Oriented Architecture
Áp dụng kiến trúc hướng dịch vụ cho hành chính công
Service.Oriented.Architecture.in.C.Sharp.2005.2nd.Edition.Aug.2006.pdf
Phần mềm đang ngày càng trở nên phức tạp quá mức và dường như đang vượt khỏi khả năng kiểm soát của các mô hình phát triển hiện có. Có một kiến trúc phần mềm mới được kỳ vọng là chìa khóa giải quyết vấn đề phức tạp này...
SOA là gì?
Dịch vụ là yếu tố then chốt trong SOA. Có thể hiểu dịch vụ như là hàm chức năng (mô-đun phần mềm) thực hiện qui trình nghiệp vụ nào đó. Một cách cơ bản, SOA là tập hợp các dịch vụ kết nối 'mềm dẻo' với nhau (nghĩa là một ứng dụng có thể 'nói chuyện' với một ứng dụng khác mà không cần biết các chi tiết kỹ thuật bên trong), có giao tiếp (dùng để gọi hàm dịch vụ) được định nghĩa rõ ràng và độc lập với nền tảng hệ thống, và có thể tái sử dụng. SOA là cấp độ cao hơn của phát triển ứng dụng, chú trọng đến qui trình nghiệp vụ và dùng giao tiếp chuẩn để giúp che đi sự phức tạp kỹ thuật bên dưới.
Thiết kế SOA tách riêng phần thực hiện dịch vụ (phần mềm) với giao tiếp gọi dịch vụ. Điều này tạo nên một giao tiếp nhất quán cho ứng dụng khách (client) sử dụng dịch vụ bất chấp công nghệ thực hiện dịch vụ. Thay vì xây dựng các ứng dụng đơn lẻ và đồ sộ, nhà phát triển sẽ xây dựng các dịch vụ tinh gọn có thể triển khai và tái sử dụng trong toàn bộ quy trình nghiệp vụ. Điều này cho phép tái sử dụng phần mềm tốt hơn, cũng như tăng sự linh hoạt vì nhà phát triển có thể cải tiến dịch vụ mà không làm ảnh hưởng đến ứng dụng client sử dụng dịch vụ.
Thật ra triết lý SOA không hoàn toàn mới, DCOM và CORBA cũng có kiến trúc tương tự. Tuy nhiên, các kiến trúc cũ ràng buộc các thành phần với nhau quá chặt, ví dụ như các ứng dụng phân tán muốn làm việc với nhau phải đạt được 'thỏa thuận' về chi tiết tập hàm API, một thay đổi mã lệnh trong thành phần COM sẽ yêu cầu những thay đổi tương ứng đối với mã lệnh truy cập thành phần COM này.
Ưu điểm quan trọng nhất của SOA là khả năng kết nối "mềm dẻo" (nhờ sự chuẩn hóa giao tiếp) và tái sử dụng. Các dịch vụ có thể được sử dụng với trình client chạy trên nền tảng bất kỳ và được viết với ngôn ngữ bất kỳ. (Ví dụ, ứng dụng Java có thể liên kết với dịch vụ viết trên nền .NET và ngược lại).
SOA dựa trên 2 nguyên tắc thiết kế quan trọng:
- Mô-đun: Tách vấn đề lớn thành nhiều vấn đề nhỏ.
Đóng gói: Che đi dữ liệu và lô-gic trong từng mô-dun (hay 'hộp đen') đối với truy cập từ ngoài.
SOA và OOP: Không loại trừ nhau
SOA sử dụng cùng một số nguyên lý như OOP, tuy nhiên triết lý SOA có khác biệt đáng kể so với OOP. SOA có thể thực hiện với cả chương trình theo hướng đối tượng (OO) và chương trình không hướng đối tượng.
Ví dụ, xét đoạn mã sau:
Orders orders = customers[0].Orders;
Order order = orders.Add('ORDER001', customerData.Customers[0]);
Order.Lines.Add(new Product('53XYPR0D8', 2);
Orders.Save(); // Nếu việc cập nhật không được thực hiện theo thời gian thực.
Dịch vụ đóng vai trò như 'hộp đen': cung cấp một lớp trung gian cho mô hình đối tượng và đưa ra tập chức năng rút gọn, làm giảm nhu cầu trao đổi giữa các lớp.
Đoạn mã ví dụ trên được thực hiện theo kiến trúc SOA như sau:
OrderData orderData = new OrderData();
OrderEntity order = orderData.Orderss.Add('ORDER001',customerData.Customers[0].CustomerID);
Order.Lines.Add('53XYPR0D8', 2);
CustomerService.AddOrders(orderData);
SOA và WebService (dịch vụ Web): Không phải là một
Về cơ bản, SOA là kiến trúc phần mềm phát xuất từ định nghĩa giao tiếp và xây dựng toàn bộ mô hình ứng dụng như là mô hình các giao tiếp, hiện thực giao tiếp và phương thức gọi giao tiếp. Giao tiếp là trung tâm của toàn bộ triết lý kiến trúc này; thực ra, tên gọi "kiến trúc định hướng giao tiếp" thích hợp hơn cho SOA. Dịch vụ và module phần mềm nghiệp vụ được truy cập thông qua giao tiếp, thường theo cách thức yêu cầu - đáp trả. Ngay cả với yêu cầu dịch vụ 1 chiều thì nó vẫn là yêu cầu trực tiếp có chủ đích từ một phần mềm này đến một phần mềm khác. Một tương tác định hướng dịch vụ luôn bao hàm một cặp đối tác: nguồn cung cấp dịch vụ và khách hàng sử dụng dịch vụ.
Định nghĩa cơ bản của dịch vụ web dựa trên một nền tảng khác: Tập hợp các công nghệ WSDL (Web Services Description Language), SOAP (Simple Object Access Protocol) và UDDI (Universal Description, Discovery ang Integration), cho phép xây dựng các giải pháp lập trình cho vấn đề tích hợp ứng dụng và truyền thông điệp. Theo thời gian, các công nghệ này có thể hoàn thiện hay có thể được thay bằng công nghệ khác tốt hơn, hiệu quả hơn hay ổn định hơn. (Hiện tại thì các công nghệ này làm việc tốt và hiệu quả).
Rõ ràng, theo định nghĩa thì dịch vụ web là đặc tả công nghệ còn SOA là triết lý thiết kế phần mềm. Dịch vụ web đưa ra giải pháp kỹ thuật để thực hiện SOA, nhưng SOA cũng có thể thực hiện với các giải pháp kỹ thuật khác không phải dịch vụ web (và không phải tất cả dịch vụ web đều có kiến trúc SOA). Tuy vậy, SOA và dịch vụ web có mối quan hệ tương hỗ: sự phổ biến của dịch vụ web giúp thúc đẩy sự phát triển của SOA, và kiến trúc tốt của SOA sẽ giúp dịch vụ web thành công.
Tương lai cho SOA
Tháng 5 vừa qua (2006), BEA đưa ra sáng kiến Liquid Computing hỗ trợ dịch vụ web và SOA. Cũng trong tháng 5, IBM đã khai trương 4 trung tâm nghiên cứu và triển khai SOA tại Austin (Mỹ), Beijing (Trung Quốc), Delhi (Ấn độ) và Hursley (Anh). Các trung tâm này sẽ hỗ trợ cho công việc của IBM Global Services SOA Centers of Excellence. Như đã đề cập ở phần trên, phiên bản HĐH Windows thế hệ kế tiếp, tên mã Longhorn, sẽ hỗ trợ đầy đủ SOA với công nghệ tích hợp Indigo. Và SOA còn được sự ủng hộ của nhiều hãng tên tuổi khác như Sun, Oracle ... Theo Gartner, trong khoảng 2 năm nữa, SOA sẽ hiện diện trong hầu hết các dự án phần mềm.
SOA sẽ giúp cho công việc phát triển phần mềm trở nên dễ dàng và nhanh chóng hơn. 'Đừng tốn công chế tạo lại bánh xe', hãy kết hợp những linh kiện (dịch vụ) có sẵn và bổ sung những gì cần thiết để 'lắp ráp' nhanh chóng 'chiếc xe' đưa bạn đến đích. Đó là triết lý của SOA! Ngay từ bây giờ bạn có thể áp dụng triết lý này cho các hệ thống phần mềm của mình để sẵn sàng cho những nhu cầu của ngày mai.
THAM KHẢO:
Realizing a SOA with .NET (15 seconds)
The Case for Developing a SOA (IBM)
Getting a little Closer to SOA (DotNetGuru)
SOA Ushers in the Next Era in Business Software Engineering (Gartner Research)
(Theo PCWorld-VN)
Hiện thực hóa kiến trúc SOA với .NET
This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.
The Potential of Web Services
So why all the hype? Web Services obviously have great potential. It's a way to integrate at many different levels. Consider this example. A single consumer application (perhaps interacting with your company over the Internet) wants to engage the company in some business process. To facilitate that business process, the company internally invokes processing that spans two discreet systems (A and B). However, through a service-oriented architecture, the entire end-to-end business process is exposed to the consumer application as a single service.
Figure 1. Exposing separate LOB applications as a single service.
A good architecture emphasizes a separation of responsibilities. For example, the presentation tier manages presentation components; the business logic tier manages business logic components; and the data access tier manages data access components.
This separation provides for fault tolerance, easier maintenance, and future-proofing. A good service-oriented architecture is nothing new, just a smart way of separating (and exposing) a component's responsibilities. It builds on classic object-oriented (OO) ideas.
In a service-oriented architecture, clients consume services, rather than invoking discreet method calls directly. In a 3-tier model (Figure 2), objects are marshaled across process boundaries through the proxy/stub techniques we know from COM. This provides benefits such as location transparency. The same techniques are used in .NET Remoting via channels and sinks. The basic philosophy is that one tier should only communicate with the tier contiguous to it.
One disadvantage to object-orientation at an architectural level is the number of communication links. Client code is responsible for traversing complex object models and understanding details about domain-specific logic. In a service-oriented model, we introduce a further "layer of indirection". This alleviates some of the pain associated with traversing complex object models. The services layer, denoted below in Figure 3 by the cloud, provides black-box functionality.
Figure 2. A typical 3-tier application architecture
Figure 3. A service-oriented application architecture
In a service-oriented design, services should be course-grained. Course-grained services are modeled after and align to business processes.
Objects should be fine-grained and align to real business entities. These discreet objects provide the detailed business logic. Specificity is good when building discreet business objects. This is also a very successful way to codify organizational knowledge. Each business object is responsible for its own behavior and business rule implementation, such as updating a database table, sending an email, or placing a message on a queue.
Services provide the orchestration of the detailed business objects to expose a full service to the consumer. Services are responsible for orchestrating calls to discreet business objects, managing the responses, and acting accordingly. Service methods may invoke and manage several business objects.
Service methods align to business processes by design. Class methods align to detailed object-level operations by design.
Consider the following example in Figure 4. Notice we have a Web service called BookStoreService and a Web method called orderBook(). This single Web method instantiates and manages 3 separate objects, Book, Order, and OrderDetail.
Figure 4. Designing services and objects.
Minimize Roundtrips
A design goal should be to design services to minimize round-trips. This was true with COM and it continues to be true with .NET and Web Services.
Recall in classic n-tiered distributed architectures that conventional wisdom said it was better to move 1000 bytes across process boundaries 1 time, rather than moving 1 byte across 1000 times. We would optimize method signatures and design stateless components, and we would use database helper routines to convert ADO recordsets to XML to provide a lightweight payload for distributed applications.
With SOAP and Web Services, we generally see the same approach. However, we need to take it one step further. We should now consider using the Web Service as a service, not just a data pump, and XML as a self-describing package, not just a payload.
Align Web Methods to Forms
Web methods should be designed to perform an entire service for an entire form. In short, our design goals are:
Provide a course-grained Web method at the form level
Have the Web method invoke whatever business objects it needs
Return to the consumer the whole service result, like a DataSet with numerous tables within it
Consider the following example. We may be designing a search form to search a bookstore for certain titles. To support this search screen in this figure, we would design a Web method called GetSearchScreenInfo which returns a DataSet that has a number of tables within it. This Web Method is designed to provide all the information the form needs to draw itself on the load event.
Figure 5. Align service methods to forms
Behind the scenes, our web method is invoking and managing all the business objects it needs to satisfy the request.
Moving Data Between Tiers
Data can be moved between architectural tiers as DataSets, serialized objects, raw XML, etc. -- but design your solution to be consumed. DataSets are .NET specific objects that serialize nicely but are intended for other .NET applications. If your application needs to interoperate with, for example, a J2EE solution, DataSets may be too troublesome to employ because the J2EE side would not readily understand a DataSet.
Serializing business objects is also an option. But remember that the full object is not marshaled. The object's public properties and data members are serialized and shipped, but the calling client cannot re-inflate the object and access its private data members or methods.
XML is, of course, an obvious choice also. XML formatted exchanges are a solid and proven technique for moving data around any distributed architecture.
Distributed Transactions
Web methods can act as the root of a distributed transaction. These transactions are managed by the Distributed Transaction Coordinator (DTC). Our Web Service classes must reference the System.EnterpriseServices namespace, and can then use the ContextUtil class to use the SetAbort() and SetComplete() methods. This provides for declarative transaction control.
Each object enlisted by the Web method is a child object and will participate in the transaction and "vote" on the outcome. This provides the best fit for keeping objects granular enough to manage their own data from a persistent store, while still allowing them to be orchestrated by a transaction-root controller.
Transactional context is managed by the root. Web Methods must be adorned with the TransactionOption attribute, something like this:
Exception Handling
The caller would need to catch that exception, like this:
Figure 6. Throwing exceptions over a SOAP connection.
On the client, SoapExceptions should be caught for any middle-tier exceptions. This is useful for throwing exceptions from the middle tier application logic. However, ANY middle tier exceptions will be thrown as a SoapException.
We can encode the inner exception to be business-problem specific information we need. As an example, we can pass a SoapException with a meaningful message, such as "Database access error", so that the client can deal with it.
Next the client should catch WebExceptions. This is useful when the network goes down in the middle of an end-user's session.
Finally, the client must catch client-side exceptions. These are thrown by client-side processing, and are something local to client, like FileNotFound.
Conculsion
The key messages to take away from this discussion about constructing .NET applications in a service-oriented architecture are as follows:
Service-oriented architecture is rooted in object-orientation but adds a layer of abstraction. I like to think that service-orientation is not a departure from object-orientation, but rather an evolution. Services orchestrate calls to discreet business objects to satisfy requests. Objects are enlisted, behind the scenes, to formulate a response.
The openness of the technologies is exciting and easy to use. The current industry work on standards around UDDI, WSDL, Web Services, etc. promises that more and more applications can be constructed from constituent services rather than re-invented domain-specific code.
The statelessness of the technologies can be a challenge for performance heavy applications. Be aware of the non-functional requirements of the solution you want to build. Sometime line-of-business applications desire long-running transactions that are better suited to other distributed application technologies.
Design your solution for Web Services - you will have different approaches than you would for Remoting or DCOM. Again, remember that service-orientation is appropriate for some business applications, but not all. A service-oriented architecture is one possible architecture pattern to consider when designing solutions.
(Chip Irek)
Saturday, November 24, 2007
Cảm nhận một chiều cuối tuần
Mùa đông về trong những xác lá bàng đỏ tía, mùa đông về trong tiếng gió ùu, trong tiếng suýt xoa, mùa đông về trong nỗi nhớ, nỗi nhớ về một nơi, về một mùa,về một người.
Tôi còn nhớ ngày trươc, lúc cái tuổi học sinh đó có biết lạnh là gì đâu. Vào những mùa cuối năm bao giờ cũng lạnh, tiết trời của gió mùa đông bắc. Thế nhưng vẫn hồn nhiên áo phong phanh đến trường. Mẹ la: "Con mặc áo vào chứ không người ta lại nói là mình không có nỗi cái áo để mặc". Bạn bè lại nói: "Trời thế này không lạnh hay sao mà ăn mặc thế?". Mà đúng là có lạnh đấy chứ, nhưng tôi lại thích cái lạnh đó, thích được gió lạnh quét qua người và mình lại cảm nhận được cái cảm giác đó, và chợt thất rùng mình mỗi khi có cơn gió lạnh đi qua.
Giờ đây cuộc sống đã thay đổi nhiều, tất bật và sôi động hơn nhiều. Mỗi chúng ta cũng già đi để lại những cái lạnh ngày nào không được cảm nhận như ngày trước. Giá như, giá như...... tôi lại được đến trường trong cái giá lạnh của ngày xưa, trong cái hồn nhiên của ngày nào để thấy cuộc sống thật dịu dàng, thật thi vị...
Wednesday, November 21, 2007
Vì sao phụ nữ Nhật “lười” sinh con?
- Xu thế phổ biến ở các nước nước phát triển, phụ nữ ngày càng làm việc nhiều hơn và kết hôn muộn hơn.
- Những lo lắng về tài chính: tình hình tài chính của các cặp vợ chồng trẻ thậm chí có thể tệ hơn vì nhiều phụ nữ bỏ việc sau khi có con, đôi khi là bất đắc dĩ do hoàn cảnh. Một số cơ quan không sẵn sàng "giữ chỗ" cho những người sắp làm mẹ.
Lúc tôi còn thực tập tại Tokyo, chúng tôi cùng chơi thể thao chung với một nhóm nhân viên cùng lứa tuổi 30 tại đó. Trong khi các nam VN đều đã lập gia đình thì các cô gái Nhật Bản thì chưa hề có ý nghĩ đến chuyện đó. Và các cô này luôn thắc mắc là tại sao thanh niên VN lập gia đình sớm thế. Rõ ràng ở cái tuổi 30 đối với nam ở VN thì cũng là bình thường, nữ thì sẽ sớm hơn nữa, trong khi đó lứa tuổi này tại Nhật vẫn hoàn toàn chưa nghĩ tới chuyện gia đình.
Rõ ràng là gánh nặng gia đình vẫn còn đè trên đôi vai người phụ nữ tại Nhật, chính vì thế nên đã đưa họ đến quyết định lập gia đình muộn hơn và kéo theo tỷ lệ sinh cũng giảm và đất nước đón nhận ít trẻ em hơn.
URL:
Vì sao phụ nữ Nhật “lười” sinh con?
Tỷ lệ sinh của Nhật thấp kỷ lục
Tuesday, November 20, 2007
Những điều em chưa nói
(Thế giới Phụ Nữ)
Thursday, August 30, 2007
Phương pháp học tập ở bậc Đại học
Tôi nhận được những chia sẽ này trong một bài nói chuyện về phương pháp học tập ở bậc ĐH, tôi xinh chia sẽ mọi người.
1. Tự học
® Ghi chép: ở lớp, ở thư viện, ở các seminars, ở viện bảo tàng, khi đi tham quan… và tập quan sát và ghi nhận thông tin
® Tìm tài liệu: qua sách báo, trên internet; trong thư viện của trường; ở nhà… à tập nhận biết và chọn lọc thông tin
® Đọc tài liệu: đọc ý chính, đọc nhanh và nắm bắt ngay nội dung, gạch dưới những ý chính trong tài liệu à tập phân loại thông tin
® Tóm tắt tài liệu/thông tin: chỉ ghi những ý cần thiết, tránh dài dòng à tập diễn đạt ngắn gọn và xúc tích
2. Học tập theo nhóm
® Lập lịch họp nhóm
® Phân công giữa các thành viên
® Ghi chép và trao đổi thông tin
® Tranh luận và bảo vệ ý kiến
® Tham khảo chuyên gia hoặc giảng viên
3. Thực tập
® Nhận giấy giới thiệu và liên hệ nơi thực tập
® Tuân thủ nội quy thực tập/làm việc tại đơn vị
® Quan sát, học hỏi kinh nghiệm và nêu thắc mắc, không ngại khó
® Viết báo cáo
