Sunday, October 24, 2010

Command line "" and "-" symbol represents the meaning of



If the end of the line is that it is not our end, the following line, and the Bank was a means.

- Is the option to start a letter option generally used - at the beginning, a number of letters to use - at the beginning.

"" If after the carriage return, line feed, then do not be omitted; But if the other characters, it can not be omitted.

"" Tell the system followed by the characters as intended, not an order.

For example there is the file name with spaces, it is necessary add a space before the "."







Recommended links:



Free from INTERFERENCE, I use parental controls Assistant Ada



CSS Syntax Guide (4) text fill, borders, boundaries and location of the property (2)



MKV To Zune



Ma: I thank the days of no money



How To Find Out Everything About A Person Just By



"NBA 2K10" My Player mode simple process



M2TS to MKV



XviD to MP4



Good HTML Tools



Wang Yukun: Power in the Union Heavy Industry "butterfly"



National Social Security Card Can Break The Ice In The Yangtze River Delta Region



Insurance Goes To Focus On Risks And Preventive Measures



Investment Tools Specialist



Picked Games Kids



Wednesday, October 20, 2010

Instant Messaging SPI translation


Break the language barrier! This article describes how to use the Lotus Workplace Instant Messaging SPI to create real-time translation chat session, so that the two understand each other's languages can communicate with each other.
Today, instant messaging has largely ubiquitous. For some people, it is a basic e-mail as communication tools, especially in the need for timely response to the occasion. With the online in more and more aware applications (such as IBM Workplace products) in common use, instant messaging will become more and more popular.

Of course, all human means of communication, even talk face to face, must face a basic fact: We do not speak the same language. In today's multi-national composition of the world, many of us still need to take into account the language barrier. This communication is often a challenge, particularly in must be clear, when the rapid exchange of information. If you use instant messaging with others, chat functions, when each message to "immediately" be translated automatically to the receiver of the native form of presentation, this not a good idea? Just a few years ago, this feature also seems like science fiction, but now, this function is very easy to achieve together, this article describes how to implement this functionality.

This article discusses the IBM Workplace Instant Messaging Service Provider Interface (SPI) for use. Instant Messaging SPI is the IBM Workplace Products API Toolkit part, developers can use it to build instant messaging program, in a message intercepted before it reached the receiver. The most common function of this SPI is the message log. But also enables other features such as message translation. (In the annex can see the complete sample code.)

This article assumes that you are an experienced Java developer, and on the IBM Workplace Products API Toolkit have some knowledge about. On the introduction of this Toolkit, please see the developerWorks: Lotus article, "IBM Workplace portlet to add presence awareness." Can also visit the IBM Workplace resource center.

Workplace Instant Messaging SPI servlets
You can use Workplace Instant Messaging SPI application as a servlet deployed in WebSphere Portal application server instance. The servlet should be configured to start automatically when the application server instance of the load. In the init () method, servlet itself as a listener to the Instant Messaging Service in. Similarly, when the servlet destroyed, but also a listener from the Messaging Service to remove the servlet. Because this is an event listener, so servlet must implement the onMessage method passing the message to the receiver before the call. Information and records of all translation work should be dealt with in this way.

