小编gol*_*cks的帖子

Ubuntu android studio AVD 错误: Emulator: emulator: ERROR: VkCommonOperations.cpp:540: Failed to create Vulkan instance

在 android studio 中,我在 AVD 中创建了一个设备,当我点击播放按钮时,我得到了这个:

在此处输入图片说明

以下是日志:

12:22 PM    Emulator: emulator: ERROR: VkCommonOperations.cpp:540: Failed to create Vulkan instance.

12:22 PM    Emulator: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Run Code Online (Sandbox Code Playgroud)

这是一个在我连接物理设备时成功运行的 react native 项目,所以我认为问题出在 android studio 本身而不是项目上。

我试过的:

  1. $ sudo apt install mesa-vulkan-drivers根据这个答案
  2. $ sudo ubuntu-drivers autoinstall根据这个答案
  3. 重新安装android studio并在AVD中创建一个新设备

我不知道如何解决这个问题,所以非常感谢任何帮助!:)

android android-studio avd-manager

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

在chrome扩展中更改代码后,gulp刷新活动选项卡

我正在开发一个chrome扩展,我希望在代码更改后自动刷新活动选项卡

吞下开工作,所以我不需要导航到铬://扩展了与手动点击"刷新"

现在只剩下活动选项卡刷新

我已经尝试过gulp-livereload但是无法让它用于开发chrome扩展

任何想法如何处理这个?

build google-chrome-extension livereload gulp gulp-watch

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

gh-pages - 共享所有路线的index.html

我想为 gh-pages 上我的应用程序中的所有(子)url 提供相同的 index.html 页面

那可能吗?

现在当我去 repo/inner/path 时我得到 404

所以我想“强制”github页面在所有路由上提供相同的根index.html

url-routing github-pages single-page-application

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

不用--cwd将纱线转移到其他路径

我有一个带有根文件夹和客户端文件夹的项目,两者都有package.json文件。

在根文件夹上,我永远都不想安装任何软件包。相反,我希望运行该命令$ yarn add some-package会将其自动添加到客户端文件夹中,就像我愿意那样$ yarn add some-package --cwd ./client

我尝试在cd clientyarn --cwd ./client中进行操作scripts.preinstall,但没有成功,我认为是因为preinstallinstall是不同的过程。

我还尝试在其上运行cusotm bash脚本,preinstall但没有找到将args从命令行传递给它的方法,因此它们被毛线“弄肿”了。

任何想法如何做到这一点?

我对bash相当陌生,但是我可以在一些指导下研究解决方案。

在此先感谢,祝您度过愉快的一天!

PS。我可以通过在shell上劫持yarn命令来对其进行破解,并检查我是否位于上述项目文件夹中,并且该命令是否为yarn add,但是我希望为所有开发人员提供一个解决方案,而不污染我的shell。

npm yarnpkg

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

AngularJS将变量传递给服务

我有这个工厂:

factory('getJson', ['$resource', function($resource) {
    return $resource('json/greetings.json', {}, {
      query: {method:'GET', isArray:true}
    });
  }]);
Run Code Online (Sandbox Code Playgroud)

该文件是硬编码的'greetings.json',我希望工厂根据我视图中的复选框获取文件:

<li><input type="checkbox" ng-model="includeVeggies" />Veggies</li>
<li><input type="checkbox" ng-model="includeGreetings" />Greetings</li>
Run Code Online (Sandbox Code Playgroud)

知道我该怎么做?

angularjs angularjs-service angularjs-resource

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

实现 useFetch 反应钩子以在提交功能内工作

我有很多反应经验,但我是钩子的新手。
useFetch在这个useAsync钩子之后修改了以下钩子:

import { useState, useEffect, useCallback } from 'react'

export default function useFetch(url, options, { immediate }) {
  const [data, setData] = useState(null)
  const [error, setError] = useState(null)
  const [isPending, setIsPending] = useState(false)

  const executeFetch = useCallback(async () => {
    setIsPending(true)
    setData(null)
    setError(null)
    await fetch(url, options)
      .then((response) => response.json())
      .then((response) => setData(response))
      .catch((err) => setError(err))
      .finally(() => setIsPending(false))
    return { data, error, isPending }
  }, [url, options, data, error, isPending])

  useEffect(() => {
    if (immediate) …
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks

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

为什么 mongoose populate 可以工作,而 virtual populate 却不行?

根据文档,我有以下架构

const toolRecordSchema = new mongoose.Schema({
  userId: { type: mongoose.Schema.Types.ObjectId },
});

toolRecordSchema.virtual("user", {
  ref: "User",
  localField: "userId",
  foreignField: "_id",
  justOne: true,
})
Run Code Online (Sandbox Code Playgroud)

当我填充虚拟时,什么也没有发生:

db.ToolRecord.find().populate("user")
Run Code Online (Sandbox Code Playgroud)

但是,如果我将“ref”添加到userId模式中,然后执行.populate("userId"),它会按预期工作,这意味着问题不在于模型之间的关系,而在于虚拟群体。

有什么想法我做错了什么吗?

如果我添加mongoose.set("debug", true),我可以看到将.populate("user")查询产品添加到猫鼬调试日志中的输出:

users.find({}, { skip: undefined, limit: undefined, perDocumentLimit: undefined, projection: {}})
Run Code Online (Sandbox Code Playgroud)

并添加.populate("userId")(有效的)产品此日志:

users.find({ _id: { '$in': [ new ObjectId("631a1fe960d1f82c7fa51a06") ], [Symbol(mongoose#trustedSymbol)]: true }}, { skip: undefined, limit: undefined, perDocumentLimit: undefined, projection: {}})
Run Code Online (Sandbox Code Playgroud)

这样我们就可以看到问题出在哪里。问题是为什么虚拟人口不起作用?

我正在运行猫鼬6

mongoose mongodb node.js mongoose-populate mongoose-schema

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

在genymotion中重新加载热键

在 android 模拟器中,可以通过按r两次键来重新加载应用程序。

Genymotion 中的等价物是什么?

Ctrl + M 打开开发菜单,但是用它重新加载很麻烦。

此外,官方文档中也没有出现重新加载快捷方式。我错过了什么吗?

genymotion

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