我试图在Windows 2008 R2中使用Kibana运行ElasticSearch.
我按照这篇文章:安装-logstash-on-a-windows-server-with-kibana
一步一步,但我得到的是:
Connection Failed
Possibility #1: Your elasticsearch server is down or unreachable
This can be caused by a network outage, or a failure of the Elasticsearch process. If you have recently run a query that required a terms facet to be executed it is possible the process has run out of memory and stopped. Be sure to check your Elasticsearch logs for any sign of memory pressure.
Possibility #2: You are running Elasticsearch 1.4 or …Run Code Online (Sandbox Code Playgroud) 我需要PIL在我的python2.5.4-32bit上的Ubunto10.4-32bit(EDIT:64bit)机器上安装(python映像库).这个问题也与我猜测的任何其他源包有关(在我需要的那些中RPyC,psyco和numpy).
我下载了源代码,因为我找不到任何整洁的包来完成这项工作并做了一个sudo python2.5 setup.py install.
输出:
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Traceback (most recent call last):
File "setup.py", line 9, in <module>
import glob, os, re, struct, string, sys
File "/usr/lib/python2.5/struct.py", line 30, in <module>
from _struct import Struct, error
ImportError: No module named _struct
Run Code Online (Sandbox Code Playgroud)
但
echo $ PYTHONHOME
/ usr
那么,在文件中struct.py就行了from _struct import Struct, error
这是python源代码本身的一部分所以我真的很想知道python安装有什么问题,因为代码无法导入模块.
我通过以下方式安装了py2.5.4:
./configure --prefix=/usr …Run Code Online (Sandbox Code Playgroud) 请注意我在OCaml几乎是一个完整的新手.为了学习一点并测试其性能,我尝试使用Leibniz系列实现一个近似Pi的模块.
我的第一次尝试导致堆栈溢出(实际错误,而不是此站点).从Haskell知道这可能来自太多的"thunk",或者承诺计算某些东西,同时递归加法,我寻找一些方法来保持最后的结果,同时与下一个相加.我发现下面的尾递归的实现sum,并map在OCaml的课程的笔记,在这里和这里,和预期编译器产生有效的结果.
但是,使用编译的结果可执行文件ocamlopt比编译的C++版本慢得多clang++.这段代码是否尽可能高效?我缺少一些优化标志吗?
我的完整代码是:
let (--) i j =
let rec aux n acc =
if n < i then acc else aux (n-1) (n :: acc)
in aux j [];;
let sum_list_tr l =
let rec helper a l = match l with
| [] -> a
| h :: t -> helper (a +. h) t
in helper 0. l
let rec tailmap f …Run Code Online (Sandbox Code Playgroud) 这是我第一次尝试使用Racket的FFI.我想创建一个绑定到的应用程序,libgit2以便操作GIT存储库.
我需要做的第一件事是初始化一个存储库,如libgit2文档中所示:
git_repository *repo = NULL;
int error = git_repository_init(&repo, "/tmp/…", false);
Run Code Online (Sandbox Code Playgroud)
在Racket中获取函数调用很简单:
(require ffi/unsafe
ffi/unsafe/define)
(define-ffi-definer define-libgit (ffi-lib "/opt/local/lib/libgit2.dylib"))
(define _git_repository-ptr (_cpointer/null 'git_repository))
(define-libgit git_repository_init (_fun _git_repository-ptr _string _bool -> _int))
Run Code Online (Sandbox Code Playgroud)
但是,然后尝试使用该功能不起作用:
-> (define new_repo _git_repository-ptr)
-> (git_repository_init new_repo "/tmp/..." #f)
; git_repository->C: argument is not `git_repository' pointer
; argument: #<ctype>
; [,bt for context]
Run Code Online (Sandbox Code Playgroud)
libgit2没有提供初始化指针的功能,如Racket FFI文档示例所示.
这是定义可空指针并将其初始化为的正确方法NULL吗?
git_repository另一方面,是struct图书馆中定义的.我应该define-cstruct在Racket一侧使用它来正确使用它吗?这可能很麻烦,因为它struct是根据其他structs …
如何让 Intellij 识别静态链接到解释器的内置函数,例如sys?因此,当我这样做时,import sys我没有获得自动完成功能 sys.py中没有相应的文件site-packages。为什么这适用于 PyCharm 但不适用于 IntelliJ?
import sys
def dump(module):
if module in sys.builtin_module_names:
print("<BUILTIN>")
else:
module = __import__(module)
print(module.__file__)
dump("sys")
Run Code Online (Sandbox Code Playgroud)
输出:
<BUILTIN>
我有两个清单
val firstList = List(("A","B",12),("P","Q",13),("L","M",21))
val secondList = List(("A",11),("P",34),("L",43))
Run Code Online (Sandbox Code Playgroud)
我想要输出如下
val outPutList = List(("P","Q",13,34),("L","M",21,43))
Run Code Online (Sandbox Code Playgroud)
我想比较firstList的第三个成员和secondList的第二个元素.这意味着 - 我想检查第二个列表值secondList.map(_.2)是否大于第一个列表firstList.map(_.3)
在Rackunit中,我知道如何断言抛出异常:
#lang racket
(module+ test
(require rackunit)
(check-exn exn:fail:contract? (lambda () (3 + 4))))
Run Code Online (Sandbox Code Playgroud)
但是,我找不到一种方法来断言更具体的东西.看看Racket中的异常层次结构,exn:fail:contract可能意味着许多事情:错误的arity,除以零......
我想在测试中声明这个特殊的异常是:
; application: not a procedure;
; expected a procedure that can be applied to arguments
Run Code Online (Sandbox Code Playgroud)
在其印刷的信息中.你是如何做到这一点的?