在我的模板中,
...
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> Name </th>
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
</ng-container>
...
Run Code Online (Sandbox Code Playgroud)
在我的模板样式中,我有
...
.mat-column-name {
color: red;
// flex: 0 1 200px !important; // not getting applied
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
...
Run Code Online (Sandbox Code Playgroud)
我想控制列宽。但是当在 中使用flex属性时mat-column-name,它不会被应用。作为一种解决方法,我正在使用max-width. 它有点工作,但我不明白如何max-width习惯使其响应
编辑:工作代码Stackblitz 演示
我正在使用图像,我想用零填充numpy数组.我看了一下np.pad
对于填充单个数组,它工作正常
x = np.array([[1,2],[3,4]])
y = np.pad(x,(1,1), 'constant')
x
=> array([[1, 2],
[3, 4]])
y
=> array([[0, 0, 0, 0],
[0, 1, 2, 0],
[0, 3, 4, 0],
[0, 0, 0, 0]])
Run Code Online (Sandbox Code Playgroud)
如果我们x type在列表/数组中有数组,如何实现,比如
c_x=np.array([[[2,2],[2,3]],[[3,2],[2,3]],[[4,4],[2,3]]])
c_y=np.pad(c_x,((0,0),(1,1),(0,0)),'constant') #padding is present only on top and bottom
Run Code Online (Sandbox Code Playgroud)
因为这样的数组包含R,G,B通道,填充时也可以考虑吗?
编辑:
比如c_x使用RGB通道存储28x28像素的10个图像的商店列表
现在我想填充所有10个图像,因此在修改10个图像后,30x30的边框像素为 [0,0,0]
我正在尝试获取图像 url,以便我可以src在 html 中传递它。我创建了函数并想发送 url 作为响应。我尝试了下面的方法,但我不断得到
错误:无法在没有
client_email.
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
export const getPicURL = functions.https.onRequest(
(request, response) => {
const storageBucket = admin
.storage()
.bucket('gs://my-app.appspot.com');
const fileName = 'my-app/pic1.jpg';
const tomorrow = new Date(
new Date().getTime() + 24 * 60 * 60 * 1000
);
const signedURL = storageBucket
.file(fileName)
.getSignedUrl({ action: 'read', expires: tomorrow });
signedURL
.then((data) => {
response.send(data[0]);
})
.catch((err) => {
console.log('My Error', …Run Code Online (Sandbox Code Playgroud)