XHTML MP MIME Types and File Extension

MIME Types


The following three MIME types can be used for XHTML MP documents:




  1. application/vnd.wap.xhtml+xml



  2. application/xhtml+xml



  3. text/html



The MIME type specified by the Open Mobile Alliance [OMA] for XHTML MP documents is “application/vnd.wap.xhtml+xml”. This MIME type is required for some WAP browsers (for example, some Nokia Series 60 browsers) to display XHTML MP documents correctly.


Another choice is the “application/xhtml+xml” MIME type. It is the MIME type for XHTML Family document types.


The “text/html” MIME type is also a possible choice. It is the MIME type of HTML documents. Using “text/html” for XHTML MP documents has the benefit that your XHTML MP pages will be viewable on ordinary web browsers without any problems. (Some web browsers like IE 6 do not show documents with MIME types “application/vnd.wap.xhtml+xml” or “application/xhtml+xml” but will bring up a dialog box to let you open the file in an external program or choose a location to save the file.) The drawback is that the user agent will not treat your XHTML MP pages as XML documents, which means the user agent may not complain even if the markup code does not follow strictly the XML rules.


Choosing MIME Types Dynamically


Another option is to detect the MIME types that can be handled by a user agent and choose the MIME type dynamically. For example, if your server finds out that a certain user agent can handle the “application/vnd.wap.xhtml+xml” MIME type, then all your XHTML MP documents will be delivered as “application/vnd.wap.xhtml+xml” to this user agent.


To choose the MIME type dynamically, you need to write a few lines of code using a server-side scripting language (e.g. ASP, JSP, Perl, PHP). The pseudo-code is shown below:




  1. Obtain the accept header value of the HTTP request received. The accept header contains all MIME types that can be handled by the client user agent that sends the request.



  2. If the accept header value contains “application/vnd.wap.xhtml+xml”, set the MIME type of the XHTML MP document to “application/vnd.wap.xhtml+xml”.
    Else if the accept header value contains “application/xhtml+xml”, set the MIME type of the XHTML MP document to “application/xhtml+xml”.
    Else set the MIME type of the XHTML MP document to “text/html”.


The following example demonstrates how to use JSP to write the code. If you use a server-side technology other than JSP, the code will be slightly different but the idea is the same.




<%
String acceptHeader = request.getHeader(“accept”);

if (acceptHeader.indexOf(“application/vnd.wap.xhtml+xml”) != -1)
  response.setContentType(“application/vnd.wap.xhtml+xml”);
else if (acceptHeader.indexOf(“application/xhtml+xml”) != -1)
  response.setContentType(“application/xhtml+xml”);
else
  response.setContentType(“text/html”);
%>




Here are some descriptions of the above JSP code:


1. The accept header value is obtained from the HTTP request. It is then stored in the variable acceptHeader.




String acceptHeader = request.getHeader(“accept”);




2. After that, the variable acceptHeader is checked to see if it contains the words “application/vnd.wap.xhtml+xml” or “application/xhtml+xml”. The indexOf(String str) method of the String object returns the index of the first occurrence of the str substring. If str is not found, -1 is returned by the indexOf(String str) method. In other words, if str is found, the return value will not be -1.




if (acceptHeader.indexOf(“application/vnd.wap.xhtml+xml”) != -1)

else if (acceptHeader.indexOf(“application/xhtml+xml”) != -1)




3. The method


response.setContentType(…);


is used to set the MIME type of a document.




The following example illustrates how to use the JSP code in an actual XHTML MP document. What you need to do is very simple — Just copy and paste the JSP code into the XHTML MP document and use “.jsp” as the file extension. (The XHTML MP markup in this example will be discussed in detail in the following sections.)


 


<?xml version=”1.0″?>
<!DOCTYPE html PUBLIC “-//WAPFORUM//DTD XHTML Mobile 1.0//EN” “
http://www.wapforum.org/DTD/xhtml-mobile10.dtd“>


<html xmlns=”http://www.w3.org/1999/xhtml“>
  <head>
    <title>XHTML MP Tutorial</title>
  </head>


  <body>
    <p>Hello world. Welcome to our XHTML MP tutorial.</p>
  </body>
</html>
<%
String acceptHeader = request.getHeader(“accept”);


