<head>
<meta charset="UTF-8">
head>
<form onsubmit="return false;">
<input type="hidden" name="file_base64" id="file_base64">
<input type="file" id="fileup" multiple="multiple">
<input type="submit" value="submit" onclick="$.post('./uploader.php', $(this).parent().serialize());">
<div>
<div id="msg">div>
div>
form>
<script src="scripts/jquery.min.js">script>
<script>
$(document).ready(function () {
authcookie = login();
document.cookie = "authcookie=" + authcookie;
$("#fileup").change(function () {
getauthcookie("authcookie");
filelist = this.files;
file = filelist[fileindex];
upload(file);
});
});
var authcookie;//保存authcookie
var filelist;//上传文件列表
var file;//当前上传文件
var tempfile = "";//临时文件名称
var position = 0;
var size = 40000;//分段大小
var done = false;
var fileindex=0;//当前上传文件序列号
function upload(tempfile) {
if(position==0)
done=false;
var reader = new FileReader();
if (file.size > position + 40000)
reader.readAsArrayBuffer(file.slice(position, position + 40000));
else
reader.readAsArrayBuffer(file.slice(position, file.size));
reader.onload = function (e) {
if (e.target.readyState === 2) {
var base64string = base64ArrayBuffer(e.target.result);
var data = {
authenticationCookie: authcookie,
dicomData: base64string,
fileName: tempfile,
status: position==0?"start":"append"
};
tempfile = senddata(JSON.stringify(data));
if (!done) {
position += 40000;
upload(tempfile);
if (position+40000>file.size)
done = true;
}
else {
var data = {
authenticationCookie: authcookie,
dicomData: "",
fileName: tempfile,
status: "done"
};
tempfile = senddata(JSON.stringify(data));
position = 0;
$("#msg").html($("#msg").html()+"第"+(fileindex+1)+"个文件已经上传完成");
fileindex += 1;
if (fileindex < filelist.length) {
file = filelist[fileindex];
upload(tempfile);
}
else {
fileindex = 0;
$("#msg").html($("#msg").html() + "文件全部已经上传完成");
}
}
}
};
}
function senddata(data) {
var result;
$.ajax({
type:"post",
url: "http://localhost/MedicalViewerService19/StoreService.svc/UploadDicomImage",
data: data,
contentType: "application/json",
dataType: "json",
success: function(data){result= data},
async: false
});
return result;
}
function login() {
var auth;
var logininfo = { userName: "a", password: "a", userData: "" };
$.ajax({
type: "post",
url: "http://localhost/MedicalViewerService19/AuthenticationService.svc/AuthenticateUser",
data: JSON.stringify(logininfo),
contentType: "application/json",
dataType: "text",
success: function (data) { auth= data },
async: false
});
return auth;
}
function query() {
}
function getauthcookie() {
document.cookie.split(";").forEach(function (val, index) {
var index = val.indexOf("=");
if ($.trim(val.substring(0, index)) == "authcookie") {
authcookie = $.trim(val.substring(index + 1, val.length));
}
});
return "";
}
function base64ArrayBuffer(arrayBuffer) {
var base64 = '';
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var bytes = new Uint8Array(arrayBuffer);
var byteLength = bytes.byteLength;
var byteRemainder = byteLength % 3;
var mainLength = byteLength - byteRemainder;
var a, b, c, d;
var chunk;
// Main loop deals with bytes in chunks of 3
for (var i = 0; i < mainLength; i = i + 3) {
// Combine the three bytes into a single integer
chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
// Use bitmasks to extract 6-bit segments from the triplet
a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18
b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12
c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6
d = chunk & 63; // 63 = 2^6 - 1
// Convert the raw binary segments to the appropriate ASCII encoding
base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];
}
// Deal with the remaining bytes and padding
if (byteRemainder == 1) {
chunk = bytes[mainLength]
a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2
// Set the 4 least significant bits to zero
b = (chunk & 3) << 4; // 3 = 2^2 - 1
base64 += encodings[a] + encodings[b] + '==';
} else if (byteRemainder == 2) {
chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];
a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10
b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4
// Set the 2 least significant bits to zero
c = (chunk & 15) << 2 // 15 = 2^4 - 1
base64 += encodings[a] + encodings[b] + encodings[c] + '=';
}
return base64;
}
script>



