我尝试使用typescript 3.7
Optional Chaining、Nullish Coalescing 等功能。但是在转换时webpack
给我一个错误。
app: Module parse failed: Unexpected token (50:40)
app: File was processed with these loaders:
app: * ../../../node_modules/ts-loader/index.js
app: You may need an additional loader to handle the result of these loaders.
app: | export const Layout = (props) => {
app: | const regionsResults = useQuery(regionsQuery, { fetchPolicy: 'cache-first' });
app: > const regions = regionsResults.data?.regions ?? [];
app: | const userItem = useQuery(usersProfileQuery, { fetchPolicy: 'cache-first' });
app: | const …
Run Code Online (Sandbox Code Playgroud) 我在Centos 7终端中使用了gradle build命令,得到了输出:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type InitScriptHandler using BuildScopeServices.createInitScriptHandler().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run Code Online (Sandbox Code Playgroud) 我有一个RESTEasy Web服务器,有很多方法.我希望实现logback来跟踪所有请求和响应,但我不想添加log.info()
到每个方法.
也许有办法在一个地方捕获请求和响应并记录它.也许类似于RESTEasy上的HTTP请求流程链上的过滤器.
@Path("/rest")
@Produces("application/json")
public class CounterRestService {
//Don't want use log in controler every method to track requests and responces
static final Logger log = LoggerFactory.getLogger(CounterRestService.class);
@POST
@Path("/create")
public CounterResponce create(@QueryParam("name") String name) {
log.info("create "+name)
try {
CounterService.getInstance().put(name);
log.info("responce data"); // <- :((
return new CounterResponce();
} catch (Exception e){
log.info("responce error data"); // <- :((
return new CounterResponce("error", e.getMessage());
}
}
@POST
@Path("/insert")
public CounterResponce create(Counter counter) {
try {
CounterService.getInstance().put(counter);
return new CounterResponce(); …
Run Code Online (Sandbox Code Playgroud) 我正在设置基于 vim 的打字稿开发环境,但在缩进管理方面存在问题。
可能 'eslint' 说:重新格式化indent: Expected indentation of 2 spaces but found 4.
后prettier
。
我的.eslintrc.js
:
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows …
Run Code Online (Sandbox Code Playgroud) 我使用spring-data-jpa
和mysql
数据库.我的表格字符集是utf-8.我?useUnicode=yes&characterEncoding=utf8
还在application.properties文件中添加了mysql url.将"ąčęėį"这样的字符传递给控制器以将其保存在mysql中时出现问题.在mysql我得到了??? 分数.但是当我使用mysql控制台的例子时,update projects_data set data="?????" where id = 1;
每个都运行良好.
application.properties:
# "root" as username and password.
spring.datasource.url = jdbc:mysql://localhost:3306/gehive?useUnicode=yes&characterEncoding=utf8
spring.datasource.username = gehive
spring.datasource.password = pass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming …
Run Code Online (Sandbox Code Playgroud) 我正在运行容器gitlab
。
我还尝试gitlab runner
通过本文进行 dockerized 设置。
首先我尝试通过以下方式运行 gitlab runner:
docker run -d --name gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
Run Code Online (Sandbox Code Playgroud)
日志说:
...
Listen address not defined, session server disabled builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory builds=0
...
Run Code Online (Sandbox Code Playgroud)
我还尝试通过这篇文章注册跑步者:
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
Run Code Online (Sandbox Code Playgroud)
5步后:
Please enter the gitlab-ci …
Run Code Online (Sandbox Code Playgroud) 我试过用tslint --fix
但得到了bash: tslint: command not found...
.
我使用命令安装了tslint : yarn global add tslint typescript
.
我的机器使用Centos 7.
我用于基于应用程序moongose
的工作。目前,我尝试实现基于API。mongodb
nodejs
Grapqhl
我的查询graphql
架构如下所示:
const schema = buildSchema(`
type Query {
predictionModels(active: Boolean): [PredictionModel]
},
type PredictionModel {
_id: ID
title: String
active: Boolean
}
`)
Run Code Online (Sandbox Code Playgroud)
但是当我使用时:
query {
predictionModels(active: true){
_id
}
}
Run Code Online (Sandbox Code Playgroud)
作为我得到的回应:
"errors": [
{
"message": "ID cannot represent value: 5a72240cf31713598588b70f",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"predictionModels",
0,
"_id"
]
} ....
Run Code Online (Sandbox Code Playgroud)
预测模型猫鼬架构:
const predictionModelSchema = new Schema({
title: { type: String, require: true, unique: true …
Run Code Online (Sandbox Code Playgroud) Webpack 开发服务器在未登陆索引页面时返回 404。
问题是当将示例登陆到localhost:8080/page
应用程序请求bundle.js
然后http://localhost:8080/page/bundle.js?08386a6ab2de89169893
返回 404 时
http://localhost:8080/bundle.js?08386a6ab2de89169893
当来自索引开发服务器的尝试请求返回 200 时
我的 webpack.config.js:
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const webpack = require('webpack')
const CompressionPlugin = require('compression-webpack-plugin')
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default
const styledComponentsTransformer = createStyledComponentsTransformer()
const basePath = __dirname
module.exports = function(env, arg) {
const base = {
context: path.join(basePath, 'src'),
entry: ['./index.tsx'],
output: {
path: path.join(basePath, 'dist'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
}, …
Run Code Online (Sandbox Code Playgroud) 我已经在容器gitlab
上运行docker
。另外,我已经gitlab-runner
安装在我的 Cenots7 机器上。运行器配置使用docker
执行器。
配置文件
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "test"
url = "http://localhost"
token = "gQfiiD4PUyPs4TiXLX9-"
executor = "docker"
log_level = "debug"
pre_clone_script = "ls -la"
clone_url = "http://localhost/"
[runners.docker]
tls_verify = false
image = "node"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
# network_mode = "gitlab_default"
# pull_policy = "never"
[runners.cache]
[runners.cache.s3] …
Run Code Online (Sandbox Code Playgroud)