if (acceptHeader.indexOf(“application/vnd.wap.xhtml+xml”) != -1)
  response.setContentType(“application/vnd.wap.xhtml+xml”);
else if (acceptHeader.indexOf(“application/xhtml+xml”) != -1)
  response.setContentType(“application/xhtml+xml”);
else
  response.setContentType(“text/html”);
%>


File Extension


The file extensions of static XHTML MP documents are “.xhtml”, “.html” and “.htm” typically. You can use other file extensions you like, as long as the MIME type associated with the file extension is set correctly at your WAP server’s configuration file. If you are going to use a server-side technology such as ASP, JSP, Perl, PHP or SSI (Server Side Includes) to add content to XHTML MP documents dynamically, you may need to change the file extension of your XHTML MP documents to that used by the server-side technology. For example, the typical file extension used by PHP is “.php”, while that used by SSI is “.shtml”.

Connection reset by peer:jvm_recv in socket






am programming in Jbuilder7 and weblogic 7. I created a jdbc datasource of a postgres database. In the ejb, I lookup the jndi and get connection to execute a query to get some data and return the ArrayList of data. I also created a servlet to lookup the ejb and get the ArrayList. It always work fine after I restart computer that the server is running. But if I leave it 4 or 5 hours, in the server window, it always appear error in the ejb function “executequery” after I lookup the jndi, get connection and createstatement. The error is:

An I/O error occured while reading from backend – Exception: java.net.S
ocketException: Connection reset by peer: JVM_recv in socket input stream read
Stack Trace:

java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
eam read
at java.net.SocketInputStream.socketRead(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:85)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:181)
at java.io.BufferedInputStream.read(BufferedInputStream.java:199)
at org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:141)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:68)
at org.postgresql.Connection.ExecSQL(Connection.java:398)
at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54)
at weblogic.jdbc.pool.Statement.executeQuery(Statement.java:863)
at weblogic.jdbc.rmi.internal.StatementImpl.executeQuery(StatementImpl.j
ava:81)
at weblogic.jdbc.rmi.SerialStatement.executeQuery(SerialStatement.java:8
3)
at com.panda.ejb.categorydatamanager.CategoryBean.GetCategory(CategoryBe
an.java:88)
at com.panda.ejb.categorydatamanager.CategoryBean_9ra2ge_EOImpl.GetCateg
ory(CategoryBean_9ra2ge_EOImpl.java:201)
at com.panda.ejb.categorydatamanager.CategoryBean_9ra2ge_EOImpl_WLSkel.i
nvoke(Unknown Source)

Please help me. I have not any ideas about it. Thanks.

 

 

RE:Connection reset by peer:jvm_recv in socket


Hi!

Do you have a firewall in the network between the application and database server? Maybe this error is due to the closing of the connection by the firewall (timeout after inactivation).

I am having the same problem, but it had never happened before after 3 years of production use of a connection pooling framework. In fact, the database and application servers are separated by the Internet…

I am trying to find a way to check for a link-failure event in Java.

You should also watch topic “ORACLE driver: timeout => Connection reset by peer: socket write error ?”

 

RE:

from http://java.sun.com/features/2002/08/j2se-network.html

Connection Reset by Peer :

One of the issues that developers frequently run into is the Connection reset by peer exception:

Exception in thread “main” java.net.SocketException:
Connection reset by peer: JVM_recv in socket input stream read.

This basically means that a network error occurred while the client was receiving data from the server. But what is really happening is that the server actually accepts the connection, processes the request, and sends a reply to the client. However, when the server closes the socket, the client believes that the connection has been terminated abnormally because the socket implementation sends a TCP reset segment telling the client to throw away the data and report an error.

Sometimes, this problem is caused by not properly closing the input/output streams and the socket connection. Make sure you close the input/output streams and socket connection properly. If everything is closed properly, however, and the problem persists, you can work around it by adding Thread.sleep(1000) before closing the streams and the socket. This technique, however, is not reliable and may not work on all systems.

 

RE:


Try to have a look at this similar topic, expecially at answer 1.
http://forum.java.sun.com/thread.jsp?forum=48&thread=424393

Bye

永久免費使用NOD32殺毒軟件(更新12月19日)

本方法利用官方服務器的後門,不同于以前那種延長試用期的方法,是真正完美的NOD32破解。

既能更新病毒庫,又能更新程序組件!


