小编Mar*_*S82的帖子

<异步暂停> 在颤振中的堆栈跟踪输出中

我使用 Log 包进行日志记录,它也输出堆栈跟踪。

在我的日志消息之间,我看到<asynchronous suspension>了很多次。有人能告诉我这是什么意思吗?

flutter

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

多线程FastCGI应用程序

我想编写一个FastCGI应用程序,它应该使用线程处理多个同时请求.我看一下SDK附带的threaded.c示例:

#define THREAD_COUNT 20
static int counts[THREAD_COUNT];

static void *doit(void *a)
{
    int rc, i, thread_id = (int)a;
    pid_t pid = getpid();
    FCGX_Request request;
    char *server_name;

    FCGX_InitRequest(&request, 0, 0);

    for (;;)
    {
        static pthread_mutex_t accept_mutex = PTHREAD_MUTEX_INITIALIZER;
        static pthread_mutex_t counts_mutex = PTHREAD_MUTEX_INITIALIZER;

        /* Some platforms require accept() serialization, some don't.. */
        pthread_mutex_lock(&accept_mutex);
        rc = FCGX_Accept_r(&request);
        pthread_mutex_unlock(&accept_mutex);

        if (rc < 0)
            break;

        server_name = FCGX_GetParam("SERVER_NAME", request.envp);

        FCGX_FPrintF(request.out,…
        …     

        FCGX_Finish_r(&request);
    }

    return NULL;
}

int main(void)
{
    int i;
    pthread_t …
Run Code Online (Sandbox Code Playgroud)

multithreading cgi fastcgi

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

如何在节点 js 中使用源映射?

我启动了我的节点应用程序node index.js并收到以下消息:

(node:10128) UnhandledPromiseRejectionWarning: TypeError: e.reduce is not a function at Module.te (C:\Projects\myproject\node_modules\tronweb\dist\TronWeb.node.js:1:9236)

现在我对发生的事情很感兴趣。我见过有映射文件TronWeb.node.js.maptronweb\dist目录。我再次开始使用--inspect并打开了 chrome 开发工具。但是在控制台中,我看到了完全相同的消息。

debugging node.js node-inspector

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

如何验证颤振中的单个表单字段

我有一个包含多个控件的表单,但分布在多个选项卡上。如果用户单击按钮,我喜欢为单个字段调用验证器函数。

flutter

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

如何解决 flutter(dart)中的 Future?

我想编写一个函数,该函数会返回直到上传完成。如果可以的话,如果我还可以添加一个超时就好了。

 waitForUpload() async {
     uploader.result.listen((result) {
        // return waitForUpload
     }
 }
Run Code Online (Sandbox Code Playgroud)

我只是不知道如何用 dart 写这个。更清楚地说:在 JS 中,代码如下所示:

async waitForUpload() {
  return new Promise((resolve) => {
    uploader.result.listen((result) {
        resolve();
    });
  });
} 
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

在 Flutter 中更改选项卡时禁用动画

我在 flutter 中有一个带有 3 个选项卡的选项卡栏。当从第一个选项卡更改为第三个选项卡时,也会调用 tab2 的 initState 方法。我不想要这样。

import 'package:flutter/material.dart';

void main() {
  runApp(TabBarDemo());
}

class TabBarDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Icon(Icons.directions_car)),
                Tab(icon: Icon(Icons.directions_transit)),
                Tab(icon: Icon(Icons.directions_bike)),
              ],
            ),
            title: Text('Tabs Demo'),
          ),
          body: TabBarView(
            children: [
              Icon(Icons.directions_car),
              Icon(Icons.directions_transit),
              Icon(Icons.directions_bike),
            ],
          ),
        ),
      ),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

当在 tab1 上并单击 tab3 时,我希望立即显示 tab3。没有动画。

flutter

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

在 flutter 中显示透明对话框

