小编Pau*_*opf的帖子

WPF,Visual Studio的混合?

我听说过使用WPF(xaml设计师)和VS 2008-2010的投诉,但不是2012年的投诉.它仍然是使用Blend的标准还是VS 2012拥有我们需要的一切?我知道最近有一个版本"Blend for Visual Studio".这是神奇的整合吗?

这当然是假设我们没有设计师要求Blend.

wpf expression-blend visual-studio-2012 blend-2012

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

c#通过HTTP流式传输降级质量的视频

我有非常大的高质量视频,我需要通过HTTP流式传输(用于移动设备).无法使用ffmpeg创建视频的"流式"版本.

我还必须支持HTTP的搜索/开始功能,以便用户可以在视频中跳过.

我正在使用ServiceStack(不是IIS).

有没有可用的选择?

我可以访问服务器,因此任何第三方服务都是可以接受的.

.net c# video-streaming servicestack

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

未提供COM + dll时获取IDL(用于TLB)

我有一个.dll,其中包含一些带有特定/自定义界面的DirectShow筛选器(COM)进行查询。

大多数第三方DirectShow组件都包含嵌入式.tlb文件,这些文件可用于跨环境通信(C#typelib导入)。

我不想尝试手动创建c#所需的接口,因为没有提供idl / tlb文件。

是否可以从COM .dll生成tlb(或至少是idl,我可以MIDL编译)?

c++ com idl typelib midl

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

.NET 排队任务(使用 async/await)

我有大量任务(~1000)需要执行。我在 4 核处理器上运行,所以我想一次并行处理 4 个任务。

为了给您一个起点,这里有一些示例代码。

class Program
{
    public class LongOperation
    {
        private static readonly Random RandomNumberGenerator = new Random(0);
        const int UpdateFrequencyMilliseconds = 100;

        public int CurrentProgress { get; set; }

        public int TargetProcess { get; set; }

        public LongOperation()
        {
            TargetProcess = RandomNumberGenerator.Next(
                (int)TimeSpan.FromSeconds(5).TotalMilliseconds / UpdateFrequencyMilliseconds, 
                (int)TimeSpan.FromSeconds(10).TotalMilliseconds / UpdateFrequencyMilliseconds);
        }

        public async Task Execute()
        {
            while (!IsCompleted)
            {
                await Task.Delay(UpdateFrequencyMilliseconds);
                CurrentProgress++;
            }
        }

        public bool IsCompleted => CurrentProgress >= TargetProcess;
    }

    static void Main(string[] args)
    {
        Task.Factory.StartNew(async …
Run Code Online (Sandbox Code Playgroud)

.net task-parallel-library async-await tpl-dataflow

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

AutoFac - 使用已知服务实例化未注册的服务

使用已知服务实例化未注册的服务(通过ctr注入它们).

我想避免容器污染.

ioc-container autofac

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

Yocto:将内核模块配方添加到映像,但它不会在启动时加载

出于测试目的,我使用yocto提供的示例配方来演示如何构建内核模块.

SUMMARY = "Example of how to build an external Linux kernel module"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"

inherit module

PR = "r0"
PV = "0.1"

SRC_URI = "file://Makefile \
           file://hello.c \
           file://COPYING \
          "

S = "${WORKDIR}"

# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.
Run Code Online (Sandbox Code Playgroud)

hello.c文件非常简单.

#include <linux/module.h>

int init_module(void)
{
    printk("Hello World!\n");
    return 0;
}

void cleanup_module(void)
{
    printk("Goodbye Cruel World!\n");
} …
Run Code Online (Sandbox Code Playgroud)

kernel-module yocto

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

扩展方法没有显示

我正在为MVC Web应用程序中的HtmlHelper类创建扩展方法.什么都没有显示,甚至没有显示默认的InputExtensions.

public static class HtmlHelpers
{
    public static void RegisterScriptInclude(this HtmlHelper htmlhelper, string script)
    {
        if (!RegisteredScriptIncludes.ContainsValue(script))
        {
            RegisteredScriptIncludes.Add(RegisteredScriptIncludes.Count, script);
        }
    }

    public static string RenderScripts(this HtmlHelper htmlhelper)
    {
        var scripts = new StringBuilder();
        foreach (string script in RegisteredScriptIncludes.Values)
        {
            scripts.AppendLine("<script src='" + script + "' type='text/javascript'></script>");
        }
        return scripts.ToString();

    }

    private static SortedList<int, string> RegisteredScriptIncludes
    {
        get
        {
            SortedList<int, string> value = (SortedList<int, string>)HttpContext.Current.Items["RegisteredScriptIncludes"];
            if (value == null)
            {
                value = new SortedList<int, string>();
                HttpContext.Current.Items["RegisteredScriptIncludes"] = value;
            } …
Run Code Online (Sandbox Code Playgroud)

extension-methods

3
推荐指数
1
解决办法
2304
查看次数

RegEx,冒号分隔列表

我正在尝试匹配冒号分隔的电子邮件列表.为了简单起见,我将把电子邮件表达式从混合中删除,并将它与任意数量的字符匹配,它们之间没有空格.

以下将匹配......

somevalues  ;somevalues;       somevalues;
Run Code Online (Sandbox Code Playgroud)

要么

somevalues; somevalues             ;somevalues
Run Code Online (Sandbox Code Playgroud)

结局; 不应该是必要的.

以下内容不匹配.

somevalues ;   some values    somevalues;
Run Code Online (Sandbox Code Playgroud)

要么

some values; somevalues some values
Run Code Online (Sandbox Code Playgroud)

到目前为止,我已经得到了这个,但它不起作用.由于我在冒号之间允许空格,因此表达式不知道空格是在单词中还是在冒号之间.

([a-zA-Z]*\s*\;?\s*)*
Run Code Online (Sandbox Code Playgroud)

以下是匹配的(不应该是e)

somevalue ; somevalues  some values;
Run Code Online (Sandbox Code Playgroud)

如果有的话,如何使表达式只允许空格; 在它的左边或右边?

regex list

3
推荐指数
1
解决办法
4338
查看次数

MonoTouch"无法识别的选择器发送到实例"不能在iOS5上运行(但在iOS6上运行)

我使用MonoTouch与Aviary SDK链接时遇到以下错误.

- [__ NSArrayM objectAtIndexedSubscript:]:无法识别的选择器发送到实例0x9b0f1d0

当我尝试推送链接的控制器时,会出现问题.

PresentViewController(photoEditor, true, new NSAction(() => {}));
Run Code Online (Sandbox Code Playgroud)

我已将我的项目推送/共享到https://github.com/theonlylawislove/MonoTouch.Aviary,您可以在其中重现问题.

我的演示应用程序适用于iOS 6模拟器,但提到的错误发生在iOS 5模拟器(和设备)上.

我直接从最新的Aviary SDK 3.0中获取了所有内容(.a/bundles).他们提供的演示应用程序(使用相同的.a lib)适用于iOS 5,因此问题必须在于MonoTouch和链接.

这是我的链接标志.

[assembly: LinkWith ("libAviarySDK.a", 
                     LinkTarget = LinkTarget.ArmV7 | LinkTarget.Simulator, 
                     ForceLoad = true, 
                     IsCxx = true,
                     Frameworks="Accelerate CoreData CoreText Foundation MessageUI OpenGLES QuartzCore StoreKit SystemConfiguration UIKit", 
                     WeakFrameworks="AdSupport",
                     LinkerFlags="-ObjC -all_load -fobjc-arc -lz -lsqlite3.0")]
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?提前致谢!我希望解决方案能够与社区分享,因为Aviary不提供MonoTouch绑定.

c# linker xamarin.ios aviary

3
推荐指数
1
解决办法
1766
查看次数

MonoTouch对象引用可防止垃圾回收

我有一个奇怪的问题,导致MonoTouch内存泄漏.这是我的设置.

CaseTabController - UITabBarController
-- CaseMediaItemsController - UIViewController
-- CaseInfoController (irrelevant) - UIViewController
Run Code Online (Sandbox Code Playgroud)

子控制器显示为选项卡.从子控制器,我试图添加一些NavigationItem(s)到父UITabBarController.但是,当我访问时ParentViewController,会保留一个引用,使我的对象保持活动状态并且永远不会被垃圾回收.

仅仅将以下代码添加到子UIViewController ViewDidLoad会导致内存泄漏.

var ni = ParentViewController.NavigationItem;
ni = null;
Run Code Online (Sandbox Code Playgroud)

可能父UITabBarController永远不会被处理,因为我的子选项卡引用它.这是HeapShot的输出.

通过访问ParentViewController从子TABS

HeapShot内存泄漏

无需访问ParentViewController儿童标签

HeapShot没有内存泄漏

请注意,除了步骤之外,每个内存快照都在执行相同的操作.请注意快照WITHOUT引用ParentViewController的实例如何更少,因为正在处理它们.它们处理得如此之快,以至于我在查看相关控制器时实际拍摄了快照.没有访问ParentViewController的快照正在访问另一个控制器.在每种情况下,UITabBarController都已从UINavigationController中弹出.

CaseMediaItemsController在访问ParentViewController时是否维护对CaseTabController的引用的任何想法?

garbage-collection memory-leaks xamarin.ios

3
推荐指数
1
解决办法
487
查看次数