小编JMW*_*JMW的帖子

如何递归查找目录中的最新修改文件?

ls在执行递归调用时,似乎没有正确排序文件:

ls -altR . | head -n 3
Run Code Online (Sandbox Code Playgroud)

如何在目录(包括子目录)中找到最近修改过的文件?

filesystems bash find

233
推荐指数
9
解决办法
20万
查看次数

如何收缩.git文件夹

我目前的基数总大约是.200MB.

但我的.git文件夹有5GB(!)的惊人大小.因为我把我的工作推到外部服务器,我不需要任何大的本地历史......

如何缩小.git文件夹以释放笔记本上的一些空间?我可以删除超过30天的所有更改吗?

非常感谢任何帮助:)

git

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

Oracle SQL查询日志记录

我正在使用Oracle 11g标准版.

我想将用户正在执行的所有SQL查询记录到表中.

如何才能做到这一点?

sql oracle logging

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

python日志记录dictConfig自定义格式化程序未被调用

我的模块中有以下ColoeredFormatter.

但格式化程序不会被调用.我希望在控制台上"hi",但我得到"这是根记录器的信息".

我已经删除了所有.pyc文件,但它没有帮助.

MyModule的/ __ init__.py

from MyModule.ColoredFormatter import ColoredFormatter

__all__ = ('ColoredFormatter')
Run Code Online (Sandbox Code Playgroud)

MyModule的/ ColoredFormatter.py

import logging

class ColoredFormatter(logging.Formatter):
    def __init__(self, default):
        self.default = default

    def format(self, record):
        print("hi")
        record.msg = "hi"
        return self.default.format(record)
Run Code Online (Sandbox Code Playgroud)

我的剧本

import logging, logging.config, yaml

conf="""
logging:
  version: 1
  disable_existing_loggers: true
  root:
    level: !!python/name:logging.NOTSET
    handlers: [console]
  handlers:
    console:
      class: logging.StreamHandler
      stream: ext://sys.stdout
      formatter: myFormatter
      level: !!python/name:logging.NOTSET

  formatters:
    myFormatter:
      class: !!python/name:MyModule.ColoredFormatter
"""
dict = yaml.parse(conf)
logging.config.dictConfig(dict["logging"])

logging.info("This is an info of the root logger")
Run Code Online (Sandbox Code Playgroud)

python logging formatter

8
推荐指数
2
解决办法
2707
查看次数

perl open:如何将stderr转发到stdout?

可能的重复:
如何在 Perl 中同时捕获 stderr、stdout 和退出代码?
在通过管道将 STDOUT 传输到文件时捕获 STDERR 的输出

我正在使用以下代码来执行进程:

open( my $proch, "-|", $command, @arguments );
Run Code Online (Sandbox Code Playgroud)

不幸的是,我只会阅读stdout。但我也想阅读 stderr

Stderr 重定向会导致以下错误:

open( my $proch, "2>&1 -|", $command, @arguments );
>>> Unknown open() mode '2>&1 -|' at file.pl line 289
Run Code Online (Sandbox Code Playgroud)

如何将stderr转发到stdout

perl stdout stderr

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

WPF:ScrollViewer 和 Grid - 禁用 TexBox 调整大小

请考虑以下 XAML 示例。

  1. 我有一个滚动查看器。如果窗口对于网格来说太小,滚动条将可见。
  2. 在 ScrollViewer 中是 Grid。网格内的所有项目都应拉伸到网格的列宽。
  3. 现在有文本框(带有很长的文本)。

我的问题是,如果文本越来越大,文本框会越来越大。但我只想让文本框适合网格空间。

如何禁用带有大文本的文本框调整大小?

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
            <RowDefinition Height="10*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="*" MinWidth="130" />
            <ColumnDefinition Width="130" />
        </Grid.ColumnDefinitions>

        <Label VerticalAlignment="Center" HorizontalAlignment="Left" Content="Label 1"  Grid.Column="0" Grid.Row="0"/>
        <TextBox x:Name="Tbox1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Text="asfas fasd fasdf asdf asdf asdf asdf asf  safasdf asdf asdf fasasd fas …
Run Code Online (Sandbox Code Playgroud)

wpf xaml

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

需要一个使用skype4py发送即时消息的python脚本

我已经安装了skype4py.(http://skype4py.sourceforge.net/doc/html/)

我不知道python.我需要一个简单的示例脚本,它将第一个cmd参数作为用户名,将第二个参数作为消息.然后应该将此即时消息发送到skype用户名.

有谁知道如何做到这一点?

非常感谢提前

python skype skype4py

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

找出 Linux 中一个进程休眠了多长时间?

基本上我想要所有已经休眠超过一小时的进程。

我知道 ps 中有 etime,但遗憾的是它显示了整体生命周期。

在linux下如何做到这一点(最好用ps)?

linux process ps procfs

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

如何在document.write中包含脚本?

我们需要在Web应用程序中添加一个脚本.它基本上增加了一个企业菜单.

所以我们收到了一个脚本,要包含在我们的webapp主体中:

<!-- BEGIN NAVIGATION -->
<script type="text/javascript" src="https://intranet.local/?getCorporateJsMenu"></script>
<!-- END NAVIGATION -->
Run Code Online (Sandbox Code Playgroud)

https://intranet.local/?getCorporateJsMenu的内容基本上如下所示:

document.write('<script type="text/javascript" src="..."></script>');
//....
document.write('<div>');
document.write('<ul>');
//...
document.write('<li><a href="...">...</a></li>');
//...
document.write('</ul>');
document.write('</div>');
Run Code Online (Sandbox Code Playgroud)

<!--NAVIGATION--><script...直接放入html主体之后,我们遇到了严重的页面加载性能问题.

所以我们的想法是用JS添加菜单,当所有内容都已经加载了这样的东西:

var script=document.createElement('script');
script.type='text/javascript';
script.src='https://intranet.local/?getCorporateJsMenu';
var domparent=jQuery('#header').get();
domparent[0].appendChild(script);
Run Code Online (Sandbox Code Playgroud)

我们看到,使用firebug,脚本元素已添加到html中并且脚本已从网络加载,但不知何故加载脚本的document.write未执行?


更新:我们无法修改https://intranet.local/?getCorporateJsMenu的内容,因为它来自第三方

javascript document.write

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