小编Gor*_*ean的帖子

windows linux子系统中剪贴板中的管道

使用适用于 Windows 的 Linux 子系统 (LSW),clip.exe可用于将数据复制到 Windows 剪贴板:

$ clip.exe /?

CLIP

Description:
    Redirects output of command line tools to the Windows clipboard.
    This text output can then be pasted into other programs.

Parameter List:
    /?                  Displays this help message.

Examples:
    DIR | CLIP          Places a copy of the current directory
                        listing into the Windows clipboard.

    CLIP < README.TXT   Places a copy of the text from readme.txt
                        on to the Windows clipboard.
Run Code Online (Sandbox Code Playgroud)

有没有办法剪贴板管道?预期用途示例:

$ paste.exe > …
Run Code Online (Sandbox Code Playgroud)

clipboard windows-subsystem-for-linux

10
推荐指数
1
解决办法
1421
查看次数

释放与IPython Notebook中的错误相关的内存

我有时会在IPython笔记本中使用非常大的数据集.有时单个pandas DataFrame将占用1 + GB的内存,因此我无法保留许多副本.

我发现如果我尝试对这样的矩阵执行操作,并且出现错误,我就不会恢复内存 - 某些间歇性变量仍在某处被跟踪.问题是,我不知道在哪里,也无法释放它!

例如,下图显示了重复尝试执行单元后的内存消耗(图中的每个步骤对应于执行单元的尝试).每次消耗一个永不释放的新内存块.

执行引发错误的单元格时的内存使用情况

有谁知道这个记忆的去向以及如何释放它?或者,如果这是一个错误(即内存泄漏或类似),你如何表明?我不想将此报告为错误,如果它实际上是代码按设计执行的副作用(例如,IPython是缓存内容而我只是滥用缓存系统).

谢谢!

memory ipython jupyter-notebook

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

使用GetHashCode方法扩展接口,以用作通用字典(C#)中的键

在C#中,是否可以使用GetHashCode和Equals扩展接口,以便在使用接口作为通用字典中的密钥类型时覆盖默认行为?

public interface IFoo {
    int MagicNumber { get; }
}

public static class IFooExtensions {
    public static int GetHashCode(this IFoo foo) { return foo.MagicNumber; }
    public static bool Equals(this IFoo foo, object other) { 
        return foo.MagicNumber == other.GetHashCode(); 
    }
}

public class Foo : IFoo {
    public MagicNumber { get; set; }
    public Foo(int number) { MagicNumber = number; }
}

Dictionary<IFoo, string> dict = new Dictionary<IFoo, string>();
Foo bar = new Foo(7);
dict[bar] = "Win!"
Run Code Online (Sandbox Code Playgroud)

在这个玩具示例中,用作字典中的键的Foo对象是使用接口扩展方法还是对象方法?

c# generics extension-methods dictionary interface

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