The rest of this article explains how to create a simple message handler, which extends the previously added to the Purchase Order portlet (described in this article) in the chat. The handler will use the WebSphere Translation Server in the message before they reach the receiver to translate. Our goal is to explain the development of a treatment program and its instant messaging integrated into IBM Workplace Collaborative Services solution is so simple. This example can be extended, before the implementation of the translation consider the use of configuration information, of course, is not the scope of this article series. (For example, the message handler can be translated into the receiving party stored in the LDAP server's preferred language.)

Note: The following steps assume that you are using IDE, have some understanding of J2EE applications, such as WebSphere Studio Application Developer V5.1 or IBM Rational Application Developer V6.0. It should also be installed with English and Spanish translation engine IBM WebSphere Translation Server. (In the following examples assume that you are using Rational Application Developer.)

Create instant messaging program
Open development environment such as IBM Rational Application Developer (RAD) V6.0, create a new Dynamic Web Project, will be named IMTranslatorProj (Figure 1). If you are using IBM RAD V6.0, so be sure to set Web project deployment target WebSphere Application Server V5.0.

Figure 1. Create a dynamic Web project


To use Instant Messaging SPI and the WebSphere Translation Server API, you must be able to access lwpapi25_imspi.jar and wts.jar file. These two JAR files into Web project WebContent WEB-INF lib folder (see Figure 2). (Download and unzip the toolbox, you can find in the directory lwpapi25imspilib lwpapi25_imspi.jar file. Wts.jar file to install WebSphere Translation Server is located in the directory.)

Figure 2. Lwpapi25_imspi.jar and wts.jar file


In the project to create a new servlet, name it IMTranslator. The servlet should also include a init () and destroy () method (which may need to manually input). Add the following code to the servlet code to the start position for the introduction of the correct package:

import com.ibm.workplace.services.messaging .*; import com.ibm.lt. *; to receive news of events MessagingListener servlet must implement the interfaces. The servlet class definition was revised to:

public class IMTranslator extends HttpServlet implements Servlet, MessagingListener (Now, a new servlet code should be as follows (ignore the error, because you will be in the next step to correct it):

import java.io.IOException;
import javax.servlet .*;
import javax.servlet.http .*;
import com.ibm.workplace.services.messaging .*;
import com.ibm.lt. *;
public class IMTranslator extends HttpServlet implements Servlet, MessagingListener (
public IMTranslator () (
super ();
)
protected void doGet (HttpServletRequest arg0, HttpServletResponse arg1) throws
ServletException, IOException (
)
protected void doPost (HttpServletRequest arg0, HttpServletResponse arg1) throws
ServletException, IOException (
)
public void init (ServletConfig arg0) throws ServletException (
)
public void destroy () (
)
)

To achieve MessageListener interfaces, servlet must provide the onMessage () method implementation. The method is passed to the receiver in the message before the call. Add in the servlet onMessage () method, the code is as follows (depending on the environment should change the value of translation server host name):

public byte [] onMessage (
String fromPresentityId,
String fromContactId,
java.util.Collection toPresentities,
java.util.Collection toContacts,
String sessionId,
String contentType,
byte [] data)
(
String msg = new String (data);
String convertedMsg = msg;
try
(
/ / Translation server hostname
String hostname = "portal14.dfw.ibm.com";
/ / Convert from english to spanish
String fromto = "enes";
/ / Connect to server and submit translation request
LTinterface service =
(LTinterface) LTengine.GetService (hostname, fromto);
Object handle = service.jltBeginTranslation ("* format = text");
convertedMsg = service.jltTranslate (handle, msg);
service.jltEndTranslation (handle);
)
catch (Throwable t)
(
System.out.println (t.getMessage ());
t.printStackTrace ();
)
return convertedMsg.getBytes ();
)

The servlet event notification message itself must be registered as a Messaging Service listener. In servlet's init () method to complete this operation, the method called when you first load the servlet. To the init () method to add the appropriate code, as follows:

public void init (ServletConfig arg0) throws ServletException (
MessagingService messagingService = MessagingServiceFactory.getMessagingService ();
if (messagingService == null) (
System.err.println ("IMTranslator: Messaging Service is NULL");
return;
)
messagingService.addMessagingListener (this);
)

In the unloaded servlet, you should monitor the program from the Messaging Service to delete this servlet. Can servlet's destroy () method to complete this operation, the method called before unloading the servlet. To destroy () method to add the appropriate code, as follows:

public void destroy () (
MessagingService messagingService = MessagingServiceFactory.getMessagingService ();
if (messagingService == null) (
System.err.println ("IMTranslator: Messaging Service is NULL");
return;
)
messagingService.removeMessagingListener (this);
)

By default, servlet request in the first start. The servlet will quietly deal with messages, so the application should be configured to start automatically be loaded. To this end, we should open the deployment descriptor file (web.xml) to open the Servlet tab, then select the Load On Startup options box and save the changes (see Figure 3).

Figure 3. Load on Startup option


Save the changes, will be exported to WAR files Web project. In IBM Rational Application Developer, you can right click project and select Export through to complete this operation. Then select the WAR file, click Next. In the input file name, click Finish to complete the export operation.

Web application WAR file should be deployed in WebSphere Portal IBM Workplace services application server instance. Through http:// : 9091/admin access WebSphere Application Server Administrative Console. Login navigate to the Applications Install New Application. Select the previous step to export the WAR file, enter / IMTranslator as the context root. Click Next to continue behind the operation. Follow the wizard's prompts to install the Web application. In wizard step 1 and 2, accept the default settings. Step 3 (mapping module to the application server), Web application will be mapped to WebSphere Portal application server (Figure 4):

Figure 4. Mapping modules to application servers


After the wizard finishes, you can see a message, this application has been successfully installed. Select "Save to master configuration" link and click the Save button to save your changes.

Instant messaging program running
To start IMTranslator instant messaging program, first navigate to Applications Enterprise Applications. Select IMTranslatorProj application and click the Start button. Status symbols (status symbol) of the changes that the application has been started. With the handling procedures for the WebSphere Portal information recorded in the standard output and standard error log file, the file is located in C: / WebSphere / PortalServer / log directory.

Start the message processing program, you can open a chat session with another user. English message to the receiver before the pass will be translated into Spanish and vice versa. For example Figure 5 shows the message:

Figure 5. Spanish news


Content displayed to the recipient as shown in Figure 6:

Figure 6. Translated into English news


Addressed before the application can be further expanded, according to a message recipient's preferred language (usually stored in the LDAP server) to be translated.

Conclusion
Workplace Products API Toolkit in the Instant Messaging SPI allows developers to send a message to the receiver before the acquisition and processing of the message, so you can complete the message record, monitor and translation of such features. This paper describes the use of Rational Application Developer V6.0 to create this type of development environment to achieve MessagingListener interface servlet, to instant messaging needs from English into Spanish steps. In the servlet's init () method will be added for registration as a Messaging Service servlet listener code. destroy () method contains the code to delete servlet listener. To achieve MessageListener interfaces, servlet must implement the call in a message delivered before the onMessage () method. Using IBM WebSphere Translation Server translation message needed business logic is handled in this method. Finally, we will install the servlet to the WebSphere Portal application server instance.

In short, this is a fairly easy to achieve together the application. But this is not a complex servlet in a multilingual environment may be useful, Instant Messaging SPI can be used as an example of the power.

We hope this can give you help. For clarity, keep this example simple, but you can in their own instant messaging application, creativity, achieve more.






Recommended links:



Shanghai Caohejing Property CMC Fast New Way To Communicate



Compare Reference Tools



Sun executives hefty pay Increase for 2006, six times the most high



Real to MP4



Name enterprises HR Field coaching "candidates"



Free online fax services to send fax by email



MKV to VOB



Analysis of Taobao in 2008 to adjust the CAUSES and effects of B2C strategy



3GP to FLV



Decade of embarrassing the Chinese game



Another PAIR of eyes CMMI [2]



MP4 standard expected by the end of line introduced to avoid repeating the mistakes MP3



Easy Compilers And Interpreters



Saturday, October 9, 2010

Why not read the disk drive?


The author of this two-day drive failure, when the CD into the CD-ROM drive tray is always coming and going after the busy, I went after it by force, not out running, despite the drive light is still blinking but can not properly read the disk. I guess cause trouble for two reasons: first, because they drive the aging, decreased ability to read the disk; or is something wrong with system software, because these days computer viruses and other malicious code has not had time to clear, I think that has to cross the a few days time for handling it, did not expect was a chance to solve this difficult problem.

Two days ago, my PC is not on the LAN together, the instructions of the green card is not on, I would open the case to remove the card to check the results to open the case and found the back of the drive 4-pin power plug is seated loosely scattered scattered behind in the drive. So, I unplug the 4 pin power connector plug tight handle the situation when the network card, boot into the system, then put in discs, just listen to "brush" and read the disk voice, data disc is smoothly identified, no optical drive tray is always coming and going non-stop annoying scene, and drive the problem to be solved in unintentionally.

Summary: The CD-ROM into the computer because I did not tighten the screws after, so pull the whole drive, it may put the back of the 4-pin power plugs get loose, and they have not completely out, the resulting optical light show鏈夌數锛屼絾渚涚數涓嶈冻閫犳垚鍏夐┍涓嶈兘姝e父浣跨敤锛屼娇浜轰骇鐢熶簡閿欒鐨勫垽鏂?鍍忔垜绛変範鎯?DIY鈥濊?涓?畾瑕佸皬蹇冮伩鍏嶆绫婚棶棰橈紝浠ュ厤褰卞搷姝e父浣跨敤銆?br />





相关链接:



Screen Savers Specialist



MKV to Zune



FAQ: The Difficult Cases To Solve Foobar



Wang Haibo: Society world partners, with 10 000 win



YUV to AVI



Tencent intensified defendant who copied the crime portal



VS 2010 Beta1 and Silverlight have to say something



Specialist Dial Up And CONNECTION Tools



Brief File Sharing Or Peer to Peer



Own Way To The Poor Poorer Between-MP3 And Tape Transcription DIY



How to avoid price war



Health And Nutrition for YOU



AVI to DivX



SOFTWARE289



Pocket Baidu claims 10 million downloads have been pushed Android version has Expired