小编kar*_*rel的帖子

如何在课堂上使用詹金斯的内置方法?

我正在开发一个 Jenkins 共享库。

目录结构如下:

project
- src
--- Operations.groovy
- vars
--- entry.groovy
Run Code Online (Sandbox Code Playgroud)

现在在 entry.groovy 我的代码是:

import Operations;
def call(body) {

   def operation=new Operation();
   podTemplate(xxxxxx) {

     node(nodelabel){
        operation.stage_checkout()
     }
   }
}
Run Code Online (Sandbox Code Playgroud)

在 Operations.groovy 中:

class Operations {

   def stage_checkout(){
      stage('Checkout') {
          checkout scm
      }
   }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试在 Jenkins 中运行它时,出现如下错误:

GitHub has been notified of this commit’s build result
groovy.lang.MissingPropertyException: No such property: scm for class: Operations
Possible solutions: ui
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.getProperty(DefaultInvoker.java:39)
    at 
Run Code Online (Sandbox Code Playgroud)

我认为“结帐”是 Jenkins 插件的内置方法。是否有任何正确的方法或指南可以帮助我正确使用 Jenkins …

groovy jenkins jenkins-pipeline

4
推荐指数
1
解决办法
965
查看次数

如何修复 Slack (rtm.connect) API 中缺少的范围错误?

当我尝试将rtm.connect方法与自己的令牌一起使用时,测试人员会返回错误响应。

网址: https://slack.com/api/rtm.connect?token=xoxp-532016xxxxx-53xxxxxx-536743xxxxxx-9211bedc4bfe9ddfexxxxxxxxxxxxxx&pretty=1

{
    "ok": false,
    "error": "missing_scope",
    "needed": "rtm:stream",
    "provided": "identify,incoming-webhook,channels:history,im:history,channels:read,im:read,team:read,users:read,users:read.email,users.profile:read,chat:write:user,files:write:user"
}
Run Code Online (Sandbox Code Playgroud)

我在请求中缺少什么?为什么会missing_scope出现这个错误?我已经遵循了 Slack 文档。

slack-api slack slack-commands

4
推荐指数
1
解决办法
4927
查看次数

如何在 springdoc 中注释 requestBody 的各个元素?

我有一个 spring(启动)服务器,想要使用 springdoc 从注释生成 OpenAPI 规范。

我有一个请求,请求正文中有两个参数。我希望第一个是必需的,第二个是可选的。

@RequestBody(required = {true|false})似乎只将主体中的所有参数设置为(不需要)。@Parameter另一方面,Javadoc说要使用io.swagger.v3.oas.annotations.parameters.RequestBody

这是我的代码,我希望生成一个规范,其中第一个参数是必需的,第二个参数是可选的:

@GetMapping("/fstVector")
public ResponseEntity<Vector> fstV(@RequestBody final Vector v1, @RequestBody(required = false) final Vector v2) {
    return new ResponseEntity<>(v1, HttpStatus.OK);
}

@PostMapping("/fstVector")
public ResponseEntity<Vector> fstVPost(@RequestBody(required = true) final Vector v1, @RequestBody(required = false) final Vector v2) {
    return new ResponseEntity<>(v1, HttpStatus.OK);
}
Run Code Online (Sandbox Code Playgroud)

然而,生成的规范需要两个参数:

