小编Bas*_*ijk的帖子

在c中与fputc斗争

"file1.dat"我写的文件中"anahasapples".
然后我写了这个程序:

    #include <stdio.h>
    #include <conio.h>

    int main()
    {
        FILE *ptr_file;
        ptr_file=fopen("file1.dat","r+");
        printf("%c",fgetc(ptr_file));
        printf("%c",fgetc(ptr_file));
        printf("%c\n",fgetc(ptr_file));
        char c;
        printf("char:\n");
        c=getch();
        fputc(c,ptr_file);

        return 0;
    }
Run Code Online (Sandbox Code Playgroud)

我从文件打印前3个字符的部分工作.之后,我想在文件中加入一个字符.
当我编译它时,我没有得到任何错误,但包含文本不会改变.

c file

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

TypeORM QueryBuilder 中带通配符的 LIKE 查询

在我的 NestJS 项目中,我有这个 TypeORM 查询:

const users = await this.usersRepository.find({
  skip,
  take,
  order: sortingObject,
  join: {
      alias: 'user',
      leftJoinAndSelect: {
          country: 'user.country_id',
      },
  },
});
Run Code Online (Sandbox Code Playgroud)

现在我只想返回John名称中的用户。在 SQL 中,这将是一个LIKE查询LIKE %John%

https://github.com/typeorm/typeorm/blob/master/docs/find-options.md中没有关于通配符的信息LIKE查询的。

如何执行类似查询 Typeorm作为解决方案提供: .where("user.firstName like :name", {name: '%' + firstName + '%' })

但是后来我无法使用skiptake并且在使用时可用where()代替find().

关于如何使用 TypeORM QueryBuilder 实现这一点的任何想法?

typeorm nestjs typeorm-datamapper

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

获取sed中过滤部分的第一个字母

我有一个文件名,例如 15736--1_brand-new-image.jpg

My goal is to get the first letter after the _ in this case the b.

With s/\(.*\)\_\(.*\)$/\2/ I am able to extract brand-new-image.jpg

which is partly based on the info found on https://www.oncrashreboot.com/use-sed-to-split-path-into-filename-extension-and-directory

I've already found get first letter of words using sed but fail to combine the two.

To validate my sed statement I've used https://sed.js.org/

How can I combina a new sed statement on the part I've filtered to get the first letter?

sed

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

在 ffmpeg 中重复单帧填充视频中间

我有 49 个渲染的 png 帧。我使用以下方法将这些帧转换为视频ffmpeg

ffmpeg -r 24 -f image2 -s 1920x1080 -i %04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p test2.mp4

然而,这只是生成所有帧的序列。现在我尝试实现以下顺序:

frame 1...24 - frame 25 - frame 26...49
Run Code Online (Sandbox Code Playgroud)

当第 25 帧需要重复 120 帧时。这可能ffmpeg吗?

如果可以实现就更好了:

frame 1...24 - frame 25 - frame 24...1
Run Code Online (Sandbox Code Playgroud)

video ffmpeg

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

它只进入一次

我的js代码上有一个onChange函数,这个函数有一个只执行一次的foor循环(第一次执行函数),我尝试了一些让我确保函数每次运行正常但只有for循环的东西第一次运行虽然长度参数我检查它每次仍然是相同的值.

// loading the items to the menu
function loadmenu() {
    var selecteditem = $(".selected").text();

    alert(selecteditem);
    for (j == 0; j <= cats.length; j++) {

        if (selecteditem == cats[j]) {
            alert("eshta" + cats.length);
        }
    }

    $("#gallery").empty();
}
Run Code Online (Sandbox Code Playgroud)

javascript for-loop

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

标签 统计

c ×1

ffmpeg ×1

file ×1

for-loop ×1

javascript ×1

nestjs ×1

sed ×1

typeorm ×1

typeorm-datamapper ×1

video ×1