我正在尝试学习跟踪的内置功能.我无法弄清楚如何使用配置来设置写入我的监听的级别(信息,警告,错误).
我有默认的app.config.在我的代码中,我使用Trace.TraceInformation()和Trace.TraceError.
所有消息都写入我的文本文件.我希望能够在app.config中更改某些内容,使其记录Info消息或仅记录错误消息.
Module1.vb中
Sub Main(ByVal args() As String)
Dim index As Integer = 0
For Each arg As String In args
Trace.TraceInformation(String.Format("Sub Main(): arg({1}) = {0}", arg, index))
Trace.Flush()
If arg.Split("=").Count = 2 Then
If String.Compare(arg.Split("=")(0), "mode", True) = 0 Then _Mode = arg.Split("=")(1)
End If
index += 1
Next
End Sub
Run Code Online (Sandbox Code Playgroud)
的app.config
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application …Run Code Online (Sandbox Code Playgroud) 基本上,我需要一种方法将控制返回到for循环的开头,并且如果满足某个条件,则在采取操作后实际重新启动整个迭代过程.
我想要做的是这样的:
for index, item in enumerate(list2):
if item == '||' and list2[index-1] == '||':
del list2[index]
*<some action that resarts the whole process>*
Run Code Online (Sandbox Code Playgroud)
这样,如果['berry','||','||','||','pancake'在列表中,我将结束:
['berry','||','pancake']相反.
谢谢!
我正在尝试在Ubuntu 10.04上安装RMagick.看着这里却没有快乐.我甚至从源代码编译和安装了ImageMagick,但是当我尝试使用RubyGems安装RMagick时,这里的说明仍然没有帮助我.我收到了这个错误:
carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$ sudo gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
carcher@carcher-laptop:~/Code/temp/RMagick-2.13.1$
Run Code Online (Sandbox Code Playgroud)
这是什么意思呢?:)我是Ruby和RubyGems的新手,所以请保持温柔.我的设置如下:
Ruby: 1.8.7
RubyGems: 1.3.7
Run Code Online (Sandbox Code Playgroud)
我几乎没有想法(也累了!).我厌倦了使用上面的链接从源代码编译RMagick但它失败了,因为没有./configure脚本:(
任何和所有帮助表示赞赏!
这个问题的扩展:https: //stackoverflow.com/questions/50335/ok-cancel-or-cancel-ok
应用按钮应该去哪里(单击"应用"按钮与单击"确定"具有相同的效果,除了对话框保持打开状态)?
Windows通常使用OK-CANCEL-APPLY,但我倾向于使用OK-APPLY-CANCEL.
此外,如果单击"应用"按钮,是否应将"取消"按钮文本更改为"关闭",直到对话框中的其他更改为止?我假设如果没有要应用的更改,将禁用APPLY按钮.
我只想在emacs服务器运行时在我的init文件中执行一些代码(特别是如果emacs是以--daemon标志启动的话).似乎没有任何钩子在server-start被调用时运行,并且没有变量我可以查看服务器是否正在运行.
黑客是使用(featurep 'server),因为服务器功能没有加载,除非服务器启动,这似乎适合我的目的,但我想知道正确的方法是什么.谢谢.
#include <map>
#include <iostream>
template <typename T>
class A
{
static std::map<int, int> data;
public:
A()
{
std::cout << data.size() << std::endl;
data[3] = 4;
}
};
template <typename T>
std::map<int, int> A<T>::data;
//std::map<int, int> A<char>::data;
A<char> a;
int main()
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这有什么问题?如果没有明确的实例化,它就会破坏
data[3] = 4;显式实例化解决了问题但程序在之后中断
std::cout << data.size() << std::endl;什么意思是静态类模板memeber
data被实例化. 我正在与我的公司一起使用Git,但是一些设计师使用Dreamweaver进行合成和布局.
Dreamweaver包含一个SVN工具,但我一直试图找到一种方法让他们包含git,这样他们就可以直观地提交并将他们的更改推送到存储库.
谷歌搜索,我发现GitWeaver,但似乎是Git工具的所有东西,Windows独家.
那么,你会怎么做呢?
我为自己编写了一个人工神经网络(ANN)实现(很有趣).我现在在想我可以在哪里使用它.
现实世界中使用ANN的关键领域是什么?
我正在尝试创建一个沙盒AppDomain来加载扩展/插件.我有一个MarshalByRefObject,它在appdomain中实例化以加载dll.我在尝试加载dll时遇到SecurityExceptions,我无法弄清楚如何绕过它们,同时仍然限制第三方代码可以做什么.我的所有项目都是.net 4.
InDomainLoader类位于完全受信任的域中,该方法标记为SecuritySafeCritical.从我读过的所有内容来看,我认为这应该有效.
这是我的Loader类,它创建AppDomain并跳转到它:
public class Loader
{
public void Load(string dll, string typeName)
{
Log.PrintSecurity();
// Create new AppDomain
var setup = AppDomain.CurrentDomain.SetupInformation;
var permissions = new PermissionSet(null);
permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
var strongname = typeof(InDomainLoader).Assembly.Evidence.GetHostEvidence<StrongName>();
var strongname2 = typeof(IPlugin).Assembly.Evidence.GetHostEvidence<StrongName>();
AppDomain domain = AppDomain.CreateDomain("plugin", null, setup, permissions, strongname, strongname2);
// Create instance
var loader = (InDomainLoader)domain.CreateInstanceAndUnwrap(
typeof (InDomainLoader).Assembly.FullName, typeof (InDomainLoader).FullName);
// Jump into domain
loader.Load(dll, typeName);
}
}
Run Code Online (Sandbox Code Playgroud)
这是在域中运行的引导加载程序:
public class InDomainLoader : MarshalByRefObject
{
[SecuritySafeCritical]
public void Load(string dll, string …Run Code Online (Sandbox Code Playgroud) 当你可以用Solve做同样的事情时,为什么Roots功能存在?