小编wak*_*aka的帖子

不支持Content-Type标头[application/x-www-form-urlencoded]

我已将Elasticsearch(版本5.5)集成到Gitlab中并尝试使用它.这是我从外部Windows客户端发送的命令:

curl -XGET gitlab.server:9200/ -H 'Content-Type: application/json' -d '{"query": {"simple_query_string" : {"fields" : ["content"], "query" : "foo bar -baz"}}}'
Run Code Online (Sandbox Code Playgroud)

但它不起作用.在客户端我得到这些错误:

{"error":"不支持Content-Type标头[application/x-www-form-urlencoded]","status":406}
curl:(6)无法解析host:text
curl:(3)[globbing第1列
卷曲中无与伦比的支撑:(3)错误的URL,冒号是第一个字符
卷曲:(3)[globbing]第1列
卷曲中无法匹配的括号:(3)错误的URL,冒号是第一个字符
卷曲:(3)[globbing ]第2列
卷曲中的不良范围:(6)无法解析主机:查询
卷曲:(3)错误的URL,冒号是第一个字符
卷曲:(3)[globbing]第13列中不匹配的闭括号/括号

在/var/log/elasticsearch/elasticsearch.log中的服务器上,我看不到任何日志消息.

但是,从linux服务器运行与上面相同的命令会给我一个没有错误的响应:

{
  "name" : "name",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "uuid",
  "version" : {
    "number" : "5.5.0",
    "build_hash" : "260387d",
    "build_date" : "2017-06-30T23:16:05.735Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}
Run Code Online (Sandbox Code Playgroud)

我尝试添加http.content_type.required: true到elasticsearch.yml,但问题是一样的.那么,我在这里做错了什么?为什么我从Windows客户端获得"不支持Content-Type标头"?我怎么解决这个问题?

将'改为'后如下:

curl -XGET gitlab.server:9200/ -H "Content-Type: application/json" …
Run Code Online (Sandbox Code Playgroud)

curl elasticsearch elasticsearch-5

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

lynx dump——使用颜色?

我刚刚尝试过...

lynx -dump -list_inline "http://www.samplepage.com"
Run Code Online (Sandbox Code Playgroud)

获取网页的格式化输出。但是,我注意到对于链接,只标记了起点,但没有标记终点。例如,对于这样的事情

this is <a href="www.link.com">a link</a> somewhere
Run Code Online (Sandbox Code Playgroud)

我明白了

this is [www.link.com]a link somewhere
Run Code Online (Sandbox Code Playgroud)

但我想要得到的是类似的东西

this is [www.link.com]a link[endlink] somewhere
Run Code Online (Sandbox Code Playgroud)

这样我就知道链接中到底包含文本的哪一部分。有人知道如何做到这一点吗?

非常感谢您的帮助!

最好的问候,弗洛里安

dump lynx

8
推荐指数
0
解决办法
541
查看次数

DataTable.Load(FbDataReader)不会将所有内容加载到DataTable中

这里有一个密切相关的问题:.NET DataTable在Load(DataReader)上跳过行

我有一个SQL查询返回169结果.结果如下:

CustomerID Customer Name TerminalID Creation Date
     1     First Customer   12345   2010-07-07
     1     First Customer   12346   2010-07-07
     1     First Customer   12347   2010-07-07
     2     Second Customer  23456   2011-04-18
Run Code Online (Sandbox Code Playgroud)

这个结果是正确的.

我在C#程序中输入了查询并执行它:

public DataTable getDataTableFromSql(FbCommand command)
{
    // Create a new datatable
    DataTable result = new DataTable();

    // Set up the connection
    using (FbConnection con = new FbConnection(this.connectionString))
    {
        // Open the connection
        con.Open();

        // Set up the select command
        FbCommand sqlCmd = command;
        // Add the connection to it …
Run Code Online (Sandbox Code Playgroud)

c# datatable firebird

7
推荐指数
2
解决办法
4360
查看次数

Google Cloud DNS无法加载

我正在使用谷歌云开发新网站,但云DNS无法加载.不知道那有什么不对.有解决方案吗

问题

dns google-cloud-platform

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

在Winforms中绘制一条线

我在以简单的窗体形式在组框中绘制线条时遇到问题.

这是我的代码:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();                        
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);            
            DrawLShapeLine(groupBox1.CreateGraphics(), 10, 10, 20, 40);
        }

        public void DrawLShapeLine(System.Drawing.Graphics g, int intMarginLeft, int intMarginTop, int intWidth, int intHeight)
        {
            Pen myPen = new Pen(Color.Black);
            myPen.Width = 2;
            // Create array of points that define lines to draw.
            int marginleft = intMarginLeft;
            int marginTop = intMarginTop;
            int width = intWidth;
            int height = intHeight;
            int arrowSize = 3;
            Point[] points …
Run Code Online (Sandbox Code Playgroud)

.net c# system.drawing winforms

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

违反完整性约束:如何连接两个表

我正在为 laravel 的一个学校项目制作一个程序,所以我尝试加入两个表:产品和目的地

表 Product 有以下列:id、name

Destinations 表包含以下列:Destinations:id,product_id,destination,quantity,target_person

我需要加入product_idid

products = DB::table('products')
    ->leftJoin('destinations','id','=','destinations.product_id ')
    ->get();
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用时LEFT JOIN,出现以下错误:

SQLSTATE[23000]:违反完整性约束:1052 on 子句中的列 'id' 不明确(SQL:select * from productsinner join destinationson id= destinations. product_id

php mysql join

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

调试器不会在断点处停止

当我开始调试(点击右上角的错误按钮)时,它会连接并显示以下消息:

连接到 pydev 调试器(内部版本 172.3968.37)

但它不会在断点处停止。谁能帮我解决这个问题吗?

我在 Mac 上使用 PyCharm CE 和 python 3.6.2

debugging pycharm python-3.x

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

ref类型,StringBuilder

errMsg在读取输入文件后,我有一个要打印的字符串.验证完成后,如果success==false它调用该方法PrintErrorMessage(string)

//Validations 
//First Validation: checks the value of input string realization. 
success = Numerical.Check("Realizations", inputs.realizations.ToString(), out ltester, out errMsg);
sb.AppendLine(errMsg);

//Second Validation: checks the value of the input string diameter.
success = Numerical.Check("Pipe Outside Diameter", inputs.pipeOD.ToString(), out dtester, out errMsg);
sb.AppendLine(errMsg); 
if (!success)
{
    PrintErrorMessage(success, errTitle, sb.ToString());
}
Run Code Online (Sandbox Code Playgroud)

这是我打印错误的方法:

Streamwriter swpt = new Streamwriter(....);
private void PrintErrorMessage(bool success, string errTitle, string errMsg)
{
    if (!success)
    {
        swRpt.WriteLine(errTitle + errMsg);
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是这样的:StringBuilder我可以使用ref类型并将其传递给PrintErrorMessage函数并将其附加到那里,而不是在每次验证后附加每一步.

c#

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

将代码更新为swift 4会导致出现错误消息

我想将此代码更新为swift 4:

rc = select(socket_fd + 1, readfd, writefd, NULL, &timeout);

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

但我得到两个错误:

必须在模块'Darwin.POSIX.sys.time'中导入'select'
声明才能满足需要C99中函数'select'的隐式声明无效

我怎么能解决这个问题?

swift swift4 xcode9

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

如何访问由Enzyme测试中的harmicalSetInnerHTML创建的实际呈现的HTML

我的组件使用dangerouslySetInnerHTML属性呈现HTML 。我需要在测试中访问呈现的HTML 。我怎样才能做到这一点?

我已经尝试过了,component.html()但是返回了类似的信息<button ...>[object Object]</button>

javascript reactjs enzyme

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