<script type="text/javascript"> function readFile(fileBrowser) { if (navigator.userAgent.indexOf("MSIE")!=-1) readFileIE(fileBrowser); elseif (navigator.userAgent.indexOf("Firefox")!=-1|| navigator.userAgent.indexOf("Mozilla")!=-1) readFileFirefox(fileBrowser); else alert("Not IE or Firefox (userAgent="+ navigator.userAgent +")"); }
function readFileFirefox(fileBrowser) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert('Unable to access local files due to browser security settings. To overcome this, follow these steps: (1) Enter "about:config" in the URL field; (2) Right click and select New->Boolean; (3) Enter "signed.applets.codebase_principal_support" (without the quotes) as a new preference name; (4) Click OK and try loading the file again.'); return; }
var fileName=fileBrowser.value; var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); try { // Back slashes for windows file.initWithPath( fileName.replace(////g, "////") ); } catch(e) { if (e.result!=Components.results.NS_ERROR_FILE_UNRECOGNIZED_PATH) throw e; alert("File '"+ fileName +"' cannot be loaded: relative paths are not allowed. Please provide an absolute path to this file."); return; }
if ( file.exists() ==false ) { alert("File '"+ fileName +"' not found."); return; } alert(file.path); // I test to get the local file's path. var is = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance( Components.interfaces.nsIFileInputStream ); try { is.init( file,0x01, 00004, null); } catch (e) { if (e.result!=Components.results.NS_ERROR_FILE_ACCESS_DENIED) throw e; alert("Unable to access local file '"+ fileName +"' because of file permissions. Make sure the file and/or parent directories are readable."); return; } var sis = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance( Components.interfaces.nsIScriptableInputStream ); sis.init( is ); var data = sis.read( sis.available() );
alert("Data from file: "+ data); // I test to get the local file's data. }
function readFileIE(fileBrowser) { var data; try { var fso =new ActiveXObject("Scripting.FileSystemObject");
var fileName=fso.GetAbsolutePathName(fileBrowser.value); if (!fso.FileExists(fileName)) { alert("File '"+ fileName +"' not found."); return; }
var file = fso.OpenTextFile(fileName, 1);
data = file.ReadAll(); alert("Data from file: "+ data); file.Close(); } catch(e) { if (e.number ==-2146827859) { // This is what we get if the browser's security settings forbid // the use of the FileSystemObject ActiveX control alert('Unable to access local files due to browser security settings. To overcome this, go to Tools->Internet Options->Security->Custom Level. Find the setting for "Initialize and script ActiveX controls not marked as safe" and change it to "Enable" or "Prompt"'); } elseif (e.number ==-2146828218) { // This is what we get if the browser can't access the file // because of file permissions alert("Unable to access local file '"+ fileName +"' because of file permissions. Make sure the file and/or parent directories are readable."); } elsethrow e; } } script>
head> <body> <form name="form1"> Browse to select a file <input type="file" name="fileBrowser" size="125" onchange="readFile(this)"/> form> body> html>
系统中统计数据,由于调用统计过程,执行时间超过了weblogic设置的时间,提示如下错误:
统计数据出错!
原因:The transaction is no longer active - status: 'Rolling Back. [Reason=weblogic.transaction.internal
Totally five patchs committed to erlang otp, just small patchs.
IMO, erlang really is a interesting programming language, I really like its concurrency feature.
but the functional programming style
两个步骤:
1.用w命令找到要踢出的用户,比如下面:
[root@localhost ~]# w
18:16:55 up 39 days, 8:27, 3 users, load average: 0.03, 0.03, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
package edu.xidian.graph;
class MyStack {
private final int SIZE = 20;
private int[] st;
private int top;
public MyStack() {
st = new int[SIZE];
top = -1;
}
public void push(i