Windows,VSC,Running npm start
得到了这个
npm WARN生命周期用于脚本的节点二进制文件是C:\ Program Files \nodejs \node.exe,但是npm使用的是C:\ somewhere\AppData\Roaming \npm \node_modules \node\bin \node.exe本身.使用该
--scripts-prepend-node-path
选项可以包含执行的节点二进制文件npm的路径.
我理解这意味着我的本地版本是PATH变量(C:\ Program Files ...)中的差异.如何继续告诉它使用--scripts-prepend-node-path
?
我通过替换PATH变量中的C:\Program Files\nodejs
with C:\somewhere\AppData\Roaming\npm\node_modules\node\bin
来玩一个技巧,它确实获得了新的node.exe but there is no node binary in the current PATH
.再次建议使用该--scrip
ts-prepend-node-path
选项来包含执行的节点二进制文件npm的路径
我正在使用词典.在.insert()之后有"_t"和"_v".这里有两篇文章谈到序列化转换为JSON然后BSON.我正在使用MongoDB的驱动程序v2.4.3,
mCollection.InsertOne(x);
IMongoCollection<myDoc> mCollection = Db.GetCollection<myDoc>("whatever");
Run Code Online (Sandbox Code Playgroud)
如果我做JSON-to-BSON,它抱怨无法将BsonDocument转换为myDoc.切换到IMongoCollection<BsonDocument> mCollection = Db.GetCollection<BsonDocument>("whatever");
仍然得到_t和_v.
如何避免_t和_v?
这是我的数据类型和利用率代码:
public class myObjForDictionary
{
//...
}
public class myDoc
{
// ... some other elements, then Dictionary
public Dictionary<string, object> myDictionary { get; set; }
}
// to instantiate the
class myClass
{
// define MongoDB connection, etc.
// instantiate myDoc and populate data
var x = new myDoc
{
//...
myDictionary = new Dictionary<string, object>
{
{ "type", "something" …
Run Code Online (Sandbox Code Playgroud) 我在 C:\ABC 文件夹中有一个本地项目,只是意识到是时候将它备份到 GitHub 了。这就是我所做的:
错误 Git:致命:目标路径“C:\ABC”已经存在并且不是空目录。
我知道它试图从 GitHub 获取到本地,但我想要的是相反的。谷歌搜索了很多关于如何从头开始的文章和视频,但不适用于现有的本地项目。
2021-08 更新,
本地运行Basic AngularJS 1.x示例,发现style="height: 100%;"
网格是否折叠成水平线.将其设置为100px之类的其他工作.除了我的Angular之外的所有东西都是1.5.0和ag-grid v8.1.0.
HTML
<br />ag-Grid using AngularJS
<div ng-controller="exampleCtrl">
<div ag-grid="gridOptions" class="ag-fresh" style="height: 100%;">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS与教程相同.看起来像个bug.
我知道这是require
/ import
ES6的事情。我有一个使用的项目import
,文件全部.js
,基于此,我需要的只是添加"type":"module"
到最近的package.json中。这是我的 package.json ,与 server.js 和 env.js 处于同一顶层:
{
"name": "my project",
"version": "1.0.0",
"description": "many .js",
"main": "server.js",
"type":"module",
"directories": {
"test": "test"
},
"dependencies":{...},
"devDependencies":{...},
"scripts":{...},
"author":"John Doe"
}
Run Code Online (Sandbox Code Playgroud)
服务器.js
import express from 'express';
import 'babel-polyfill';
import cors from 'cors';
import env from './env';
Run Code Online (Sandbox Code Playgroud)
还有
Internal/process/esm_loader.js:74 internalBinding('errors').triggerUncaughtException( ^ 错误 [ERR_MODULE_NOT_FOUND]: 找不到从 c:\project\server.js 导入的模块 'c:\project\env' 您是否打算导入../env.js?
节点是14.9.0,使用nvm。
启动.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node", …
Run Code Online (Sandbox Code Playgroud) LocalHost、Angular 11 ( https://localhost:4200
) 和 Node API ( https://localhost:3001
) 都使用 OpenSSL,浏览器是 Chrome。为了解决这个问题Status: CORS error
(由于端口不同),我按照这个添加 Proxy,在 Angular 的控制台中得到了这个
[HPM] 尝试将请求 /somewhere1 从 localhost:4200 代理到 https://localhost:3001 (DEPTH_ZERO_SELF_SIGNED_CERT) 时出错 ( https://nodejs.org/api/errors.html#errors_common_system_errors )
以下没有帮助:
chrome://flags/#allow-insecure-localhost
启用。process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
到 Node API 的 server.js。代理.conf.json
{
"context":
[
"/path1",
"/path2"
],
"target" : "https://localhost:3001",
"secure": true,
"changeOrigin": true,
"rejectUnauthorzied": false,
"logLevel": "info"
}
Run Code Online (Sandbox Code Playgroud)
角度.json
"serve": {
...
"options": {
"browserTarget": "myapp:build",
"ssl": true,
"proxyConfig": "src/proxy.conf.json" …
Run Code Online (Sandbox Code Playgroud) 长期使用传统SQL,习惯了order by
和limit
,top
是MS自己的“限制”但更直观。
这里两个 Kusto 查询共享相同的条件和排序依据(排序,对吧?),唯一的区别是返回多少,20 与 200。结果令人惊讶:
AzureDiagnostics | where Category contains "postgresql" | take 20 | order by TimeGenerated desc
Run Code Online (Sandbox Code Playgroud)
AzureDiagnostics | where Category contains "postgresql" | take 200 | order by TimeGenerated desc
Run Code Online (Sandbox Code Playgroud)
顶部更一致
AzureDiagnostics | where Category contains "postgresql" | top 2 by TimeGenerated desc
AzureDiagnostics | where Category contains "postgresql" | top 20 by TimeGenerated desc
Run Code Online (Sandbox Code Playgroud)
更新,感谢@Yoni L,总结如下:
|
部分的顺序都很重要。例如,|take 10 | order by x
将在 …遵循有关如何连接到本地主机的文档。MongodDB Compass可以连接到“localhost:27017”,不需要认证,不需要SSL,不需要SSH Tunnel。在 C# 项目中,尝试过
mongodb//localhost
mongodb//localhost:27017
localhost:27017
Run Code Online (Sandbox Code Playgroud)
都一样
MongoDB.Driver.MongoConfigurationException 未处理
HResult=-2146233088 Message=连接字符串 'all-above' 无效。Source=MongoDB.Driver.Core StackTrace: 在 MongoDB.Driver.Core.Configuration.ConnectionString.Parse() 在 MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString) 在 MongoDB.Driver.MongoUrlBuilder.Parse(String) url) 在 MongoDB.Driver.MongoUrl..ctor(String url) 在 MongoDB.Driver.MongoClient..ctor(String connectionString)
这是代码:
static string con = "mongodb//localhost";
MongoClient mclient = new MongoClient(con);
Run Code Online (Sandbox Code Playgroud)
MongoDB.Driver v2.4.2、MongoDB.Driver.Core v2.4.2
怎么了?
我有一个 Angular11 UI 前端,使用 Google 的 RS256 身份验证
import { SocialAuthService, GoogleLoginProvider, SocialUser } from 'angularx-social-login';
providers: [{ id: GoogleLoginProvider.PROVIDER_ID, provider: new GoogleLoginProvider('my Google-Client-ID')}]
当 Google 向我发回 JWT 令牌时,我会将其发送到我的 NodeJS 应用程序服务器,以便为会话建立基于 JWT 的通信,因此此 NodeJS 应用程序服务器必须验证此 JWT。根据这篇angular-university.io 文章“ Leveraging RS256 Signatures ”部分,
最好让身份验证服务器在可公开访问的 Url 中发布 JWT 验证公钥,而不是在应用程序服务器上安装公钥。
我从 Erji 的Google Identity中找到了这个 JWK(不是 JWT)链接https://www.googleapis.com/oauth2/v3/certs。这是正确的公钥吗?
ngx-image-zoom
是一个很棒的产品。经过一些测试后,我们发现有必要设置一个max-width
大图像,这样大图像不会将其他内容从悬崖上撞下来。
无论我们做什么,以下和/或组合都无法实现包含和自动调整大小的技巧
<lib-ngx-image-zoom style="max-width:100px" ...>
<div style="width:100px; max-width:100px">
F12显示有这个设置
<div _ngcontent-tnl-c230="" class="ngxImageZoomContainer" style="width: 773px; height: 768px;">
Run Code Online (Sandbox Code Playgroud)
手动减小宽度和高度,就像剪切一样,从左上角显示相应区域。