由于针对此主题提供的其他解决方案(我也想避免使用jQuery这样的解决方案:stackoverflow)不适用于我的情况,因此我提出了一个新问题。如何使表格标题固定在垂直滚动上?
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class=container>
<div class=row>
<div class=col-sm-12>
<div class="table-responsive">
<table class="table table-condensed table-bordered table-hover fixed_headers">
<thead>
<tr>
<th rowspan="2" style="width: 10px"><span class="text-muted">#</span></th>
<th rowspan="2">ID</th>
<th rowspan="2">Name</th>
<th colspan="4">r 1</th>
<th colspan="4">r 2</th>
<th rowspan="2" ng-click="sortTableBy('recognized')" class="change-sort-order">ERK
</th>
<th rowspan="2">ERW
</th>
<th rowspan="2"><span class="text-muted">Radar</span></th>
<th rowspan="2"><span class="text-muted">RISS</span></th>
</tr>
<tr>
<th>
A 1
</th>
<th>
A 2
</th>
<th>
A 3
</th>
<th>
A 4
</th>
<th>
A …Run Code Online (Sandbox Code Playgroud)我从 RXJS 5.x 更新到 RXJS 6.2.2 并且在解决迁移错误时遇到问题。
RXJS 6 中不再有 IntervalObservables 了吗?我在以下角度组件中使用了 IntervalObservable
import {Component, OnInit} from '@angular/core';
import {IntervalObservable} from 'rxjs/observable/IntervalObservable';
@Component({
selector: 'app-date-time-display',
templateUrl: './date-time-display.component.html',
styleUrls: ['./date-time-display.component.css']
})
export class DateTimeDisplayComponent implements OnInit {
constructor() {
}
today = Date.now();
ngOnInit() {
IntervalObservable.create(1000)
// .takeWhile(() => this.alive) // only fires when component is alive
.subscribe(() => {
this.today = Date.now();
});
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行“ng serve”或“ng build”时,出现以下错误:
Module not found: Error: Can't resolve 'rxjs/observable/IntervalObservable' in 'C:\Users\Daniel\Documents\IMA\Porsche_lack\git\webapp\porsche-lack-tracking\src\app\date-time-display'
i ?wdm?: Failed …Run Code Online (Sandbox Code Playgroud) 首先,我读了这个问题,但它实际上不包括我想要的方法。此外,否定实际值不适用于我的用例。
Heapq 文档:https://docs.python.org/3.6/library/heapq.html
假设我的堆中有一个数据类对象列表。只有a属性决定对象的顺序。
import heapq
from dataclasses import dataclass
@dataclass
class C:
a: int
b: int
def __lt__(self, other):
return self.a < other.a
l=[C(2,1),C(9,109),C(2,4),C(9,4)]
print(heapq.heappop(l)) # C(a=2, b=1)
print(heapq.heappop(l)) # C(a=2, b=4)
print(heapq.heappop(l)) # C(a=9, b=109)
print(heapq.heappop(l)) # C(a=9, b=4)
Run Code Online (Sandbox Code Playgroud)
现在我想要一个倒序。因此,我将该行更改return self.a < other.a为return self.a > other.a. 结果:
import heapq
from dataclasses import dataclass
@dataclass
class C:
a: int
b: int
def __lt__(self, other):
return self.a > other.a
l=[C(2,1),C(9,109),C(2,4),C(9,4)]
print(heapq.heappop(l)) …Run Code Online (Sandbox Code Playgroud) 我检查了 PyInstaller 和 FastAPI(超出最大递归深度)并且 Pyinstaller 编译的 Uvicorn 服务器无法正确启动
FastAPI 演示main.py:
import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
return {"hello": "world"}
if __name__ == '__main__':
uvicorn.run(app, host="0.0.0.0", port=58000, reload=False)
Run Code Online (Sandbox Code Playgroud)
首先运行 pyinstallerpyinstaller -F main.py --clean并添加hidden_imports规范:
hidden_imports=[
'uvicorn.logging',
'uvicorn.loops',
'uvicorn.loops.auto',
'uvicorn.protocols',
'uvicorn.protocols.http',
'uvicorn.protocols.http.auto',
'uvicorn.protocols.websockets',
'uvicorn.protocols.websockets.auto',
'uvicorn.lifespan',
'uvicorn.lifespan.on',
]
Run Code Online (Sandbox Code Playgroud)
它工作得很好,但是当工人大于 1 时,应用程序必须是字符串:
WARNING: You must pass the application as an import string to enable 'reload' or 'workers'.
所以我改为:
if __name__ == '__main__': …Run Code Online (Sandbox Code Playgroud) python ×2
angular ×1
css ×1
fastapi ×1
heap ×1
pyinstaller ×1
python-3.6 ×1
python-3.x ×1
rxjs ×1
uvicorn ×1