场景:我正在使用Managed Extensibility Framework在运行时根据在单独的dll中定义的接口契约加载插件(导出).在我的Visual Studio解决方案中,我有3个不同的项目:主机应用程序,类库(定义接口 - "IPlugin")和另一个实现接口的类库(导出 - "MyPlugin.dll").
主机在其自己的根目录中查找导出,因此在测试期间,我构建整个解决方案并将Plugin.dll从Plugin类库bin/release文件夹复制到主机的调试目录,以便主机的DirectoryCatalog可以找到它并且能够将它添加到CompositionContainer.每次重建后都不会自动复制Plugin.dll,所以每次我对合同/实现进行更改时都会手动执行.
但是,有几次我运行主机应用程序而没有首先复制(更新)Plugin.dll,并且它在组合期间抛出异常:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions for more information
这当然是因为它试图导入的Plugin.dll实现了不同版本的IPlugin,其中属性/方法签名不匹配.虽然在受控和受监控的环境中很容易避免这种情况,但通过简单地避免(duh)插件文件夹中过时的IPlugin实现,我不能依赖于可能遇到传统插件的生产环境中的这种假设.
问题是这个异常有效地破坏了整个Compose操作,并且没有导入导出.我宁愿忽略不匹配的IPlugin实现,因此仍会导入实现正确版本的IPlugin的目录中的其他导出.
有没有办法实现这个目标?我在想几种可能的选择:
<ImportMany()>属性上指定了类似的标志想法?
ANTLR4是否有可用的sql语法?如果是这样,我在哪里可以找到它?
有一个来自ANTLR维基的链接,但链接被破坏了:语法列表
Fedora 20,xorg 1.14.4-11.
我打开了很多终端窗口,并且我大量使用了组合/多键机制.最令人沮丧的事情之一是,在更改我的~/.Xcompose文件后,我需要启动新的终端窗口以查看更改.
有没有办法让X客户端重新加载~/.Xcompose而不仅仅是一次启动时?特别是终端应用和XChat?
谢谢!
我目前正在使用环境变量将自定义参数传递给我的负载测试.例如,我的测试类看起来像这样:
from locust import HttpLocust, TaskSet, task
import os
class UserBehavior(TaskSet):
@task(1)
def login(self):
test_dir = os.environ['BASE_DIR']
auth=tuple(open(test_dir + '/PASSWORD).read().rstrip().split(':'))
self.client.request(
'GET',
'/myendpoint',
auth=auth
)
class WebsiteUser(HttpLocust):
task_set = UserBehavior
Run Code Online (Sandbox Code Playgroud)
然后我正在运行我的测试:
locust -H https://myserver --no-web --clients=500 --hatch-rate=500 --num-request=15000 --print-stats --only-summary
Run Code Online (Sandbox Code Playgroud)
有没有更多locust方法可以将自定义参数传递给locust命令行应用程序?
执行maven 3的两种主要方法似乎是:
<prerequisites>元素.最佳使用方法似乎取决于几个不同的因素.这个问题是为了帮助人们决定哪种方法对他们最有意义.
问题:哪种类型的项目结构最适合maven-enforcer-plugin,哪种类型的项目结构最适合于先决条件.
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>enforce-maven-3</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.0.5</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
<project>
...
<prerequisites>
<maven>3.0.5</maven>
</prerequisites>
...
</project>
Run Code Online (Sandbox Code Playgroud) 我有以下配置,只对vagrant up命令有意义:
config.vm.provider :virtualbox do |vb|
vb.gui = false
if ENV["VB_GUI"] == "true" then vb.gui = true
else
puts("[info] VB_GUI environment variable not set so running headless")
end
end
Run Code Online (Sandbox Code Playgroud)
是否有可能挂钩到vagrant API来检索当前正在执行的命令?例如
config.vm.provider :virtualbox do |vb|
vb.gui = false
if VAGRANT_API.command == "up" # how can I do this?
if ENV["VB_GUI"] == "true" then vb.gui = true
else
puts("[info] VB_GUI environment variable not set so running headless")
end
end
end
Run Code Online (Sandbox Code Playgroud) 在线有许多步骤可以手动增加流浪盘大小,例如:link
如果调整大小可以自动完成,这将是很好的Vagrantfile,如下所示:
config.vm.provider :virtualbox do |vb|
if first_up # only run on the first 'up' command
disk_uuid = ? # how to get the disk_uuid?
vb.customize ["modifyhd", disk_uuid, "--resize", "15360"]
config.vm.provision "shell", path: "resize2fs -p -F /dev/sda"
end
end
Run Code Online (Sandbox Code Playgroud)
问题:如何以跨平台的方式找出磁盘uuid?
问题:这是调整客户磁盘大小所需的全部内容吗?
当我运行vagrant时,会创建一个新的virtualbox机器,而不是运行在其中标识的虚拟机.vagrant\machines\default\virtualbox\id.然后将新虚拟机的ID写入id文件.
我的VM:
C:\Users\Chris>vboxmanage list vms
"MyVM_1373377014" {177aef6c-b9ec-4a85-adad-76c70f80fa62}
Run Code Online (Sandbox Code Playgroud)
下一个:
C:\Users\Chris>echo 177aef6c-b9ec-4a85-adad-76c70f80fa62 > .vagrant\machines\default\virtualbox\id
其次是:
C:\Users\Chris>vagrant up
新VM中的结果:
C:\Users\Chris>vboxmanage list vms
"MyVM_1373377014" {177aef6c-b9ec-4a85-adad-76c70f80fa62}
"MyVM_1373566342" {4fedb342-cc0b-40fd-a8d1-403049065274}
Run Code Online (Sandbox Code Playgroud)
并id包含新的VM ID:
C:\Users\Chris>type .vagrant\machines\default\virtualbox\id
4fedb342-cc0b-40fd-a8d1-403049065274
Run Code Online (Sandbox Code Playgroud)
因此,出于某种原因创建新VM而不是启动现有VM.
我正在运行Vagrant版本1.2.3
我已经开始使用ssh-agent了:
$ ssh-agent.exe
SSH_AUTH_SOCK=/tmp/ssh-LagrQoD3JRqg/agent.3600; export SSH_AUTH_SOCK;
SSH_AGENT_PID=7784; export SSH_AGENT_PID;
echo Agent pid 7784;
Run Code Online (Sandbox Code Playgroud)
接下来我尝试添加一个键:
$ ssh-add /cygdrive/h/mykey.pem
Run Code Online (Sandbox Code Playgroud)
我得到的回应是:
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud) 我最近构建了Jupyter而不是菜单操作,允许您重新启动并运行所有:
我想添加一个绑定到此操作的键盘快捷键.我已经看过键盘自定义的文档,但我仍然不确定如何添加键盘快捷键.
我已经从源代码构建了Juypter,所以基于帮助,我似乎需要添加一些代码notebook/static/custom/custom.js.
我尝试添加以下内容:
IPython.keyboard_manager.command_shortcuts.add_shortcut('meta-r', function (event) {
IPython.notebook.restart_kernel();
IPython.notebook.execute_run_all();
return false;
});
Run Code Online (Sandbox Code Playgroud)
但是,当我按[Meta-r]时,内核似乎重新启动但execute_run_all()没有被执行.