小编Kev*_*291的帖子

Python直接在FTP中编写创建文件

我期待从python直接写入我的FTP站点的文本而不在磁盘上存储临时文件,如:

ftp = FTP('ftp.mysite.com')
ftp.login('un','pw')
ftp.cwd('/')
ftp.storbinary('STOR myfile.html', 'text to store', 'rb')
Run Code Online (Sandbox Code Playgroud)

这有可能吗?非常感谢你.

python ftp

10
推荐指数
2
解决办法
8542
查看次数

垫形场内的角材料垫-滑动-切换

如果我在mat-form-field内有一个mat-slide-toggle,则会收到错误消息:

错误:mat-form-field必须包含MatFormFieldControl

我希望在mat-form-field内切换mat-slide,以便获得样式。任何想法为什么我会收到此错误?是mat-slide-toggle不是mat-form-field吗???

这是我目前拥有的一个示例:

<mat-form-field fxFlexFill *ngSwitchCase="'mat-slide-toggle'">
    <mat-slide-toggle>{{el.text}}</mat-slide-toggle>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

material angular

7
推荐指数
2
解决办法
2105
查看次数

Firebase函数为Node_Modules部署查找错误的目录

在尝试部署我的firebase函数时,我收到了父目录的node_modules的错误,尽管我的firebase函数目录有自己的函数.当我运行"firebase deploy --only functions"时,我非常确定我在我的函数目录中.任何想法为什么它看看父目录???

错误:

    > tsc -p tsconfig.json

../node_modules/@types/highcharts/index.d.ts(53,33): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(186,23): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(187,27): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(188,26): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(189,27): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(623,33): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(635,32): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1360,38): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1374,39): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1385,43): error TS2304: Cannot find name 'Event'.
../node_modules/@types/highcharts/index.d.ts(1404,43): …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions

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

firebase 托管不显示正确的文件内容

我正在尝试在 firebase 上托管 PWA 的 assetlinks.json 文件,问题是我无法查看文件的内容。我认为这与我的 firebase.json 文件有关。我试图获取的链接是 https://bionomichealth.com/.well-known/assetlinks.json ,它包含:

    [
  {
    "relation": ["delegate_permission/common.handle_all_urls"],
    "target": {
      "namespace": "android_app",
      "package_name": "xyz.appmaker.flvhwm",
      "sha256_cert_fingerprints": ["83:AE:08:45:58:C6:08:16:69:1E:80:50:31:84:1E:B9:55:AF:CC:4F:A9:20:B3:D5:58:B1:6A:D1:E1:27:B3:F7"]
    }
  }
]
Run Code Online (Sandbox Code Playgroud)

