在写入XML文件时,我收到了一个非常奇怪的IOException:
System.IO.IOException: The requested operation cannot be performed on a file with a user-mapped section open.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)
at System.Xml.XmlDocument.Save(String filename)
Run Code Online (Sandbox Code Playgroud)
当我调用XmlDocument的Save(字符串)函数时发生错误.
发生了什么事吗?
我有兴趣编写一个方法,接受另一个方法作为参数,但不想被锁定到特定的签名 - 因为我不关心这一点.我只对该方法在调用时是否抛出异常感兴趣..NET Framework中是否有一个构造允许我接受任何委托作为参数?
例如,以下所有调用都应该有效(不使用重载!):
DoesItThrowException(doSomething(arg));
DoesItThrowException(doSomethingElse(arg1, arg2, arg3, arg4, arg5));
DoesItThrowException(doNothing());
Run Code Online (Sandbox Code Playgroud) 从gimp.org下载使用Gimp 2.6.6 for MAC OS X(在X11下).
我正在尝试使用Script-Fu自动化无聊的手动过程.我需要解析图像文件名以使用原始文件名上的后缀将各种图层保存为新文件.
我最初的尝试是这样的,但失败了,因为(string-search ...)似乎在2.6下没有(脚本引擎的更改?).
(set! basefilename (substring filename 0 (string-search "." filename)))
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用此信息使用正则表达式解析基本文件名,但(re-match-nth ...)也无法识别.
(if (re-match "^(.*)[.]([^.]+)$" filename buffer)
(set! basefilename (re-match-nth orig-name buffer 1))
)
Run Code Online (Sandbox Code Playgroud)
虽然从向量中拉出值没有错误,但在传入时,结果值不会被视为字符串(string-append ...).
(if (re-match "^(.*)[.]([^.]+)$" filename buffer)
(set! basefilename (vector-ref buffer 1))
)
Run Code Online (Sandbox Code Playgroud)
所以我想我的问题是,我将如何解析基本文件名?
我已经在SO和网络上看到过很多关于这个特定主题的帖子,大多数(如果不是全部)代码如下所示
private void btnSubmit_Click(object sender, RoutedEventArgs e)
{
webBrowser1.Navigate(new Uri("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/onsubmit.htm"));
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
mshtml.HTMLDocument htmlDoc = null;
htmlDoc = (mshtml.HTMLDocument) this.webBrowser1.Document;
if (webBrowser1.Document != null)
{
foreach (mshtml.HTMLFormElement form in htmlDoc.forms)
{
form.submit();
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
代码没有任何错误,但对于生命它没有提交.我正在使用的示例页面有简单的按钮,它做什么,它提醒选择单选按钮,然后提交表单.由于某些奇怪的原因,当使用WebBrowser控件通过代码提交表单时,表单已提交,但警报从未显示.
我不确定我在这里做错了什么.任何有关这方面的帮助将不胜感激.
我有一个jqGrid说明用户信息,将在表单中进行编辑.用户名是不可变的,但应该出现在表单中,以便用户知道他们正在编辑哪个用户.密码仅限编辑.所以在我的colModel中我有这样的设置:
{name:'username', index:'username', width:155, editable:true, editoptions: {readonly:'readonly'}},
{name:'password', index:'password', width:155, hidden:true, editable: true, edittype:'password', editrules:{edithidden:true}},
Run Code Online (Sandbox Code Playgroud)
这适用于编辑.我的问题是添加我需要使用户名"不读取".我没有看到控制添加表单和编辑表单的属性.也许我可以使用该afterShowForm事件来更改编辑选项?有人做过这样的事吗?
只是出于好奇,它不是'我必须拥有它',而是如何使用powershell中的system.tuple类声明一个元组?
我正在使用powershell.exe.config加载框架4.0,但我无法创建元组.
试试这个:
PS C:\ps1> $a = [System.Tuple``2]::Create( "pino", 34)
Chiamata al metodo non riuscita. [System.Tuple`2] non contiene un metodo denominato 'Create'.
In riga:1 car:31
+ $a = [System.Tuple``2]::Create <<<< ( "pino", 34)
+ CategoryInfo : InvalidOperation: (Create:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Run Code Online (Sandbox Code Playgroud)
抱歉意大利样品......
谢谢你的帮助.
编辑:
如果我尝试:
PS C:\ps1> $a = [System.Tuple]::Create(34,"pino")
Impossibile trovare un overload per "Create" e il numero di argomenti: "2".
In riga:1 car:28
+ $a = [System.Tuple]::Create <<<< (34,"pino")
+ CategoryInfo : NotSpecified: (:) [], …Run Code Online (Sandbox Code Playgroud) 我正在考虑升级我的iPhone 3G,并想知道我是否可以继续使用它进行appstore应用程序开发和测试.我不想继续支付额外的线路和数据计划,我也不会对使用is作为手机感兴趣.我可以对它进行配置和调试吗?它必须越狱吗?
我想在脚本任务中执行此操作.例如,我希望能够做到这样的事情:
For each file as file in strDirectory
file.delete
next file
Run Code Online (Sandbox Code Playgroud)