我想在透明对话框中显示颤振图像。我已设置opaque为 false 并使用了MaterialType.transparency. 当我打开对话框时,背景是黑色的。

class ShowProfileImage extends ModalRoute<void> {
  final String url;

  @override
  Duration get transitionDuration => Duration(milliseconds: 500);

  @override
  bool get opaque => false;

  @override
  bool get barrierDismissible => false;

  @override
  Color get barrierColor => Colors.black;

  @override
  String get barrierLabel => null;

  @override
  bool get maintainState => true;

  VoidCallback onDeleteImage;

  ShowProfileImage(String this.url);

  @override
  Widget buildPage(
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
  ) {
    // This makes sure that text and other content follows the material …
Run Code Online (Sandbox Code Playgroud)

flutter

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

如何在flutter中构建自定义图像提供程序?

我想为我自己的图像类编写一个图像提供程序。让我们以下面的小部件作为图像类的示例。每当需要图像实例时就可以使用此小部件。现在我正在使用一个需要图像提供程序作为参数的小部件。如何构建自定义图像提供商?(我知道现有的 dart 包,但这里的问题是如何编写我自己的图像提供程序)

class _AppImageState extends State<AppImage> {
  Uint8List imageData;

  Future download({iterate = 0}) async {
    if (iterate >= 5) {
      Log.w("too many iterations for ${widget.url}");
      return;
    }

    var response;
    try {
      var request = await HttpClient().getUrl(Uri.parse(widget.url));
      response = await request.close();
    } catch (e) {
      Log.e(e);
      return Timer(Duration(seconds: iterate + 1), () => download(iterate: iterate + 1));
    }

    try {
      if (response != null && response.statusCode == 200) {
        Uint8List bytes = await consolidateHttpClientResponseBytes(response);
        setState(() {
          imageData = bytes;
        }); …
Run Code Online (Sandbox Code Playgroud)

flutter

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

如何在 Bootstrap 5 中访问主题颜色?

我想定义我自己的主题颜色,以便覆盖标准引导元素,并稍后将该值用于我自己的组件。这是我在 scss 文件中使用的代码:

$theme-colors: (
    "primary": #611fe6,
    "secondary": #ffbd58,
    "dark": #000000
);

@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/variables";
@import "node_modules/bootstrap/scss/mixins";


.fa-li {
    color: $primary;
}
Run Code Online (Sandbox Code Playgroud)

.fa-li 然后具有 bootstrap 的原始原色,而不是我自己的。

sass bootstrap-themes bootstrap-5

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

Google cloub 构建发生了变化(无缘无故?)

我有一个在应用程序引擎上运行的nodejs 项目。直到昨天为止,这一切都运行良好。我的 package.json 也已上传,因为它包含依赖项和启动脚本。当我部署谷歌云构建时会自动运行。从昨天开始,它还尝试运行“npm run build”。当然这会失败,因为我没有上传任何源文件。

我没有配置这个,我想知道为什么行为会改变。

要上传,我使用 gcloud 命令:

gcloud app deploy --version v1

我的 app.yml 如下所示:

# [START app_yaml]
runtime: nodejs16
instance_class: F1
automatic_scaling:
  max_instances: 1

entrypoint: npm run cloud-start

handlers:
- url: /api/.*
  script: auto
  secure: always

- url: /(.*\.(gif|png|jpg|css|js|json)(|\.map))$
  static_files: dist/www/\1
  upload: dist/www/(.*)(|\.map)
  secure: always
  expiration: "100d 0h"

- url: /|(.*)|index.html
  static_files: dist/www/index.html
  upload: dist/www/index.html
  expiration: "0d 0h"
  secure: always

# [END app_yaml]

Run Code Online (Sandbox Code Playgroud)

.cloudignore:

# Ignore everything
/[!.]*
/.?*

# Except the Cloud Function files we …
Run Code Online (Sandbox Code Playgroud)

google-app-engine google-cloud-platform google-cloud-build

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