Automatically Printing Crystal Reports in ASP.NET

如何创建一个水晶报表用户自定义函数库 UFls (Creating a Crystal Reports Custom Function Library)  Creating a Crystal Reports Custom Function LibraryYou dont always have to massage your data with complex formulas to report on it. Complex calculations in a report can be difficult at times. Not onl 阅读详情
Introduction

Unlike the Windows Forms CrystalReportViewer toolbar, the web-based CrystalReportViewer toolbar does not include a print button.  For reports that are directly rendered as HTML, the user can simply use the browser's print button.  For reports rendered as PDF or Excel, the user can use the print functionality in either the Acrobat Reader or Excel to print the report.

Most users can figure out how to print the report, but some still need a little help, and in some cases, clients request this as part of their application specs.  In this article, we'll review two methods for automatically printing a Crystal Report using the web-based CrystalReportViewer:  the server side ReportDoucment.PrintToPrinter method, and a small client-side JavaScript that uses the window.print method.  We'll also discuss rendering a report in PDF and allowing the user to print that document as an alternative to the two other methods.  Because of the disconnected nature of web client applications, and security considerations, there isn't a perfect way to make every web-based Crystal Report automatically print.  But, under certain conditions, we can provide this functionality in user-friendly ways.

Using Server-Side ReportDocument.PrintToPrinter Method

This server-based method is documented in the Visual Studio help files.  Open the Help Index, and enter PrintToPrinter in the "Look for:" box.  The syntax for this method is:

 Report.PrintToPrinter(<copies as int>, <collated as True/False>, <startpage as int>, <endpage as int>)

'Collated' in this context has nothing to do with database collation.  Some advanced printers (like copier/printers) will sort each document into its own shelf.  Not every printer supports this functionality, so check the printer dialog before setting to true.  To print the entire report, set startpage and endpage each to 0. 

An example in use might look like

MyReport.PrintToPrinter(1,False,0,0)

One limitation of this method is that a printer name must be specified.  You can set the default printer at design time in the report, and you can change the printer name at run time by setting the ReportDocument.PrintOptions.PrinterName property (the PrintOptions are also where you can assign page margins, portrait/landscape, etc.).  Keep in mind that this method prints from the server itself, not from the client machine.  This means that any printer you wish to use must be accessible from the server.  You cannot print to a client's desktop printer using this method unless that printer is shared on the network and mapped to the server.

If your LAN has networked printers, you can make some guesses as to which printer to assign as the default in each report.  For instance, if the Accounting Department has a departmental printer, that would be a good choice to use for the default in an accounting report.  You can provide users the option to choose a networked printer by enumerating the printers mapped to the server and populating a drop-down list.  The PrinterSettings.InstalledPrinters property returns a collection of installed printers, and can be bound to a DropDownList as below.

DropDownList1.DataSource = System.Drawing.Printing.PrinterSettings.InstalledPrinters
DropDownList1.DataBind()

Again, since this code is executing on the server, this will only enumerate the printers on the server mapped to the System user.  If a printer does not appear in the drop-down list, you need to ensure that it is properly mapped to the System user (see below).

All printers and the .NET Framework need to be mapped to the System user in order for this to work.  This is not a trivial task to configure.  Printers can be mapped to the system account only by editing the registry, and since the Framework is mapped to the System user, you may need to reassign security permissions on files and folders.  This process is outlined in the "Printing Web-Based Reports From the Server" article in the VS .NET help files (look up "Crystal Reports, printing" in the VS help index to link to the articles.) and also in Reference 3 (at the end of this article).  The process is a little too intricate to cover here (leave comments if help is needed, and I can amend the article later).

Client Side JavaScript: window.Print

