小编fam*_*kin的帖子

熟悉Logstash输出插件

我试图使用flunetd从scribe服务器读取并输出这些日志暂时存储在logstash中.我知道将scribe_central日志记录到另一个中央记录器是非常愚蠢的,但我们需要在我们当前的架构中完成.

有谁知道是否有任何插件可以做到这一点?我搜索了谷歌但找不到任何东西.

logging log-shipping logstash fluentd

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

如何安装NodeBox for console

我正在研究OS X Mavericks,并希望在Python脚本中使用NodeBox模块.

关于如何为控制台安装模块的帖子是从2009年开始的,不再适用,因为它引用版本1.9.x(当前为3.0.40).此外,SVN源不再存在.这些消息来源可以在GitHub上找到.

通过克隆项目并运行:

ant run
Run Code Online (Sandbox Code Playgroud)

我得到的只是桌面版的构建.

如何在Python脚本中正确安装和运行最新的NodeBox模块?

python python-module python-2.7 nodebox

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

在Python中查找span标记内的多个属性

我希望从网站上获取两个值.它们存在于以下标记中:

<span class="sp starBig">4.1</span>
<span class="sp starGryB">2.9</span>
Run Code Online (Sandbox Code Playgroud)

我需要值sp starBig,sp starGryB.

我正在使用的findAll表达式是 -

soup.findAll('span', {'class': ['sp starGryB', 'sp starBig']}):
Run Code Online (Sandbox Code Playgroud)

代码执行时没有任何错误,但没有显示结果.

python beautifulsoup

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

绑定GradientStop可以工作但报告错误

以下代码将a绑定GradientStop到Background.Color属性TemplatedParent.一切正常但我在输出窗口中收到绑定错误:

System.Windows.Data错误:2:找不到目标元素的管理FrameworkElement或FrameworkContentElement.BindingExpression:路径= Background.Color; 的DataItem = NULL; target元素是'GradientStop'(HashCode = 6944299); 目标属性是'颜色'(类型'颜色')

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
x:Class="WpfBindingTest.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="100" Height="100">
<Window.Resources>
    <ControlTemplate x:Key="GradientTemplate" TargetType="{x:Type ContentControl}">
        <Border BorderThickness="1" BorderBrush="{TemplateBinding Background}">
            <Border.Background>
                <LinearGradientBrush  EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="{Binding Path=Background.Color, 
                        RelativeSource={RelativeSource TemplatedParent}}"  Offset="1"/>
                    <GradientStop Color="White"  Offset="0"/>
                </LinearGradientBrush>
            </Border.Background>
            <ContentPresenter/>
        </Border>
    </ControlTemplate>
</Window.Resources>

<Grid x:Name="LayoutRoot">
    <ContentControl Background="Green" Template="{StaticResource GradientTemplate}" >
        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="X" />
    </ContentControl>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

wpf binding

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

IIS中的Apache的ProxyPass和ProxyPassReverse等价物

在IIS中是否有Apache的mod_proxy等价物?

我在Apache的httpd.conf中启用了以下配置(启用了mod_proxy):

Header add Set-Cookie "ROUTEID=hej.%{BALANCER_WORKER_ROUTE}e; path=/;" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://openfire>
    BalancerMember http://server2:7070/http-bind/ route=1
    ProxySet stickysession=ROUTEID
</Proxy>

ProxyPass /project1/http-bind balancer://openfire nofailover=Off
ProxyPassReverse /project1/http-bind balancer://openfire
Run Code Online (Sandbox Code Playgroud)

我需要为IIS做类似的配置.我尝试了ARR(应用程序请求路由)但无法使其正常工作.

有人可以帮我实现这个目标吗?

谢谢.

apache iis mod-proxy proxypass

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

JavaFX:即使在调整窗口大小时,也要将所有组件保持在中心位置

我希望我的所有组件(TextFields,标签等)都保持在固定大小的中心.我在场景构建器中制作它并且当我看到预览时它可以工作,但是当我启动它时,当我调整它时,组件不会留在中心.

请看这里的图片:http://postimg.org/image/r42kvvfbf/

FXML文件:

