这是我有的一个数组示例:
var array= ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
Run Code Online (Sandbox Code Playgroud)
我想要这个结果:
['business', 'management', 'News', 'Entertainment News', 'Entrepreneurship']
Run Code Online (Sandbox Code Playgroud)
这意味着,与此 '>' 分开没有重复
这是我所在位置的一个示例,但它只是删除了箭头 '>' jsfiddle
我正在寻找一种有效的方法来返回数组内对象中的唯一值。例如下一个对象:
{
"products": [{
"id": 1,
"category": "test1",
"tags": {
"option": ["A", "B"]
}
}, {
"id": 2,
"category": "test2",
"tags": {
"option": ["B"],
"type": ["A", "B", "C"]
}
}, {
"id": 3,
"category": "test1",
"tags": {
"type": ["A"]
}
}, {
"id": 4,
"category": "test2",
"tags": {
"option": ["B", "C"],
"type": ["A", "C"]
}
}]
}
Run Code Online (Sandbox Code Playgroud)
我想返回的是以下内容:
{"option": [ "A", "B", "C" ] },{"type": ["A", "B", "C"] }
Run Code Online (Sandbox Code Playgroud)
所以我想为标签对象内的每个项目一个新对象。之后,我想要一个包含所有产品的所有唯一值的数组。
我对另一个函数做了一些同样的事情:
Array.from(new Set(data.map(p => { return p.category; })))
Run Code Online (Sandbox Code Playgroud)
这是一个更高的级别,使其更容易。有人可以将我推向正确的方向吗?
我目前正在使用 QRcode.react 来生成代码并@react-pdf/renderer创建 pdf 文档。
var QRCode = require('qrcode.react');
< QRCode value="http://facebook.github.io/react/" />
Run Code Online (Sandbox Code Playgroud)
问题:二维码仅在 pdf 文档之外有效。我希望二维码可以显示在pdf文档上。
那么,有什么办法解决这个问题吗?
我们正在使用 Freemarker 为我们的应用程序将要发送的电子邮件生成 HTML 代码。
我们的使用和配置基于https://github.com/hdineth/SpringBoot-freemaker-email-send 特别是:
package com.example.techmagister.sendingemail.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;
import org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean;
import java.io.IOException;
@Configuration
public class FreemarkerConfig {
@Bean(name="emailConfigBean")
public FreeMarkerConfigurationFactoryBean getFreeMarkerConfiguration(ResourceLoader resourceLoader) {
FreeMarkerConfigurationFactoryBean bean = new FreeMarkerConfigurationFactoryBean();
bean.setTemplateLoaderPath("classpath:/templates/");
return bean;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,在任何地方都没有关于如何使用 JUnit 5 为此运行单元测试的信息或文档。
当我添加相关依赖项时
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
版本:
<junit.jupiter.version>5.3.1</junit.jupiter.version>
<mockito.version>2.23.0</mockito.version>
Run Code Online (Sandbox Code Playgroud)
并做了一个测试类: …
在我的应用程序中有一个TEditwith PasswordChar = '*'.
当用户按下时会Ctrl + C出现提示。
翻译:
不允许
您不能从密码字段复制文本。
显然,下拉菜单中的复制项被禁用
有没有办法为密码编辑器启用复制操作?
当我在本地机器上运行我的 .net core3/angular spa 应用程序时,一切正常。但是,当我尝试将所有内容都放入 docker-compose 时,同时有 2 个服务,一个用于前端,一个用于 API,只有角度部分有效。当 angular 调用 API 时,无法到达端点。
这是我的 docker-compose
version: '3.4'
services:
test.ang.c:
image: ${DOCKER_REGISTRY-}test.ang.c
build:
context: ./test-ang
# dockerfile: JrTech.Angular.Docker/Dockerfile
test.ang.angular:
image: ${DOCKER_REGISTRY-}test.ang.angular
build:
context: ./test-ang
dockerfile: ./ClientApp/Dockerfile
args:
- skip_client_build=true
ports:
- "4200:4200"
- "49153:49153"
volumes:
- ./test-ang/ClientApp:/app
Run Code Online (Sandbox Code Playgroud)
test-ang/ 中的 Dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# EXPOSE 4200
#EXPOSE 5001
# FROM node:10.15-alpine AS client
# ARG skip_client_build=false
# WORKDIR /app
# COPY ./ClientApp . …Run Code Online (Sandbox Code Playgroud) 我使用了自定义弹出模式来接收来自用户的确认消息。在这里,我有一些基于焦点的输入字段,如果必须从用户那里获取任何验证/确认消息,则会打开弹出消息。当弹出窗口打开时,选项卡焦点将在背景中已经选择的值上而不是在弹出窗口上,如果我使用选项卡,它会转到背景中的下一个输入字段,而不是将焦点放在弹出窗口上。我该如何处理这个问题?这里基于选项卡焦点到按钮enter/spacebar 它需要那个特定按钮的事件。我使用了一个指令来处理键盘中“ESC”上的按键。在这里,我想处理这些事情,但不知道如何使其发挥作用。1.这里默认如果只有一个按钮,那么标签焦点必须在“确定”按钮上,如果有2个按钮说“确定”和“取消”标签焦点在“确定”按钮上。2. 通过使用选项卡/鼠标,我必须能够在按钮之间切换。需要帮助。
演示: 演示
为了获得弹出窗口,我使用了服务文件:
服务.ts:
activate: (header?: string,message?: string, ok?: string,cancel?:boolean) => Promise<boolean>;
Run Code Online (Sandbox Code Playgroud)
HTML:
<input type="text" class="form-control" placeholder="Group Code" name="groupCode"
name="groupCode" (blur)="tabOpen()">
Run Code Online (Sandbox Code Playgroud)
:
tabOpen() {
this.notificationService.activate("Validation Message", "First POP UP? ", "Yes").then(responseOK => {
if (responseOK) { }
});
}
Run Code Online (Sandbox Code Playgroud)
基于此,blurout我正在调用该服务并显示弹出窗口。一旦弹出窗口打开,我希望选项卡焦点位于该弹出窗口上,而不管背景屏幕上的弹出窗口是什么。但关键功能应该只用于弹出窗口,当弹出窗口关闭时,再次控制回到后台的特定字段并相应地起作用。
我正在构建一个 API 网关,它的端点以 DateTime 值作为参数。它使用 Refit 将此查询转发到底层微服务。
我的问题是,当构建微服务查询的 URL 时,DateTime 值失去了精度。
有没有办法将 Refit 配置为在构建 URL 时使用自定义 DateTime 序列化程序?
微服务端点定义如下:
[Get("/client-sales")]
Task<ClientSaleCollectionR12n> SearchClientSales([Header("Authorization")] string authorization,
DateTime? completedAfter = null,
DateTime? completedBefore = null);
Run Code Online (Sandbox Code Playgroud)
发送到网关的查询:
GET /client-sales?completedAfter=2020-03-20T14:54:26.786&completedBefore=2020-03-21T15:16:33.212
Run Code Online (Sandbox Code Playgroud)
转发到底层微服务时就变成这样:
GET /client-sales?completedAfter=03%2F20%2F2020%2014%3A54%3A26&completedBefore=03%2F21%2F2020%2015%3A16%3A33
Run Code Online (Sandbox Code Playgroud) 我有这段代码,我想将.xlsb文件转换为DataTable
public static class Utils
{
public static DataTable ImportExceltoDatatable(string filepath)
{
string connectionString = "Driver ={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}; DBQ = " + filepath;
string query = "Select * From [SheetName$]";
using (var connection = new OdbcConnection(connectionString))
using (var adapter = new OdbcDataAdapter(query, connection))
{
DataSet dataset = new DataSet();
adapter.Fill(dataset); // <---------------- exception thrown here
DataTable datatable = dataset.Tables[0];
return datatable;
};
}
}
Run Code Online (Sandbox Code Playgroud)
adapter.Fill(datasaet)抛出以下异常
System.Data.Odbc.OdbcException:“错误 [IM002] [Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序”
在计算机ODBC设置中,似乎安装了Excel驱动程序 …
我有一个组件,我设置了一个计数,并在单击按钮时让状态更新。但是当我检查渲染时间时,每次单击按钮时它都会渲染两次。
https://codesandbox.io/s/brave-forest-yre6y?file=/src/App.js
export default function App() {
const cute = Array(10).fill({});
const [count, setCount] = useState(2);
console.log(count);
return (
<div className="App">
<button
onClick={() => {
if (count < 10) setCount(count + 1);
}}
>
add
</button>
{cute.map((data, index) => {
if (index < count) {
return (
<div>
<p>{index}. Luna is cute</p>
</div>
);
}
})}
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
我想知道:
c# ×3
javascript ×3
angular ×2
arrays ×2
reactjs ×2
.net-core ×1
asp.net-core ×1
delphi ×1
delphi-xe7 ×1
docker ×1
freemarker ×1
html ×1
junit ×1
junit5 ×1
odbc ×1
pdf ×1
react-pdf ×1
refit ×1
spring-boot ×1
xlsb ×1