我已成功制作了几个Visual Studio调试器可视化工具,并且它们工作得非常好,除了在某些对象上我尝试使用反序列化对象时出现超时错误 objectProvider.GetObject()
System.Exception: Function evaluation timed out.
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.MaybeDeserializeAndThrowException(Byte[] data)
Run Code Online (Sandbox Code Playgroud)
超时发生的时间相当快(可能在我点击可视化器图标后大约一秒钟),即使我的其他可视化工具工作正常,即使大型数据对象显示更长时间(5-10秒)仍然没有超时.
我已经创建了一个自定义对象源来限制序列化到我需要显示的字段.我还能做些什么来使数据反序列化而不超时?
我正在使用ggplot2来创建直方图面板,我希望能够在每个组的平均值上添加一条垂直线.但是geom_vline()对每个面板使用相同的截距(即全局均值):
require("ggplot2")
# setup some sample data
N <- 1000
cat1 <- sample(c("a","b","c"), N, replace=T)
cat2 <- sample(c("x","y","z"), N, replace=T)
val <- rnorm(N) + as.numeric(factor(cat1)) + as.numeric(factor(cat2))
df <- data.frame(cat1, cat2, val)
# draws a single histogram with vline at mean
qplot(val, data=df, geom="histogram", binwidth=0.2) +
geom_vline(xintercept=mean(val), color="red")
# draws panel of histograms with vlines at global mean
qplot(val, data=df, geom="histogram", binwidth=0.2, facets=cat1~cat2) +
geom_vline(xintercept=mean(val), color="red")
Run Code Online (Sandbox Code Playgroud)
我怎样才能使用每个面板组的意思作为x截距?(如果您还可以使用平均值的行添加文本标签,则可以获得奖励积分.)
如何在C#中将控制台应用程序窗口置于最前面(特别是在运行Visual Studio调试器时)?
可能重复:
如何在C#中正确清理Excel互操作对象
我在这里阅读了许多关于管理COM引用的其他线程,同时使用.Net-Excel互操作来确保Excel进程在退出时正确退出,到目前为止,这些技术已经运行良好,但我最近遇到了一个将新工作表添加到现有工作簿文件时出现问题.
下面的代码留下了僵尸Excel进程.
如果我将工作表添加到新创建的工作簿文件,它将退出正常.如果我运行除.Add()行之外的代码,它会退出.(我正在读取的现有文件是由注释掉的代码创建的空文件)
有任何想法吗?
//using Excel = Microsoft.Office.Interop.Excel;
//using System.Runtime.InteropServices;
public static void AddTest()
{
string filename = @"C:\addtest.xls";
object m = Type.Missing;
Excel.Application excelapp = new Excel.Application();
if (excelapp == null) throw new Exception("Can't start Excel");
Excel.Workbooks wbs = excelapp.Workbooks;
//if I create a new file and then add a worksheet,
//it will exit normally (i.e. if you uncomment the next two lines
//and comment out the .Open() line below):
//Excel.Workbook wb = wbs.Add(Excel.XlWBATemplate.xlWBATWorksheet);
//wb.SaveAs(filename, …Run Code Online (Sandbox Code Playgroud) 有没有办法在Visual Studio调试器可视化工具中获取目标对象的基础变量名称?内置的字符串可视化工具:
string myStr = "abc\ndef";
Debugger.Break();
Run Code Online (Sandbox Code Playgroud)
单击可视化器图标myStr,您将看到"表达式"文本框显示"myStr".我怎样才能在自己的可视化工具中获得这个?
如何在C#中创建EPS文件?是否有可用的开源库,还是我必须诉诸规范并手动完成?
我正在尝试使用Barton和Nackman技巧来实现类,以避免动态调度.(我正在编写性能很重要的MCMC代码.)我不是C++专家,但基本的诀窍是在别处为我工作.但是我现在有一个案例,其中第二个派生类需要模板化.这似乎会引起问题.我的代码大纲是:
// Generic step class
template<class DerivedStepType>
class Step {
public:
DerivedStepType& as_derived() {
return static_cast<DerivedStepType&>(*this);
}
void DoStep() {
return as_derived.DoStep();
}
};
// Gibbs step
template<class DerivedParameterType> // THIS IS THE PROBLEM
class GibbsStep : public Step<GibbsStep> {
public:
GibbsStep(DerivedParameterType new_parameter) {
}
void DoStep() {
}
};
Run Code Online (Sandbox Code Playgroud)
问题是template<class DerivedParameterType>以下<GibbsStep>(来自Barton和Nackman的伎俩).使用g ++ v 4.01(OSX),我收到以下错误:
./src/mcmc.h:247: error: type/value mismatch at argument 1
in template parameter list for 'template<class DerivedStepType> class Step'
./src/mcmc.h:247: error: expected a type, …Run Code Online (Sandbox Code Playgroud) 如何使表单具有固定的宽高比,并在调整大小时保留?
我知道可以通过覆盖OnSizeChanged和手动修改[new]高度/宽度来完成,但这会导致闪烁,因为它在调用事件之前调整大小一次(大小与宽高比不匹配)然后再次调整大小(到正确的宽高比).有没有更好的办法?