不需要任何ID、升級外挂等!




0.如果你已經安裝NOD32,不管是什麽版本,都要先卸載,然後重啓!因為只有以下版本能用這個方法,彆的版本都不行!


1.下載NOD32安裝包


http://www.strongd.net/file/200709/nentcsst.exe


2.安裝前斷開網絡!安裝完成後重啓,打開NOD32控制中心,到“更新”頁面,可以看見一個“購買完全版”按鈕,説明現在是試用版。彆急,現在我們來破解他。


3.點設定——服務器——新增——填入:


http://www.nod32.com/nod_upd


新加NOD32中國非官方論壇專用升級服務器




http://u1.chinanod32.com (電信)


http://www.strongd.net/nod32 (本站更新地址)


http://u2.chinanod32.com (網通)[點確定,把它設成默認的更新服務器,再確定,連上網絡。




等到更新完成,你會發現“完全版”按鈕神奇消失了!就變成正版了!




聲明:這種方法不是用代理!不信你在IE裏打開http://www.nod32.com看看!是正宗的官網



upgrading SVN or remove SVN REPO


  1. Shut down svnserve, Apache, and anything else that might be accessing the repository.
  2. svnadmin dump /path/to/repository > dumpfile.txt , using version X of svnadmin.
  3. mv /path/to/repository /path/to/saved-old-repository
  4. Now upgrade to Subversion Y (i.e., build and install Y, replacing X).
  5. svnadmin create /path/to/repository, using version Y of svnadmin.
  6. svnadmin load /path/to/repository < dumpfile.txt , again using version Y of svnadmin.
  7. Copy over hook scripts, etc, from the old repository to the new one.
  8. Restart svnserve, Apache, etc.

simultaneous-build-throttle resin config

對系統做壓力測試時經常出現以下問題,測試就不通過.

We are already in the process of making 6 connections and the number of simultaneous builds has be
en throttled to 5

 

但在400個用戶時沒有很問題.一超過400就會有40來個錯誤,,,查看系統記錄,發現了上面的問題.

 

查了一個官方的資料,問題解決了!


In http://proxool.sourceforge.net/properties.html is Say:




simultaneous-build-throttle:
This is the maximum number of connections we can be building at any one time. That is, the number of new connections that have been requested but aren’t yet available for use. Because connections can be built using more than one thread (for instance, when they are built on demand) and it takes a finite time between deciding to build the connection and it becoming available we need some way of ensuring that a lot of threads don’t all decide to build a connection at once. (We could solve this in a smarter way – and indeed we will one day) Default is 10.

 



<simultaneous-build-throttle>5</simultaneous-build-throttle>

改成

<simultaneous-build-throttle>20</simultaneous-build-throttle>

 

問題就不再出現了!

獲取LINUX系統資訊(how to get system info in linux)




以下命令列表,提示和資訊是我翻譯過來的.使用這些命令可以很快的取得您的系統資訊.


一般性的系統資訊

提示:很多硬體資訊命令一定要使用root管理員才可以執行,或者使用管理員執行可以獲得更多資訊.


運行qtparted 或者GParted 獲得硬盤和分區資訊.並且使用KDiskFree和fdisk -l獲得全部分區資訊.


hardinfo – 非常好的工具,而且可以獲得詳細報告.


獲取一個硬體報告:


這個報告包含很多其他報告,一些已經列到這篇文章裏面.通過installation-report 安裝Synaptic 包,


在全屏的命令行下運行:
report-hw
或者
report-hw > hwreport (把結果保存到文件hwreport 裏)


sysinfo – 在命令行下運行,可以獲得不錯的效果.


hal-device-manager
kde-hal-device-manager
這些包可以安裝在Synaptic下. 當使用kde-hal-device-manager時.可以通過 KMenu > System > Device Manager 來安裝.


dmidecode -t memory (as root)這個工具顯示系統的DMI(Desktop Management Interface)報告,報告內容包括系統的所有硬體,例如BIOS的版本號等. dmidecode 不單單顯示系統的當前配置,還包括BIOS支援CPU速度,最大記憶體等資訊.
dmidecode | less (as root) BIOS 資訊和系統資訊 (使用空格換頁,使用q退出)


uname -a (系統版本號)
uname -m 系統版本 (i.e. – i686)
uname -r 系統核心版本號


