问题列表 - 第45438页

在haskell-mode 2.7中强制haskell-indent-mode超过haskell-indentation-mode?

我是一名Emacs用户,在配置编辑器方面没有任何技能.从haskell-mode 2.4 升级到2.7之后,我注意到了两个变化:

  • 压痕在某种程度上是不同的,在某种程度上我不太喜欢.我无法完全理解它是什么.
  • 更重要的是:如果我启用CUA模式和突出显示文本,退格块/删除并不会删除整个块,只是一个/下一个从我的标记性状.

我看到haskell-mode 2.7默认使用次模式haskell-indentation-mode,而2.4的行为以haskell-indent-mode的形式保存.如果我先关闭前者,然后关闭后者,我想恢复的行为(即缩进感觉就像之前一样,退格/删除会删除突出显示的块).

但是,每当我打开带有.hs后缀的文件时,我都无法自动执行此操作.我尝试了各种类似的东西

(remove-hook 'haskell-mode-hook 'turn-on-haskell-indentation-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent-mode)
Run Code Online (Sandbox Code Playgroud)

和它类似,但我要么最终得到标准模式或普通的haskell模式没有缩进和文档.

有任何想法吗?

解决方案(感谢nominolo):

(remove-hook 'haskell-mode-hook 'turn-on-haskell-indent)
(remove-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
(defun my-haskell-mode-hook ()
   (haskell-indentation-mode -1) ;; turn off, just to be sure
   (haskell-indent-mode 1)       ;; turn on indent-mode
   )
Run Code Online (Sandbox Code Playgroud)

emacs haskell indentation

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

决策树和规则引擎(Drools)

在我正在进行的应用程序中,我需要定期检查成千上万个对象的资格,以获得某种服务.决策图本身采用以下形式,只是更大:决策图

在每个端节点(圆圈)中,我需要运行一个动作(更改对象的字段,日志信息等).我尝试使用Drool Expert框架,但在这种情况下,我需要为图中的每个路径编写一条长规则,从而导致结束节点.Drools Flow似乎也没有为这样的用例构建 - 我拿一个对象,然后,根据一路上的决定,我最终进入一个终端节点; 然后又为另一个对象.或者是吗?你能给我一些这些解决方案的例子/链接吗?

更新:

Drools Flow调用可能如下所示:

// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
Map<String, Object> params = new HashMap<String, Object>();

for(int i = 0; i < 10000; i++) {

    Application app = somehowGetAppById(i);

    // insert app into working memory
    FactHandle appHandle = ksession.insert(app);

    // app variable for action nodes
    params.put("app", app);

    // start a new process instance
    ProcessInstance instance = ksession.startProcess("com.sample.ruleflow", params);
    while(true) {
        if(instance.getState() == instance.STATE_COMPLETED) {
            break; …
Run Code Online (Sandbox Code Playgroud)

java drools expert-system decision-tree drools-flow

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

maven货物和硒

我使用maven货物和硒进行自动化.这是代码:

<plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.0.5</version>
            <configuration>
                <wait>false</wait>
                <container>
                    <containerId>tomcat6x</containerId>
                    <zipUrlInstaller>
                        <url>
                            http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip
                        </url>
                        <installDir>${installDir}</installDir>
                    </zipUrlInstaller>
                    <output>
                        ${project.build.directory}/tomcat6x.log
                    </output>
                    <log>${project.build.directory}/cargo.log</log>
                </container>
                <configuration>
                    <home>
                        ${project.build.directory}/tomcat6x/container
                    </home>
                    <properties>
                        <cargo.logging>high</cargo.logging>
                        <cargo.servlet.port>8081</cargo.servlet.port>
                    </properties>
                    <files>
                        <copy>
                          <file>${project.basedir}/src/main/resources/datasource.properties</file>
                          <todir>webapps</todir>
                          <configfile>true</configfile>
                          <overwrite>true</overwrite>
                        </copy>
                    </files>
                    <properties>
                       <customMessage>${catalina.home}</customMessage>
                    </properties>
                </configuration>
            </configuration>
            <executions>
                <execution>
                    <id>start-container</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>configure</goal>
                        <goal>start</goal>
                        <goal>deploy</goal>
                    </goals>
                    <configuration>
                        <deployer>
                            <deployables>
                                <deployable>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>${project.artifactId}</artifactId>
                                    <type>war</type>
                                    <pingURL>**the url**</pingURL>
                                    <pingTimeout>180000</pingTimeout>
                                    <properties>
                                        <context>**war-name**</context>
                                    </properties>
                                </deployable>
                            </deployables>
                        </deployer>
                    </configuration>
                </execution>

                <execution>
                    <id>stop-container</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
Run Code Online (Sandbox Code Playgroud)

但随着战争开始变得越来越大,pingtimeout开始增加,我不想使用ping超时,但我现在被迫,因为部署需要一点时间,如果没有提到pingtimeout,selenium不会等待.

有没有解决这个问题的方法?

java selenium tomcat maven-2 maven-cargo

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

不使用STL的原因?

可能重复:
对于STL或!STL,这是个问题

是否有人应避免在他/她的项目中使用C++ STL?

c++ stl

15
推荐指数
4
解决办法
4077
查看次数

DataContractJsonSerializer何时包含类型信息?

我注意到,对于DataContractJsonSerializer,序列化的JSON字符串有时包含形式的类型信息

{"__type":"MyClass:#MyNamespace", ... }
Run Code Online (Sandbox Code Playgroud)

基于我的观察,它似乎只是在它序列化一个基类型但是通过已知的子类型而不是有意义的时候这样做,但是我没有找到任何官方文件来证实这个或者实际上无论如何迫使序列化器一直展示遇到自定义类型时的此行为.

任何人都可以确认我的观察是否正确吗?更好的是,如果您知道一种方法来指示序列化程序始终序列化自定义类型的类型信息,那么这是否可行?

谢谢,

.net wcf serialization json

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

如何在Java中创建一个不可变的单例?

不可变对象仅由其构造函数初始化,而单例由静态方法实例化.如何在Java中创建一个不可变的单例?

java singleton immutability

5
推荐指数
2
解决办法
4770
查看次数

Datagrid悬停不使用备用行颜色 - wpf

这适用于DataGridRow ..

   <Trigger Property="IsMouseOver" Value="true">
        <Setter Property="Background" Value="{StaticResource RolloverBrush}" />
        <Setter Property="Foreground" Value="#000" />
   </Trigger>
Run Code Online (Sandbox Code Playgroud)

但是当我添加这些时,鼠标悬停样式不起作用..

<Trigger Property="ItemsControl.AlternationIndex" Value="0">
    <Setter Property="Background" Value="{StaticResource LightRowBrush0}" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
    <Setter Property="Background" Value="{StaticResource LightRowBrush1}" />
</Trigger>
Run Code Online (Sandbox Code Playgroud)

wpf datagrid wpf-controls wpfdatagrid

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

这是什么意思:地图(1 +)

我的意思是,我知道这意味着什么:拿出列表并在其中添加1; 也就是说,它相当于map (1 + _ ).我不明白的是Scala如何知道它是等价的.这里发生了什么?

编辑

丹尼尔指出这是一个更普遍的问题.例如

def g(f : Int => Int, x : Int) = f(f(x))
g( (1 + ), 2)
res12: Int = 4
Run Code Online (Sandbox Code Playgroud)

哪个很酷.每天我都会发现Scala可以做的新功能.我想我正在寻找这个特殊事物的完整描述(理想的名称).

functional-programming scala

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

在Direct3D中挣扎着顶点和索引缓冲区

我已经尝试了许多个月,学习如何IDirect3DVertexBuffer9IDirect3DIndexBuffer9工作.我读过多本书,电子书和论坛,但我仍然无法理解他们的工作方式.有人可以帮我理解它们的工作方式以及它们如何连接在一起吗?

PS:我试过搜索相关问题,但没有什么比我感兴趣了.

谢谢.

c++ indexing buffer direct3d vertex

9
推荐指数
2
解决办法
2321
查看次数

什么类型的解析器是野牛?

什么类型的解析器是野牛.它是LALR(1)还是LR(1)?

parser-generator

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