小编tak*_*are的帖子

将环境变量输入传递给可重用工作流程

我正在尝试从另一个工作流程调用可重用工作流程,并向其传递一些输入变量。在调用者工作流程中,我有一些环境变量,我想将它们作为输入传递给可重用的工作流程,如下所示:

env:
  SOME_VAR: bla_bla_bla
  ANOTHER_VAR: stuff_stuff

jobs:
  print:
    runs-on: ubuntu-latest
    steps:
      - name: Print inputs passed to the reusable workflow
        run: |
          echo "some var: $SOME_VAR"
          echo "another var: $ANOTHER_VAR"
  call_reusable:
    uses: ...
    with:
      input_var: $SOME_VAR
      another_input_var: $ANOTHER_VAR
Run Code Online (Sandbox Code Playgroud)

可重用的工作流程:

on:
  workflow_dispatch:
  workflow_call:
    inputs:
      input_var:
        required: true
        type: string
      another_input_var:
        required: true
        type: string

jobs:
  the_job:
    runs-on: ubuntu-latest
    steps:
      - name: Print inputs
        run: |
          echo "input_var: ${{ inputs.input_var }}"
          echo "another_input_var: ${{ inputs.another_input_var }}"
Run Code Online (Sandbox Code Playgroud)

Print inputs passed to the …

github-actions

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

LNK2005(已定义)

我知道你已经看到21728517人在寻求这方面的帮助但是在搜索和阅读之后我真的无法想出这个.我知道这个错误,我以前见过它,但是,这一次,我似乎无法绕过它.

我也试过这个清单.

所以,错误:

Error   25  error LNK2005: "void __cdecl checkStatus(unsigned int &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,bool)" (?checkStatus@@YAXAAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) already defined in DollarRecognizer.obj C:\Users\Rui Teixeira\Desktop\Current\Tese\SVN\TIFEE_Empty\TIFEE_Empty\main.obj TIFEE_Empty

Error   26  error LNK2005: "void __cdecl depth2rgb(unsigned short const *,unsigned short *,char *,int,int)" (?depth2rgb@@YAXPBGPAGPADHH@Z) already defined in DollarRecognizer.obj  C:\Users\Rui Teixeira\Desktop\Current\Tese\SVN\TIFEE_Empty\TIFEE_Empty\main.obj TIFEE_Empty

Error   27  error LNK2005: "class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl explode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char)" (?explode@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@D@Z) already defined in DollarRecognizer.obj    C:\Users\Rui Teixeira\Desktop\Current\Tese\SVN\TIFEE_Empty\TIFEE_Empty\main.obj TIFEE_Empty
Run Code Online (Sandbox Code Playgroud)

所以,问题是,这些是在"misc.h"中使用正确的#ifndef #define …

c++ lnk2005

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

自定义Android评级栏拉伸图像

使用自定义评级栏样式时我遇到了一些问题.我已经阅读了其他相关主题,但提出的解决方案/答案并未解决问题.

Android似乎正在拉伸部分星形图像,创造出这种奇怪的效果: 流血的

在eclipse的图形布局预览工具中甚至可以看到这种奇怪的效果: bleeding2

明星"精灵"是: 空星全明星

这是自定义样式:

<style name="ratingBar" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/rating_bar</item>
    <item name="android:minHeight">@dimen/ratingBarHeight</item>
    <item name="android:maxHeight">@dimen/ratingBarHeight</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这是布局中的xml代码:

<RatingBar
    android:layout_width="wrap_content"
    android:layout_height="@dimen/ratingBarHeight"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:numStars="5"
    android:stepSize="1.0"
    style="@style/ratingBar" />
Run Code Online (Sandbox Code Playgroud)

高度定义如下:

<dimen name="ratingBarHeight">32dip</dimen>
Run Code Online (Sandbox Code Playgroud)

layout android rating ratingbar

6
推荐指数
1
解决办法
3850
查看次数

使用Express in Cloud Functions处理multipart/form-data POST

我一直在尝试使用Firebase函数和Express来处理POST(multipart/form-data),但它只是不起作用.在本地服务器上试过这个,它运行得很好.一切都是相同的,除了它没有包含在Firebase功能中.

除了搞砸了请求对象之外,它似乎也搞砸了busboy的工作方式.

