- C# / .NET 在类中使用Server.MapPath
自我修炼的小石头
c#ui
直接在类中使用Server.MapPath会出现错误,这是由于类中不能直接使用System.Web.UI.Page的非静态函数造成的。解决方法有两种:方法一、使类继承System.Web.UI.Page类classCFoo:System.Web.UI.Page在使用方法一时请注意:C#中,派生类只能从一个类中继承。换句话说,如果该类已经继承了其他类,则不能再继承Page类,只能使用第二种方法。方法
- Asp.Net 在类中使用Server.MapPath(随手笔记)
无味无感
.NETFramework
C#在类中使用Server.MapPath直接在类中使用Server.MapPath会出现错误,这是由于类中不能直接使用System.Web.UI.Page的非静态函数造成的。解决方法有两种:解决方案:方案1:使类继承System.Web.UI.Page类classCFoo:System.Web.UI.Page在使用方法一时请注意:C#中,派生类只能从一个类中继承。换句话说,如果该类已经继承了其他
- DataSet 读取xml文件
Joson.e8love
datasetxmlobjectstringpathc
DataSetds=newDataSet();ds.ReadXml(Server.MapPath(NetShop.Config.DbConfigs.GetSitePath+"images/flashdata/flash.config"));DataRow[]drs=ds.Tables[0].Select("","[SortOrder]ASC");//返回的是个DataRow[]://DataRow
- loniczip
live for myself
java前端服务器
if(!Directory.Exists(Server.MapPath(webUploadFile))){Directory.CreateDirectory(Server.MapPath(webUploadFile));}//stringpath=Server.MapPath(webUploadFile+filename);//获取存储的目标地址using(varzip=newZipFile(En
- Spire.doc读取模板文档,并在书签处插入内容
阿发博客
Spire.doc.net.netcorec#Spire.doc.netword
在书签位置插入文字//加载模板文档Documentdocument=newDocument(Server.MapPath("~/File/评价结果.doc"));//创建书签导航器BookmarksNavigatorbn=newBookmarksNavigator(document);//添加一个section到文档SectionnewSec=document.AddSection();//目标内
- 上传的问题(FileUpload控件上传不支持给定路径的格式 问题解决 )
weixin_30399155
stringfilepath=Server.MapPath("~/upload"); HttpFileCollectionuploadFile=Request.Files; for(inti=0;i0) { Label1.Text=""; Label
- C#中如何调整图像大小
fangyuan621
MicrosoftVisualStudioC#c#
1.首先要获取你想要调整大小的图像:stringpath=Server.MapPath(“~/Images”);System.Drawing.Imageimg=System.Drawing.Image.FromFile(string.Concat(path,”/3904.jpg”));2.将图像转换为Bitmap:Bitmapb=newBitmap(img);3.创建一个调整图像大小的方法priv
- c# npoi创建数据有效性约束制定列和单元格分别设置
葩熊
数据库前端c#
publicActionResultExport(){varcodesstringtemplateFileName=Path.Combine(Server.MapPath("/ExcelTemplate"),"Auto.xlsx");varfileName=@"Auto.xlsx";ExportExcelXlsxHelperex=newExportExcelXlsxHelper();ex.Init
- C#中判断文件夹或文件是否存在的方法
BeanGo
WPFc#开发语言后端
一、根据虚拟路径获取文件物理路径:stringsavePath=Server.MapPath("~/Uploads/RemoteDatum/");二、判断文件夹是否存在if(!System.IO.Directory.Exists(@"E:\Files")){System.IO.Directory.CreateDirectory(@"E:\Files");//不存在就创建文件夹}三、判断文件是否存在
- ASP.NET 操作XML文件
HappySheep欢乐小羊
XML示例文件实例化(new)一个XML文档对象:XmlDocumentxml=newXmlDocument();载入实例化的XML对象:xml.Load(Server.MapPath("test.xml"));获取实例化的XML对象的节点:XmlNoderoot=xml.SelectSingleNode("root");获取节点的子节点列表:XmlNodeListrootlist=root.Ch
- EPPlus导出excel实例及设置工作簿比例
DunDunM
publicvoidPrintExcel(Listdatalist,Listzuzhilist,Listchuwailist){//创建excelstringfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".xlsx";stringnewpath=Server.MapPath("/excel/PrintExcel/")+filename;File
- ASP.NET MVC获取路径并下载的问题
CyborgNO1
最近在做一个ASP.NETMVC项目,有一个功能是实现生成excel文件并下载。在生成excel文件时,总是会因为路径问题,导致无法正确的写道文件位置。在网上查了给种方法,一直在说用Server.MapPath()。但是在我的项目中,是没有这个方法。对于我这种小白来说,当然是不知道原因了。最后在无意间发如何在ASP.NetCore中为Server.MapPath获取绝对路径的内同,于是就按照这种方
- C# 调用exe 传递参数
sqh001
System.Diagnostics.Processproc=newSystem.Diagnostics.Process();proc.StartInfo.FileName=Path.Combine(Server.MapPath("/"),"Office2Pdf.exe");proc.StartInfo.Arguments=string.Format("{0}{1}",officePath,p
- ASP.Net core 中Server.MapPath的替换方法
shanghaimoon
asp.netcorewebasp.net后端c#
最近忙着将原来的asp.net项目迁移到asp.netcore平台,整体还比较顺利,但其中也碰到不少问题,其中比比较值得关注的一个问题是,在netcore平台中,System.Web程序集已经取消了,要获取HttpContext并不是太容易,好在通过依赖注入,还是可以得到的,具体方法不在本文的讨论范围,大家可以自行百度。但是在得到了netcore版本的HttpContext后,发现已经不再有Ser
- error CS0103: 当前上下文中不存在名称“Server”; error CS0103: 当前上下文中不存在名称“Path”;error CS0103: 当前上下文中不存在名称“XXX”
认真看海
c#错误记录
Server.MapPath()的全名是System.Web.HttpContext.Current.Server.MapPath()。有时在程序调试时会提示“当前上下文中不存在名称“Server””错误,从而不支持函数Server.MapPath()的使用。尽管引用了命名空间“usingSystem.Web;”也是无济于事,此时就需要使用其全名,或者是当前使用Server.MapPath()函数
- c#将文件流转成pdf,并保存文件
qq_36276758
c#后台功能
最近比较忙,有一点时间,可以总结一下前几天遇到的问题,c#将从数据库中读取的base64流生成pdf,并保存文件byte[]fileData=(byte[])dt.Rows[0]["fileData"];stringfileName=DateTime.Now.ToString("yyyyMMddhhmmss")+".pdf";StringdirPath=Server.MapPath("/print
- asp.net web api2设置默认启动登录页面的方法
1.在Global.asax文件中添加Application_BeginRequest方法,如下如所示:publicclassWebApiApplication:HttpApplication{protectedvoidApplication_Start(){log4net.Config.XmlConfigurator.Configure(newFileInfo(Server.MapPath("~
- c# mysql 1062_C#中MySQL函数用DATASET 和 MySqlDataAdapter 操作数据库
weixin_39915267
c#mysql1062
[如果一门程序设计语言不支持数据库操作的话,其很难在现在的世界中存活下来。C#语言提供了丰富的数据库操作类库,极大地方便了对数据库的操作。在C#中,常用的有三种访问1.C#中调用MYSQL数据库时,我用的是MySQLDriverCS这个方法.一般的查询可以方便执[stringdbPath=@"Data\dbTest.mdb";stringdb=Server.MapPath(dbPath);stri
- ASP.NET MVC创建XML文件并实现元素增删改
如果创建如下的XML:darren创建XML文件在HomeController中,在根目录下创建new.xml文件:publicActionResultIndex(){returnView();}[HttpPost]publicActionResultAddXml(){stringpath=Server.MapPath("~/new.xml");XDocumentdoc=newXDocument(
- C#中调整图像大小的步骤详解
在本篇文章中,我将介绍如何在C#中来调整你想要的图像大小。要实现这一目标,我们可以采取以下几个步骤:1.首先要获取你想要调整大小的图像:stringpath=Server.MapPath("~/Images");System.Drawing.Imageimg=System.Drawing.Image.FromFile(string.Concat(path,"/3904.jpg"));2.将图像转换
- C# MVC 获取程序中 目录 或虚拟目录的实际文件目录路径
f5df0a516b61
System.Web.HttpContext.Current.Request.PhysicalApplicationPath;这个只能取得当前项目的根目录,也就是http://www.a.com/的根目录Server.MapPath("~/uploads");这个可以获取实际存在在项目中的uploads目录,也可以获取在IIS关联的虚拟目录
- asp.net简单读取xml文件信息
LMAOhuaNL
C#asp.Net
//以下是循环读取xml文件中节点的值 XmlDocumentxmlDoc=newXmlDocument(); xmlDoc.Load(Server.MapPath("Student1.xml"));//加载xml XmlNodeListNodeList=xmlDoc.SelectNodes(
- 最大在线人数统计
MRman0404
数据库
global.asax:protectedvoidSession_Start(Objectsender,EventArgse){Application.Lock();DataSetobjDataSet=newDataSet()objDataSet.ReadXml(Server.MapPath("database/count.xml"));if(Convert.ToInt32(objDataSet.
- C# 上传RAR文件 解压 获取解压后的文件名称
下一秒_待续
C#类库方法
此方法适用于C盘windows文件夹中有WinRAR.exe文件if(fileExt.ToUpper()==".RAR"){stringzpath=Server.MapPath("~/SendFileZIP/");//不存在文件夹时创建文件夹if(!Directory.Exists(zpath)){Directory.CreateDirectory(zpath);}//导入rar压缩文件时,清空S
- 上传Rar文件
PatyTime
C#
if(fileExt.ToUpper()==".RAR"){stringzpath=Server.MapPath("~/SendFileZIP/");//不存在文件夹时创建文件夹if(!Directory.Exists(zpath)){Directory.CreateDirectory(zpath);}//导入rar压缩文件时,清空SendFileZIP文件夹里面所有的文件DirectoryInf
- 关于Server.MapPath()的命名空间
newnazi
代码
下面是c#连接access数据库的一个示例,其中用到了access数据库,大家也可以看看哦.asp.net-C#连接Access数据库连接字符串:"Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+System.Web.HttpContext.Current.Server.MapPath("App_Data\tbk.mdb;PersistSecurityI
- access最快速的批量导入SQL的方法 使用SqlBulkCopy
emailqjc
.NET
access最快速的批量导入SQL的方法使用SqlBulkCopy2008-11-2223:51stringfilename=DateTime.Now.ToString("yyyyMMdd")+".mdb";stringtablename=DateTime.Now.ToString("yyyyMMdd");if(File.Exists(Server.MapPath("/tempmdb/"+file
- ASPNET Core 中获取应用程序物理路径
十年河东,十年河西,莫欺骚年穷
.netcore
如果要得到传统的ASP.Net应用程序中的相对路径或虚拟路径对应的服务器物理路径,只需要使用使用Server.MapPath()方法来取得Asp.Net根目录的物理路径,如下所示://ClassicASP.NETpublicclassHomeController:Controller{publicActionResultIndex(){stringphysicalWebRootPath=Serve
- asp连接数据库示例
xiang588
技术文章
asp连接Access数据库(OleDb)setconn=server.createobject("adodb.connection")dbPath="config/bloo.mdb"connStr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Server.MapPath(DBpath)conn.openconnStrasp连接SQLServer数
- Webform(文件上传)
weixin_30454481
uic#
1.HTML编码:2.控件:FileUpload它是用来选择要上传的文件,还需要一个按钮来将选中的文件上传到服务器上stringpath="images/"+FileUpload1.FileName;FileUpload1.SaveAs(Server.MapPath(path));优化1:文件保留原有名称和后缀stringpath="images/"+FileUpload1.FileName;优化
- LeetCode[Math] - #66 Plus One
Cwind
javaLeetCode题解AlgorithmMath
原题链接:#66 Plus One
要求:
给定一个用数字数组表示的非负整数,如num1 = {1, 2, 3, 9}, num2 = {9, 9}等,给这个数加上1。
注意:
1. 数字的较高位存在数组的头上,即num1表示数字1239
2. 每一位(数组中的每个元素)的取值范围为0~9
难度:简单
分析:
题目比较简单,只须从数组
- JQuery中$.ajax()方法参数详解
AILIKES
JavaScriptjsonpjqueryAjaxjson
url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址。
type: 要求为String类型的参数,请求方式(post或get)默认为get。注意其他http请求方法,例如put和 delete也可以使用,但仅部分浏览器支持。
timeout: 要求为Number类型的参数,设置请求超时时间(毫秒)。此设置将覆盖$.ajaxSetup()方法的全局
- JConsole & JVisualVM远程监视Webphere服务器JVM
Kai_Ge
JVisualVMJConsoleWebphere
JConsole是JDK里自带的一个工具,可以监测Java程序运行时所有对象的申请、释放等动作,将内存管理的所有信息进行统计、分析、可视化。我们可以根据这些信息判断程序是否有内存泄漏问题。
使用JConsole工具来分析WAS的JVM问题,需要进行相关的配置。
首先我们看WAS服务器端的配置.
1、登录was控制台https://10.4.119.18
- 自定义annotation
120153216
annotation
Java annotation 自定义注释@interface的用法 一、什么是注释
说起注释,得先提一提什么是元数据(metadata)。所谓元数据就是数据的数据。也就是说,元数据是描述数据的。就象数据表中的字段一样,每个字段描述了这个字段下的数据的含义。而J2SE5.0中提供的注释就是java源代码的元数据,也就是说注释是描述java源
- CentOS 5/6.X 使用 EPEL YUM源
2002wmj
centos
CentOS 6.X 安装使用EPEL YUM源1. 查看操作系统版本[root@node1 ~]# uname -a Linux node1.test.com 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux [root@node1 ~]#
- 在SQLSERVER中查找缺失和无用的索引SQL
357029540
SQL Server
--缺失的索引
SELECT avg_total_user_cost * avg_user_impact * ( user_scans + user_seeks ) AS PossibleImprovement ,
last_user_seek ,
 
- Spring3 MVC 笔记(二) —json+rest优化
7454103
Spring3 MVC
接上次的 spring mvc 注解的一些详细信息!
其实也是一些个人的学习笔记 呵呵!
- 替换“\”的时候报错Unexpected internal error near index 1 \ ^
adminjun
java“\替换”
发现还是有些东西没有刻子脑子里,,过段时间就没什么概念了,所以贴出来...以免再忘...
在拆分字符串时遇到通过 \ 来拆分,可是用所以想通过转义 \\ 来拆分的时候会报异常
public class Main {
/*
- POJ 1035 Spell checker(哈希表)
aijuans
暴力求解--哈希表
/*
题意:输入字典,然后输入单词,判断字典中是否出现过该单词,或者是否进行删除、添加、替换操作,如果是,则输出对应的字典中的单词
要求按照输入时候的排名输出
题解:建立两个哈希表。一个存储字典和输入字典中单词的排名,一个进行最后输出的判重
*/
#include <iostream>
//#define
using namespace std;
const int HASH =
- 通过原型实现javascript Array的去重、最大值和最小值
ayaoxinchao
JavaScriptarrayprototype
用原型函数(prototype)可以定义一些很方便的自定义函数,实现各种自定义功能。本次主要是实现了Array的去重、获取最大值和最小值。
实现代码如下:
<script type="text/javascript">
Array.prototype.unique = function() {
var a = {};
var le
- UIWebView实现https双向认证请求
bewithme
UIWebViewhttpsObjective-C
什么是HTTPS双向认证我已在先前的博文 ASIHTTPRequest实现https双向认证请求
中有讲述,不理解的读者可以先复习一下。本文是用UIWebView来实现对需要客户端证书验证的服务请求,网上有些文章中有涉及到此内容,但都只言片语,没有讲完全,更没有完整的代码,让人困扰不已。但是此知
- NoSQL数据库之Redis数据库管理(Redis高级应用之事务处理、持久化操作、pub_sub、虚拟内存)
bijian1013
redis数据库NoSQL
3.事务处理
Redis对事务的支持目前不比较简单。Redis只能保证一个client发起的事务中的命令可以连续的执行,而中间不会插入其他client的命令。当一个client在一个连接中发出multi命令时,这个连接会进入一个事务上下文,该连接后续的命令不会立即执行,而是先放到一个队列中,当执行exec命令时,redis会顺序的执行队列中
- 各数据库分页sql备忘
bingyingao
oraclesql分页
ORACLE
下面这个效率很低
SELECT * FROM ( SELECT A.*, ROWNUM RN FROM (SELECT * FROM IPAY_RCD_FS_RETURN order by id desc) A ) WHERE RN <20;
下面这个效率很高
SELECT A.*, ROWNUM RN FROM (SELECT * FROM IPAY_RCD_
- 【Scala七】Scala核心一:函数
bit1129
scala
1. 如果函数体只有一行代码,则可以不用写{},比如
def print(x: Int) = println(x)
一行上的多条语句用分号隔开,则只有第一句属于方法体,例如
def printWithValue(x: Int) : String= println(x); "ABC"
上面的代码报错,因为,printWithValue的方法
- 了解GHC的factorial编译过程
bookjovi
haskell
GHC相对其他主流语言的编译器或解释器还是比较复杂的,一部分原因是haskell本身的设计就不易于实现compiler,如lazy特性,static typed,类型推导等。
关于GHC的内部实现有篇文章说的挺好,这里,文中在RTS一节中详细说了haskell的concurrent实现,里面提到了green thread,如果熟悉Go语言的话就会发现,ghc的concurrent实现和Go有点类
- Java-Collections Framework学习与总结-LinkedHashMap
BrokenDreams
LinkedHashMap
前面总结了java.util.HashMap,了解了其内部由散列表实现,每个桶内是一个单向链表。那有没有双向链表的实现呢?双向链表的实现会具备什么特性呢?来看一下HashMap的一个子类——java.util.LinkedHashMap。
- 读《研磨设计模式》-代码笔记-抽象工厂模式-Abstract Factory
bylijinnan
abstract
声明: 本文只为方便我个人查阅和理解,详细的分析以及源代码请移步 原作者的博客http://chjavach.iteye.com/
package design.pattern;
/*
* Abstract Factory Pattern
* 抽象工厂模式的目的是:
* 通过在抽象工厂里面定义一组产品接口,方便地切换“产品簇”
* 这些接口是相关或者相依赖的
- 压暗面部高光
cherishLC
PS
方法一、压暗高光&重新着色
当皮肤很油又使用闪光灯时,很容易在面部形成高光区域。
下面讲一下我今天处理高光区域的心得:
皮肤可以分为纹理和色彩两个属性。其中纹理主要由亮度通道(Lab模式的L通道)决定,色彩则由a、b通道确定。
处理思路为在保持高光区域纹理的情况下,对高光区域着色。具体步骤为:降低高光区域的整体的亮度,再进行着色。
如果想简化步骤,可以只进行着色(参看下面的步骤1
- Java VisualVM监控远程JVM
crabdave
visualvm
Java VisualVM监控远程JVM
JDK1.6开始自带的VisualVM就是不错的监控工具.
这个工具就在JAVA_HOME\bin\目录下的jvisualvm.exe, 双击这个文件就能看到界面
通过JMX连接远程机器, 需要经过下面的配置:
1. 修改远程机器JDK配置文件 (我这里远程机器是linux).
 
- Saiku去掉登录模块
daizj
saiku登录olapBI
1、修改applicationContext-saiku-webapp.xml
<security:intercept-url pattern="/rest/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern=&qu
- 浅析 Flex中的Focus
dsjt
htmlFlexFlash
关键字:focus、 setFocus、 IFocusManager、KeyboardEvent
焦点、设置焦点、获得焦点、键盘事件
一、无焦点的困扰——组件监听不到键盘事件
原因:只有获得焦点的组件(确切说是InteractiveObject)才能监听到键盘事件的目标阶段;键盘事件(flash.events.KeyboardEvent)参与冒泡阶段,所以焦点组件的父项(以及它爸
- Yii全局函数使用
dcj3sjt126com
yii
由于YII致力于完美的整合第三方库,它并没有定义任何全局函数。yii中的每一个应用都需要全类别和对象范围。例如,Yii::app()->user;Yii::app()->params['name'];等等。我们可以自行设定全局函数,使得代码看起来更加简洁易用。(原文地址)
我们可以保存在globals.php在protected目录下。然后,在入口脚本index.php的,我们包括在
- 设计模式之单例模式二(解决无序写入的问题)
come_for_dream
单例模式volatile乱序执行双重检验锁
在上篇文章中我们使用了双重检验锁的方式避免懒汉式单例模式下由于多线程造成的实例被多次创建的问题,但是因为由于JVM为了使得处理器内部的运算单元能充分利用,处理器可能会对输入代码进行乱序执行(Out Of Order Execute)优化,处理器会在计算之后将乱序执行的结果进行重组,保证该
- 程序员从初级到高级的蜕变
gcq511120594
框架工作PHPandroidhtml5
软件开发是一个奇怪的行业,市场远远供不应求。这是一个已经存在多年的问题,而且随着时间的流逝,愈演愈烈。
我们严重缺乏能够满足需求的人才。这个行业相当年轻。大多数软件项目是失败的。几乎所有的项目都会超出预算。我们解决问题的最佳指导方针可以归结为——“用一些通用方法去解决问题,当然这些方法常常不管用,于是,唯一能做的就是不断地尝试,逐个看看是否奏效”。
现在我们把淫浸代码时间超过3年的开发人员称为
- Reverse Linked List
hcx2013
list
Reverse a singly linked list.
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
p
- Spring4.1新特性——数据库集成测试
jinnianshilongnian
spring 4.1
目录
Spring4.1新特性——综述
Spring4.1新特性——Spring核心部分及其他
Spring4.1新特性——Spring缓存框架增强
Spring4.1新特性——异步调用和事件机制的异常处理
Spring4.1新特性——数据库集成测试脚本初始化
Spring4.1新特性——Spring MVC增强
Spring4.1新特性——页面自动化测试框架Spring MVC T
- C# Ajax上传图片同时生成微缩图(附Demo)
liyonghui160com
1.Ajax无刷新上传图片,详情请阅我的这篇文章。(jquery + c# ashx)
2.C#位图处理 System.Drawing。
3.最新demo支持IE7,IE8,Fir
- Java list三种遍历方法性能比较
pda158
java
从c/c++语言转向java开发,学习java语言list遍历的三种方法,顺便测试各种遍历方法的性能,测试方法为在ArrayList中插入1千万条记录,然后遍历ArrayList,发现了一个奇怪的现象,测试代码例如以下:
package com.hisense.tiger.list;
import java.util.ArrayList;
import java.util.Iterator;
- 300个涵盖IT各方面的免费资源(上)——商业与市场篇
shoothao
seo商业与市场IT资源免费资源
A.网站模板+logo+服务器主机+发票生成
HTML5 UP:响应式的HTML5和CSS3网站模板。
Bootswatch:免费的Bootstrap主题。
Templated:收集了845个免费的CSS和HTML5网站模板。
Wordpress.org|Wordpress.com:可免费创建你的新网站。
Strikingly:关注领域中免费无限的移动优
- localStorage、sessionStorage
uule
localStorage
W3School 例子
HTML5 提供了两种在客户端存储数据的新方法:
localStorage - 没有时间限制的数据存储
sessionStorage - 针对一个 session 的数据存储
之前,这些都是由 cookie 完成的。但是 cookie 不适合大量数据的存储,因为它们由每个对服务器的请求来传递,这使得 cookie 速度很慢而且效率也不