最后,这是我的 filebase.json:

    {
  "database": {
    "rules": "database.rules.json"
  },
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ]
  },
  "hosting": {
    "public": "public",
    "rewrites": [
      {
        "source": "/.well-known/assetlinks.json",
        "destination": "assets/assetlinks.json"
      },
      {
        "source": "/public/**",
        "destination": "/public.html"
      },
      {
        "source": "**",
        "destination": "/index.html" …
Run Code Online (Sandbox Code Playgroud)

google-play firebase firebase-hosting progressive-web-apps

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

角度错误:newTree.optimize 不是函数

我最近在尝试使用 angular CLI 创建新组件时开始收到此错误:

newTree.optimize is not a function
Run Code Online (Sandbox Code Playgroud)

发出的命令是:

ng g c test
Run Code Online (Sandbox Code Playgroud)

谷歌搜索只返回来自 Angular CLI v6.x 的文章我试过全局卸载和重新安装 Angular,但没有成功。这是我当前的版本:

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular angular-cli-v9

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

找不到 OpenCV haarcascade_frontalface_alt.xml

好像有很多人遇到过这个问题。我似乎无法让我的程序在当前工作目录中以及所有其他项目目录中找到 haarcascade_frontalface_alt.xml、haarcascade_frontalface_alt.xml IS。我已经尝试过“haarcascade_frontalface_alt.xml”和“C:\haarcascade_frontalface_alt.xml”都没有运气。我确保它在属性中被“解锁”,但仍然没有。有谁知道如何让 opencv 在 windows 7 x64 中查看 haarcascade_frontalface_alt.xml?非常感谢。

c++ xml opencv

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

Cloud Functions auth onCreate 触发器将用户添加到 Firestore

当用户通过 google auth 注册时,我试图将用户对象添加到 firestore。这是我的代码:

export const accountCreate = functions.auth.user().onCreate(user => {
    console.log(user.data);
    admin.firestore().collection('users').doc(user.data.uid).set(user.data).then(writeResult => {
        console.log('User Created result:', writeResult);
        return;
    }).catch(err => {
        console.log(err);
        return;
    });
});
Run Code Online (Sandbox Code Playgroud)

不走运,我只是不断收到错误消息:

错误:无法将类型 ([object Object]) 编码为 Function.encodeValue 处的 Firestore 值 (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/document.js:773:11)

我不确定为什么这不起作用。有任何想法吗?谢谢

firebase typescript firebase-authentication google-cloud-functions google-cloud-firestore

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

MongoDB Docker 初始化脚本

我正在尝试在 Docker 中播种我的 MongoDB。我的 docker-compose.yml 文件非常简单,但这是我的音量:

...
volumes:
      - ./mongo/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
      - ./mongo/mongod.conf:/etc/mongod.conf:ro
      - ./mongo/mongo-volume:/data/db
...
Run Code Online (Sandbox Code Playgroud)

我将 init-mongo.js 映射为一个卷,这是它的内容:

db.createUser({
  user: 'root',
  pwd: 'toor',
  roles: [
    {
      role: 'readWrite',
      db: 'testDB',
    },
  ],
});
db.createCollection('users', { capped: false });
db.createCollection('test', { capped: false });

db.test.insert([
  { "item": 1 },
  { "item": 2 },
  { "item": 3 },
  { "item": 4 },
  { "item": 5 }
]);
Run Code Online (Sandbox Code Playgroud)

用户root和数据库testDB以及集合userstest都没有问题产生。

问题是db.test.insert([])似乎全部都被遗漏了,并且没有文档被插入到test集合中。

任何想法为什么会这样?我绝对很乐意让这个工作,并且非常感谢这方面的任何帮助。 …

mongodb docker docker-compose

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

Angular 8 异步管道内存使用率高并使 chrome 崩溃

在 Angular 8 发布后,我在 Angular 和 Firebase 中使用异步管道时遇到了问题。我不知道为什么会这样,这真的很困扰我。

我有我的类别服务:

    public getAllCategories(): Observable<Category[]> {
    return this.afs.collection<Category>(`categories`).valueChanges();
  }
Run Code Online (Sandbox Code Playgroud)

然后我的组件使用该服务,如下所示:

    export class AttributesComponent implements OnInit {
  form: FormGroup;
  count = 0;

  constructor(
    private fb: FormBuilder,
    private attributesService: AttributesService,
    public categoryService: CategoryService
  ) {
    this.form = this.fb.group({
      attributeArray: this.fb.array([])
    });
  }......etc......
Run Code Online (Sandbox Code Playgroud)

最后,在我的 HTML 中,我有一个异步管道调用公共 CategoryService 和函数:

{{ categoryService.getAllCategories() | async | json }}
Run Code Online (Sandbox Code Playgroud)

我不明白为什么这不起作用,服务正在返回正确的可观察值,并且异步应该显示它。没有给出任何错误,chrome 刚刚开始使用 Gigs 内存,我的计算机风扇开始转动,我被迫杀死 chrome。

关于我做错了什么有什么想法吗???

非常感谢!

rxjs angular

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

VsCode 不使用单引号格式化 TS/JS 文件

在 VS Code 的最新更新之一之后,在 Windows 中按 Ctrl+Shift+F 时,尽管我将其设置为仅使用单引号,但它会自动使用双引号而不是单引号格式化我的所有代码。

这是我的设置文件:

{
"[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"atlascode.jira.workingSite": {
    "baseUrlSuffix": "atlassian.net"
},
"yaml.schemas": {
    "file:///c%3A/Users/kevin/.vscode/extensions/atlassian.atlascode-2.1.5/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
},
"window.zoomLevel": -1,
"[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"git.autofetch": true,
"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single",
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true
Run Code Online (Sandbox Code Playgroud)

}

还有人处理这个吗?

谢谢!!!

javascript typescript visual-studio-code prettier

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

带双引号的更漂亮的格式

即使您在首选项中明确将其设置为替换为单引号,还有其他人遇到过使用双引号而不是单引号的更漂亮的格式化代码吗?这是一张照片: 在此处输入图片说明

在最近对 VSCode 进行更新后,我开始遇到这个问题,这让我发疯了。关于如何解决这个问题的任何想法。我错了,更漂亮:单引号实际上没有用单引号而不是双引号格式化?谢谢。

visual-studio-code prettier prettier-standard

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