小编Law*_*ton的帖子

在数据库中存储Crystal Reports文件?

我有一个UI前端,可以与SQL Server数据库进行对话和操作,它可以做的一件事是运行数据库中数据的报告.

这个UI可以安装在多台计算机上,到目前为止我只是将报告保存在安装文件夹中,但这意味着每次添加新报告时都必须手动复制到每个安装的UI中.那里.

我正在考虑将.rpt文件存储在数据库本身(As Blobs)中,并在需要时使用某种机制让UI获取它们,以此作为集中报告和消除此问题的方法.

有没有人试过这个,并且做得好吗?或者,如果你还没有,你能想到在继续前进之前我应该​​考虑的任何事情吗?您能想到的任何提示,技巧或警告可能对我有帮助吗?

sql-server blob crystal-reports

5
推荐指数
1
解决办法
5319
查看次数

在IPython中,如何为%magics创建别名?

假设我要为%edit -x创建别名%xed。我该怎么办?

alias magic-function ipython

5
推荐指数
1
解决办法
2083
查看次数

任务和任务.WaitAll具有超时异常处理

当使用Task.WaitAll等待任务并在WaitAll超时时指定超时时,我还必须单独观察任何未完成的任务(例如通过注册延续)?

这个帖子让我觉得答案是肯定的,但我还没有找到其他证实这一点的东西.

var random = new Random();
var tasks = Enumerable.Range(0, 10).Select((i) => Task.Factory.StartNew(() => {
        // Sleep 5-15 seconds
        Thread.Sleep(random.Next(5000, 15000));
        throw new Exception("Some exception.");
    }
)).ToArray();

try {
    // Wait for 10 seconds
    Task.WaitAll(tasks, 10000);
} catch (AggregateException) {
    // Swallow
}

// Check to see how many tasks were unfinished
tasks.Where(t => !t.IsCompleted).Count().Dump("Unfinished count: ");