lshw (as root) – 列印硬體列表; 可以要使用 lshw | less (使用空格換頁,使用q退出)
lshw-gtk (as root) –


lsb_release -a (發行版本的資訊)  (或者查看 /etc/lsb_release)

***在 RedHat Linux AS4, 顯示的內容為:
LSB Version:    :core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: RedHatEnterpriseAS
Description:    Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
Release:        4
Codename:       NahantUpdate2


lspci (as root) (控制器等資訊) (非常好的報告;參數 -v 顯示詳細內容,參數 -vv 顯示非常詳細的內定)
lspci -tv (as root) 以樹的形式顯示
lsusb, lsusb -tv – 列出USB設備
lsmod (at root, 顯示系統已載入的核心模組. 或者使用lsmod | less)


/proc – 包含很多本地重要資訊,使用 cd /proc  && ls ,使用cat命令查看/proc下面的文件,例如:cpuinfo,devices,filesystems,meminfo,partitions,swaps,uptime,version等;也可以進入子目錄查看,例如 cd driver.
例子:
cat /proc/cpuinfo (或者在/proc下使用cat cpuinfo )
cat /proc/version (或者在/proc下使用 cat verson ) – 版本資訊
cat /proc/swaps (或者在/proc下使用 cat swaps ) 顯示所有交換區.


top – 即時地顯示Linux的進程; 系統的情況和被內核所管理的進程,還包括交換區使用情況;使用 Shift-f 來排序 (默認排序是 k – CPU 使用率)

ctrl-esc 在KDE環境下顯示進程列表

顯示正在運行的線程:
ps aux
ps -e


swapon -s 顯示記憶體交換區和對應的資訊
swapon -a 使得包含在/etc/fstab裏的全部交換區生效.


free (記憶體使用情況,以K單位)
free -m (記憶體使用情況,以M為單位).


df -h (顯示所有載入的文件系統的資訊, 全部用戶都有權查看)
df -hT (顯示所有載入的文件系統的資訊,並且顯示文件系統的類型, 全部用戶都有權查看)


