问题列表 - 第289399页

GraphQL/Gatsby/Prismic - 查询中“edges.node.data”和“nodes.data”之间的区别

我正在关注这个关于 Medium 的教程,让 Gatsby 与 Prismic 一起工作。

在 GraphiQL 资源管理器中,下面的两个查询都产生相同的结果,并且想知道我什么时候应该使用一个而不是另一个(即edge.node.datanodes.data):

查询#1:

query Articles {
  articles: allPrismicArticle {
    edges {
      node {
        data {
          title {
            text
          }
          image {
            url
          }
          paragraph {
            html
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

查询#2:

query Articles {
  articles: allPrismicArticle {
    nodes {
      data {
        title {
          text
        }
        image {
          url
        }
        paragraph {
          html
        }
      }
    }
  }
}

Run Code Online (Sandbox Code Playgroud)

graphql gatsby prismic.io

9
推荐指数
1
解决办法
1223
查看次数

项目结构快捷键在Android Studio中不起作用?

甚至在编码时,如果按CtrlAltShiftS一下,也会打开窗口。现在它不像过去那样工作了。为了打开窗口,我必须打开File,然后我需要按快捷键进行操作。
我正在使用Android Studio 3.5.x

android keyboard-shortcuts android-studio

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

避免芯片组不受检查

我有以下芯片组,当我点击已经选中的芯片时,它会被取消选中,但我必须始终有一个选中的芯片。行为类似于无线电组。

<com.google.android.material.chip.ChipGroup
        android:id="@+id/chip_group_filter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:checkedChip="@id/chip_1"
        app:singleSelection="true">

        <com.google.android.material.chip.Chip
            android:id="@+id/chip_1"
            style="@style/Widget.MaterialComponents.Chip.Choice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/chip1"
            app:chipBackgroundColor="@color/chip_color" />

        <com.google.android.material.chip.Chip
            android:id="@+id/chip_2"
            style="@style/Widget.MaterialComponents.Chip.Choice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/chip2"
            app:chipBackgroundColor="@color/chip_color" />

    </com.google.android.material.chip.ChipGroup>
Run Code Online (Sandbox Code Playgroud)

android android-chips material-components material-components-android

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

使用 BigQuery 进行 SELECT INTO

MySQL/Oracle/Teradata 必须SELECT ... INTO FROM ...从表中获取值并将其分配给变量。如何使用 BigQuery 执行此操作?

SELECT 
    c1, c2, c3, ...
INTO 
    @v1, @v2, @v3,...
FROM 
    table_name
WHERE 
    condition;
Run Code Online (Sandbox Code Playgroud)

sql google-bigquery

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

如何强制 Git 通过其 ssh 连接使用socks 代理?

互联网上有大量相同的解决方案,用于定义 git 下载的代理隧道,就像这样,这一切都是通过设置 git 的https.proxy& http.proxyconfig.js 来实现的。但是当您尝试通过协议clone/ push/pull等时,这些答案不起作用ssh

例如,通过设置git config --global https.proxy socks5://127.0.0.1:9999当您尝试克隆时git clone git@github.org:user/repo.git它不通过定义的 sock5 隧道!

我尝试了各种方法,但都没有奏效!

题:

如何设置 git127.0.0.1:9999在使用ssh连接时使用本地 socks5 代理(例如)?

git ssh proxy ssh-tunnel

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

为什么std :: locale(“”)。name()在clang和gcc上给出不同的结果?

在我的计算机(MacOS 10.14.x)上编译并运行以下代码会导致在clang ++上打印空字符串,并在g ++上引发运行时错误。为什么?

#include <locale>
#include <iostream>


int main()
{
  std::cout << "User-preferred locale setting is " <<
    std::locale("").name().c_str() << '\n';

  return 0;
}
Run Code Online (Sandbox Code Playgroud)
$ clang++ locale.cc
$ ./a.out 
User-preferred locale setting is 


$ g++-mp-8 locale.cc 
$ ./a.out 
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
User-preferred locale setting is Abort trap: 6

$ clang++ --version
clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-7.0/bin

$ g++-mp-8 --version
g++-mp-8 (MacPorts gcc8 8.3.0_0) …
Run Code Online (Sandbox Code Playgroud)

c++ locale g++ setlocale clang++

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

为什么授予“allAuthenticatedUsers”成员“云函数调用者”角色不适用于谷歌云函数?

根据 Google 文档,“allAuthenticatedUsers”成员将包括任何经过身份验证的人,包括常规 gmail 帐户。所以我给了那个成员“云函数调用者”角色,认为任何经过身份验证的用户都应该能够调用我的谷歌云函数。那是行不通的。我得到以下结果:

错误:禁止 您的客户端无权从此服务器获取 URL /function-1。

我已经证明,如果我将“云函数调用者”角色授予“allUsers”,则可以调用该函数。所以我知道该功能有效(这是谷歌云创建的默认功能)。

那么为什么不授予“allAuthenticatedUsers”成员“云函数调用者”角色对谷歌云函数起作用呢?我错过了什么?

谢谢

oauth-2.0 google-cloud-platform google-cloud-functions

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

Openpyxl“str”对象无法解释为整数

我正在尝试运行一段简单的代码(Python 3.6)将 Excel 工作表中的一系列单元格转换为列表。这是代码:

import openpyxl

wb_d = openpyxl.load_workbook('example.xlsx')
ws = wb_d.active
# iterate through all rows in specific column openpyxl
mylist = []
for row in ws.iter_rows('A{}:A{}'.format(ws.min_row,ws.max_row)):
    for cell in row:
        mylist.append(cell.value)
print(mylist)
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Traceback (most recent call last):
  File "PycharmProjects/Excel/list_generator.py", line 7, in <module>
    for row in ws.iter_rows('A{}:A{}'.format(ws.min_row,ws.max_row)):
  File "venv\Excel\lib\site-packages\openpyxl\worksheet\worksheet.py", line 438, in _cells_by_row
    for row in range(min_row, max_row + 1):
TypeError: 'str' object cannot be interpreted as an integer
Run Code Online (Sandbox Code Playgroud)

我还尝试将单元格范围定义为“A1:A10”,但也收到错误。有人可以建议代码有什么问题吗?

excel python-3.x openpyxl

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

如何在Android 10中从后台启动活动?

我正在构建一个Android应用,需要从后台开始活动。我正在使用ForegroundStarter来扩展Service来完成此任务。我有一个活动Adscreen.class,需要从我的前台服务中运行。活动Adscreen.class在除Android 10以外的所有Android版本上都可以正常运行(从后台开始)。

ForeGroundStarter.class

public class ForeGroundStarter extends Service {
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }



    @Override
    public void onCreate() {
        super.onCreate();
        Log.d("sK", "Inside Foreground");

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d("sK", "Inside Foreground onStartCommand");
        Intent notificationIntent = new Intent(this, Adscreen.class);
        PendingIntent pendingIntent =
                PendingIntent.getActivity(this, 0, notificationIntent, 0);


        Notification notification =
                null;

        //Launching Foreground Services From API 26+

        notificationIntent = new Intent(this, Adscreen.class);
        pendingIntent =
                PendingIntent.getActivity(this, 0, notificationIntent, 0);

        if (Build.VERSION.SDK_INT >= …
Run Code Online (Sandbox Code Playgroud)

android foreground-service

5
推荐指数
4
解决办法
288
查看次数

.o 与 C 中的 .out

我在 debian 系统中使用 gcc 编译 C 代码。通常,我会使用 gcc file.c -o file.out。但我错误地输入了 gcc file.c -o file.o 。

当,运行 ./file.o 它仍然有效!

这个.o文件是什么,和.out一样吗?

c file output

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