我有一组元组:
a = [(375, 193)
(364, 113)
(277, 20)
(271, 16)
(52, 106)
(133, 266)
(289, 296)
(372, 282)]
Run Code Online (Sandbox Code Playgroud)
如何在 OpenCV 中的点之间画线?
这是我的代码不起作用:
for index, item in enumerate(a):
print (item[index])
#cv2.line(image, item[index], item[index + 1], [0, 255, 0], 2)
Run Code Online (Sandbox Code Playgroud) 我使用 Laravel Excel 库,并尝试过以下代码:
public function registerEvents(): array
{
return [
AfterSheet::class => function(AfterSheet $event) {
$styleArray = array('fill' => array(
'color' => array('rgb' => '000000')
));
$cellRange = 'A1:W1'; // All headers
$event->sheet->getDelegate()->getStyle($cellRange)->applyFromArray($styleArray);
},
];
}
Run Code Online (Sandbox Code Playgroud)
结果我得到没有黑色背景颜色的标题。
我也试过这个数组设置:
$styleArray = [
'font' => [
'bold' => true,
],
'background' => [
'color'=> '#000000'
]
];
Run Code Online (Sandbox Code Playgroud)
我使用事件,而不是创建。请不要推荐不相关的答案
我使用DI在几个组件中注入服务.现在它不是一个常见的实例.
如何只为几个组件保留一个服务实例?
我试图app.module
在部分加载服务providers
我div
在页面上有元素:
<div #draggable></div>
@ViewChild('draggable') private draggableElement: ElementRef;
Run Code Online (Sandbox Code Playgroud)
我听滚动事件并尝试更改此块的位置:
@HostListener('window:scroll', ['$event']) onScrollEvent($event){
this.draggableElement.nativeElement.clientTop = 200;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用!
让我们假设我们有参数的功能:
function do(classId: number, schoolId: number, pupilId: number, teacherId: number, roomId: number) {
}
Run Code Online (Sandbox Code Playgroud)
我需要调用此函数传递具有属性的对象,该属性应该填充相应的函数的参数,如:
案例一:
let obj1 = {classId: 1, roomId: 3};
do(obj1); // passed only classId, roomId
Run Code Online (Sandbox Code Playgroud)
案例二:
let obj2 = {schoolId: 5, pupilId: 4};
do(obj2); // passed only schoolId, pupilId
Run Code Online (Sandbox Code Playgroud) 我有一个简单的减速器,如何this
从外部绑定以在减速器内部使用this.teacherInstance
?
this.teachersDropMenu = this.plans.reduce(function (teacherIdArr, teacher) {
if (teacherIdArr.indexOf(teacher.teacherId) == -1) {
teacherIdArr.push(this.teacherInstance.getTeacherModelById(teacher.teacherId));
}
return teacherIdArr;
}, []);
Run Code Online (Sandbox Code Playgroud) 为什么这行代码不像在JS中那样在PHP中工作:
$id = [];
$id = null || [];
if (count($id)) {
echo 'd';
}
Run Code Online (Sandbox Code Playgroud)
为什么$id
仍然是null而不是空数组[]
?因此count()
给出错误.
我已经签出,类PermissionsTableSeeder
按路径存在:Database\Seeds\PermissionsTableSeeder
。
另外,我试过:
composer dump-autoload
php artisan cache:clear
Run Code Online (Sandbox Code Playgroud)
当我运行命令时:php artisan db:seed
它给了我一个例外:
ReflectionException : Class Database\Seeds\PermissionsTableSeeder 不存在
在 C:\Projects\secure_secure\vendor\laravel\framework\src\Illuminate\Container\Container.php:790 786| if ($concrete instanceof Closure) { 787| 返回 $concrete($this, $this->getLastParameterOverride()); 788| 第789话
790| $reflector = new ReflectionClass($concrete); 791| 第792话 // 如果类型不可实例化,则开发人员正在尝试解析 793| // 抽象类型,如接口或抽象类,有 794| // 没有为抽象注册绑定,所以我们需要退出。
异常跟踪:
1
ReflectionClass::__construct("Database\Seeds\PermissionsTableSeeder") C:\Projects\secure_secure\vendor\laravel\framework\src\Illuminate\Container\Container.php:7902
Illuminate\Container\Container::build("Database\Seeds\PermissionsTableSeeder") C:\Projects\secure_secure\vendor\laravel\framework\src\Illuminate\Container\Container.php:667
如何解决?
如果单击位于具体 DOM 元素之外,我使用以下指令来检测和隐藏块:
import {
Directive,
ElementRef,
Output,
EventEmitter,
HostListener
} from "@angular/core";
@Directive({
selector: "[clickOutside]"
})
export class ClickOutsideDirective {
constructor(private _elementRef: ElementRef) {}
@Output()
public clickOutside = new EventEmitter();
@HostListener("document:click", ["$event.target"])
public onClick(targetElement) {
const clickedInside = this._elementRef.nativeElement.contains(
targetElement
);
this.clickOutside.emit(clickedInside);
}
}
Run Code Online (Sandbox Code Playgroud)
我已将此指令应用于元素:
<div class="action" (click)="open()">Open</div>
<div
class="search_content"
*ngIf="_searchContentOpen"
clickOutside
(clickOutside)="clickOutside($event)"
></div>
Run Code Online (Sandbox Code Playgroud)
组件代码为:
open(): void {
this._searchContentOpen = !this._searchContentOpen;
}
Run Code Online (Sandbox Code Playgroud)
问题是当我调用 click 我设置this._searchContentOpen
为真/假。
取决于它,我会显示应用指令的块。但是当 ngIf 工作时,指令也总是同步工作。因此,永远不会显示结果块。
如何解决?
我有路径让路径="/";
当它调用这个路径时,Angular 会生成这样的路径:
http://localhost:4200/backend/api
Run Code Online (Sandbox Code Playgroud)
但是我需要
http://localhost/backend/api
Run Code Online (Sandbox Code Playgroud)
没有端口,如何在 Angular 中设置此选项?
angular ×4
angular5 ×2
angular8 ×2
javascript ×2
laravel ×2
laravel-5 ×2
angular-di ×1
laravel-5.8 ×1
opencv ×1
opencv3.0 ×1
php ×1
python ×1
typescript ×1