我有一个 svg 内容,看起来有点像这样:
<svg height="1000" preserveaspectratio="xMidYMid meet" style="width: 100%; height: 100%; transform: translate3d(0px, 0px, 0px);" viewbox="0 0 1000 1000" width="1000"
xmlns="http://www.w3.org/2000/svg">
<defs>
<clippath id="__lottie_element_2">
<rect height="1000" width="1000" x="0" y="0"></rect>
</clippath>
<clippath id="__lottie_element_4">
<path d="M0,0 L3048,0 L3048,2431 L0,2431z"></path>
</clippath>
</defs>
<g clip-path="url(#__lottie_element_2)">
<g clip-path="url(#__lottie_element_4)" opacity="1" style="display: block;" transform="matrix(0.5006899833679199,0,0,0.5006899833679199,-263.051513671875,-180.58868408203125)">
<g class="H01 2k" opacity="1" style="display: block;" transform="matrix(0.9999813437461853,0.006108480971306562,-0.006108480971306562,0.9999813437461853,504.42333984375,488.25836181640625)">
<image height="1442px" preserveaspectratio="xMidYMid slice" width="2048px" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACAA...MC2S3oHLwAAAABJRU5ErkJggg=="></image>
</g>
<g opacity="1" style="display: block;" transform="matrix(0.9947565197944641,-0.10227109491825104,0.10227109491825104,0.9947565197944641,452.203369140625,619.6126708984375)">
<image height="1442px" preserveaspectratio="xMidYMid slice" width="2048px" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACAAA...BJRU5ErkJggg=="></image>
</g>
<g opacity="1" style="display: block;" transform="matrix(0.9999813437461853,0.006108480971306562,-0.006108480971306562,0.9999813437461853,504.40704345703125,490.92486572265625)">
<image height="1442px" …Run Code Online (Sandbox Code Playgroud) 我想在Vagrant(安装在Windows 10上)中运行一个webpack项目,我在其中嵌入了一个Ubuntu 16.04虚拟机.
我能够安装npm 5.6.0并且nodejs v8.9.4非常成功.
我试图运行npm install安装所有依赖项.收到这些错误后:
...
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-116-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /vagrant/src/my_project/static/node_modules/contextify
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! …Run Code Online (Sandbox Code Playgroud) 我在互联网上捕获了这段css代码,在悬停时在按钮的边框周围执行动画.我觉得很好.
有没有办法自定义它,以使边框动画无限循环而不是悬停?
这是代码:
button {
background: none;
border: 0;
box-sizing: border-box;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
margin: 1em;
padding: 1em 2em;
text-align: center;
text-transform: capitalize;
position: relative;
vertical-align: middle;
}
button::before, button::after {
box-sizing: border-box;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
.draw {
-webkit-transition: color 0.25s;
transition: color 0.25s;
}
.draw::before, .draw::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
.draw::before {
top: 0;
left: …Run Code Online (Sandbox Code Playgroud)我有 2 个模型:User 和 UserSummary。UserSummary 有一个 User 的外键。我只是注意到,如果我depth= 1在 内设置UserSummarySerializer,则密码字段将包含在输出中。它被散列,但最好还是排除这个字段。
为了隐藏密码字段,我刚刚在序列化程序中明确设置了用户字段,就像这样:
class UserSerializer(serializers.ModelSerializer):
"""A serializer for our user profile objects."""
class Meta:
model = models.User
extra_kwargs = {'password': {'write_only': True}}
exclude = ('groups', 'last_login', 'is_superuser', 'user_permissions', 'created_at')
def create(self, validated_data):
"""Create and return a new user."""
user = models.User(
email = validated_data['email'],
firstname = validated_data['firstname'],
lastname = validated_data['lastname'],
mobile = validated_data['mobile']
)
user.set_password(validated_data['password'])
user.save()
return user
class UserSummarySerializer(serializers.ModelSerializer):
user = UserSerializer()
class Meta:
model = models.UserSummary …Run Code Online (Sandbox Code Playgroud) 这篇文章可能听起来像重复,但事实并非如此,请先阅读。
我希望主容器 ( <main role="main" class="container">) 使用 Bootstrap 4 在页眉和页脚之间是全高的。这是我的 html 代码:
// Initialize tooltip component
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
// Initialize popover component
$(function () {
$('[data-toggle="popover"]').popover()
})Run Code Online (Sandbox Code Playgroud)
.container{
width: 100%; min-height: 100% !important;
min-height:calc(100% - 110px); !important;
margin: 0 auto -33px;
border: solid blue;
}Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<title>My Example</title>
<!-- Latest compiled and minified Bootstrap CSS -->
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
<body>
<header>
<nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse fixed-top">
<button class="navbar-toggler navbar-toggler-right" type="button" …Run Code Online (Sandbox Code Playgroud)我有一个类似于这个SO post的问题,但它的答案都没有帮助我解决我的问题。
我们在这里:我能够在服务器上保存图像,但无法从 API 图像超链接中获取图像。
我的文件 :
模型.py
class Summary(models.Model):
question_text = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
cover_image = models.ImageField(upload_to='cover_image/', max_length=255)
userProfileSummary = models.ManyToManyField(UserProfile, through='UserProfileSummary')
def __str__(self):
return self.question_text
Run Code Online (Sandbox Code Playgroud)
视图.py
class Summary(models.Model):
question_text = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
cover_image = models.ImageField(upload_to='cover_image/', max_length=255)
userProfileSummary = models.ManyToManyField(UserProfile, through='UserProfileSummary')
def __str__(self):
return self.question_text
Run Code Online (Sandbox Code Playgroud)
序列化程序.py
class SummarySerializer(serializers.ModelSerializer):
"""A serializer for summary item"""
cover_image = serializers.ImageField(max_length=None, use_url=True)
class Meta:
model = models.Summary
exclude = ('userProfileSummary',)
Run Code Online (Sandbox Code Playgroud)
设置.py
STATIC_URL = '/static/'
STATICFILES_DIRS =(
os.path.join(BASE_DIR, 'static'),
'/static', …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用Xcode进行C编程。但是我现在有一个问题。我写了这段代码:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
FILE *fp;
fp = fopen("toto.txt", "w+");
fputs("hi", fp);
fclose(fp);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
由于toto.txt不存在,它应该创建并打开它,但没有任何反应,我不知道为什么。
我的主标记(<main role="main" class="container">)中有3列。第一列有一个包含许多行的表。我希望该列可垂直滚动,同时在页眉和页脚之间保持拉伸状态。我在css中添加了:
#please-scroll{
height: calc(100% - 110px); overflow-y: scroll
}
Run Code Online (Sandbox Code Playgroud)
但这是行不通的。
这是我的代码:
#please-scroll{
height: calc(100% - 110px); overflow-y: scroll
}
Run Code Online (Sandbox Code Playgroud)
html {
height: 100%;
font-family: sans-serif;
background: #1F1F1F !important; }
body {
font-family: sans-serif;
background-color: #1F1F1F;
height: 100%; }
.container {
min-height: calc(100% - 110px) !important;
margin: 0 auto -33px;
width: 100%; }
body > .container {
padding: 60px 15px 0; }
.nav-item .nav-link span {
border-radius: 10px;
border: 2px solid;
padding: 3px;
font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
font-size: …Run Code Online (Sandbox Code Playgroud)嗨,我想用 FabricJS 只为选定的文本及其背景着色。事实上,带有 FabricJS 的文本字母如下:
但我想不出一种方法来重现它。我尝试obj.set("textBackgroundColor", "red")只为所选字母的背景着色,但它始终为整个文本的背景着色。
我试过obj.setColor("red")只给选定的字母上色,但它总是给文本的所有字母上色。这是我的jsfiddle
请问我错在哪里?
提前谢谢了。
我正在尝试按照本教程将Elasticsearch 5.5.2连接到Django 2项目:
curl -X GET 'http://localhost:9200'在终端上运行时,出现此错误:curl: (7) Failed to connect to localhost port 9200: Connection refused在localhost:9200浏览器上运行得很好。
这是我的elasticsearch.yml文件的概述:
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path …Run Code Online (Sandbox Code Playgroud)