| Private Sub Form_Load() EDOffice1.OpenFileDialog'EDOffice1.OpenWord “d:\ test.xlsx” 'EDOffice1.Open“d:\ test.xls”,“Excel.Application” End Sub |
| Private Sub EDOffice_DocumentOpened() EDOffice1.ProtectDoc 1'XlProtectTypeNormal End Sub |
| bool ExcelAddWorkSheet(long Index); bool ExcelDeleteWorkSheet(long Index); bool ExcelActivateWorkSheet(long Index); 长ExcelGetWorkSheetCount(); bool ExcelSetCellValue(long Column,long Row,BSTR Value); BSTR ExcelGetCellValue(长列,长行); bool ExcelSetRowHeight(long Row,double Height); bool ExcelSetColumnWidth(long Column,double Width); afx_msg bool ExcelDeleteRow(long Row); bool ExcelDeleteColumn(long Column); bool ExcelInsertRow(long Row); bool ExcelInsertColumn(long Column); bool ExcelInsertPageBreakInRow(long Row); bool ExcelInsertPageBreakInColumn(long Column); bool ExcelCopyToClipboard(); bool ExcelPasteStringToWorksheet(BSTR bstText); |
Private Sub Command1_Click() Dim oXL As Excel.Application Set oXL = EDOffice1.GetApplication() Dim oWB As Excel.Workbook Set oWB = EDOffice1.ActiveDocument() Dim oSheet As Excel.Worksheet Dim oRng As Excel.Range Set oSheet = oWB.ActiveSheet oSheet.Cells(1, 1).Value = "First Name" oSheet.Cells(1, 2).Value = "Last Name" oSheet.Cells(1, 3).Value = "Full Name" oSheet.Cells(1, 4).Value = "Salary" ' Format A1:D1 as bold, vertical alignment = center. With oSheet.Range("A1", "D1") .Font.Bold = True .VerticalAlignment = xlVAlignCenter End With ' Create an array to set multiple values at once. Dim saNames(5, 2) As String saNames(0, 0) = "John" saNames(0, 1) = "Smith" saNames(1, 0) = "Tom" saNames(1, 1) = "Brown" saNames(2, 0) = "Sue" saNames(2, 1) = "Thomas" saNames(3, 0) = "Jane" saNames(3, 1) = "Jones" saNames(4, 0) = "Adam" saNames(4, 1) = "Johnson" ' Fill A2:B6 with an array of values (First and Last Names). oSheet.Range("A2", "B6").Value = saNames ' Fill C2:C6 with a relative formula (=A2 & " " & B2). Set oRng = oSheet.Range("C2", "C6") oRng.Formula = "=A2 & "" "" & B2" ' Fill D2:D6 with a formula(=RAND()*100000) and apply format. Set oRng = oSheet.Range("D2", "D6") oRng.Formula = "=RAND()*100000" oRng.NumberFormat = "$0.00" ' AutoFit columns A:D. Set oRng = oSheet.Range("A1", "D1") oRng.EntireColumn.AutoFit oXL.UserControl = True End Sub |
1 2 3 | /* Property *//* Scan pages in 200 DPI */DWObject.Resolution = 200; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // Method ///<summary> /// Rotates the image of a specified index in buffer by a specified angle. /// </summary>///<param name="sImageIndex" type="short" data-filtered="filtered">specifies the index of image in buffer. The index is 0-based.///<param name="fAngle" type="float" data-filtered="filtered">specifies the angle.///<param name="bKeepSize" type="bool" data-filtered="filtered">specifies whether to keep the original size///<returns type="bool" data-filtered="filtered"></returns>DWObject.Rotate(0, 45, false); // rotate the 1st image in the buffer by 45 degrees |
1 2 3 4 5 6 7 8 9 10 11 12 13 | <script type="text/javascript" data-filtered="filtered">Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);var DWObject;/* OnWebTwainReady event fires as soon as Dynamic Web TWAIN is initialized and ready to be used. It is the best place to add event listeners */function Dynamsoft_OnReady() { DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); DWObject.RegisterEvent("OnPostTransfer", Dynamsoft_OnPostTransfer);}function Dynamsoft_OnPostTransfer() { /* This event OnPostTransfer will be triggered after a transfer ends. */ /* your code goes here*/}</script> |
1 2 3 4 5 6 7 8 9 10 | <script type="text/javascript" data-filtered="filtered">Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);var DWObject;function Dynamsoft_OnReady() { DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); DWObject.RegisterEvent("OnPostTransfer", function() { /* your code goes here*/ });}</script> |
1 2 | /* sImageIndex is the index of the image you clicked on*/OnMouseClick(short sImageIndex) |
1 2 3 | function DynamicWebTwain_OnMouseClick(index) { CurrentImage.value = index + 1;} |
1 2 3 | DWObject.RegisterEvent("OnPostTransfer", function(index) { CurrentImage.value = index + 1;}); |
1 2 3 4 5 6 7 | <script type="text/javascript" data-filtered="filtered">Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);var DWObject;function Dynamsoft_OnReady() { DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');}</script> |
1 2 3 4 5 | <script type="text/javascript" data-filtered="filtered"> Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', function() { DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); });</script> |
本次教程到此结束,希望能对Dynamic Web TWAIN的用户带来帮助,接下来还会有更多的相关教程,敬请期待!
Java社区进程(JCP)执行委员会的成员Ben Evans认为最急需重构的应用恰好就是最适合进行模块化的应用。如果你已经备受Lava Flow/God Class/Stovepipe System地狱的折磨,而且你的利益相关方明确知道这一点,那么你可能更容易说服他们进行一次完整的底层重构,通过渐进式的努力形成一个完成的模块解决方案(而不是简单重构并迁移至Java 8)是值得去做的。
对特定类型的应用来说,这是很有帮助的。例如,我曾经见到有的电子商务网站具有非常大的堆空间,其中包含了大约40G的字符串数据。Java 9的ompact Strings技术能够将这种类型的内存使用减半。这反过来又会对GC的性能带来积极的影响。对于有些应用来说(这可能就包括大型的Solr安装环境及类似场景),单单这一项收益就值得将运行时升级到Java 9。
这项变更是很重要的,因为相对于Parallel来说,G1会在应用线程上做更多的事情,而Parallel几乎没有在应用线程上做任何事情,它基本上完全依赖GC线程完成所有的内存管理。这意味着切换到G1将会为应用线程带来额外的工作,从而直接影响到应用的性能。 在很多(甚至可以说大多数)场景中,这种额外的性能损耗都不是什么问题。但是,在这方面,我确实也曾经见过从Parallel切换到G1时,有一定比例的工作负载会引起性能的下降。对于这些应用来说,这种性能下降是无法接受的,所以他们无法切换至G1收集器。随着G1成为默认的收集器,这将会影响到升级至Java 9的每个应用。
foreach await (string s in asyncStream)
async IAsyncEnumerable MethodName()
extension CustomerExt extends Customer {
//定义方法和属性的代码。
}试用、下载、了解更多产品信息请点击"咨询在线客服"
























每个人都知道编程正在成为几乎每个行业的重要组成部分,它对组织的帮助和对大型系统的维护是独一无二的,因此越来越多的人开始了他们的编程旅程。你可以从你觉得合适和方便的任何交互式平台和书籍中学习编程。但是这还不够,我们应该练习更多新的东西。
编码与你的创造力、创新能力密切相关。但很多时候,我们花费大量时间来处理常见问题而忘记了创造力。我不太确定这是否是编码挑战出现的原因,但它们肯定可以帮助你去思考。
我们可以说编程挑战是伟大的:
学习新的做事方式
练习一种新的编程语言
解决遇到的关键问题
保持我们的大脑活跃和集中力
以及玩得开心!
在寻找最好的编程挑战过程中筛选了五个非常好的资源。相信这对你的编程旅途有所帮助,并探索更大的计算机科学领域。
试用、下载、了解更多产品信息请点击"咨询在线客服"
