小编Nik*_*hev的帖子

gnu screen:重新连接所有以前分离的会话

我在一个screen会话中有几个窗口,然后我想分离我的会话.这没有问题.

但我无法找到一种方法来恢复我之前分离的会话中的所有窗口.我可以看到我可以通过ID恢复其中一个.

但是,如何在其中的所有窗口中重新连接相同的会话环境?

-

Updated:

如果我键入screen -d -r,这就是说:

There are several suitable screens on:
    21074.pts-7.atx (05/29/2010 02:26:32 PM)    (Attached)
    3420.pts-3.atx  (05/29/2010 12:16:41 AM)    (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
Run Code Online (Sandbox Code Playgroud)

我怎样才能重新连接所有这些?

unix gnu-screen

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

@Get DTO 在 NestJs 中具有多个参数

我正在尝试在 NestJS 中创建一个可通过 GET HTTP 请求访问的控制器操作,该请求接收两个参数,但由于某种原因它们未定义。

如何解决?

@Get('/login')
login(@Param() params: LoginUserDto) {
  console.log(params)
  return 'OK'
}
Run Code Online (Sandbox Code Playgroud)
import { ApiModelProperty } from '@nestjs/swagger';

export class LoginUserDto {
  @ApiModelProperty()
  readonly userName: string;

  @ApiModelProperty()
  readonly password: string;
}
Run Code Online (Sandbox Code Playgroud)

nestjs

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

NestJS websocket 向客户端广播事件

我无法通过 websocket 将数据从服务器 NestJS 发送到客户端。什么都没有发出。

我的用例:

  • 多个客户端通过 websocket 连接到服务器
  • 客户端通过 websocket 向服务器发送消息
  • 服务器向所有客户端广播消息

我的堆栈:

  • 带有 websocket 的 NestJS 服务器
  • Angular 客户端和其他(如用于测试 websocket 的 chrome 扩展)

我的代码:

simple-web-socket.gateway.ts:

import { SubscribeMessage, WebSocketGateway, WsResponse, WebSocketServer, OnGatewayConnection, OnGatewayDisconnect, OnGatewayInit } from '@nestjs/websockets';

@WebSocketGateway({ port: 9995, transports: ['websocket'] })
export class SimpleWebSocketGateway implements OnGatewayConnection, OnGatewayDisconnect, OnGatewayInit {

  @WebSocketServer() private server: any;
  wsClients=[];
  afterInit() {
    this.server.emit('testing', { do: 'stuff' });
  }

  handleConnection(client: any) {
    this.wsClients.push(client);
  }

  handleDisconnect(client) {
    for (let i = 0; i < …
Run Code Online (Sandbox Code Playgroud)

websocket nestjs

9
推荐指数
2
解决办法
8387
查看次数

这是什么意思:TypeError: dest.on is not a function

我是新手,遵循有关现代 webdev 工作流程的教程。我在控制台中收到此错误消息。TypeError: dest.on is not a function 我知道,这里有相关的问答。但我不明白他们。因为我不知道“dest.on”与什么有关以及它有什么作用。这是到目前为止的代码:

var gulp = require("gulp");
var sass = require("gulp-sass");
var sourcemaps = require("gulp-sourcemaps");
var autoprefixer = require("auto-prefixer");
var imagemin = require("gulp-imagemin");
var browserSync = require("browser-sync").create();

gulp.task("css", function() {
  return gulp
    .src("src/sass/**/*.scss")
    .pipe(sourcemaps.init())
    .pipe(sass({ outputStyle: "compressed" }).on("error", sass.logError))
    .pipe(
      autoprefixer({
        browsers: ["last 2 versions"]
      })
    )
    .pipe(sourcemaps.write("./maps"))
    .pipe(gulp.dest("dist/css"));
});
Run Code Online (Sandbox Code Playgroud)

谁能解释一下错误消息的含义以及我如何解决这个特定问题?我很抱歉冗余,但我在现有答案中没有找到解决方案。

编辑::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::: 也许它有助于添加 package.json

{
  "name": "sitepointresponsivewebsite",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" …
Run Code Online (Sandbox Code Playgroud)

javascript gulp

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

curl:-d 和 --data-binary 选项有什么区别?

我正在尝试向 REST API 发送发布请求。我注意到当我在curl中使用-d选项传递参数时一切正常。例子:

curl "https://mywebsite.com" -d "param1=x" -d "param2=y" -u "3SUHZb0sanKWrQ"
Run Code Online (Sandbox Code Playgroud)

但是,如果将参数作为 json 对象发送并使用 --data-binary,我会从 Api 收到错误(就好像没有收到参数一样)。例子:

curl "https://mywebsite.com" --data-binary $'{ "param1": "x", -d "param2":"y" }' -u "3SUHZb0sanKWrQ"
Run Code Online (Sandbox Code Playgroud)

我认为这两种方法具有相同的行为,但我认为我错了。这两种方法有什么区别?

PS:第二个请求是我在Google Chrome上选择选项时收到的curl请求copy as cURL,因为实际请求是Angular中的$http.post,其数据负载为JSON对象。我可以在 Angular 中做什么来让它工作?

var data = { 
  "param1": "x", 
  "param2": "y" 
};

$http({
    url: "https://mywebsite.com",
    method: 'POST',
    data: data
}).then(function successCallback(response){
    console.log(response);
}, function errorCallback(response){
    console.log(response);
});
Run Code Online (Sandbox Code Playgroud)

javascript json curl angularjs

8
推荐指数
2
解决办法
2万
查看次数

如何在 getReducers(): ActionReducerMap&lt;fromFeature.State&gt; 中返回减速器的映射?

我试图在通过 NgRx 功能模块组合状态时注入功能减少器。

import { NgModule, InjectionToken } from '@angular/core';
import { StoreModule, ActionReducerMap } from '@ngrx/store';

import * as fromFeature from './reducers';

export const FEATURE_REDUCER_TOKEN = new InjectionToken<ActionReducerMap<fromFeature.State>>('Feature Reducers');
Run Code Online (Sandbox Code Playgroud)

我应该在这里返回什么?

export function getReducers(): ActionReducerMap<fromFeature.State> {
  // map of reducers
  return {
  
  };
}
Run Code Online (Sandbox Code Playgroud)

我试过

export function getReducers(): ActionReducerMap<fromFeature.State> {
      // map of reducers
      return {
          reducerA: FeatureAReducer
      };
    }
Run Code Online (Sandbox Code Playgroud)

但它给出了错误Object literal may only specified known properties

其余模块代码:

@NgModule({
  imports: [
    StoreModule.forFeature('feature', FEATURE_REDUCER_TOKEN),
  ],
  providers: [ …
Run Code Online (Sandbox Code Playgroud)

ngrx ngrx-store

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

如何在 Rust 中找到本地时区偏移量

Rustchrono::Local包含本地时区信息,但似乎没有任何方法来获取字符串或秒数偏移量的值。

任何想法都是如何获得正确的局部偏移量,以便

DateTime::parse_from_rfc3339([iso8601 date] + [timezone]).unwrap().with_timezone(&Local)
Run Code Online (Sandbox Code Playgroud)

将返回DateTime运行代码的计算机的默认当前时区。

rust

8
推荐指数
2
解决办法
5344
查看次数

如何始终显示 ng-select 的占位符?

我在 Angular 应用程序中使用 ng-select,并且有一个非常不寻常的用例。我需要始终显示占位符,即使在选定的选项上也是如此。在当前代码中,占位符将替换为所选选项的值:

<ng-select
  [(ngModel)]="selectedApplication"
  class="application-switcher"
  [attr.data-sel-id]="selId"
  [clearable]="false"
  appendTo="body"
  [searchable]="false"
  placeholder="{{ 'APP_TITLE' | translate }}"
  [virtualScroll]="virtualScroll"
  [markFirst]="false">
    <ng-option *ngFor="let application of applicationList" [value]="application">
      <div>
        {{ getApplicationName(application) }}
      </div>
    </ng-option>
</ng-select>
Run Code Online (Sandbox Code Playgroud)

angular-ngselect angular

8
推荐指数
2
解决办法
2万
查看次数

Cypress - 检查文件是否已下载

我在尝试检查文件是否已下载时遇到了一些问题。

单击按钮会生成一个 PDF 文件并开始下载。

我需要检查它是否有效。

赛普拉斯能做到这一点吗?

automation automated-tests cypress

8
推荐指数
2
解决办法
9915
查看次数

在 dockerising nest.js 应用程序上出错

我正在开发一个 Nest.js 应用程序,这是我们拥有的 Dockerfile。当我运行它时,我npm run build在 docker的步骤中遇到错误。这是 package.json 中的构建任务。 "build": "nest build"

sh: nest: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! atom-qbuilder-api@0.0.1 build: `nest build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the atom-qbuilder-api@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)

文件

# Build
FROM node:8-alpine as builder

COPY package.json …
Run Code Online (Sandbox Code Playgroud)

docker nestjs

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