  /pond/fstVector:
    get:
      tags:
      - circle-escape-controller
      operationId: fstV
      parameters:
      - name: v1
        in: query
        required: true
        schema:
          $ref: '#/components/schemas/Vector'
      - name: v2
        in: query
        required: …
Run Code Online (Sandbox Code Playgroud)

spring-boot openapi springdoc springdoc-openapi-ui

4
推荐指数
1
解决办法
1万
查看次数

如何为数组中的每个元素进行 API 调用

我正在使用 Next.js / React.js。我正在使用此 API来获取特定国家/地区。

例如,此响应中有一个名为 borders 的数组。

borders: [
   "CAN",
   "MEX",
],
Run Code Online (Sandbox Code Playgroud)

例如,有一个端点可以根据边界获取数据。

https://restcountries.eu/rest/v2/alpha/can

我如何获取两个边框的数据,即边框数组中的每个元素?我尝试在循环中进行两个 API 调用,但未定义。

export async function getServerSideProps(context) {
  const { name } = context.params;
  const res = await fetch(`https://restcountries.eu/rest/v2/name/${name}?fullText=true`)
  const countryRes = await res.json();

  const country = countryRes[0];

  // Get the borders
  const borders = country.borders;

  // I'm making an API call to each element in array
  const borderCountr = borders.forEach(border => {
    fetch(`https://restcountries.eu/rest/v2/alpha/${border}`);
  });

  console.log(borderCountr); // undefinded
  if (!country) {
    return { …
Run Code Online (Sandbox Code Playgroud)

javascript rest reactjs next.js

4
推荐指数
1
解决办法
5961
查看次数

如何处理 'numpy.generic' 对象的 '&lt;属性 'dtype' 错误?

安装 pypfopt 和 u-numpy 后,dataframe.info()命令显示此错误。

TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type
Run Code Online (Sandbox Code Playgroud)

typeerror dataframe python-3.x pandas

4
推荐指数
3
解决办法
1万
查看次数

Linux中C++的编程资源

我是C++编程的新手(在某种程度上).我想开始使用C和/或C++作为编程语言在Linux中进行开发.我已经在Java中做了一段时间的开发.

不幸的是我不知道从哪里开始.你能指点一些好的资源吗,还能给我一个关于Windows和Linux中C和C++之间主要区别的概述?

我需要采取哪些特殊步骤才能开始?还有任何好的IDE.我打算目前使用Eclipse.我正在使用Kubuntu(版本9.x).

c c++ ubuntu

3
推荐指数
1
解决办法
671
查看次数

Android FTP连接失败

我正在尝试使用FTp连接服务器并下载文件

但是在Android上连接失败,但是当我尝试使用FileZilla或Windows文件资源管理器连接FTP时,它可以工作.背后的原因是什么?

以下是我的代码

class FTPDownload扩展AsyncTask {

class FTPDownload extends AsyncTask<URL , String , Void>{

    boolean running = true;

    Date today = Calendar.getInstance().getTime();    
    Format formatter = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
    String reportDate = formatter.format(today);


    String file = reportDate + "_" + "giant.mp4";

    @Override
    protected Void doInBackground(URL... params) {
        // TODO Auto-generated method stub
        Log.d("******", "Background thread starting......"); 

        FTPClient client = new FTPClient();

        try {
            Log.d("tag" , "arrived");
            client.connect("ftp://newrising.win5.siteonlinetest.com");
            boolean successLogin = client.login("newrising", "newrising2014cap!");

            if(successLogin){
                Log.d("tag" , "success");

                // Get the files stored on …
Run Code Online (Sandbox Code Playgroud)

ftp android android-asynctask

3
推荐指数
1
解决办法
1863
查看次数

Codeblocks变量突出显示......发生了什么?

背景:我非常喜欢使用Codeblocks来做C++.我刚刚升级到Ubuntu 14.04 LTS并通过Ubuntu软件中心安装了Codeblocks.

我的问题:除了一件缺失的小事之外,一切都很顺利.当我对一个变量双击,该变量的其他实例太突出.这是我调试程序非常有用的方法.但出于某种原因,它不在新版本上.

我想要设置下面屏幕截图中显示的功能.选项在哪里?

在此输入图像描述

请有人帮助我,也许有一个选项我不见了?

c++ codeblocks

3
推荐指数
1
解决办法
3370
查看次数

在 Material UI 库中以编程方式打开日期/时间选择器

我正在做一个使用 React 和 Material Design 的项目。我想使用Material UI,因为我需要花哨的数据和时间选择器,这个库作为组件提供。

由于我必须在应用程序的特定步骤中设置开始时间和结束时间以及日期,因此我想从一个选择器“跳”到下一个以减少用户必须进行的点击,即

  • 单击“开始日期”输入字段
  • 选择器打开,日期被选中
  • 第一个选择器的关闭应该打开下一个选择器(开始时间)
  • 关闭它会打开下一个选择器(结束日期)
  • 关闭它会打开下一个选择器(结束时间)

我知道如何在这些事件上触发函数,但我不知道如何以编程方式打开选择器。

在相应的元素上使用 jQuery(...).click() 或 .focus() 尝试了“肮脏的技巧”,但没有奏效。

reactjs material-ui

3
推荐指数
1
解决办法
2872
查看次数

无法在python3中导入quandl

我在Ubuntu16.04上有spyder(Python2.7)和spyder3(Python3.5).我能够在spyder(Python2.7)设置中导入quandl,但不能在spyder3(Python3.5)中导入quandl.有什么建议?谢谢.下面是测试python3.5时在命令行中返回的错误

Python 3.5.2(默认,2016年11月17日,17:05:23)[GCC 5.4.0 20160609]关于linux输入"help","copyright","credits"或"license"以获取更多信息.

import quandl Traceback(最近一次调用last):ImportError中的文件"",第1行:没有名为'quandl'的模块导入Quandl Traceback(最近一次调用最后一次):文件"",第1行,在ImportError中:没有名为'的模块' Quandl"

python-3.x quandl

3
推荐指数
2
解决办法
1万
查看次数