A second option you have uses the JavaScript window.Print method.  Adding this method to the onLoad event of the BODY tag will trigger the browser to print the current page.  Adding this method to a button.onClick event can also be done, just make sure you are using a standard HTML button and not an ASP.NET button control (if you do use an ASP.NET button control, you'll cause a postback, not execute the JavaScript).  In a future article, we'll look at adding a print button to a custom CrystalReportViewer toolbar that uses this method to print a report.

The window.print method does cause a printer selection window to open.  The user will have a chance to select the printer they want to use and must click the "Print" button to start printing.  There is no way to disable the prompt with JavaScript, so for Netscape and other browsers, users will have to see the dialog.  However, in some versions of Internet Explorer, a call to the ExecWB OLE method from a second browser object can be used to circumvent the print dialog (note: spaces have been added to OBJECT declarations to display the code properly in this article--you should remove the spaces to use the code):

function PrintWindow(){ 
if (navigator.appName == "Microsoft Internet Explorer") { 
     var PrintCommand = '< O B J E C T ID="PrintCommandObject" WIDTH=0 HEIGHT=0 ';
PrintCommand += 'CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">';
     document.body.insertAdjacentHTML('beforeEnd', PrintCommand); 
     PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = ""; } 
else { window.print();} }  

The ExecWB method requires IE 5.5 or higher to function.  This script essentially creates another browser object of size 0 at the end of the current page.  This new browser object then issues a print command without prompting the user.

A limitation of the window.Print method is that only the current window will print.  In order to print all pages, you must set the SeparatePages property of your CrystalReportViewer to False when the report is rendered.  For example:

CrystalReportViewer1.SeparatePages=False
CrystalReportViewer1.ReportSource=MyReport

Setting SeparatePages to False will cause the entire report to be shown in the current window.  The user will not have to page through the report, but a lot of scrolling may be required.  Page breaks will appear wherever the browser puts them--there is no way to control where page breaks occur--and the browser may wrap the layout in order for it to fit the printer page dimensions.  Your formatting may be completely lost using the window.Print method if your report is wider than the browser window.

The basic window.Print method also prints everything in the window, including whatever form inputs you have added, and the CrystalReportViewer toolbar.  If you have set SeparatePages= False, you probably don't need the toolbar displayed.

If you do not have any other inputs or buttons on your report page, turning off the toolbar may be all you need to do.  If you did add inputs or other buttons, having them show on the printout will not look very professional. To make the report appear a little more professional, we can enclose the report output in a DIV (by enclosing the CrystalReportViewer in a DIV or Panel) and then print just that DIV using a JavaScript function that opens a new window and includes only the information inside the DIV.  In a future article, we'll look at "skinning" the toolbar so you can have a toolbar and this printing functionality at the same time.  The basic code is shown below (source: Reference 2; note that spaces have been added in some tag names for them to display in this article - you should remove the spaces to use the code):

var gAutoPrint = true; // Flag for whether or not to automatically call the print function
function printSpecial() {
if (document.getElementById != null) {
var html = '/n/n'; 
if (document.getElementsByTagName != null) { 
var headTags = document.getElementsByTagName("head"); 
if (headTags.length > 0) 
html += headTags[0].innerHTML;
} 
html += '/n< / H E A D >/n< B O D Y>/n';
var printReadyElem = document.getElementById("printReady"); 
if (printReadyElem != null) { 
html += printReadyElem.innerHTML; } 
else { 
alert("Could not find the printReady section in the HTML"); return; } 
html += '/n
      /n
      '; 
var printWin = window.open("","printSpecial"); 
printWin.document.open(); 
printWin.document.write(html); 
printWin.document.close(); 
if (gAutoPrint) printWin.print(); 
}
else { 
alert("Sorry, the print ready feature is only available in modern browsers."); 
} }

If you want to get really fancy, you can combine the two methods so that a report window will automatically open and print in IE browsers or open and prompt for printing in non-IE browsers.  The combined code is shown below and has been tested in both IE 6.0 and FireFox 0.9 (note: spaces have been inserted into tag names so code will display properly--you should remove the spaces to use the code):

var gAutoPrint = true; // Flag for whether or not to automatically call the print function 
function printSpecial() { 
if (document.getElementById != null) { 
var html = '< H T M L >/n< H E A D >/n'; 
if (document.getElementsByTagName != null) { 
var headTags = document.getElementsByTagName("head"); 
if (headTags.length > 0) html += headTags[0].innerHTML; 
} 
if (gAutoPrint) { 
if (navigator.appName == "Microsoft Internet Explorer") { 
html += '/n
      /n<'
html += 'B O D Y onLoad="PrintCommandObject.ExecWB(6, -1);">/n'; 
} 
else { 
html += '/n
      /n< B O D Y >/n'; 
} } 
else { 
html += '/n
      /n< B O D Y >/n'; 
} 

var printReadyElem = document.getElementById("printReady"); 
if (printReadyElem != null) { 
html += printReadyElem.innerHTML; 
} 
else { 
alert("Could not find the printReady section in the HTML"); 
return; 
}
if (gAutoPrint) { 
if (navigator.appName == "Microsoft Internet Explorer") { 
html += '< O B J E C T ID="PrintCommandObject" WIDTH=0 HEIGHT=0 '
html += 'CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
      /n
      /n
      '; } 
else { 
html += '/n
      /n
      '; 
} } 
else { 
html += '/n
      /n
      '; 
} 
var printWin = window.open("","printSpecial"); 
printWin.document.open(); 
printWin.document.write(html); 
printWin.document.close();
if (gAutoPrint) { 
if (navigator.appName != "Microsoft Internet Explorer") { 
printWin.print(); 
}}} 
else { 
alert("Sorry, the print ready feature is only available in modern browsers.");
}} 
Export to PDF

As you may have learned from experience, the output from a CrystalReportViewer does not always look like you had intended.  That is because the output is rendered as HTML and sent to the browser that then generates the web page.  In order to get the exact formatting you want, you should export your reports as PDF documents.  One advantage of doing so is that most users know how to print from the Acrobat Reader.  Also, users can save reports and send them as e-mail attachments.

One downside to this option is that users must start the printing process themselves, which does not solve the problem of minimizing user interaction.  Unfortunately, since a PDF is not a page rendered by the browser, none of the JavaScript tricks above will work for us.  There is no simple way to automatically print an exported Crystal Report in PDF format.

Conclusion and References

If your report is fairly simple, you can use the client-side JavaScript window.Print command and a little scripting magic to come up with a satisfactory solution.  Complex reports generated using the JavaScript window.Print may lose the formatting you desired, and, in non-IE browsers, some user intervention is required to answer the Printer Setup dialog.

In a controlled networked environment, the PrintToPrinter() method may provide all the functionality you need.  Networked printers can be enumerated in a drop-down list, and the the user can choose which printer to use.  Most of the limitations have to do with the Internet being a disconnected medium and browser security, which also limits intranet functionality.  Using the PrintToPrinter method requires editing the registry and remapping the .NET Framework user context and limits printing to networked printers.

Printing Crystal Reports is not a process that can be easily automated in a very satisfactory manner.   There is no single magic solution to fit every need; you will need to see which option works best in each situation.  Future versions of Crystal Reports .NET may contain additional functionality, and there are additional tricks we can use in Crystal Reports 10 that will be looked at in a future article.

References

1) "ExecWB Method", http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/methods/execwb.asp

2) "Print Ready Page Script", http://javascript.about.com/library/scripts/blprintready.htm

