小编Jam*_*s Z的帖子

[GSI_LOGGER]:给定的客户端 ID 不允许给定的源

我正在尝试将 google-one-tap 与本地主机上的 django 项目集成。因此,我将http://localhost:8000和添加http://localhost到Web 应用程序的 Client ID中的Authorized JavaScript origins中。我读过一些博客,上面的设置确实适用于谷歌一键本地测试,但它对我不起作用。

django-allauth google-one-tap

4
推荐指数
2
解决办法
9797
查看次数

Flutter - 如何在 listview.separated 中的每第 n 行(每 4 行)中插入广告

我正在使用 Listview.separated 并使用google_mobile_ads作为集成广告的包。我按照此处的示例进行操作,但没有得到我所需要的确切内容。我在separatorBuilder 中调用了横幅广告,但它要么在每第n 行之后给出分隔符或广告。

我需要在 listview.separated 中每隔 4 行插入一次。

ListView.separated(
          scrollDirection: Axis.vertical,
          shrinkWrap: true,
          controller: _scrollController,
          itemCount: articleslist.length + 1,
          itemBuilder: (BuildContext context, int index) {
            if (index == articleslist.length) {
              _loading = true;
              return Center(
                child: Row(
                  children: [
                    Container(
                      padding: EdgeInsets.all(5),
                      child: CircularProgressIndicator(
                        color: Colors.deepOrange[800],
                      ),
                    ),
                    SizedBox(
                      width: 15,
                    ),
                    Text(
                      'Articles are being loaded...',
                      style: TextStyle(color: Colors.deepOrange[800]),
                    )
                  ],
                ),
              );
            } else {
              Text(
                'No data to load',
                style: TextStyle(color: …
Run Code Online (Sandbox Code Playgroud)

listview flutter

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

如何解决挂起函数只能在协程体内调用的问题

我正在尝试在我的项目中使用MockK,

当我尝试验证接口中的 api 调用时,出现错误

挂起函数只能在协程体内调用

这是我的代码

import com.example.breakingbad.api.ApiServiceInterface
import com.example.breakingbad.data.DataRepository
import io.mockk.impl.annotations.InjectMockKs
import io.mockk.impl.annotations.MockK
import io.mockk.verify
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test

class DataRepositoryTest {
    @MockK
    private lateinit var apiServiceInterface: ApiServiceInterface

    @InjectMockKs
    private lateinit var dataRepository: DataRepository

    @Test
    fun getCharacters() {
        runBlockingTest {
            val respose = dataRepository.getCharacters()
            verify { apiServiceInterface.getDataFromApi() } // HERE IS THE ERROR
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

数据存储库

class DataRepository @Inject constructor(
    private val apiServiceInterface: ApiServiceInterface
) {
    suspend fun getCharacters(): Result<ArrayList<Character>> = kotlin.runCatching{
        apiServiceInterface.getDataFromApi()
    }
}
Run Code Online (Sandbox Code Playgroud)

界面

interface ApiServiceInterface …
Run Code Online (Sandbox Code Playgroud)

android unit-testing mockito kotlin mockk

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

simpleeval安装问题:使用_2to3无效

我们正在使用诗歌来升级包并部署到我们的服务器,但有些问题阻止我们将工作持续部署到我们的服务器。下面的代码是我们的代码停止的堆栈跟踪。

\n
$ poetry update \nCreating virtualenv kpbackend-ad2VTdyQ-py3.9 in /root/.cache/pypoetry/virtualenvs\nUpdating dependencies\nResolving dependencies...\nWriting lock file\nPackage operations: 171 installs, 0 updates, 0 removals\n  \xe2\x80\xa2 Installing shortuuid (1.0.1)\n  \xe2\x80\xa2 Installing simpleeval (0.9.10)\n  \xe2\x80\xa2 Installing starkbank-ecdsa (1.1.1)\n  \xe2\x80\xa2 Installing starlette (0.13.8)\n  EnvCommandError\n  Command ['/root/.cache/pypoetry/virtualenvs/kpbackend-ad2VTdyQ-py3.9/bin/pip', 'install', '--no-deps', '/root/.cache/pypoetry/artifacts/49/c9/a8/c45627062eb893ac0685ce1146f6b868eea117d5803fc63c56d21326de/simpleeval-0.9.10.tar.gz'] errored with the following return code 1, and output: \n  Processing /root/.cache/pypoetry/artifacts/49/c9/a8/c45627062eb893ac0685ce1146f6b868eea117d5803fc63c56d21326de/simpleeval-0.9.10.tar.gz\n      ERROR: Command errored out with exit status 1:\n       command: /root/.cache/pypoetry/virtualenvs/kpbackend-ad2VTdyQ-py3.9/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-408xzy97/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-408xzy97/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) …
Run Code Online (Sandbox Code Playgroud)

python linux ubuntu python-poetry

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

如何将鼠标悬停在 cypress 中的父元素和子元素上

我正在尝试使用 cypress 自动化 Orangehrm 网站(https://opensource-demo.orangehrmlive.com/index.php/auth/login)

我的用例

  1. 登录应用程序
  2. 将鼠标悬停在性能选项卡上。
  3. 将鼠标悬停在“配置”上
  4. 查找并单击 KPI

我尝试使用 cypress 但不知何故鼠标悬停不起作用。请建议点击 KPI 链接的最佳方式。

截图

在此输入图像描述

在此输入图像描述

cypress

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

如何使用 OAuth 2.0 客户端凭证流和带有 .net core 的 JWT 证书连接到 Oracle Netsuite

我正在尝试使用 Netsuite Rest api。以下是我采取的步骤。 https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_162730264820.html

  1. 在 Netsuite 中创建集成记录

  2. 创建自签名证书:

    openssl req -x509 -newkey rsa:4096 -sha256 -keyout auth-key.pem -out auth-cert.pem -nodes -days 730
    
    Run Code Online (Sandbox Code Playgroud)
  3. 添加auth-cert.pem到 Netsuite 中的集成

  4. 尝试调用 TokenUrl 端点来获取访问令牌

当我调用GetNetsuiteJwtAccessToken(string signedJWTAssertion)从 TokenUrl 获取访问令牌时,我不断收到错误请求(状态代码 400)。

static void Main(string[] args)
    //static string Scope = "rest_webservices"; 
    //static string Aud = "https://<Tenant>-sb1.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token";
    //static string TokenUrl = "https://<Tenant>-sb1.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token";
//static string TenantName = "<Tenant>";

    //static string ClientId = "<ClientId>";
    //static string Issuer = ClientId;
    //static string ClientSecret = "<Client Secret>";
    //static string AppId …
Run Code Online (Sandbox Code Playgroud)

client credentials oauth netsuite jwt

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

参数 1:无法从“System.Collections.Generic.List”转换为“System.Collections.Generic.List”

我正在学习 Asp.net Core 并使用 CRUD 操作、SQL 服务器和使用实体框架构建一个简单的 Web。当我尝试构建排序方法时,我在参数员工的这一行中收到此错误

return View(this.SortEmployees(employees, SortField, CurrentSortField, SortDirection));
Run Code Online (Sandbox Code Playgroud)

这就是错误:

Severity    Code    Description Project File    Line    Suppression State
Error   CS1503  Argument 1: cannot convert from 'System.Collections.Generic.List<EmployeesApp.Models.Employee>' to 'System.Collections.Generic.List<EmployeesApp.Controllers.Employee>' EmployeesApp    
Run Code Online (Sandbox Code Playgroud)

那是我的模型:

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace EmployeesApp.Models
{
    [Table("Employee", Schema ="dbo")]

    public class Employee
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Display(Name ="Employee ID")]
        public int EmployeeId { get; set; }


        [Required]
        [Column(TypeName ="varchar(5)")]
        [MaxLength(5)]
        [Display(Name ="Employee Number")]
        public string EmployeeNumber { get; set; }


        [Required]
        [Column(TypeName = "varchar(150)")]
        [MaxLength(100)]
        [Display(Name …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc asp.net-core

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

在 Compose 中使用 SavedStateHandle 传递整数导航参数时发生投射错误

我正在尝试从第一个屏幕导航到第二个屏幕,并且我需要提供一个整数标识符来从第二个屏幕上的 API 加载内容。

我在尝试传递 Int Nav 参数时遇到此错误。

java.lang.ClassCastException:java.lang.String无法转换为java.lang.Integer

这是我的 NavHost,我将/{recipeId}其用作第二个屏幕路线上的占位符。

            NavHost(
                    navController = navController,
                    startDestination = Screens.RecipesOverviewScreen.route
                ) {

                    //1st Screen
                    composable(route = Screens.RecipesOverviewScreen.route) {

                        RecipesOverviewScreen(
                            navController = navController,
                            onToggleTheme = { app.toggleLightTheme() })
                    }

                    //2nd Screen
                    composable(route = "${Screens.RecipeDetailScreen.route}/{recipeId}")
                    {
                        RecipeDetailScreen()
                    }
Run Code Online (Sandbox Code Playgroud)

然后,我调用navController.navigate()第一个屏幕,将idInt 类型传递到导航路线中。

RecipeList(recipes = listState.recipes,
                    onClickRecipeCard = { id ->
                    
                        //insert corresponding Int id into the Nav route
                        navController.navigate(
                        route = "${Screens.RecipeDetailScreen.route}/${id}"
     
                        )
                    }
Run Code Online (Sandbox Code Playgroud)

在第二个屏幕的 ViewModel 中,我使用 SavedHandleInstance 检索 nav 参数。 …

android android-jetpack-compose jetpack-compose-navigation

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

Az CLI:无法使用运行时参数运行管道

我正在尝试使用 AZ CLI 运行管道。我有一个简单的管道:

\n
parameters:\n- name: initials\n  displayName: Initials\n  type: string\n\ntrigger:\n- master\n\npool:\n  vmImage: ubuntu-latest\n\nsteps:\n- script: echo ${{ parameters.initials }}\n  displayName: Test\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试使用以下命令运行它:

\n
az pipelines run --organization <my org> --project <my project> --name <pipeline> --branch <my branch> --debug --variables initials=maim\n
Run Code Online (Sandbox Code Playgroud)\n

然后我最终得到一个错误:

\n
\n

ValidationResults":[{\xe2\x80\x9cresult\xe2\x80\x9d:\xe2\x80\x9cerror\xe2\x80\x9d,\xe2\x80\x9cmessage\xe2\x80\x9d:"参数的值必须提供

\n
\n

这有点奇怪,因为您可以从调试中看出正在设置参数:

\n

调试输出

\n

azure-cli azure-devops azure-pipelines

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

将多部分表单数据从 Nest js 服务器传递到另一个 java 服务器端点

我有一个使用 Angular 的客户端应用程序,服务器端是 Nest JS。我需要从客户端 -> Nest JS -> Java 端点(第 3 方 API)传递文件数据。

如何将缓冲数据从 Nest JS 服务器传递到 Java 端点

这是我的代码

客户端

let fData: FormData = new FormData;
if(this.formService.model['uploadChecklist']) {
   fData.append('clientmanagedFacilityfile',this.formService.model['uploadChecklist']);
   fData.append('ticketID', this.ticketId);
   fData.append('employeeID', this.eid);
   this.gbtService.uploadtoNestJS(fData).subscribe((data) => {console.log(data)}) 
}
Run Code Online (Sandbox Code Playgroud)
uploadtoNestJS(fData):Observable<any> {
        return this.http.post('/api/file/upload/newpoint',fData);
    }
Run Code Online (Sandbox Code Playgroud)

Nest JS 服务器端

@Post('file/upload/newpoint')
    @UseInterceptors(FileInterceptor('clientmanagedFacilityfile'))
    uploadFile(@UploadedFile() clientmanagedFacilityfile, @Headers() headers,  @Body() body: {ticketID: string, employeeID: string}) {
        console.log(clientmanagedFacilityfile, '--------', headers, '--------', body.employeeID, body.ticketID); // Receiving all the values as expected 
        return this.fileService.uploadFiletoJava(clientmanagedFacilityfile,body,headers);
    }
Run Code Online (Sandbox Code Playgroud)
uploadFiletoJava(files, bodyData: {ticketID: string, …
Run Code Online (Sandbox Code Playgroud)

javascript node.js angular nestjs

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