// Is this neccessary to avoid exceptions being thrown on the finalizer?
foreach (Task task in tasks) {
    task.ContinueWith(t => t.Exception, …
Run Code Online (Sandbox Code Playgroud)

c# task-parallel-library

5
推荐指数
1
解决办法
6695
查看次数

为什么将方法组传递给重载方法会导致在lambda中调用方法时出现歧义?

// Compiler Error当在所有其他情况下正确推断出类型时,为什么不能在下面的代码中标记的行上推断出要调用的正确重载?

public static class Code {

    private static void Main() {

        OverloadedMethod<string>(() => new Wrapper<string>()); // OK
        OverloadedMethod<string>(() => MethodReturningWrappedString()); // OK
        OverloadedMethod<string>((Func<Wrapper<string>>)MethodReturningWrappedString); // OK
        OverloadedMethod<string>(MethodReturningWrappedString); // Compiler Error

    }

    public static Wrapper<string> MethodReturningWrappedString() {
        return new Wrapper<string>();
    }

    public static void OverloadedMethod<T>(Func<Wrapper<T>> func) where T : class {
    }

    public static void OverloadedMethod<T>(Func<T> func) where T : class {
    }

    public struct Wrapper<T> where T : class {
    }

}
Run Code Online (Sandbox Code Playgroud)

这是编译器错误:

The call is ambiguous between …
Run Code Online (Sandbox Code Playgroud)

c# lambda overloading method-group

5
推荐指数
1
解决办法
114
查看次数

如何解析文件列表以获取Python中的文件名?

所以假设我使用Python的ftplib从FTP服务器检索日志文件列表.我如何解析该文件列表以获取列表中的文件名(最后一列)?请参阅上面的链接,例如输出.

python ftp scripting parsing ftplib

4
推荐指数
2
解决办法
1万
查看次数

从基类访问应用于派生类中的方法的属性

所以我有一个案例,我希望能够将属性应用于派生类中的(虚拟)方法,但我希望能够提供一个在我的基类中使用这些属性的默认实现.

我这样做的最初计划是覆盖派生类中的方法,然后调用基本实现,此时应用所需的属性,如下所示:

public class Base {

    [MyAttribute("A Base Value For Testing")]
    public virtual void GetAttributes() {
        MethodInfo method = typeof(Base).GetMethod("GetAttributes");
        Attribute[] attributes = Attribute.GetCustomAttributes(method, typeof(MyAttribute), true);

        foreach (Attibute attr in attributes) {
            MyAttribute ma = attr as MyAttribute;
            Console.Writeline(ma.Value);
        }
    }
}

public class Derived : Base {

    [MyAttribute("A Value")]
    [MyAttribute("Another Value")]
    public override void GetAttributes() {
        return base.GetAttributes();
    }
}
Run Code Online (Sandbox Code Playgroud)

这只打印"测试的基本值",而不是我真正想要的其他值.

有没有人建议如何修改它以获得所需的行为?

c# attributes custom-attributes

4
推荐指数
1
解决办法
2417
查看次数

如何为GUI Cocoa应用程序创建命令行前端?

我正在创建一个主要的GUI Cocoa应用程序,但我想创建一个命令行前端,打印相同的数据,以便我可以使用geektool显示它.

我猜我需要在我的Xcode项目中创建一个额外的命令行自定义可执行文件,并将其与GUI可执行文件一起构建?有没有关于如何做到这一点的教程?

user-interface xcode cocoa command-line

4
推荐指数
1
解决办法
2384
查看次数

如何在安全首选项窗格中创建锁定/解锁按钮和行为?

是否有指导模仿锁定/解锁按钮和安全Apple偏好窗格的行为?(例如网络)

security authentication macos cocoa

4
推荐指数
1
解决办法
466
查看次数

使用 UserNameOverTransport 绑定时,如何让 WCF 以摘要模式发送密码?(将 WSE3.0 代码转换为 WCF)

我正在尝试将此 WSE3.0 代码转换为 WCF:

// we use Microsoft WSE 3.0 to insert the username token in the soap header.
// This strategy takes care of creating and inserting the Nonce and Created elements 
// for us, as well as creating a password digest based on Nonce, Created, and 
// the password itself.  Refer to the WS-Secutiry UsernameToken Profile 1.1
// specification at http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wss.

Microsoft.Web.Services3.Security.Tokens.UsernameToken nametoken;
nametoken = new Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, password, Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendHashed);
Microsoft.Web.Services3.Design.Policy ClientPolicy = new Microsoft.Web.Services3.Design.Policy();

ClientPolicy.Assertions.Add(new UsernameOverTransportAssertion());
this._proxy.SetPolicy(ClientPolicy);
this._proxy.SetClientCredential<UsernameToken>(nametoken); …
Run Code Online (Sandbox Code Playgroud)

c# wcf ws-security wse

4
推荐指数
1
解决办法
4974
查看次数

当请求具有不受支持的Content-Type时,如何配置ASP.NET Web API服务返回的状态代码?

如果向我的Web API服务发出请求Content-Type,该服务的标头包含该服务不支持的类型,则会返回500 Internal Server Error状态代码,其中包含类似于以下内容的消息:

{"Message":"An error has occurred.","ExceptionMessage":"No MediaTypeFormatter is available to read an object of type 'MyDto' from content with media type 'application/UnsupportedContentType'.","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
   at System.Net.Http.HttpContentExtensions.ReadAsAsync(HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
   at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
   at System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)
   at System.Web.Http.Controllers.HttpActionBinding.<>c__DisplayClass1.<ExecuteBindingAsync>b__0(HttpParameterBinding parameterBinder)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Threading.Tasks.TaskHelpers.IterateImpl(IEnumerator`1 enumerator, CancellationToken cancellationToken)"}
Run Code Online (Sandbox Code Playgroud)

我宁愿415 Unsupported Media Type按照建议返回状态代码,例如,这里 …

content-negotiation asp.net-web-api

4
推荐指数
1
解决办法
1285
查看次数