我正在使用AngularJS为前端开发应用程序,为后端使用Yii2.
前端需要全面的所有用户.
在Yii2的文档中,http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html 我可以读取按X-Pagination-Per-Page划分的结果:20
如何设置X-Pagination-Per-Page:ALL?
我知道,在某些编程语言中,如果您执行以下操作:
'This is on first line \n This is on second line'
Run Code Online (Sandbox Code Playgroud)
然后它会像这样正确显示:
This is on first line
This is on second line
Run Code Online (Sandbox Code Playgroud)
当我在SQLite数据库中连接一个字符串时
SELECT *, [FIELD1] || '\n' || [FIELD2] from TABLE
Run Code Online (Sandbox Code Playgroud)
(其中[FIELD1] =这是在第一行[FIELD2] =这是在第二行)
它显示如下:
This is on first line \n This is on second line
Run Code Online (Sandbox Code Playgroud)
有没有理由不正确显示\n字符?
我有一个通用 SSL 证书 *.domain.com 我想为 4 级域 (my4.level.domain.com) 配置 HTTPS 我在本讨论中读到,我需要使用 --default-ssl-certificate
但我不明白如何使用它
我应该如何更改此配置?
ingress:
enabled: true
annotations: {}
labels: {}
path: /
hosts:
- my4.level.domain.com
extraPaths: []
tls:
- secretName: tls-tierra-ingress
hosts:
- '*.level.domain.com'
- level.domain.com
- my4.level.domain.com
Run Code Online (Sandbox Code Playgroud)
或者我必须运行特殊命令?
Google Chrome在其chrome.webrequest API中包含一些功能(例如,http: //developer.chrome.com/extensions/samples.html#12a7bf1490a26359eadf10917e37c5b9),可用于将某些网址重定向到指定的网页.Chrome扩展程序使用阻止事件侦听器(chrome.webRequest.onBeforeRequest.addListener)并对目标网址执行重定向.我如何在FireFox附加组件中做类似的事情?
google-chrome webrequest firefox-addon google-chrome-extension firefox-addon-webextensions
我知道解决方案很简单,但我花了一个小时才解决这个问题。
\n\n在Windows 10中,如果我启动命令“ dir ”,我得到以下结果:
\n\nIl 卷 nell\'unit\xc3\xa0 D non ha etichetta。
\n\n在Node.js中中,我尝试以这种方式执行 dir 命令:
\n\nvar child = exec(\'dir\', {\'encoding\': \'UTF-8\'}, (err, stdout, stderr) => {\n console.log(stdout);\n});\nRun Code Online (Sandbox Code Playgroud)\n\n我得到了这个结果:\n Il 卷 nell\'unit\xef\xbf\xbd C non ha etichetta。
\n\n啊,该死的带口音的信!
\n\n我尝试使用 UTF-16,然后转换为字符串:
\n\nvar child = exec(\'dir\', {\'encoding\': \'UTF-16\'}, (err, stdout, stderr) => {\n let b: Buffer = stdout;\n let o: string;\n o = stdout.toString(\'UTF-8\');\n console.log(o);\n});\nRun Code Online (Sandbox Code Playgroud)\n\n我得到了同样的诅咒结果:
\n\n“Il 卷 nell\'unit\xef\xbf\xbd C …
angular 2如何使用Web worker在后台运行进程?这样做我应该遵循什么模式?
我试过这个:
npm i @angular/platform-webworker
npm i @angular/platform-webworker-dynamic
npm i @angular/platform-webworker
ng serve
Run Code Online (Sandbox Code Playgroud)
到app.module.ts我添加:
import {WorkerAppModule} from '@angular/platform-webworker';
//import {platformWorkerAppDynamic} from '@angular/platform-webworker-dynamic';
//import {ServiceMessageBrokerFactory, PRIMITIVE} from '@angular/platform-webworker';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
FormsModule,
WorkerAppModule,
HttpModule,
],
providers: [CommentService],
bootstrap: [AppComponent]
})
Run Code Online (Sandbox Code Playgroud)
Angular 2正确编译,但在http:// localhost:4200 / i中出现此错误:
zone.js:524 DOMException:无法在'Window'上执行'postMessage':在'postMessage'调用中无效的目标原点''.
我喜欢在背景中使用服务
我有一个有角度的2服务
import * as localforage from "localforage";
import { ReplaySubject } from 'rxjs/ReplaySubject';
@Injectable()
export class CommentService {
private localForage = require("localforage");
addComment (myvalue: string): Observable<Comment[]> {
var reply:ReplaySubject<any> = new ReplaySubject(1);
localforage.setItem(that.key, that.elencoCommenti).then(function (value) {
//throw new Error("Value cannot be 3");
reply.throw(Error('Error2'));
// reply.next( value );
// reply.complete();
});
return reply;
}
}
Run Code Online (Sandbox Code Playgroud)
该服务结合了提出异常的方法.当我尝试订阅
submitComment(){
// Variable to hold a reference of addComment
let commentOperation:Observable<string>;
commentOperation = this.commentService.addComment(this.model)
// Subscribe to observable
commentOperation.subscribe(
comments => {
console.log('ok:');
console.log(comments);
}, …Run Code Online (Sandbox Code Playgroud) 我有一个启动 entrypoint.sh 脚本的 docker 镜像
此脚本检查项目是否配置良好
如果一切正确,容器将启动,否则我收到此错误:
echo "Danger! bla bla bla"
exit 1000
Run Code Online (Sandbox Code Playgroud)
现在,如果我以这种模式启动容器:
docker-compose up
Run Code Online (Sandbox Code Playgroud)
我正确地看到错误:
Danger! bla bla bla
Run Code Online (Sandbox Code Playgroud)
但我需要以守护进程模式启动容器:
docker-compose up -d
Run Code Online (Sandbox Code Playgroud)
如何仅在出错时显示日志?
我创建了一个小组件:
import Vue from 'vue';
import Component from 'vue-class-component';
import { Inject, Model, Prop, Watch } from 'vue-property-decorator';
@Component({
template: require('./home.html'),
})
export class HomeComponent extends Vue {
name: string = 'User';
}
Run Code Online (Sandbox Code Playgroud)
我可以使用typescript@2.5.3毫无问题地编译项目
但如果我尝试使用typescript@2.6.1我有这个错误:
[at-loader] ./src/components/home/home.ts:8:2中的错误
TS2345: Argument of type 'typeof HomeComponent' is not assignable to parameter of type 'VueClass<Vue>'.
Type 'typeof HomeComponent' is not assignable to type 'new (...args: any[]) => Vue'.
Type 'HomeComponent' is not assignable to type 'Vue'.
Types of property '$options' are incompatible.
Type 'ComponentOptions<HomeComponent, …Run Code Online (Sandbox Code Playgroud) 在IE中,仅在F12调试模式下定义控制台。所以我正在寻找一种方便的方法来管理Vue的编译
我希望能够在代码内部编写console.log
alert('a');
console.log('only in develope mode');
alert('b');
Run Code Online (Sandbox Code Playgroud)
如果我在生产模式下编译,则命令控制台必须消失
alert('a');
alert('b');
Run Code Online (Sandbox Code Playgroud)
如果我在开发模式下工作,则必须出现命令控制台
alert('a');
console.log('only in develope mode');
alert('b');
Run Code Online (Sandbox Code Playgroud)
在vue js中,我有2种webpack配置:一种用于开发,另一种用于生产
这可能是这样吗?
我无法正确配置webpack文件,但我认为是这样的:
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports.plugins = (module.exports.plugins || []).concat([
new UglifyJsPlugin({
sourceMap: true,
compress: {
drop_console: true,
warnings: false
},
comments: false
}),
])
Run Code Online (Sandbox Code Playgroud) 我想在Express中使用dialogflow实现库
这是我的代码:
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as dialogflowController from './controllers/dialogflow';
const app: express.Application = express();
app.use(bodyParser.json());
app.post('/echo', dialogflowController.doActions);
const http = require('http');
const httpServer = http.createServer(app);
httpServer.listen(80, function () { // ascolta sulla porta 80 per comando: ngrok http 80
console.log('HTTP Started!');
});
// dialogflowController controller unit
import { Request, Response, NextFunction } from 'express';
const { WebhookClient, Card, Suggestion } = require('dialogflow-fulfillment');
export let doActions = (req: Request, res: …Run Code Online (Sandbox Code Playgroud) 对于Express应用程序,我有以下打字稿代码:
for (var propertyName in req.body) {
console.log(req.body[propertyName]);
}
Run Code Online (Sandbox Code Playgroud)
正常工作
现在,我在另一个打字稿应用程序中重复使用,但是出现了这个错误:
[ts]不包含任何内容的隐含元素,但不包含任何名称的索引。
[ts]元素隐式包含“ any”类型,因为没有索引签名分配给类型“ {}”。
我不明白这个错误
错误在
req.body[propertyName]
Run Code Online (Sandbox Code Playgroud)
如何将签名分配给索引?
node.js ×2
vuejs2 ×2
angular ×1
compilation ×1
console.log ×1
exec ×1
express ×1
firefox-addon-webextensions ×1
grafana-loki ×1
newline ×1
pagination ×1
rest ×1
rxjs ×1
service ×1
sqlite ×1
tsconfig ×1
typescript ×1
utf-16 ×1
utf-8 ×1
web-worker ×1
webpack ×1
webrequest ×1
yii2 ×1