Monday, August 31, 2009
sounds path of Viewlet builder
Then i create a new slide with the modification inside. but i didn't wanna speak it again. So i tried to find out the one recorded in the original first slide and use that directly on my new slide.
After searching, the sounds were recorded with mp3 format and stored in the directory:
C:\Documents and Settings\<user>\Local Settings\Temp\qarbon\ViewletBuilder6 Professional_6191\documents\<viewlet_name>_qvp
Friday, August 28, 2009
Clear the cached data of popup component in ADF Faces
In this project, i popped up a dialog to upload the document into Oracle UCM with self-defined metadata set on the check in form.
Each time after i check in content once in that popup dialog, i reopened it up and found the previous input were still kept there.
How to solve this problem? After going through all the properties of popup component, i found there is a property called contentDelivery, which its default value is lazy.
Here are the explanation of values of this property :
- lazy -- the default strategy described above. The content isn't loaded until you show the popup once, but then is cached.
- immediate -- load the content onto the page immediately, so it displays as rapidly as possible. Use this for popups that are certain to be used by all users every time they use this page.
- lazyUncached -- the content isn't loaded until you show the popup, and then is re-fetched every subsequent time you show the popup. Use this strategy if the popup shows data that can become stale.
For example:
<af:popup id="noteWindow" contentdelivery="lazyUncached">
...
</af:popup>
For more info, please refer to the following document:
http://www.oracle.com/technology/products/adf/adffaces/11/doc/adf-richclient-api/tagdoc/af_popup.html
Tuesday, July 7, 2009
Pass parameters to the timer in C#
In C#, there are 3 kinds of timer type definitions:
1. System.Windows.Forms.Timer
2. System.Threading.Timer
3. System.Timers.Timer
In my project, I choose to use the third one: System.Timers.Timer
Here is the sample usage of this kind of timer:
System.Timers.Timer timer = new System.Timers.Timer();
timer. Interval = 10000; // set the interval as 10000 ms
timer.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_Elapsed); // set the event to execute
timer.AutoReset = true; // false: only execute once
timer.Enabled = true; // to decide if execute the event of timer specified
…
public void timer_Elapsed(object sender, EventArgs e)
{
…
}
From the above sample, we know it is quite easy to use it.
Next, I have a problem if I need pass some parameters to be used in the timer event defined above: timer_Elapsed(…). The two input parameters of this event interface are fixed, you can’t add more in.
There is a tricky to achieve it. Since we can’t add more input parameters in this event, we can set the parameters into the unused property of that sender object. This way is simple, but not good.
After researching, i find a better way to deal with it: creating a new timer to extend the system timer , and then defining the additional parameters inside this new timer.
Here are the sample codes:
// define a class to extend the timer,
// then define those additional parameters to be used in the event.
// for example: add one more parameter: param1.
namespace XXX
{
public class TaskTimer : Timer
{
private string param1;
public string Param1
{
get
{
return param1;
}
set
{
param1= value;
}
}
public TaskTimer() : base()
{
}
}
}
// usage of this timer
using XXX;
…
TaskTimer timer = new TaskTimer();
timer.Interval = 10000;
…
// the event definition
public void timer_Elapsed(object sender, EventArgs e)
{
String param1 = (TaskTimer) sender).Param1;
…
}
Thursday, June 11, 2009
RIDC - New Connector to Oracle UCM
Originally, Oracle UCM exposes two kinds of interfaces to be used:
1. SOAP Web Service
2. Content Integration Suite (CIS)
Remote Intradoc Client (RIDC) is new in latest release.
In contrast with both CIS and SOAP, the RIDC connector is very lightweight and simple to use. There's no WSDL or J2EE bloat at all; RIDC is just a "Plain Old Java Object" wrapper around UCM web services... so it's very easy to embed in a Java application.
To get started, download the most recent version of the Content Integration Suite from Oracle. This ZIP file contains two folders: one for the new RIDC connector, and one for the standard CIS connector. I'd suggest you take a look at the "ridc-developer-guide.pdf" before you go any further. The samples and JavaDocs are also very useful, but you can peruse them later.
Basically, it's a very simple API in which you create and open a connection with UCM, build up a dataset, and call a service. The data is then returned to you that you can map to java objects to act upon.
The hardest part is to figure out what services in UCM to call and what parameters to pass. You'd better to bookmark our Services Reference Guide for those information.
Before using it, copy the RIDC library "oracle-ridc-client-10g.jar" to the java project.
Here are some sample snippets:
(1) Create and Open a connection to UCM
//arguments needs to connect to UCM
String idcConnectionURL = "idc://localhost:4444";
String username = "sysadmin";
String password = "idc";
//Create the IdcClient
IdcClientManager clientManager = new IdcClientManager ();
IdcClient client = clientManager.createClient (idcConnectionURL);
IdcContext userContext = new IdcContext(username, password);
(2) Ping Server
//Create the DataBinder and populated it with needed information for
//the service call
DataBinder dataBinder = client.createBinder ();
dataBinder.putLocal ("IdcService", "PING_SERVER");
//Join the binder and the user context and perform the service call
ServiceResponse response = client.sendRequest (userContext, dataBinder);
//Convert the response to a dataBinder
DataBinder responseData = response.getResponseAsBinder ();
//Display the status of the service call
System.out.println (String.format("Ping Server response: %s", responseData.getLocal ("StatusMessage")));
UCM and WCI integration
There are several ways to achieve it:
1. Deploying CPS portlets provided by UCM: you have to install the CIS before deploying those portlets
2. Gateway the UCM pages in WCI: there are always some problems especially on javascript, which disables some functions of it.
3. Embed the UCM pages in WCI through iframe
4. Developing the custom portlets for those UCM functions like check in, search etc.
Thursday, June 4, 2009
Unreadable data through Oracle SAP Adapter
After checking the whole environment, we noticed that the JVM of OC4J Container running SAP Adapter doesn't contain the encoding parameter.
Here we made the below changes on OC4J JVM settings:
-Dfile.encoding=UTF-8
Then it worked properly.
Thursday, February 5, 2009
如何测试和调试Apache服务器
Apache是运行在Linux操作系统上的头号Web服务器。很多小地方都可以用来调整Apache的性能,并降低它对系统资源的影响。其中一个就是调整内存使用率,当然达到这一目的可能还是需要花点功夫的。
例如,通过ps来确定httpd线程的内存使用率,可以输入下面的命令:
# ps -U apache -u apache u
USERPID %CPU %MEMVSZRSS TTYSTAT START TIME COMMAND
apache130670.05.3 149704 54504 ?SOct071:53 /usr/sbin/httpd -f /etc/httpd/conf/httpd.conf -DAPACHE2
...
上面这段输出显示了单个httpd进程使用了50 MB的RSS(驻留集大小)内存(或者非交换物理内存),以及149 MB的VSZ(虚拟)内存。这当然在很大程度上取决于你在Apache里加载和运行的模块数量。这决不是一个固定的数字。由于这个数字里还包含了共享库包,所以不是100%的准确。我们可以认为RSS数字的一半是httpd线程真正使用的内存数,这可能还有点保守,但是离我们的目的已经非常接近了。
在本文里,我们假设每个httpd进程都在使用了27 MB内存。然后,你需要确定可以让httpd真正使用的内存数。根据运行在机器上的其他进程,你可能希望要求50%的物理内存都供Apache使用。在一个装有1GB内存的系统上,就有512MB的内存可以被划分为多个27MB的内存,也就是大约19个并发的httpd内存。有些人坚持认为每个httpd 线程“真正”使用大约5MB的内存,所以从理论上讲你可以把512MB的内存划分出102个并发进程供Apache使用(要记住的是,除非你的网站需要极其巨大的流量,否则这种情况是非常罕见的)。
在默认状态下,Apache会分配最大256个并发客户端连接,或者256个进程(每一个都对应一个请求)。按照这种设置,一个流量巨大的网站会在顷刻间崩溃(即使你假设每个进程占用5MB内存,那也需要1.3GB的内存来满足请求的数量)。如果不采取其它措施,系统会通过硬盘来尝试使用交换空间以处理它无法在物理内存中完成的任务。
其他可以调整的项目包括KeepAlive、KeepAliveTimeout和MaxKeepAliveRequests等设置。可以放在httpd.conf文件里的推荐设置有:
ServerLimit 128MaxClients 128
KeepAlive On
KeepAliveTimeout 2
MaxKeepAliveRequests 100
通过将KeepAliveTimeout从15秒减到2秒,可以增加MaxClients命令;19太小,而128要好得多。通过减少进程存活的秒数,你可以在相同的时间内允许更多的连接。
当然,如果没有真正的测试在背后支持,数字就是毫无意义的,这就是ab的作用之所在。使用ab对Apache配置文件(MaxClients等于 256、ServerLimit等于256、KeepAliveTimeout等于15)进行调整,使其能够满足1000个请求(100个连续请求并发产生)的调整方法如下。(在执行测试的时候要确保服务器上有一个终端打开以观察系统的负载。)
$ ab -n 1000 -c 100 -k http://yoursite.com/index.php现在把上面的服务器设置改为更加保守的设置,重新启动Apache,试着再次测试(总是从远程计算机上进行,而不是本机)。
在这里的测试中,不同的设置导致执行所消耗的时间产生了一倍的差距(分别为27.8s和16.8s),但是负载的平均值为0.03和0.30。这可能会使得你的网站变得稍慢,但是会确保它不会在高负载的情况下崩溃。还要记住的是,你将需要进行多次测试,以便取得一个平均值。
使用ab是测试调整Apache配置的一个极佳方法,应该在你每次做出影响性能的更改时使用它。