我有两个用于统计事件和会话的表,这是它们的外观
此处会话表显示第 0 - 29 行(总共 4 730 018 行))
这是事件表显示第 0 - 29 行(共 3686 行)
现在这是我用于显示数据的 SQL
SELECT sessions.sid,
events.datetime,
count(*) as num_rows,
count(distinct sessions.sid) as sessions,
sum( targetbuttonname = 'kredyt' ) as num_kredyt,
sum( targetbuttonname = 'konto' ) as num_konto,
sum( targetbuttonname = 'czat' ) as num_czat,
sum( targetbuttonname = 'video-voice_btns' ) as num_voice,
sum( targetbuttonname = 'video-close_btn' ) as num_close,
sum( targetbuttonname = 'video-muted_btn' ) as num_muted,
sum( targetbuttonname = 'video-play_btn' ) as num_play,
sum( …Run Code Online (Sandbox Code Playgroud) 我在创建关于用户的第六个角度的CRUD应用程序时,尝试添加新用户时出现以下错误:
这是我得到的错误:
core.js:12301 ERROR TypeError: Cannot read property 'toLowerCase' of undefined
at HttpXsrfInterceptor.push../node_modules/@angular/common/fesm5/http.js.HttpXsrfInterceptor.intercept (http.js:1718)
at HttpInterceptorHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptorHandler.handle (http.js:1134)
at HttpInterceptingHandler.push../node_modules/@angular/common/fesm5/http.js.HttpInterceptingHandler.handle (http.js:1769)
at MergeMapSubscriber.project (http.js:974)
at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (mergeMap.js:61)
at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (mergeMap.js:51)
at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:54)
at Observable._subscribe (scalar.js:5)
at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable._trySubscribe (Observable.js:43)
at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:29)
Run Code Online (Sandbox Code Playgroud)
这是添加用户组件html:
<div class="container add-user">
<div class="col-md-6">
<h2 class="text-center">Add User</h2>
<form [formGroup]="addForm" (ngSubmit)="onSubmit()">
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" formControlName="email" placeholder="Email" name="email" class="form-control" id="email">
</div>
<div class="form-group">
<label for="firstName">First Name:</label>
<input formControlName="firstName" placeholder="First Name" name="firstName" class="form-control" id="firstName">
</div>
<div …Run Code Online (Sandbox Code Playgroud) 我正在使用 reactjs 创建一个带有事件的日历,现在当日历显示当前月份时,当我单击下一步时,如果我再次单击下一步,它会显示四月月份,我收到以下错误。
类型错误:无法读取未定义的属性“eventSlots”。
错误出现在一个函数中,我尝试在此处获取事件的日期。
getDaysWithEvents() {
// Get all the days in this months calendar view
// Sibling Months included
const days = this.getCalendarDays();
// Set Range Limits on calendar
this.calendar.setStartDate(days[0]);
this.calendar.setEndDate(days[days.length - 1]);
// Iterate over each of the supplied events
this.props.events.forEach((eventItem) => {
const eventStart = this.getCalendarDayObject(eventItem.start);
const eventEnd = this.getCalendarDayObject(eventItem.end);
const eventMeta = this.getEventMeta(days, eventStart, eventEnd);
if (eventMeta.isVisibleInView) {
const eventLength = eventMeta.visibleEventLength;
console.log("Days", days);
const eventSlotIndex = days[eventMeta.firstVisibleDayIndex].eventSlots.indexOf(false); // this line returns error
//console.log("eventSotsindex", eventSlotIndex); …Run Code Online (Sandbox Code Playgroud) 我正在学习带有钩子的reactjs表单,现在我想使用jest和enzyme测试提交时的表单。
这是我的登录组件。
import React from 'react'
function Login() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const handleSubmit = async (e) => {
e.preventDefault();
// ....api calLS
}
return (
<div>
<form onSubmit={handleSubmit} className="login">
<input type="email" id="email-input" name="email" value={email} onChange={e => setEmail(e.target.value)} />
<input type="password" id="password-input" name="password" value={password} onChange={e =>setPassword(e.target.value)} />
<input type="submit" value="Submit" />
</form>
</div>
)
}
export default Login
Run Code Online (Sandbox Code Playgroud)
这是login.test.js 文件
it('should submit when data filled', () => {
const onSubmit = jest.fn();
const …Run Code Online (Sandbox Code Playgroud) 我正在创建完整的平均堆栈应用程序
NodeJs、Angular 6、ExpressJs 和 MongoDB
我已经成功地创建了一个服务器并且它工作得很好,而不是console.log在我的应用程序中记录错误时使用我决定在Winston Logger这里使用的是我现在所拥有的
服务器端
var appRoot = require('app-root-path');
var winston = require('winston');
// define the custom settings for each transport (file, console)
var options = {
file: {
level: 'info',
filename: `${appRoot}/logs/app.log`,
handleExceptions: true,
json: true,
maxsize: 5242880, // 5MB
maxFiles: 5,
colorize: false,
},
console: {
level: 'debug',
handleExceptions: true,
json: false,
colorize: true,
},
};
// instantiate a new Winston Logger with the settings defined above
const logger = winston.createLogger({ …Run Code Online (Sandbox Code Playgroud) I am creating a simple filter pipe in my app , here is what I have .
Run Code Online (Sandbox Code Playgroud)
过滤组件:
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'dataFilter'
})
export class DataFilterPipe implements PipeTransform {
transform(value: any[], input: string) {
if (input) {
input = input.toLowerCase();
return value.filter(function (el: any[]) {
return el.toLowerCase().indexOf(input) > -1;
});
}
return value;
}
}
Run Code Online (Sandbox Code Playgroud)
这是componet.html
<div class="card movies-list" id="movies-list">
<div class="card-header movies-list_header">
<h1>Content: <small>Best movies of 2010's</small></h1>
</div>
<div class="card-body">
<div class="row movies-list_filter"> …Run Code Online (Sandbox Code Playgroud) 我正在为angular 6应用程序创建粘性标头的粘性导航栏指令
这是我到目前为止:
import { Directive, Input, Renderer, ElementRef, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { fromEvent } from 'rxjs';
@Directive({
selector: '[ngStickyNav]'
})
export class StickyNavDirective implements OnInit {
private offsetTop: number;
private lastScroll: number = 0;
private isSticky: boolean = false;
@Input('stickyClass') stickyClass: string;
constructor(private elementRef: ElementRef, private renderer: Renderer) {
}
ngOnInit(): void {
this.offsetTop = this.elementRef.nativeElement.offsetTop;
Observable.fromEvent(window, 'scroll').subscribe(() => this.manageScrollEvent());
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
类型'typeof Observable'上不存在属性'fromEvent'.
我的代码出了什么问题?新手虽然
我有一个用于应用程序bootstrap的电子邮件服务的表格,我正在我的应用程序中使用 sendemail,不幸的是不起作用。我收到以下错误:angular 6nodejsnodemailer
Failed to load resource: net::ERR_CONNECTION_REFUSED : :3000/contact/send:1
这是表格
<form [formGroup]="angForm" novalidate>
<div class="message">
<h3> Write to us </h3>
</div>
<div class="form__top">
<div class="form__left">
<div class="form__group">
<input class="form__input form__input--name" type="text" formControlName="name" placeholder="name" #name>
</div>
<div *ngIf="angForm.controls['name'].invalid && (angForm.controls['name'].dirty || angForm.controls['name'].touched)" class="alert alert-danger">
<div *ngIf="angForm.controls['name'].errors.required">
Name is required.
</div>
</div>
<div class="form__group">
<input class="form__input form__input--email" type="email" formControlName="email" placeholder="email" #email>
</div>
<div *ngIf="angForm.controls['email'].invalid && (angForm.controls['message'].dirty || angForm.controls['message'].touched)"
class="alert alert-danger">
<div *ngIf="angForm.controls['message'].errors.required">
message is required.
</div> …Run Code Online (Sandbox Code Playgroud) 我有一个包含六个项目的部分。
我希望在桌面设备上每行 3 个项目,在中型设备上我希望每行 2 个项目,在移动设备上每行 1 个项目
<div class="flex-container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是CSS:
.flex-container{
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 100%;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
@media only screen and (max-width: 768px) and (min-width: 320px){
.flex-container {
display: flex;
justify-content: center;
flex-basis: 100%;
}
}
Run Code Online (Sandbox Code Playgroud)
这在桌面上仅向我显示了 3 个项目,在移动设备上仅显示了 3 个项目,但没有 2 个项目,我需要在代码中更改哪些内容才能获得我想要的内容?
我有一个视频播放器,其中包含一个跳过按钮,以便用户可以将视频跳到最后。
这是html
<video id="video1" style="height: 100%" class="video-js vjs-default-skin" controls muted autoplay="true">
</video>
Run Code Online (Sandbox Code Playgroud)
跳过功能
function skipVideoTime(){
$('.skip_button').on('click', function () {
var vid = $("#video1")[0];
var vidDuration = Math.floor(vid.duration);
skipTime(vidDuration);
console.log(vidDuration);
})
}
function skipTime(time) {
var vid = $("#video1")[0];
vid.play();
vid.pause();
vid.currentTime = time;
vid.play();
console.log(vid.duration);
};
$(function () {
skipVideoTime();
});
Run Code Online (Sandbox Code Playgroud)
这是上述函数的控制台日志
32.534
32
现在,当我单击按钮时,它会跳到 32 分钟,因为我使用了数学楼层功能,如果我删除数学楼层以便它可以跳到32.534,它不起作用,
我需要改变什么才能得到我想要的东西?
javascript ×7
angular ×5
typescript ×4
bootstrap-4 ×2
express ×2
html ×2
html5 ×2
node.js ×2
reactjs ×2
angular6 ×1
arrays ×1
css ×1
enzyme ×1
flexbox ×1
jestjs ×1
jquery ×1
mysql ×1
php ×1
phpmyadmin ×1
rxjs ×1
sql ×1
unit-testing ×1
winston ×1