RUNAS 使用方法:
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/user: program
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/smartcard [/user:] program
/noprofile 指定使用者的設定檔不該載入。
這會導致應用程式載入速度更快,
但可能引起一些應用程式運作失常。
/profile 指定應該載入使用者的設定檔。
這是預設值。
/env 使用目前的環境,不用使用者設定的環境。
/netonly 如果指定的憑證是供遠端存取時才使用。
/savecred 使用之前由使用者儲存的認證。
此選項在 Windows XP Home Edition 上無法使用
而且會被略過。
/smartcard 當智慧卡提供了認證時使用。
/user 格式如下 USER@DOMAIN 或 DOMAIN\USER
program EXE 的命令列。範例如下
範例:
> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""
注意: 只有在提示時,才輸入使用者密碼。
注意: USER@DOMAIN 與 /netonly 不相容。
注意: /profile 與 /netonly 不相容。
2011/03/31
runas
2011/03/27
jQuery : post/get using data() as param object
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Recursive call when post request</title>
<script type="text/javascript" src="jquery-1.5.1.js"></script>
<script type="text/javascript">
$(function() {
var count = 0;
$('input:button').click(function() {
// identity
count++;
var tick = count;
// post url
var url = '${contextPath}/';
// post param
var param = $(this).data();
console.log(param);
$('<div>(' + tick + ') Post to : ' + url + '</div>').appendTo(document.body);
$.post(url, param, function(data) {
$('<div style="color:blue;">(' + tick + ') Ajax works successfully.</div>').appendTo(document.body);
});
});
});
</script>
</head>
<body>
<input type="button" value="click to post" data-action="test" data-name="bruce" data-age="31" />
</body>
</html>
ボタンをクリックすると、data()のオブジェクトがハンドルを値を持っているため、postするときにハンドルは再び執行することになる。つまり、クリック事件は繰り返しする。この現象を避けるには、ハンドル/イベントを削除しなければならない。
2011/03/25
jQuery validte : regex rule
$.validator.addMethod(
"regex",
function(value, element, regexp) {
var check = false;
var re = new RegExp(regexp);
return this.optional(element) || re.test(value);
},
"Please check your input."
);
$("textbox").rules("add", { regex: "^[a-zA-Z'.\s]{1,40}$" })
2011/03/23
2011/03/22
Statement.executeBatch() always returns an array of value -2
The elements in the array returned by the method executeBatch may be one of the following:
- A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
- A value of -2 -- indicates that the command was processed successfully but that the number of rows affected is unknown
If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands. If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be the following: - A value of -3 -- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails
2011/03/18
SqlCommand (Sample)
new SqlCommand() //
.setDebugMode(true)
.setConnection(Connector.get())
.setCommandText("SELECT" +
" e.entry_id," +
" e.entry_name," +
" e.entry_english_name," +
" e.entry_description," +
" e.entry_sop_path," +
" e.entry_cordon," +
" e.role_name," +
" e.entry_enabled," +
" e.group_id," +
" e.group_name" +
" FROM mv_wrk e" +
" WHERE" +
" (&entry_id IS NULL OR UPPER(e.entry_id) LIKE UPPER(&entry_id))" +
" AND (&entry_name IS NULL OR UPPER(e.entry_name) LIKE UPPER(&entry_name))" +
" AND (&entry_english_name IS NULL OR UPPER(e.entry_english_name) LIKE UPPER(&entry_english_name))" +
" AND (&entry_enabled IS NULL OR e.entry_enabled = &entry_enabled)" +
" ORDER BY e.entry_id ASC")
.addParameter("&entry_id", OracleDataType.VARCHAR2)
.addParameter("&entry_name", OracleDataType.VARCHAR2, null)
.addParameter(new SqlParameter("&entry_english_name", OracleDataType.VARCHAR2))
.addParameter(new SqlParameter("&entry_enabled", OracleDataType.NUMBER).setValue(null))
.setAdapter(new QueryAdapter() {
@Override
public void executedQuery(SqlArgument arg) throws Exception {
ResultSet rs;
if ((rs = ((QueryArgument) arg).resultset) == null)
return;
while (rs.next()) {
System.err.println(DataMap.fill(rs));
}
}
})
.query();
batch
new SqlCommand()
.setDebugMode(true)
.setDebugOut(System.err)
.setConnection(ConnectionUtil.get())
.addCommand("/* 1. &name 2. &aid 3. &time */ INSERT INTO access_log VALUES(&aid, &name, &time)", CommandType.Text, CommandMode.Batch)
.addCommand("SELECT * FROM access_log WHERE rownum < &rows ORDER BY time DESC")
.addParameter("&rows", OracleDataType.INT, 5)
.setAdapter(new QueryListener() {
@Override
public boolean executingQuery(SqlArgument arg) throws Exception {
if (arg.first && arg.mode == CommandMode.Batch)
for (int i = 0; i < 3; i++) {
arg.addBatchParameters(
new SqlParameter("&name", OracleDataType.VARCHAR2, "bruce"),
new SqlParameter("&aid", OracleDataType.VARCHAR2, UUID.randomUUID().toString()),
new SqlParameter("&time", OracleDataType.DATE, DateTime.now().toTimestamp())
);
}
return true;
}
@Override
public void executedQuery(SqlArgument arg) throws Exception {
if (arg.first) {
UpdateArgument ua = (UpdateArgument) arg;
System.err.println(Arrays.toString(ua.batchResult));
} else {
QueryArgument argument = (QueryArgument) arg;
if (argument.resultset != null)
while (argument.resultset.next()) {
System.err.println(DataMap.fill(argument.resultset));
}
}
}
})
.query();
2011/03/14
Change IP of listener
listener.ora
# listener.ora Network Configuration File: C:\oracle\product\10.1.0\db_1\network\admin\listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = C:\oracle\product\10.1.0\db_1) (PROGRAM = extproc) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521)) ) ) )
2011/03/11
Start/stop oracle
REM This batch file is used to start/stop the oracle instance REM Simply invoke oracle.bat start/stop cls @ECHO off REM ****************************************************************** REM ** Batch file used to stop/start oracle services REM ****************************************************************** SET _db_=10g_home1 SET _sid_=CCIMES if(%1)==(start) GOTO START if(%1)==(stop) GOTO STOP echo Invalid use. Usage is oracle.bat stop/start GOTO END :START REM ** START the oracle services echo Starting Oracle Services REM change the instance/listener names to match what is in your services list NET START OracleCSService NET START OracleOraDB%_db_%iSQL*Plus NET START OracleOraDb%_db_%TNSListener NET START OracleService%_sid_% NET START OracleDBConsole%_sid_% REM NET START OracleJobScheduler%_sid_% REM NET START "Oracle INNOVATEST VSS Writer Service" echo Oracle Services Started GOTO END :STOP echo Stopping Oracle Services REM change the instance/listener names to match what is in your services list REM NET STOP "Oracle INNOVATEST VSS Writer Service" REM NET STOP OracleJobScheduler%_sid_% NET STOP OracleDBConsole%_sid_% NET STOP OracleOraDb%_db_%TNSListener NET STOP OracleService%_sid_% NET STOP OracleOraDB%_db_%iSQL*Plus NET STOP OracleCSService echo Oracle Services Stopped GOTO END :END
2011/03/08
Word break tag : <wbr/> (HTML5)
The HTML <wbr> tag is used defines a potential line break point if needed. This stands for Word BReak.
This is used with the <nobr> tag, <wbr> advises the extended browser when it may insert a line break in an otherwise nonbreakable sequence of text. Unlike the <br> tag, which always causes a line break, even within a <nobr>- tagged segment, the <wbr> tag works only when placed inside a <nobr>- tagged content segment and causes a line break only if the current line has already extended beyond the browser's display window margins.
test:
This
test:
Words without breaks
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Words with breaks
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
2011/03/05
no object DCH for MIME type multipart/mixed
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/related; boundary="----=_Part_0_9042915.1299319807397" at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source) at javax.activation.DataHandler.writeTo(Unknown Source) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1383) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1743) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:888) ... 4 moreThere is something wrong with MailCap, javamail can not find a handler for such multipart/mixed part.
And the solution is add mime programmingly:
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
CommandMap.setDefaultCommandMap(mc);