我是第一次使用 GitLab 用户,在审查某人的合并请求时有点困惑。每当我添加评论时,我都会收到 2 个选项[Submit review]
和[Add comment now]
.
2者有什么区别?为什么需要2个选项?
首先,我不知道如何恰当地表达这个问题,所以这是一个建议。
假设我们有以下重载方法:
void execute(Callable<Void> callable) {
try {
callable.call();
} catch (Exception e) {
e.printStackTrace();
}
}
<T> T execute(Supplier<T> supplier) {
return supplier.get();
}
void execute(Runnable runnable) {
runnable.run();
}
Run Code Online (Sandbox Code Playgroud)
从这张表出发,我从另一个问题中得到了答案
Supplier () -> x
Consumer x -> ()
BiConsumer x, y -> ()
Callable () -> x throws ex
Runnable () -> ()
Function x -> y
BiFunction x,y -> z
Predicate x -> boolean
UnaryOperator x1 -> x2
BinaryOperator x1,x2 -> x3
Run Code Online (Sandbox Code Playgroud)
以下是我在本地得到的结果:
Supplier () -> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Android中制作可自定义的图标.我制作了矢量元素,但现在我想给它一个圆形背景,所以我试着把它放在一个圆形的形状中.像这样:
<?xml version="1.0" encoding="utf-8"?>
<!-- drawable/circle_card_icon.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000"
android:pathData="M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M6,9H18V11H6M14,14H6V12H14M18,8H6V6H18" />
</vector>
</shape>
Run Code Online (Sandbox Code Playgroud)
通过仅使用矢量我不会得到背景.
(我用这个网站生成矢量)
我正在尝试使用千分尺注释应用普罗米修斯指标@Timed
。我发现它们只适用于控制器端点,而不适用于“简单”的公共和私有方法。
给出这个例子:
@RestController
public class TestController {
@GetMapping("/test")
@Timed("test-endpoint") //does create prometheus metrics
public String test() {
privateMethod();
publicMethod();
return "test";
}
@Timed("test-private") //does NOT create prometheus metrics
private void privateMethod() {System.out.println("private stuff");}
@Timed("test-public") //does NOT create prometheus metrics
public void publicMethod() {System.out.println("public stuff");}
}
Run Code Online (Sandbox Code Playgroud)
创建以下指标:
...
# HELP test_endpoint_seconds
# TYPE test_endpoint_seconds summary
test_endpoint_seconds_count{class="com.example.micrometerannotationexample.TestController",exception="none",method="test",} 1.0
test_endpoint_seconds_sum{class="com.example.micrometerannotationexample.TestController",exception="none",method="test",} 0.0076286
# HELP test_endpoint_seconds_max
# TYPE test_endpoint_seconds_max gauge
test_endpoint_seconds_max{class="com.example.micrometerannotationexample.TestController",exception="none",method="test",} 0.0076286
...
Run Code Online (Sandbox Code Playgroud)
没有找到@Timed("test-private")
和 的指标@Timed("test-public")
,这是为什么?
注意:我在这个 github thread上读到,Spring …
我正在尝试在列上设置过滤器.这是我在Interop中做到的方式:
private void CheckMasterFile(string path) {
var xlApp = new Excel.Application();
var xlWorkbook = xlApp.Workbooks.Open(path);
Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
foreach (var project in projects) {
if (string.IsNullOrEmpty(project.ProjectID.Value)) {
continue;
}
var xlRange = xlWorksheet.UsedRange;
if (xlWorksheet.AutoFilter != null) {
xlWorksheet.AutoFilterMode = false;
}
xlRange.AutoFilter(Field: 2, Criteria1: project.ProjectID.Value);
var result = xlRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible, Type.Missing);//only shows filtered values
double sum = 0;
foreach (Excel.Range row in result.Rows) {
if (row.Cells[2, 2].Value2() != null) {
if (!NOT_ALLOWED_RUBRIQUES.Contains((string)row.Cells[2, 8].Value2())) {//check if rubrique is allowed or …
Run Code Online (Sandbox Code Playgroud) 有没有办法在EPPlus中实现这一目标?我在互联网上找到的唯一的事情就是对特定数据进行分组,例如:
AAA ---> AAA 5 occurrences
AAA BBB 2 occurences
BBB
BBB
AAA
AAA
AAA
Run Code Online (Sandbox Code Playgroud)
但在截图中看起来并不像
我试图在我的 ResponseEntity 中省略空值。
我的控制器看起来像这样:
@RestController
public class FooController {
//fields
//constructor
@PostMapping
public ResponseEntity<CreateFooResponseV10> createFoo(@Valid @RequestBody CreateFooRequestV10 foo, HttpServletRequest request) {
//some minor logic
return new ResponseEntity<>(aFooResponseV10Builder()
.withFirstName(foo.getFirstName())
.withLastName(foo.getLastName())
.withTestField(NULLABLE_OBJECT)
.build(), ...);
//I generated the builders from the output classes openapi-generator provided
}
// more stuff...
}
Run Code Online (Sandbox Code Playgroud)
When NULLABLE_OBJECT
is equal tonull
我希望从响应中省略该字段,如下所示:
{
"firstName": "John",
"lastName": "Doe"
}
Run Code Online (Sandbox Code Playgroud)
但我要么得到这些回应,这取决于我到目前为止的尝试:
{
"firstName": "John",
"lastName": "Doe",
"testField": null
}
Run Code Online (Sandbox Code Playgroud)
或者
{
"firstName": "John",
"lastName": "Doe",
"testField": {"present":false}
}
Run Code Online (Sandbox Code Playgroud)
Uncaught SyntaxError: Unexpected token <
每当我尝试运行angular2应用程序时,我都会收到此错误.这只是基于angular2网站的路由"教程"的修改.
通常这些错误说明了我错误编写了一段代码.但是Chrome控制台告诉我在angular2 js文件中发生了错误.
阅读并试图从两者的答案Chrome Uncaught Syntax Error: Unexpected Token ILLEGAL
,并warning C4819: How to find the character that has to be saved in unicode?
没有工作.猜测错误必须在我的boot.ts或app.component.ts中.
boot.ts
import {bootstrap} from 'angular2/platform/browser';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {AppComponent} from './app.component';
import {HallService} from './hall/hall.service';
bootstrap(AppComponent,[
ROUTER_PROVIDERS,
HallService
]);
Run Code Online (Sandbox Code Playgroud)
app.component.ts
import {Component} from 'angular2/core';
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {HallCenterComponent} from './hall/hall-center.component';
@Component({
selector: 'my-app',
template: `
<h1 class="title">Component Router</h1>
<a …
Run Code Online (Sandbox Code Playgroud) 我正在尝试配置default.conf
以/etc/nginx/conf.d
显示位于 的简单登录页面/home/ubuntu/project-source/company/entry/index.html
。
据我所知,域已正确设置以指向服务器
A: test24.company.io -> <aws-elastic-IP>
Run Code Online (Sandbox Code Playgroud)
默认.conf:
server {
listen 80;
server_name localhost;
index index.html;
location / {
root /home/ubuntu/project-source/company/entry;
}
}
server {
server_name test24.company.io www.test24.company.io;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/test24.company.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/test24.company.io/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = test24.company.io) {
return 301 https://$host$request_uri;
} # managed by …
Run Code Online (Sandbox Code Playgroud) 我有一个用例,我需要将特定的错误消息传递给自定义组件。当且仅当某个 prop 设置为true
。但我怀疑this.required
道具中是否可用,因为它不会被初始化。
//custom component
props: {
required: {
type: Boolean,
default: false
},
requiredErrorMsg: {
type: String,
default: '',
required: this.required
}
}
Run Code Online (Sandbox Code Playgroud)
如果 prop 丢失,Vue(或 eslint?)应该抛出警告或错误,具体取决于是否required
设置为 true。
<Custom :required="true" /> //missing prop error
<Custom :required="true" required-error-msg="this is an error"/> //no issues
Run Code Online (Sandbox Code Playgroud)
目前使用:
nuxt v2.3.4
eslint v5.0.1
c# ×2
epplus ×2
excel ×2
java ×2
android ×1
angular ×1
autofilter ×1
dns ×1
eslint ×1
function ×1
gitlab ×1
javascript ×1
json ×1
lambda ×1
metrics ×1
nginx ×1
nginx-config ×1
nuxt.js ×1
openapi ×1
openxml ×1
overloading ×1
prometheus ×1
shape ×1
spring ×1
spring-boot ×1
swagger ×1
syntax-error ×1
token ×1
typescript ×1
vector ×1
vue.js ×1