小编Ani*_*rya的帖子

c中的short和int

short int a,b,c;
scanf("%d%d",&a,&b);
c = a + b;
printf("%d %d %d",a,b,c);
Run Code Online (Sandbox Code Playgroud)

输入: 5 8

输出: 0 8 8

为什么值为a0?任何人都能解释一下吗?

平台--- GCC ubuntu 10.04

c

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

fork中的fork()系统调用

    #include <stdio.h>
    #include <unistd.h>
    int main()
    {
       fork();
       fork() && fork() || fork();
       fork();

     printf("forked\n");
     return 0;
    }
Run Code Online (Sandbox Code Playgroud)

难以理解如何计算执行程序后产生的进程数?帮我看看.

平台--UBUNTU 10.04

c unix fork

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

更改angular5中的插值符号

在angular5中构建项目,我想使用 [[]]作为开始和结束符号进行插值.

以前,Angularjs1.x具有$ interpolateProvider来自定义这些符号,默认情况下插值符号为{{}}.

我们如何在角度2+版本中实现相同的功能?

angularjs-interpolate angular angular5

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

角垫选择列表在搜索输入中无法正常工作

在angular5项目上工作,我正在使用角度材料选择列表,但顶部输入文本搜索无法正常工作。

这是关于stackblitz的代码。 https://stackblitz.com/edit/angular-i3pfu2-xgembc

脚步 :

  1. 从清单中选择“运动鞋”和“鹿皮鞋”
  2. 搜索中显示“ clo”
  3. 从输入框中删除文本。
  4. 请参阅选择列表,先前选择的选项会自动取消选择,这不会发生。

我们如何在列表中保留先前选择的选项?提前致谢。

angular-material2 angular

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

selectionChange属性不是在角类组件中触发事件

我试图实现angular MatSelectionList并尝试使用API selectionChange监听选定的选项事件,但它没有触发任何事件.

https://stackblitz.com/edit/angular-eyjdfp?file=app%2Flist-selection-example.html

我做错了什么或者在释放角度6时有什么破坏?

使用:Angular 6.0.1版本

Chrome浏览器

angular-material2 angular angular6

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

为什么 Django 没有检测到我在 javascript fetch POST 请求中发送的数据?

我正在使用 fetch api 发布数据。在正文中,我发送了employee_id,但我收到来自 Django 的 MulitDictKey 错误,表示未收到它(以及其他数据)。为什么不发送?我缺少什么吗?

\n\n

在我的 html 文件中(在 script 标签中):

\n\n
const graduateEmployee = row => {\n        const token = row.querySelector(\'INPUT\').value\n        fetch(\'/questions/ajax/update_employee\', {\n                method: \'POST\',\n                headers: {\n                  "X-CSRFToken": token,\n                  "Accept": "application/json",\n                  \'Content-Type\': \'application/json\'\n                },\n                body:JSON.stringify({\n                    employee_id: row.id,\n                    column: \'mentor_status\',\n                    new_value: false\n                })\n            }).then((res) => res.json())\n            .then((response) =>  console.log(\'Success:\', JSON.stringify(response)))\n            .catch((err)=>console.log(\'Error:\', err))\n    }\n
Run Code Online (Sandbox Code Playgroud)\n\n

在我的views.py中:

\n\n
def update_employee(request):\n    employee_id= int(request.POST["employee_id"])\n    column = request.POST["column"]\n    new_value = request.POST["new_value"]\n    employee = Employee.objects.get(employee_id = employee_id)\n    employee[column] = new_value\n    employee.save()\n    return HttpResponse(f\'{column} …
Run Code Online (Sandbox Code Playgroud)

javascript python django fetch

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

C中Sizeof运算符的复杂声明

我在书中的某个地方看到了这个复杂的sizeof运算符声明,这让我很开心:

#define SIZEOF(int)  (int)&((int *)0)[1]
Run Code Online (Sandbox Code Playgroud)

任何人都可以解释这个宣言,这里发生了什么......?

c macros sizeof c-preprocessor

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

内置的deselectAll方法无法在多个Angular Mat-Selection-List中使用

我正在使用angular5 mat-selection-list在同一组件中创建多个组件。

list-selection-example.html

 Shoes: 
<mat-selection-list #shoes>
  <mat-list-option *ngFor="let shoe of typesOfShoes" 
                   [value]="shoe">
    {{shoe}}
  </mat-list-option>
</mat-selection-list>

<button mat-button  (click)="deselectShoes()">Deselect all Shoes</button>

Cloths: 
<mat-selection-list #cloths>
  <mat-list-option *ngFor="let cloth of typesOfCloths" 
                   [value]="cloth">
    {{cloth}}
  </mat-list-option>
</mat-selection-list>

<button mat-button  (click)="deselectCloth()">Deselect all Cloths</button>
Run Code Online (Sandbox Code Playgroud)

列表选择示例

export class ListSelectionExample {
  typesOfShoes = ['Boots', 'Clogs', 'Loafers', 'Moccasins', 'Sneakers'];

  typesOfCloths = ['Amaxa', 'Cotton', 'Woolen', 'Nylon'];

    @ViewChild(MatSelectionList) shoes: MatSelectionList;
    @ViewChild(MatSelectionList) cloths: MatSelectionList;


  deselectShoes(){
    this.shoes.deselectAll(); 
  }

  deselectCloth(){
    this.cloths.deselectAll(); 
  }
  ngOnInit(){

  }
}
Run Code Online (Sandbox Code Playgroud)

这是完整的代码:https : //stackblitz.com/edit/angular-i3pfu2-dla3rd?file=app%2Flist-selection-example.ts

在此示例中,deselectShoes()方法按预期工作。但deselectCloth()在 …

angular-material angular-material2 angular angular5 angular-material-5

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