du / -bh | more 詳細的顯示每個子目錄的使用情況,全部用戶都可以查看,使用空格換頁,使用q退出.
du -s /var/log/* – 顯示系統記錄/var/log所使用的空間


hdparm -t /dev/hda (as root) – 測試並顯示 hda 的性能


相關時間命令:
date
uptime


fdisk -l 顯示所有硬碟上面的分區資訊.


/etc/fstab (這個文件包含文件系統的配置)內容一般為:
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/home1            /home1                  ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/sda5               swap                    swap    defaults        0 0



how to get cpu information on Linux machine

Hi,

I want to display cpu information like model number, vender information, and how many cpu’s are there in the system (Linux machine)

Is there any system call ? or /proc/cpuinfo is the only way

And also how get information regarding controllers and adapters installed on system(Linux machine) using any system call



Thanks and regards
laxmi

 

re:

cat /proc/cpuinfo
cat /proc/meminfo
dmesg
lspci

or

 


/usr/sbin/./x86info -a

Eclipse Profiler Plugin

Eclipse Profiler Plugin

This is a plugin for the Eclipse platform which allows java code profiling. Project

License

CPL.

 

General note

1.) if you run the remote profiler, the filter settings      in the eclipse environment are not taken into account.      Instead you must provide the filter settings in the      start command of your application server. You do this      by adding an environment variable __PROFILER_PACKAGE_FILTER      to the startup command of your aplication, see below.  2.) Setting up the profiler package filters (in general)      You must define the environment variable __PROFILER_PACKAGE_FILTER      as shown below in the examples for tomcat, jboss, weblogic and      resin.       General important Note:      The environment variable contains following parts:            the application starting class (__A__)      inclusion filters              (__P__)      exclusion filters              (__M__)            You must provide exactly one starting class, but you      can have multiple inclusion and exclusion filters.       The parts MUST be separated by the OS specific      path.separator, i.e. ":" for unix or "$$" for      WINDOWS platforms)       example package filter setting for WINDOWS: -D__PROFILER_PACKAGE_FILTER=__A__org.apache.catalina.startup.Bootstrap;__M__sun.;__P__my.company.classes.         example package filter setting for UNIX/LINUX: -D__PROFILER_PACKAGE_FILTER=__A__org.apache.catalina.startup.Bootstrap:__M__sun.:__P__my.company.classes.         In the examples below we provide the WINDOWS style. Please      take care to use the LINUX/UNIX style if that aplies to you.             

Win32 installation

Copy ProfilerDLL.dll from root plugin folder into bin folder of your JRE installation. You can skip this step, plugin will ask you and copy DLL into your JRE\BIN when you will start profiling local application inside of Eclipse first time. It will also check, that you have in JRE\BIN same DLL as in plugin directory.

Linux installation

Profiler has native part compiled with gcc 3.2, but if you have old gcc or libraries you can build native part yourself. Extract files from native\profiler_linux.tgz and look at script "m". This is example of compilation script. Change it as needed for you OS.
See also profile_cpu/profile_heap for examples of start line for cpu and heap profiling and r_cpu/r_heap as example how to use them.

Usage

Profiler plugin creates additional kind of launch configuration in Run menu. Profiler tab allows the user to define packages which shouldn’t be instrumented, thus, all time usage will be referred to calling methods.
You can specify refresh rate, i.e. how often plugin will read statistics from prolifing JVM.
You can also set method, how to get time of enter in method and leave. There are two methods: fast, but usefull only if you have one active thread, which tries to use all CPU; or slow, which use JVMPI function GetCurrentThreadCpuTime() and allows detect how much of CPU was used by thread. However with this method profiled program runs about 3 times slower than with fast method.


Fig. 1. Launch configuration.

 

Profiler supports inclusive (grren) and exlusive (red) filters. You can noy only specify what packages should be excluded from instrumentation, but also what packages should be included. Usefull, if you want to profile only your own classes. You can move filters up and down using buttons or drag and drop.


Fig. 1.1. Drag filters.

 

Plugin allows remote profiling with "Remote Profiler" launch configuration. Notice, that remote profiling is supported only in "run" mode, i.e. when you create launch configuration using "Run|Run…" menu item.
You need to start remote application with special switches like: java -XrunProfilerDLL -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__M__sun.;__M__com.sun. -D__PROFILER_USE_PACKAGE_FILTER=1 Here __M__ prefix used for exclusive filter, __P__ can be used for inclusive filter. And you should use __A__ for class with method "main".


Fig. 2. Remote launch configuration.

 

Tomcat CPU profiling

Profiler was tested with jakarta-tomcat-4.1.12. Add after lines in catalina.bat:
set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
following line:
set JAVA_OPTS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__%MAINCLASS%;__M__sun.;__M__com.sun.;__M__java.;__M__javax.;__M__org.apache. -D__PROFILER_TIMING_METHOD=1
Then copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to bin directory of tomcat. Now you can start tomcat using startup.bat and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your Tomcat and show you some statistics.

Tomcat heap profiling

Profiling heap is almost same as CPU profiling, but you should use following line:
set JAVA_OPTS=-XrunProfilerDLL:3,10,0 -D__PROFILER_PROFILE_HEAP=1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__%MAINCLASS%;__M__ -D__PROFILER_TIMING_METHOD=1

JBoss profiling

Profiler was tested with jboss-3.0.6_tomcat-4.1.18. Add following line in your bin/run.bat (directly after echo off):
set JAVA_OPTS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__org.jboss.Main;__M__sun.;__M__com.sun.;__M__java.;__M__javax. -D__PROFILER_TIMING_METHOD=1
Then copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to bin directory of JBoss. Now you can start JBoss using run.bat and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your JBoss and show you some statistics.

WebLogic profiling

Profiler was tested with WebLogic 8.1, installed in "c:/bea". WebLogic has its own JRE’s, so you will need to copy ProfilerDLL.dll manually to C:\bea\jdk141_02\jre\bin. For profiling examples, change file C:\bea\weblogic81\samples\domains\examples\startExamplesServer.cmd, line where JAVA_OPTIONS is defined:
set JAVA_OPTIONS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__weblogic.Server;__M__sun.;__M__com.sun.;__M__java.;__M__javax.;__M__weblogic. -D__PROFILER_TIMING_METHOD=1
Then copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to "C:\bea\weblogic81\samples\domains\examples". Now you can start WebLogic examplex using startExamplesServer.cmd, or shortcut in Windows menu, and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your WebLogic and show you some statistics.

Resin profiling

Profiler was tested with Resin-ee 2.1.10. Create batch file with following content in "bin":
httpd.exe -J-XrunProfilerDLL:1 -Xbootclasspath/a:c:/prof/jakarta-regexp.jar;c:/prof/profiler_trace.jar;c:/prof/commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__com.caucho.server.http.HttpServer;__M__sun.;__M__com.sun.;__M__java.;__M__javax. -D__PROFILER_TIMING_METHOD=1
Then create directory "prof" in disc "C" and copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar. Now you can start your batch file and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your Resin and show you some statistics.

Options

Profiler supports several options via -DXXX.

Options Description
__PROFILER_PACKAGE_FILTER Contains list of packages to include or exclude.
Here __P__ – inclusive pattern, __M__ – exclusive pattern.
And __A__ – application start class.
Examples:
Include only ru.* and de.* packages: __P__ru.;__P__de.
Exclude system packages: __A__org.jboss.Main;__M__sun.;__M__com.sun.;__M__java.;__M__javax.
If at least one inclusive pattern used, only classes accepted by inclusive patterns will be instrumented.
__PROFILER_TIMING_METHOD Specifies timing method – how to measure elapsed time.
0 – fast, System.currentTimeMillis(), good for application without sleeps and waits.
1 – precise, thread aware, slow, good for multithreaded applications.
2 – sampling profiling, very fast, good for long runned processes.
__PROFILER_PROFILE_HEAP 1, if HEAP profiling should be used.
__PROFILER_AUTO_START 0 – don’t start automatically.
1 (default) – start automatically.
__PROFILER_START_ON_METHOD Start method name. When applications tries to enter in this method profiling starts (see __PROFILER_AUTO_START, it should be 0).
Example: -D__PROFILER_START_ON_METHOD=ru.nlmk.train.Main.mainLoop
__PROFILER_PAUSE_ON_METHOD 1, if you need pause profiling when __PROFILER_START_ON_METHOD leaved.
__PROFILER_INSTRUMENT_SYSTEM_CLASSES 1, if you need instrument additional system classes, like java.lang.String, etc. Expensive!
__PROFILER_WAIT_FRONTEND_CONNECT 1, if you need to wait, until frontend (plugin) will connect. (0 by default).

CPU profiling

Profiler supports CPU profiling and basic function for heap profiling. The profiler collects invocation count and direct time statistics for every method. Direct time is the amount of time used by selected method for execute. Also a total time value displayed in calling tree for selected thread. The total time means a time used by selected method and by all the methods it had called.

Only instrumentation profiling method is supported because of its precise. The overhead expenses reflects at speed decreasing app. 5 times to normal.

How it works

The profiler subscribes for JVPMI event JVMPI_EVENT_CLASS_LOAD_HOOK which called during every class loading. The profiler modifies loading byte-code by adding profiler’s method call "enter" in the beginning of the every method of loading class and at the end of it – "leave". "Enter" profiler’s method notes the time of entering to profiling method. "Leave" makes method leaving timestamp and calculates a difference between enter and leave timestamps. This difference means total time for this method call. Direct time calculates as total time of this method minus total time of the all methods called by it. The profiles makes some time corrections for the time spent by profiler.

The profiler implemented as an Eclipse perspective with following views: Threads, Packages, Classes, Methods, Thread methods, Thread call tree, Heap.

Threads.
Shows a list with all threads (alive or dead) in the current process. Here you can pause/resume refreshing of statistics in views, pause/resume all threads in profilied program, clear all statistics or run GC in profiled JVM.


Fig. 3. Threads View.

 

Call graph.
Profiler uses Draw2D for displaying call graph of thread. All methods shown in several columns, column depends on level, on which this method was called. Inside one column methods sorted by direct time used. Each node in graph has color from red to dark gray, depending on direct time. Methods with maximum time use have red color, and methods, which almost don’t use time, have grey color. Each method has hint with detailed information. You can double click on method to open it in editor.
Lines between method present call from source method to target. Lines from one level to directly next have black color, to next – blue, inside one level – red, and from backward calls – green. Width of line depeneds on how much of time use in this call.


Fig. 3.1. Call graph.
You can also see hit for call.
Fig. 3.2. Call hint.
As you can see, full graph looks fairly complex, but you can select part of it. Press mouse on some method and select then button "Show callers", "Show calles" or "Show caller and callees". You can see something like this:
Fig. 3.3. Callers.

Fig. 3.4. Callees.

Fig. 3.5. Callers and callees.
You can double click on call line for opening editor with source method with highlighting places, where it calls target method.
Fig. 3.6. Show calls.

 

Packages.
Shows a list with all methods with class hierarchy from package. This allows to determine packages which used the most of CPU time. In this view (and in Classes and Methods views also) the user can see in gray color the methods with unmodified parameters since last update. The user can hide such kind of methods by applying appropriate filters.
Here:
Name – name of package/class/method
Inv. – invocation count
% – percent of all invocations
Time – direct time used
% – percent of total time
Time/Inv. – average time used for one invocation
Total time – total time used directly by method and by all methods it calls
Inst. time – time used for instrumentation of class


Fig. 4. Packages View.

 

You can add package or class to filter by pressing right mose button on element in table and selecting menu item. Filter can be added to launch configuration filter (will be used in next profiling, if you will active it) or to view filters (will be activated right now).


Fig. 4.1. Add filter.

 

Classes.
Shows a list of all class methods with method hierarchy from class. This allows to determine classes with the most CPU time usage.


Fig. 5. Classes View.

 

Filters.
Allows to define which kind of methods can be shown.


Fig. 6. Filters.
You can save configured name patterns (inclusive or exalusive) with some name and description, then you will able to select them in check list box.
Fig. 6.1. New filter.
Later you can change this user defined filter.
Fig. 6.2. Edit filter.

 

Methods.
Shows the statistics for all methods of the current process.


Fig. 7. All Methods View.

 

Thread methods.
Shows methods statictics for thread selected in Threads View.


Fig. 8. Thread Methods View.

 

Thread tree.
Shows a methods invocation tree for thread selected in Threads View. Here red square used for highlighted methods (from thread methods context menu) and green dot used for all other methods.


Fig. 9. Thread Tree View.

 

Inverted thread tree.
Shows a methods invocation tree for thread selected in Threads View starting from leaves. This allows you fastly detect, that some leaf method uses much of total time and see, what methods it is called.


Fig. 9.1. Inverted thread Tree View.

 

Heap.
Shows heap usage graph: total (green), used (blue) and free (yellow) heap.

Heap View.
Fig. 10. Heap View.

 

Here is an overall view of the profiler perspective. You can see a method HashMap.put opened in source code editor with highlighted lines of code which has the maximum hit count (size of annotation depends on hit count). You can open source code editor by choosing menu item "Open method in editor" in context menu.


Fig. 11. Perspective.

WYSIWYG 網頁線上編輯器比較表


在 OpenSource 的 WYSIWYG Editor 當中,早期最多人使用的 HTMLArea 由於原開發團隊進度緩慢,Bug 也很多,造成不少人想跳槽。


這裡有一份幾乎涵蓋所有 WYSIWYG 線上編輯器比較表:


http://www.geniisoft.com/showcase.nsf/WebEditors


OpenSource 跟商用的都有。不過這份資料還是有點小錯誤,像 FCKeditor 的網址也不正確,這些我會回報過去,相信應該很快就可以更正過來。


在 OpenSource 當中,目前風評較佳的是 TinyMCEFCKEditorXinha


其中 TinyMCE 最受大多數人青睞,速度快又穩定,目前也逐漸提供 Safari 的支援。然而 TinyMCE 除了 HTMLArea 原有的功能外,也導入了 Image Manager + Editor ,可以線上管理及簡單的修改圖片。

至於商用的就沒有研究了,有興趣的人可以去玩玩看囉。^^

NOD32最新升级ID

Username: AV-6656986
Password: bk6soccp0o

Username: AV-6383678
Password: hsyfc640um

Username: AV-6294494
Password: 53u6p5gndm

Username: AV-6171271
Password: w55beid6gj

Username: AV-6588188
Password: 2dtb6t8pgf

Username: AV-6697455
Password: wonn9hqfw6

UserName: AV-6504753
PassWord: swhmfw9i0g

Username: AV-6670664
Password: 17s9x8bgfk

UserName: AV-6383678
PassWord: hsyfc640um

Username: AV-6661155
Password: jeay9be0ix