我在课程和教练之间有一对多的关系,我想放弃.当我试图删除课程表中的instructorID时,它告诉我.我不能放弃它,因为它是外键.然后我决定放弃它:
ALTER TABLE course DROP FOREIGN KEY instructorID
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
#1091 - Can't DROP 'InstructorID'; check that column/key exists
Run Code Online (Sandbox Code Playgroud)
我不知道这个错误意味着什么.我究竟做错了什么?
我已经在Codeacademy.com上开始了13天的网络编程,并且发现它是一个学习的好地方.但我有时还会误解事情.我总是在w3school.com上查看它们,但这次我找不到我需要的信息.因此,据我所知,首先有两种类型的创建对象:对象文字符号和第二种:对象构造函数.我已经了解到还有方法和函数,但我无法理解如何用对象文字表示法创建方法?在对象构造函数中,我只写:`
var bob = new Object();
bob.age = 30;
bob.setAge = function (newAge)
{
bob.age = newAge;
};
Run Code Online (Sandbox Code Playgroud)
在编写对象文字表示法时,能否告诉我如何做同样的事情.
var bob = {
age: 30
};
Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的网页生成一个站点地图。
在线站点地图生成器仅向我显示xml文件的主页。
<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-<url>
<loc>http://margvel.com</loc>
<priority>0.5</priority>
</url>
</urlset>
Run Code Online (Sandbox Code Playgroud)
同时,我的网页有几条成角度的路线。
要查看该网页,您可以访问margvel.com
我使用了几个站点地图生成器。
我检查了botmap,因为它应该支持SPA。
我要创建站点地图的链接使用材料设计和routerlink。
代码看起来像这样。
<mat-list-item (click)="snav.close()" routerLink="/Projects"><mat-icon style="margin-left: 7px;">code</mat-icon><a style="margin-left: 25px;" >Projects</a></mat-list-item>
<mat-list-item (click)="snav.close()" routerLink="/Jobs"><mat-icon style="margin-left: 7px;">work</mat-icon><a style="margin-left: 25px;" ></a>Work Experience</mat-list-item>
<mat-list-item (click)="snav.close()" routerLink="/Education"><mat-icon style="margin-left: 7px;">school</mat-icon><a style="margin-left: 25px;"></a>Education</mat-list-item>
<mat-list-item (click)="snav.close()" routerLink="/Resume"><mat-icon style="margin-left: 7px;">description</mat-icon><a style="margin-left: 25px;" ></a>Resume</mat-list-item>
<mat-list-item (click)="openSnackBar()" routerLink="/Contact"><mat-icon style="margin-left: 7px;">contact_mail</mat-icon><a style="margin-left: 25px;" ></a>Contact</mat-list-item>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用谷歌灯塔优化我的网页。
该报告说在导入 Material Design 图标的链接上使用 rel=preloads。
我尝试使用语法预加载它们。
<link rel="preload" href="" as="style" crossorigin>
Run Code Online (Sandbox Code Playgroud)
我还尝试使用 as 字体进行预加载。类型为 woff、woff2 和 ttf。它们似乎都不起作用。我还添加了 crossorigin 和 crossorigin="anonymous" 但仍然没有进展。
这些是我的实际链接。我想导入它们。
<link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css" as="style">
<link rel="preload" href="https://fonts.googleapis.com/icon?family=Material+Icons" as="font" type="font/woff" crossorigin>
Run Code Online (Sandbox Code Playgroud)
应该如何将这些链接与预加载一起使用?
我一直在尝试使用灯塔报告来优化我的网页。
性能诊断工具之一说,可以增加我的静态文件的缓存寿命。
在报告中所指出的文件是main.js,polyfills.js,runtime.js和styles.css。据我了解,这些是我网页的主要内容。我当时在考虑使用角度服务工作者增加缓存。但是我找不到任何办法。
我发现增加缓存时间最接近的是角度服务工作者数据组。数据组支持缓存配置。
cacheConfig: {
maxSize: number;
maxAge: string;
timeout?: string;
strategy?: 'freshness' | 'performance';
};
Run Code Online (Sandbox Code Playgroud)
但我不知道如何对AssetGroups执行相同操作。据我了解,js和css文件属于AssetGroups。
这是灯塔报告屏幕截图。
我正在工作的网页是margvel.com,我在github上有代码。
我还使用Firebase进行托管。是否拥有或可以更改Firebase上的缓存策略?
如何延长这些文件的缓存寿命?
我有一个带有很多 div 的 HTML。我已经生成了看起来像这样的 div。
使用 renderer2 的所需结果的静态 HTML(非动态生成)示例
<div class="time-rowss clearfixx" #timerowss>
<div><mat-icon>today</mat-icon> date </div>
</div>
<div class="time-rows clearfix" #timerows>
<div><mat-icon>brightness_3</mat-icon>00:00</div>
<div><mat-icon>brightness_3</mat-icon>01:00</div>
<div><mat-icon>brightness_3</mat-icon>02:00</div>
</div>Run Code Online (Sandbox Code Playgroud)
我想实现相同但动态生成 div。
到目前为止,我所做的是动态添加时间和日期。
这是我的代码:
for (let j = this.requestVehicle.startDateTime.getDate(); j < this.requestVehicle.endDateTime.getDate(); j++) {
const newTime = new Date(time.getTime() + 24 * 3600 * 1000);
time = newTime;
const date = this.renderer.createElement('div');
this.renderer.appendChild(date, this.renderer.createText(newTime.getDate() + '/' + newTime.getMonth() + '/' + newTime.getFullYear()));
this.renderer.appendChild(this.d7.nativeElement, date);
for (let i = 0; i < 24; i++) {
const …Run Code Online (Sandbox Code Playgroud) 这是我的代码.我想打印所有列表数据.但是当我写我不能引起while(llist->next != NULL) llist->next的NULL,但我不知道为什么.请帮我 :)
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
struct rame
{
int data;
struct rame *next;
};
int main()
{
struct rame *llist;
llist = (rame*)malloc(sizeof(struct rame));
llist->data = 10;
llist->next = llist;
llist->next->data = 15;
llist->next->next->data = 20;
llist->next->next->next->data = 25;
llist->next->next->next->next = NULL;
printf("test\n");
if(llist->next == NULL)
printf("%d\n",llist->data);
else
while(llist->next != NULL)
{
printf("%d\n",llist->data);
llist = llist->next;
}
system("pause");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
嘿,我做了一次,但我的LOOP没有打印最后的数据.帮我 :(
#include <iostream>
#include <stdlib.h> …Run Code Online (Sandbox Code Playgroud) 这是我的代码.我做了三个函数来添加一个新节点,在另外两个节点之间插入一个新节点,一个删除,但我不知道如何删除第一个节点.我甚至都不知道.
#include <stdlib.h>
#include <stdio.h>
struct Node
{
int data;
struct Node *next;
};
void insert(Node* insertafter, Node* newNode);
void add(Node* llist,Node* newNode);
void deleteafter(Node *llist);
void deletefirts();
int main()
{
struct Node *llist;
struct Node *newNode;
newNode = (Node*)malloc(sizeof(struct Node));
newNode->data = 13;
struct Node *newNode2;
newNode2 = (Node*)malloc(sizeof(struct Node));
newNode2->data = 14;
llist = (Node*)malloc(sizeof(struct Node));
llist->data = 10;
llist->next = (Node*)malloc(sizeof(struct Node));
llist->next->data = 15;
llist->next->next = NULL;
insert(llist,newNode);
add(llist,newNode2);
if(llist->next == NULL)
printf("shecdoma");
struct Node *cursor …Run Code Online (Sandbox Code Playgroud) 我目前正在以这种形式从服务器收到响应。
{
plateNumber: string;
vehicleId: number;
garage: {
garageName: string;
};
vehicleType: {
vehicleType: string;
};
vehicleStatus: {
status: string;
};
vehicleModel: {
vehicleModelName: string;
};
vehicleOwner: {
ownerName: string;
};
contactPhone: number;
techInspectDueDate: Date;
additionalInfo: string;
lastDriver: string;
}
Run Code Online (Sandbox Code Playgroud)
但只想获取属性(字段)。意思只是字符串和数字。
{
plateNumber: string;
vehicleId: number;
garageName: string;
vehicleType: string;
status: string;
vehicleModelName: string;
ownerName: string;
contactPhone: number;
techInspectDueDate: Date;
additionalInfo: string;
lastDriver: string;
}
Run Code Online (Sandbox Code Playgroud)
目前我正在使用 HTTP post 响应从服务器获取对象。
getVehicles(): Observable<Vehicle[]> {
const url = `${this.serviceUrl}`;
return this.http.post<Vehicle[]>(url, {} ); …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ngrx-data-lab作为我项目的示例。
这是我使用的项目的stackblitz。
我无法使用我正在使用的服务器的实际 url。该网址属于我公司。但是发生的事情是服务器将随机生成的数据返回给应用程序。问题是存储中的实体不会被替换,而是被加起来。每次刷新英雄页面时,服务器都会带来新数据并将其与旧数据连接起来。
在entity-store.module.ts 中,我将defaultDataServiceConfig root 和 Hero urls更改为我的服务器。getAll() 有效,但正如我再次所说,它将数据连接到旧数据。
root: 'api', // default root path to the server's web api
// Optionally specify resource URLS for HTTP calls
entityHttpResourceUrls: {
// Case matters. Match the case of the entity name.
Hero: {
// You must specify the root as part of the resource URL.
entityResourceUrl: 'api/hero/',
collectionResourceUrl: 'api/heroes/'
}
},
Run Code Online (Sandbox Code Playgroud)
如何让 getAll 替换旧数据而不是连接它?
我试图使用CVA具有2个嵌套表单。问题是当我将第二个from绑定到formControl时没有用数据初始化。
我有主表格:
this.requestForm = this.fb.group({
garageId: 0,
routes: new FormArray([
new FormGroup({
addressPointId: new FormControl,
municipalityId: new FormControl,
regionId: new FormControl,
rvId: new FormControl,
sequenceNumber: new FormControl,
settlementId: new FormControl,
regionName: new FormControl,
municipalityName: new FormControl,
settlementName: new FormControl,
description: new FormControl,
})
]),
endDateTime: 0,
});
Run Code Online (Sandbox Code Playgroud)
在主要形式的html中,我使用formArrayName将路由绑定到。
<app-cva-form-array formArrayName="routes"></app-cva-form-array>
Run Code Online (Sandbox Code Playgroud)
组件CVA-FORM-ARRAY具有。
form = new FormArray([
new FormGroup({
addressPointId: new FormControl,
municipalityId: new FormControl,
regionId: new FormControl,
rvId: new FormControl,
sequenceNumber: new FormControl,
settlementId: new FormControl, …Run Code Online (Sandbox Code Playgroud) typescript angular angular-reactive-forms controlvalueaccessor
angular ×5
c ×2
html ×2
arrays ×1
c++ ×1
caching ×1
css ×1
fonts ×1
icons ×1
javascript ×1
lighthouse ×1
linked-list ×1
mapping ×1
mysql ×1
ngrx ×1
observable ×1
optimization ×1
preload ×1
rxjs ×1
sitemap ×1
typescript ×1