我尝试练习"HtmlAgilityPack",但我遇到了一些问题.这是我编码的内容,但我无法正确获取网页的标题和描述...如果有人可以启发我的错误:)
...
public static void Main(string[] args)
{
string link = null;
string str;
string answer;
int curloc; // holds current location in response
string url = "http://stackoverflow.com/";
try
{
do
{
HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(url);
HttpWReq.UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5";
HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
//url = null; // disallow further use of this URI
Stream istrm = HttpWResp.GetResponseStream();
// Wrap the input stream in a StreamReader.
StreamReader rdr = new StreamReader(istrm);
// …Run Code Online (Sandbox Code Playgroud) 我在下面有一篇关于ElasticSearch的文章,我尝试将这个例子放在我的引擎上.
例:
curl -XPUT 'elasticsearch:9200/twitter/tweet/1' -d '{
"user": "david",
"message": "C'est mon premier message de la journée !",
"postDate": "2010-03-15T15:23:56",
"priority": 2,
"rank": 10.2
}'
Run Code Online (Sandbox Code Playgroud)
我尝试通过bash文件发送此信息(我使用Putty),但我有这个错误:
{"error":"MapperParsingException[object mapping for [tweet] tried to parse as object,
but got EOF, has a concrete value been provided to it?]","status":400}
Run Code Online (Sandbox Code Playgroud)
我也尝试用"cat -e tweet.sh"看到一个错误,但我不明白为什么我有这个错误.
提前致谢.
目前,我已经在 ElasticSearch 中索引了许多文档,当我对最大分数进行搜索时,数量超过了 1。
如何获得介于 0 和 1 之间的相似性搜索?
我应该更好地配置 ElasticSearch 吗?或者我应该改变我的映射?
预先感谢您的建议。
目前我尝试在守护进程启动泊坞窗图像与docker run -d ID(后推出这个COMMANDE: docker build -t toto .)
但是当我发布这个命令时docker exec -it ID bash,我有这个错误:
来自守护进程的错误响应:没有这样的id:toto
我的Dockerfile看起来像这样:
# Dockerfile
FROM debian:jessie
# Upgrade system
RUN apt-get update && apt-get dist-upgrade -y --no-install-recommends
# Install TOR
RUN apt-get install -y --no-install-recommends tor tor-geoipdb torsocks
# INSTALL POLIPO
RUN apt-get update && apt-get install -y polipo
# INSTALL PYTHON
RUN apt-get install -y python2.7 python-pip python-dev build-essential libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev libxslt-dev libxml2-dev …Run Code Online (Sandbox Code Playgroud) 如果我的数据库中不存在一个值,我想将数据插入到我的数据库中.
我有这个代码:
try
{
SQLConnection.Open();
string sql = "INSERT INTO shop (title, price, information) values (@chp1, @chp2,@chp3)";
SqlCommand cmd = new SqlCommand(sql, SQLConnection);
cmd.Parameters.AddWithValue("@chp1", title);
cmd.Parameters.AddWithValue("@chp2", price);
cmd.Parameters.AddWithValue("@chp3", information);
cmd.ExecuteNonQuery();
}
Run Code Online (Sandbox Code Playgroud)
我尝试在我的数据库中插入,如果我的数据库中不存在值"title".
在stackoverflow中,我已经创建了这个答案IF EXISTS,但我没有看到如何使用它...
在此先感谢您的回答:)
我正在寻找关于ElasticHQ和Marvel之间差异的文档,文章或基准.
我想知道哪个最好?您对这两种工具之一的经验反馈是什么?
提前致谢,
我尝试使用ScrapyFileLogObserver测试scrapy日志.在我的源代码中,我正确设置了要使用的包:
来自scrapy.log导入ScrapyFileLogObserver
但是当我启动我的蜘蛛时,我遇到了这个错误:
来自scrapy.log导入ScrapyFileLogObserver
ImportError:无法导入名称ScrapyFileLogObserver
作为信息,我使用scrapy的最新版本(Scrapy 1.0.1).我如何解决我的错误?
目前我安装了 H2 数据库,但是当我启动程序并尝试从我的浏览器(http://localhost:8082/login.do)访问它时,我收到此错误:
IO Exception: "/root/test outside /opt/h2/DB" [90028-192] 90028/90028 (Aide) org.h2.jdbc.JdbcSQLException: IO Exception: "/root/test outside /opt/h2/DB" [90028-192]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.engine.ConnectionInfo.setBaseDir(ConnectionInfo.java:182)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:114)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:102)
at org.h2.Driver.connect(Driver.java:72)
at org.h2.server.web.WebServer.getConnection(WebServer.java:735)
at org.h2.server.web.WebApp.login(WebApp.java:955)
at org.h2.server.web.WebApp.process(WebApp.java:211)
at org.h2.server.web.WebApp.processRequest(WebApp.java:170)
at org.h2.server.web.WebThread.process(WebThread.java:133)
at org.h2.server.web.WebThread.run(WebThread.java:89)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
目前,我尝试通过Keycloak的Admin REST API从curl命令创建用户。我可以以管理员身份进行身份验证,我的回答很好,但是当我要创建用户时,会出现类似“ 404-Not Found”的错误。
这是我的curl命令:
#!/bin/bash
echo "* Request for authorization"
RESULT=`curl --data "username=pierre&password=pierre&grant_type=password&client_id=admin-cli" http://localhost:8080/auth/realms/master/protocol/openid-connect/token`
echo "\n"
echo "* Recovery of the token"
TOKEN=`echo $RESULT | sed 's/.*access_token":"//g' | sed 's/".*//g'`
echo "\n"
echo "* Display token"
echo $TOKEN
echo "\n"
echo " * user creation\n"
curl http://localhost:8080/apiv2/users -H "Authorization: bearer $TOKEN" --data '{"firstName":"xyz","lastName":"xyz", "email":"demo2@gmail.com", "enabled":"true"}'
Run Code Online (Sandbox Code Playgroud)
我使用了位于以下地址的官方API文档:https://www.keycloak.org/docs-api/4.4/rest-api/index.html
我该如何解决?提前致谢。
在我的bash脚本的标题中,我必须询问用户名和他的IP地址.
我需要以这种方式验证条目:
name变量中,并用下划线替换其空间.对于用户点击的示例"Albert Smith",我必须存储"Albert_Smith"到我的变量中name.我知道我需要使用"阅读",但我不知道要实现我的短脚本(替换和验证).预先感谢 :)
c# ×2
java ×2
bash ×1
curl ×1
docker ×1
dockerfile ×1
h2 ×1
hibernate ×1
insert ×1
keycloak ×1
lucene ×1
python ×1
python-2.7 ×1
scrapy ×1
spring ×1
sql ×1
sql-server ×1
title ×1
validation ×1
variables ×1
web-scraping ×1