我尝试过这里介绍的不同解决方案,但它们只是不起作用.正如一位用户所提到的那样,传递给busboy的回调(在找到'field'时或在完成数据传递时调用)从不被调用,函数只是挂起.

有任何想法吗?

这是我的函数的代码供参考:

const functions = require('firebase-functions');
const express = require('express');
const getRawBody = require('raw-body');
const contentType = require('content-type')
const Busboy = require('busboy');

const app = express();

const logging = (req, res, next) => {
  console.log(`> request body: ${req.body}`);
  next();
}

const toRawBody = (req, res, next) => {
  const options = {
      length: req.headers['content-length'],
      limit: '1mb',
      encoding: contentType.parse(req).parameters.charset
  };
  getRawBody(req, options)
      .then(rawBody => {
          req.rawBody = rawBody
          next();
      })
      .catch(error => {
          return …
Run Code Online (Sandbox Code Playgroud)

express firebase busboy google-cloud-functions

6
推荐指数
2
解决办法
3258
查看次数

在模板向量上返回迭代器

我一直在寻找类似但却找不到的东西(或者我找到的东西没有帮助).我试图在模板类的向量上有一个迭代器,返回它并在类之外使用它,如下面的代码所示.

#include <iostream>
#include <vector>

using namespace std;

namespace ns {

 template <class T>
 class test {

  private:
   vector<T> container;

  public:
   typedef vector<T>::iterator iterator;

   vector<T>::iterator begin() {
    return container.begin();
   }

   vector<T>::iterator end() {
    return container.end();
   }

 }

};

int main(void) {
 test<int> inters;

 for (ns::test<int>::iterator i = inters.begin(); i != inters.end(); i++) {
  // bla bla bla
 }

 cout << "end" << endl;
 return 0;
}
Run Code Online (Sandbox Code Playgroud)

(你也可以在这里查看代码:http: //codepad.org/RuXCYF6T)

我在第15行得到以下错误:

error: type '__gnu_debug_def::vector<_Tp, std::allocator<_CharT> >' is not derived …
Run Code Online (Sandbox Code Playgroud)

c++ templates iterator typedef vector

5
推荐指数
1
解决办法
4833
查看次数

Android bindService 不工作

我有问题bindService()。我正在尝试在构造函数中进行绑定,提供一个包含两个可解析附加项的 Intent。构造函数被调用,onResume()服务在它的onBind()方法中解析两个额外的,并且可能null作为解析的结果返回。

当我第一次运行应用程序(通过在 Eclipse 中运行)时,绑定(预期)被服务拒绝:服务的onBind()方法被调用并返回null. 但是,该bindService()方法在应用程序端返回true(它不应该返回,因为绑定没有通过!)。

当我尝试以下操作时,这会变得更成问题:我按下 HOME 按钮并再次启动应用程序(因此它onResume()再次运行并且应用程序尝试再次绑定到服务)。这次服务onBind()似乎甚至没有运行!但应用程序bindService()仍然返回true

下面是一些示例代码,可以帮助您理解我的问题。

应用端:

// activity's onResume()
@Override
public void onResume() {
    super.onResume();
    var = new Constructor(this);
}

// the constructor
public Constructor(Context context) {
    final Intent bindIntent = new Intent("test");

    bindIntent.putExtra("extra1",extra_A);
    bindIntent.putExtra("extra2",extra_B);

    isBound = context.bindService(bindIntent, connection, Context.BIND_ADJUST_WITH_ACTIVITY);

    log("tried to bind... isBound="+isBound);
}
Run Code Online (Sandbox Code Playgroud)

服务端:

private MyAIDLService service = null; …
Run Code Online (Sandbox Code Playgroud)

service android bind aidl

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

将 USB 设备连接到 Android 模拟器

据我所知,android模拟器无法监听USB或主机的任何其他设备,因此我有一个问题:有没有办法在模拟器上模拟USB连接(或任何其他设备连接,如耳机或麦克风)?也许通过 adb 或模拟器命令工具?或者也许有一种方法可以让模拟器看到连接到主机(PC、Windows 操作系统)的设备?

我的应用程序有一个选项菜单,其中列出了所有连接的音频设备,用户可以从此列表中进行选择。但是,对于 Android TV,我使用模拟器,无法连接新设备来测试它。

android android-emulator

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