小编Ste*_*i J的帖子

R - 日期格式检查

我正在尝试检查给定日期是否为 dd/mm/yyyy 格式的R语言,以及它是否同时是有效日期。我想要 TRUE 或 FALSE 格式的输出,例如

输入

date<- c('12/05/2016','35/11/2067','12/52/1000')
Run Code Online (Sandbox Code Playgroud)

输出

TRUE FALSE FALSE
Run Code Online (Sandbox Code Playgroud)

r date-formatting

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

Shepard导游JS不滚动

我正在努力让Shepard导游工作.

http://github.hubspot.com/shepherd/docs/welcome/

我已经在全局和每个Shepard巡回站点设置了scrollTo:true,但无论如何页面都会跳转.这是一个例子:

http://codepen.io/anon/pen/mRvdKv

(function() {
var tour = new Shepherd.Tour({
  defaults: {
    classes: 'shepherd-theme-square',
    scrollTo: true
  }
});

tour.addStep('example', {
  title: 'Example Shepherd',
  text: 'This is the first step',
  attachTo: '#test1 bottom',
  advanceOn: '.docs-link click',
  scrollTo: true
});

tour.addStep('example', {
  title: 'Example Shepherd',
  text: 'This is the second step',
  attachTo: '#test2 bottom',
  advanceOn: '.docs-link click',
  scrollTo: true
});

tour.addStep('example', {
  title: 'Example Shepherd',
  text: 'This is the third step',
  attachTo: '#test3 top',
  advanceOn: '.docs-link click',
  scrollTo: true
});

tour.start(); …
Run Code Online (Sandbox Code Playgroud)

javascript

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

Angular 2 - 使用管道进行字符串转换的数字

我正在尝试使用管道中的typescript将数字值转换为角度为2的字符串.它抱怨

类型字符串不能分配给类型编号

.我的管道如下.

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({ name: 'pxsuffix'

}) export class pxsuffix implements PipeTransform {

transform(input: number): number {

if ((input > 0)) {
    input = input.toString(),
}

return (
    input = input + 'px',

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

pipe angular

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

gTTS 错误:另存为 wav 但另存为 MPEG

尝试使用 gTTS 模块将文本转换为语音并另存为 wav 文件。

我的代码:

import gTTS
text = "This is my text in the saving folder"
tts = gTTS(text)
tts.save('sample.wav')
Run Code Online (Sandbox Code Playgroud)

文件已保存,但当我检查文件信息时:

$ mediainfo sample.wav
General
Complete name                            : sample.wav
Format                                   : MPEG Audio
File size                                : 15.8 KiB
Duration                                 : 4 s 32 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 32.0 kb/s
FileExtension_Invalid                    : m1a mpa1 mp1 m2a mpa2 mp2 mp3

Audio
Format                                   : MPEG Audio
Format version                           : Version 2
Format profile                           : …
Run Code Online (Sandbox Code Playgroud)

python mpeg python-3.x google-text-to-speech

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