如何降低给定代码段的复杂性?我在 Sonarqube 中收到此错误---> 重构此方法以将其认知复杂度从 21 降低到允许的 15。
this.deviceDetails = this.data && {...this.data.deviceInfo} || {};
if (this.data && this.data.deviceInfo) {
this.getSessionInfo();
// tslint:disable-next-line: no-shadowed-variable
const { device, driver, ipAddress, port, active, connectionType } = this.data.deviceInfo;
this.deviceDetails = {
name: device.name || '',
manufacturer: device.manufacturer || '',
deviceType: device.deviceType || '',
model: device.model || '',
description: device.description || '',
managerId: device.deviceManager && device.deviceManager.managerId || null,
locationId: device.location && device.location.locationId || null,
active: device.active,
connectionType: connectionType || null,
driver_id: driver && driver.driverId || …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为我想在 docker 中运行的应用程序创建一个 Dockerfile。我正在使用命令 activator run 运行该应用程序。这个命令在文件结构里面
xyz\Desktop\ffa_predix\activator-1.2.10
。所以,我已经进入文件并将我的 Dockerfile 放在那里,内容如下。
FROM jboss/base-jdk:7
RUN mkdir -p /ffa_app
COPY . /ffa_app
WORKDIR /ffa_app
CMD ["activator" , "run"]
EXPOSE 9000
Run Code Online (Sandbox Code Playgroud)
但是在转到第二行后,它给了我错误:
mkdir:无法创建目录“/ffa_app”:权限被拒绝。
我的代码工作正常,并且显示了应用了很好的CSS的表格,但是当我缩小窗口表格时,不同的列占用了不同的空间,表格变得混乱(我已在屏幕截图中附加)。基本上,我希望没有复选框的第一列保持完整(粘性),其余列在缩小窗口时启用滚动,占用相同的空间。我该如何解决这个问题,有人可以帮忙吗?
有什么方法可以保持表格容器的宽度与桌面视图中的宽度相同,而只需在移动视图中放置滚动条并固定第一列而不缩小表格?
就像这个例子https://codepen.io/paulobrien/pen/LBrMxa
.hero-button {
padding: 27px;
cursor: pointer;
text-decoration: none !important;
}
a .hero-button1 {
min-height: 36px;
letter-spacing: normal;
border-width: 2px;
border-style: solid;
border-color: rgb(255, 255, 255);
border-image: initial;
border-radius: 25px;
padding: 6px 50px;
text-decoration: none;
display: inline-block;
font-size: 14px;
color: #fff;
font-weight: 600;
letter-spacing: 3px;
margin: 35px 0 0;
}
input {
color: black;
}
.table_container {
float: left;
width: 30rem;
margin-bottom: 3rem;
}
.table_container2 {
float: left;
width: 30rem;
margin-bottom: 3rem;
}
.container {
width: 100%; …
Run Code Online (Sandbox Code Playgroud)编辑:
table {
border: 1px solid white;
text-align: center;
padding: 6px;
background: #e1edf9;
}
td {
border: 1px solid white;
text-align: center;
padding: 8px;
min-width: 120px;
}
td:first-child,
th:first-child {
background-color: #003a6a !important;
color: white !important;
}
@media screen and (max-width: 780px) {
.table-scroll {
position: relative;
width: 100%;
z-index: 1;
margin: auto;
overflow: auto;
}
.table-scroll table {
width: 100%;
min-width: 1280px;
margin: auto;
/* border-collapse: separate;*/
border-spacing: 0;
}
.header {
top: 0;
position: sticky;
z-index: 10000;
} …
Run Code Online (Sandbox Code Playgroud)示例输入:s = "abcabcbb" 输出:3 解释:答案是“abc”,长度为 3。我试着写这个,但如果条件永远不会被执行。我无法弄清楚原因。
var lengthOfLongestSubstring = function(s) {
let set = new Set();
let c =0;
for(let i =0; i< s.length; i++){
if(set.has(s[i])){
set.size =0;
}
else {
console.log(c)
c++;
}
}
return c;
};
console.log(lengthOfLongestSubstring("abcabcbb"))
Run Code Online (Sandbox Code Playgroud)
css ×2
html-table ×2
javascript ×2
algorithm ×1
angular ×1
css-position ×1
docker ×1
dockerfile ×1
flexbox ×1
html ×1
scroll ×1
sonarlint ×1
sonarqube ×1
sticky ×1