我想访问在我的本地系统上运行的kibana,以便local_ip:5601在我的本地网络中的其他系统上访问.我尝试在弹性搜索中添加这两行:
http.cors.allow-origin: "*"
http.cors.enabled: true
Run Code Online (Sandbox Code Playgroud)
但是,它也没有用.
我想从数据库中删除一些表。早些时候,我有课程、部门等模型。现在,我想从数据库中删除所有这些并仅使用一个:
class Student(models.Model):
"""here goes model for users"""
def __str__(self):
return self.name
name = models.CharField(default = "",max_length=200)
enrollment_no = models.CharField(default = "",max_length=10)
batch = models.CharField(default = "",max_length=4)
father_income = models.IntegerField(max_length=100)
email = models.CharField(default = "",max_length=1000)
mobile_number = models.CharField(default = "",max_length=1000)
Run Code Online (Sandbox Code Playgroud)
但是,当我使用时:
python manage.py makemigrations
Run Code Online (Sandbox Code Playgroud)
它说no changes detected.并在运行命令时:
python manage.py migrate
Run Code Online (Sandbox Code Playgroud)
我正在将所有表恢复到数据库中,而这些表在 models.py 中不存在。我尝试使用:
382 python manage.py makemigrations
383 python manage.py squashmigrations
384 python manage.py squashmigrations appname
385 python manage.py squashmigrations appname 001
386 python manage.py squashmigrations appname 0001 …Run Code Online (Sandbox Code Playgroud) 我有一个字符串:
str = '[\'RED\', \'GREEN\', \'BLUE\']'
Run Code Online (Sandbox Code Playgroud)
我想将其解析为
list = ['RED','GREEN','BLUE']
Run Code Online (Sandbox Code Playgroud)
但是,我无法这样做。
我尝试使用 json.loads 解析:
json.loads(str)
Run Code Online (Sandbox Code Playgroud)
它给了我:
{JSONDecodeError}Expecting value: line 1 column 2 (char 1)
Run Code Online (Sandbox Code Playgroud) 我想使用该Runnable接口实现线程.
我有以下三个类:
FirstThread.java
public class FirstThread implements Runnable
{
//This method will be executed when this thread is executed
public void run()
{
//Looping from 1 to 10 to display numbers from 1 to 10
for ( int i=1; i<=10; i++)
{
//Displaying the numbers from this thread
System.out.println( "Messag from First Thread : " +i);
/*taking a delay of one second before displaying next number
*
* "Thread.sleep(1000);" - when this statement is executed,
* this thread …Run Code Online (Sandbox Code Playgroud) 我想打印像:
#
##
###
####
#####
######
#######
Run Code Online (Sandbox Code Playgroud)
我的代码是:
<html>
<head>
<title>Learning Javascript</title>
</head>
<body>
<script type="text/javascript">
for (var i = 1; i <= 7; i++) {
for ( var j = 1 ; j <= i ; j++ )
{
console.log("#");
}
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它只提供一个#:
#
Run Code Online (Sandbox Code Playgroud)
为什么我没有在控制台日志中获得预期的输出?我试过镀铬和萤火虫.
我有以下表格(以及其他两种表格):
class UploadFileForm(forms.Form):
file = forms.FileField()
Run Code Online (Sandbox Code Playgroud)
以下是我的html:
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
<form action="" method="POST" role="form" enctype="multipart/form-data">
{% csrf_token %}
<legend>Upload a file: </legend>
<div class="form-group">
<input type="file" name="file" class="form-control" id="" placeholder="Input field">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
文件处理完成:
if request.method == 'POST':
print "I am in request."
print request.FILES['file']
# create a form instance and populate it with data from the request:
formName = NameForm(request.POST)
formHandle = HandleForm(request.POST)
fileForm = …Run Code Online (Sandbox Code Playgroud) 我想过滤掉Too many connectionsLogMessage 字段中存在的所有文档。
我写的查询是:
'
{
"query": {
"bool": {
"must": {
"match": {
"logType": "Error"
}
},
"must_not": {
"match": {
"LogMessage": ".*Too many connections.*"
}
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
另一方面,如果我在LogMessage现场使用我的整个字符串,它工作正常。
我在这里验证了我的正则表达式:
https://regex101.com/r/EexTmV/1
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题。
我试图从c ++中的以下方法返回整数:
int check_for_chef(string str1,string str2,int M,int N)
{
if ( N == -1 )
{
cout << "I am returning 1." <<endl;
return 1;
}
else if ( N > M )
{
cout << " I am returning 0." <<endl;
return 0;
}
else
{
if ( str1[M] == str2[N])
{
location[N] = M;
cout << "location is: "<<location[N]<<endl;
check_for_chef(str1,str2,M - 1, N - 1);
}
else
{
check_for_chef(str1,str2,M - 1, N);
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我在返回时得到的是:
Returned value …Run Code Online (Sandbox Code Playgroud) 我正在从头学习javascript.我目前正在尝试掌握DOM.我有一个像这样的HTML页面:
<html>
<head>
<title>javascript</title>
</head>
<body>
<h1>Welcome to javascript</h1>
Visit me <a href="facebook.com">here.</a>
<p> <img id="image" src="kalam.jpg"></p>
<script type="text/javascript" src="code.js">
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
现在,我想阅读a标签.
var links = document.body.getElementsByTagName("a")[0];
console.log(links.href);
Run Code Online (Sandbox Code Playgroud)
它工作正常.现在我想读图像.
var imageLink = document.body.getElementById("image");
console.log(imageLink.src);
Run Code Online (Sandbox Code Playgroud)
但是,上面的代码不起作用.
我收到一个错误:
未捕获的TypeError:document.body.getElementById不是函数.
将其更改为:
var imageLink = document.getElementById("image");
console.log(imageLink.src);
Run Code Online (Sandbox Code Playgroud)
工作良好.
我的问题是document.body.getEl...和document.getEl..?之间的区别?
不document.body读只有身体的一部分,而document.getEl..读取整个文档,包括标题等?如果是这样,那么上述代码不应该都有效吗?