我无法强迫mat-card-title保持在一行并切断多余的文本。
我已经尝试过下面的 css 类(text-oneline)。
<mat-card>
<mat-card-header>
<mat-card-title class="text-oneline">Heeeeeellllllloooo</mat-card-title>
<mat-card-subtitle>World!</mat-card-subtitle>
</mat-card-header>
<img mat-card-image [src]="icon_url" alt="App Icon">
<mat-card-content>
<p>Some Text</p>
</mat-card-content>
<mat-card-actions>
<button mat-button>Hello</button>
</mat-card-actions>
</mat-card>
Run Code Online (Sandbox Code Playgroud)
<mat-card>
<mat-card-header>
<mat-card-title class="text-oneline">Heeeeeellllllloooo</mat-card-title>
<mat-card-subtitle>World!</mat-card-subtitle>
</mat-card-header>
<img mat-card-image [src]="icon_url" alt="App Icon">
<mat-card-content>
<p>Some Text</p>
</mat-card-content>
<mat-card-actions>
<button mat-button>Hello</button>
</mat-card-actions>
</mat-card>
Run Code Online (Sandbox Code Playgroud)
现在,文本比卡片长。我希望文字停止而不是溢出卡片。我希望文本填满所有可用空间,但不要超过垫卡的宽度。
示例:https : //angular-mat-card-example-4cb2wk.stackblitz.io
解决方案:
代码由 ???? ???效果很好,但只有在 window.resize 被触发之后。我发现的简单解决方案是编辑mat-card-header.
.text-oneline {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试按照本教程在 python 中使用 C 代码。http://dfm.io/posts/python-c-extensions/
这是要点https://gist.github.com/GreenJoey/b08528d6abe62da70f28f73c39c0efd0
当我尝试使用它进行编译时,python setup.py build_ext --inplace它失败并显示以下错误消息:
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building '_chi2' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\XXX\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\XXX\AppData\Local\Continuum\anaconda3\include -IC:\Users\XXX\AppData\Local\Continuum\anaconda3\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tc_chi2.c /Fobuild\temp.win-amd64-3.6\Release\_chi2.obj
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo …Run Code Online (Sandbox Code Playgroud) 根据 Tensorflow 模型文档,应该可以冻结 Tensorflow 1.4 的模型
通过重新运行导出器,将其指向模型目录以及样本/配置中的相应配置文件,可以使用当前版本的 Tensorflow 重新生成每个冻结推理图。 https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
当尝试冻结我的模型时,出现错误:
Traceback (most recent call last):
File "export_inference_graph.py", line 96, in <module>
from object_detection import exporter
File "C:\detection\object_detection\exporter.py", line 20, in <module>
from tensorflow.contrib.quantize.python import graph_matcher
ImportError: cannot import name 'graph_matcher'
Run Code Online (Sandbox Code Playgroud)
那么文档是错误的吗?
我想在 Python 中为我的 C++ 代码启用类型提示。
using boost::python;
BOOST_PYTHON_MODULE(foo)
{
docstring_options doc_options;
doc_options.disable_all();
doc_options.enable_user_defined();
class_<Bar>("Bar", init<>(), "Bar class" )
.def("foobar", &Bar::foobar, (arg("name")), "foobar(name: str) -> None");
}
Run Code Online (Sandbox Code Playgroud)
但在 python 中,我只能在缺少类型提示的情况下得到这个。有什么办法可以保留类型提示吗?
using boost::python;
BOOST_PYTHON_MODULE(foo)
{
docstring_options doc_options;
doc_options.disable_all();
doc_options.enable_user_defined();
class_<Bar>("Bar", init<>(), "Bar class" )
.def("foobar", &Bar::foobar, (arg("name")), "foobar(name: str) -> None");
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试将转义 Unicode 转换为表情符号。
例子:
>>> emoji = ""
>>> emoji_text = "\\ud83d\\ude00"
>>> print(emoji)
>>> print(emoji_text)
\ud83d\ude00
Run Code Online (Sandbox Code Playgroud)
我想打印而不是“\ud83d\ude00”
我发现了一个简单的技巧,有效但不实用:
>>> import json
>>> json.loads('"\\ud83d\\ude00"')
''
Run Code Online (Sandbox Code Playgroud) 我正在尝试建立一个模型,其中必须压缩张量,然后将其输入LSTM。
由于压缩的张量不具有layer属性,因此无法编译模型。
Using TensorFlow backend.
Traceback (most recent call last):
File "C:/workspace/keras_test/src/testing.py", line 10, in <module>
model = Model(inputs=model_in, outputs=output)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\engine\network.py", line 93, in __init__
self._init_graph_network(*args, **kwargs)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\engine\network.py", line 237, in _init_graph_network
self.inputs, self.outputs)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\engine\network.py", line 1353, in _map_graph_network
tensor_index=tensor_index)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\engine\network.py", line 1340, in build_map
node_index, tensor_index)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\engine\network.py", line 1340, in build_map
node_index, tensor_index)
File "E:\ProgramData\Miniconda3\envs\py37\lib\site-packages\keras\engine\network.py", line 1312, in build_map
node = layer._inbound_nodes[node_index]
AttributeError: 'NoneType' object …Run Code Online (Sandbox Code Playgroud) 进口有from __future__ import annotations什么好处?当我理解正确时,我应该在运行时停止不必要的输入导入。
在我的例子HelloWorld中只需要打字。但是使用此代码,输出始终为:
Should this happen?
x = World!
当我删除from hello import HelloWorldPyCharm 中的输入帮助时,它不再起作用(我可以理解这一点,因为它不知道从哪里来HelloWorld)。
from __future__ import annotations
from hello import HelloWorld
if __name__ == '__main__':
def hello(x: str, hello: HelloWorld = None):
if hello is not None:
print('hello.data_01 =', hello.data_01)
print('x =', x)
hello('World!')
Run Code Online (Sandbox Code Playgroud)
你好.py
from dataclasses import dataclass
@dataclass
class HelloWorld:
data_01: str
data_02: str
print("Should this happen?")
Run Code Online (Sandbox Code Playgroud)
所以我的问题是我是否仍然需要from hello import HelloWorld做我能从中得到什么好处from __future__ import annotations …
python ×4
tensorflow ×2
angular ×1
boost ×1
boost-python ×1
c ×1
cpython ×1
css ×1
emoji ×1
keras ×1
lstm ×1
pep ×1
python-3.7 ×1
type-hinting ×1
typing ×1
unicode ×1