<AnchorPane id="AnchorPane" fx:id="root" maxHeight="-1.0" maxWidth="-1.0" minHeight="400.0" minWidth="600.0" prefHeight="-1.0" prefWidth="-1.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="myController">
  <children>
    <GridPane alignment="CENTER" prefHeight="-1.0" prefWidth="-1.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
      <children>
        <VBox alignment="CENTER_LEFT" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="-1.0" prefWidth="-1.0" spacing="10.0" GridPane.columnIndex="0" GridPane.rowIndex="0">
          <children>
            <Label text="ID number" />
            <TextField fx:id="id" maxWidth="-Infinity" minWidth="-Infinity" prefWidth="210.0" promptText="" />
            <Label text="Password" />
            <TextField fx:id="password" maxWidth="-Infinity" minWidth="-Infinity" prefWidth="210.0" promptText="" />
            <HBox id="HBox" alignment="CENTER" spacing="5.0">
              <children>
                <Button mnemonicParsing="false" onAction="#loginAction" text="????" textAlignment="CENTER" textOverrun="ELLIPSIS" />
              </children>
            </HBox>
          </children>
          <padding>
            <Insets bottom="20.0" left="20.0" …
Run Code Online (Sandbox Code Playgroud)

layout javafx fxml scenebuilder

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

从PowerShell cmdlet返回对象

我正在尝试为PowerShell管理单元创建自己的cmdlet集.我遇到的问题是我创建了自己的对象,我在ProcessRecord方法中创建和填充但我无法更改返回类型以允许我返回我创建的对象.

 protected override void ProcessRecord()
 {
    ReportFileSettings rptFileSettings = new ReportFileSettings();
    rptFileSettings.Enabled = string.Equals((reader.GetAttribute("Enabled").ToString().ToLower()), "yes");
    rptFileSettings.FileLocation = reader.GetAttribute("FileLocation").ToString();
    rptFileSettings.OverwriteExisting = string.Equals(reader.GetAttribute("OverwriteExistingFile").ToString().ToLower(), "yes");
    rptFileSettings.NoOfDaysToKeep = int.Parse(reader.GetAttribute("NumberOfDaysToKeep").ToString());
    rptFileSettings.ArchiveFileLocation = reader.GetAttribute("ArchiveFileLocation").ToString();

    return rptFileSettings;
 }
Run Code Online (Sandbox Code Playgroud)

这是我的ProcessRecord方法,但是因为它覆盖了PSCmdlet中的那个,所以无法从void更改返回类型.

任何人都可以帮助返回rptFileSettings对象的最佳方法,以便我可以将其与其他cmdlet中的值一起使用吗?

c# powershell cmdlets return-type pscmdlet

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

如何实现价格区间搜索栏?

我需要像我在下面的图片中提到的价格范围搜索栏或滑块.任何帮助或示例代码将不胜感激.

提前致谢.

价格范围寻求酒吧

android seekbar android-seekbar

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

我们可以在单独的模块中使用Flask错误处理程序

我们正在将Flask应用程序从基于函数的视图迁移到可插入视图,除了错误处理程序之外,所有这些都按预期工作.我试图将所有错误处理程序放在一个名为error_handlers.py的模块中,并将其导入主模块.但它没有用.尝试在谷歌搜索并按照相同的方式找到一些Git回购,但它不适合我,请帮我解决这个问题.

app
 |
 |__ __init__.py
 |__ routing.py (which has the app=Flask(__name__) and imported error handlers here [import error_handlers])   
 |__ views.py 
 |__ error_handlers.py (Ex: @app.errorhandler(FormDataException)def form_error(error):return jsonify({'error': error.get_message()})
 |__ API (api modules)
      |
      |
      |__ __init__.py
      |__ user.py  
Run Code Online (Sandbox Code Playgroud)

我使用的是Python 2.6和Flask 0.10.1.

python flask

6
推荐指数
2
解决办法
2450
查看次数

Python可以无缝地执行DI而不依赖于服务定位器吗?

我来自C#世界,所以我的观点可能有些偏差.我想在Python中做DI,但是我注意到了一个趋势,它们都看起来依赖于服务定位器.也就是说,您必须将对象创建绑定到框架,例如injectlib.build(MyClass)为了获取实例MyClass.

这是我的意思的一个例子 -

from injector import Injector, inject


class Inner(object):
    def __init__(self):
        self.foo = 'foo'


class Outer(object):
    @inject(inner=Inner)
    def __init__(self, inner=None):
        if inner is None:
            print('inner not provided')
            self.inner = Inner()
        else:
            print('inner provided')
            self.inner = inner


injector = Injector()

outer = Outer()
print(outer.inner.foo)

outer = injector.get(Outer)
print(outer.inner.foo)
Run Code Online (Sandbox Code Playgroud)

有没有办法在Python中创建一个类,同时根据参数名称自动推断依赖类型?因此,如果我有一个被调用的构造函数参数my_class,那么MyClass将注入一个实例.我问的原因是我没有看到如何将依赖注入到通过第三方库自动创建的类中.

python dependency-injection

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