3) "Printing Web based reports with Crystal Reports for Visual Studio .NET", http://support.businessobjects.com/communityCS/TechnicalPapers/crnet_web_app_printing.pdf.asp

【SpringBoot】1、创建第一个SpringBoot项目 创建SpringBoot项目可以通过两种方式,1、通过访问:https://start.spring.io/,SpringBoot的官方网站进行创建SpringBoot项目;2、通过工具(例如:Idea)创建SpringBoot项目。本次使用开发工具:Idea创建我的第一个SpringBoot项目。 首先,打开我们的Idea开发工具 选择Create New Poject(创建一个新的项目) ... 阅读详情

相关推荐

华三模拟器实战:IPSec VPN穿越NAT的完整配置与调试(附常见问题排查)

本文详细解析了华三模拟器中IPSec VPN穿越NAT的完整配置与调试方法,包括基础环境准备、分步配置、ACL协调策略及高级故障排查。通过实战案例和关键参数解析,帮助网络工程师解决IPSec与NAT协同工作的典型问题,提升企业网络安全性。

weixin_33724046的博客 468

水晶报表 CrystalReportViewer 去除白色和灰色边框

$(document).ready(function () {             $('div.insetBorder').css("background-color", "White");             $('div.menuShadow').css("background-color", "White");             $('.dialogzone').css

cjwix2012的专栏 1488

别再瞎调了!手把手教你用ADI IIO Oscilloscope配置AD936x的AGC(附Pluto SDR实测)

本文详细介绍了如何使用ADI IIO Oscilloscope工具配置AD936x系列射频捷变收发器的自动增益控制(AGC)功能,包括Slow/Fast Attack模式的参数设置与优化技巧。通过Pluto SDR硬件实测演示,帮助开发者快速掌握AGC配置方法,提升无线通信系统的接收性能。

weixin_30267785的博客 589

水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)

System.Drawing.Printing.PrintDocumentdoc=newPrintDocument(); doc.PrinterSettings.PrinterName="NFCPLQ1600K"; intrawKind=1; for(inti=0;i...

weixin_33721427的博客 164

AI工作流革命:从n8n到Sora2,揭秘自动化视频创作的底层逻辑

本文深入探讨了AI工作流在自动化视频创作中的应用,重点介绍了n8n、Coze和Sora2的组合如何实现从链接输入到视频输出的全流程自动化。通过三层架构解析、关键技术模块优化及成本控制策略,这套方案显著提升了视频生产效率,适用于电商、热点追踪等多种场景。

gg901的博客 1106

保姆级教程:Java调用海康SDK实现录像回放与倍速播放(附完整代码)

本文详细介绍了如何使用Java调用海康SDK实现录像回放与倍速播放功能,包括开发环境配置、设备连接、流媒体处理、倍速播放实现及性能优化等关键步骤。通过完整的代码示例和实战经验,帮助开发者快速构建智能录像回放系统,提升开发效率。

weixin_29285605的博客 365

RDLC8.0 报表完美解决方案

1.为了报表的松耦合,代码重用度高,先在数据库中建表   IsLandscape:在网页呈现的时候是横向的还是纵向的。 ReportName:报表文件的路径 ExportName:输出名称 HeadTableName:主数据源的名称,以后依次类推   2.新建强类型数据集 根据需求建强类型数据集,如果是单一的数据库可以保留adapter,因为

我的地盘 2639

Zabbix 7.0 从入门到精通部署手册

zabbix 入门到精通

weixin_43806846的博客 1046

Integrating PayPal into E-Commerce Solutions with ASP.NET

By Rick Strahlwww.west-wind.comrstrahl@west-wind.com Last Update:November 02, 2004 Whats covered:Overview - where does PayPal fit in?How PayPal Processing worksWalkthrough and

流男@水孩 8579

华为OD新系统真题-最小极差分组(C/C++/Py/Java/Js/Go)

华为OD机试 新系统真题【最小极差分组】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【最小极差分组】多语言题解。

qq_45776114的博客 602

【python】懂车帝字体反爬逐层解密案例(附完整代码)

懂车帝字体反爬解密,完整代码分享

景天科技苑 2万+

Creating New Modules In The CSK

Published by Packt PublishingAuthor(s) Cristian Darie, K. Scott Allen The next three chapters in this book will demonstrate various methods of customizing the CSK. Every community site will have d

流男@水孩 3977

【OpenCV】图像的像素直方图 图像特征点 cv::FAST cv::ORB ORB_SLAM2::ORB

文章目录图像直方图代码实现cv::FAST和cv::ORB 检测图像特征点cv::FAST和cv::ORB 检测图像特征点代码实现ORB_SLAM2::ORB和自己实现ORB图像特征点检测效果对比ORB_SLAM2::ORB和自己实现ORB图像特征点检测效果对比代码实现 图像直方图代码实现 图像是由不同数值(颜色)的像素构成的,像素值在图像中的分布情况是图像的重要属性,可以用直方图修改图像的外观,标识图像的内容,检测图像中特定的物体或纹理。 单通道灰度图像中每个像素都有一个 0(黑色)-255(白色)的整

小秋 AI SLAM 入门实战教程 2519

Searcharoo Too : Populating the Search Catalog with a C# Spider

Download the source code for this article [ZIP 8kb] Comment on this article at TheCodeProject Article I describes building a simple search engine that crawls the filesystem from a specified

流男@水孩 3669

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Use Office Web Components to Load Excel and perform calculations in ASP.NET

Ive talked about using Excel, OWC SpreadSheet and the OWC Chart class from ASP.NET in several other articles here. Theres one last item I never covered, and its an important one, now that Office XP

流男@水孩 2968

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

GridView sorting

 Introduction As you may know the GridView have built in support of sorting. In the current version of ASP.Net 1.x, we don’t have the GridView control. Instead you have the DataGrid control. To

流男@水孩 2242

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Screen Scraping, ViewState, and Authentication using ASP.Net

 Before web services came along, screen scraping was a popular technique for grabbing the output from another application by examining the text it displays on the screen. For web applications, this

流男@水孩 2241

ASP.NET WebParts Connections Transformers Tutorial

ContentsDownload: Pending...IntroductionSample ScenarioSummaryIntroduction Connections are a very powerful feature of WebParts that allows interchanging data between two webparts, allowing creat

流男@水孩 2239

Accessibility Improvements in ASP.NET 2.0

Table of Contents <!--OAS_AD(flex);//--> Page 1 Introduction Accessibility and the Law Accessibility Issues in Web Pages Areas for Improvement Recomm

流男@水孩 2161

Page Template Framework for ASP.NET 1.1

29 members have rated this article. Result:Popularity: 6.41. Rating: 4.38 out of 5.Download source files - 16.8 Kb Download demo project - 77.6

流男@水孩 2159

ASP.NET SQLCacheDependency with SQLite and Triggers

The SQLite database engine is getting better all the time, with Version 3.0.6 now out and 3 "Final" not too far off. If you arent familiar with SQLite, you might want to catch up by reading my previo

流男@水孩 2009

Queue MSMQ Messages from SQL Server

download source code If youve ever found yourself scratching your head, wondering how to queue a message from MS SQL Server, then you might find yourself writing your own plumbing. (Microsoft wil

流男@水孩 2008

NATA1 Walk Through

My mission, To implement NATA1 to spider and search my .Text site. Props to Paul [Sedgewick@Nata1.com] for sharing his source and walkthough to get me started on this, and for responding to my pleas f

流男@水孩 2000

Build A C# SQL Server Database Export Utility

One of the most common actions developers need to perform is the scripting of databases for archiving, distribution and installation purposes. Sql Server has the capability to script databases, but it

流男@水孩 1993
上一篇: Server side Message box in ASP.Net
下一篇: Exporting to Excel in Crystal Reports .NET - Perfect Excel Exports
waterboy
博客等级 码龄24年 8粉丝 156原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值