我已经使用node.js 标准环境在AppEngine上部署了一个 cron ,以便定期更新我的 Firestore 数据库。
在此文档之后,链接到此可用 npm 模块列表,我应该可以使用@google-cloud/firestore,但之后:
npm i --save @google-cloud/firestore
我收到以下错误:
Error: Cannot find module '@google-cloud/firestore'
在线:
var firestore = require('@google-cloud/firestore');
Run Code Online (Sandbox Code Playgroud)
我的 package.json 与 Hello World 示例相同:
{
"name": "appengine-hello-world",
"description": "Simple Hello World Node.js sample for Google App Engine Standard Environment.",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google Inc.",
"repository": {
"type": "git",
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": "8.x.x"
},
"scripts": { …Run Code Online (Sandbox Code Playgroud) google-app-engine node.js firebase google-cloud-platform google-cloud-firestore
我们最近在 Google App Engine 上设置了一个 nodejs webapp 的持续集成/部署/交付。CI 服务器 (GitLabCI) 根据分支 (develop/master) 运行依赖项安装、构建、测试和部署到集成/生产。
在今天,我们面临的唯一错误是在依赖步骤期间,所以我们并没有太在意它。但是昨天(21/10/16)发生了大规模的 DNS 中断,并且管道在部署步骤中间失败,导致生产中断。只需重新运行管道即可完成工作,但问题随时可能重现。
我的问题是:
目前我们只有两个版本“dev”和“prod”在提交后更新,但在随机时间我可以观察到奇怪的行为。
非常欢迎任何回应/建议/反馈!
关于我正在谈论的网络问题的堆栈跟踪示例:
DEBUG: Error sending result: 'MetadataServerException(HTTPError(),)'. Reason: 'PicklingError("Can't pickle <type 'cStringIO.StringO'>: attribute lookup cStringIO.StringO failed",)'
Traceback (most recent call last):
File "/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 733, in Execute
resources = args.calliope_command.Run(cli=self, args=args)
File "/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 1630, in Run
resources = command_instance.Run(args)
File "/google-cloud-sdk/lib/surface/app/deploy.py", line 53, in Run
return deploy_util.RunDeploy(self, args)
File "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", …Run Code Online (Sandbox Code Playgroud) google-app-engine continuous-integration continuous-deployment continuous-delivery gitlab-ci
遵循关于如何构建 Angular 应用程序的几个建议,我最终得到了这个文件组织:
- app
- core
- header
- sidenav
core.module.ts
- shared
- material
custom-material.module.ts
shared.module.ts
- features
app.module.ts
Run Code Online (Sandbox Code Playgroud)
features/是延迟加载的但是现在,我的问题是:我的标题组件需要一些材料组件。
我应该将共享模块导入核心模块还是应用模块?但这对我来说似乎是一种反模式。
我正在尝试在Angular7应用程序中使用刚引入的Firestore模拟器。
根据此文档,我使用以下命令运行开发服务器127.0.0.1:8080:
firebase serve --only firestore
Run Code Online (Sandbox Code Playgroud)
然后,之后ng serve,如何使AngularFire模块使用数据库模拟器?
我尝试了以下内容environment.ts:
export const environment = {
production: false,
name: 'local',
firebase: {
databaseURL: "http://127.0.0.1:8080"
}
};
Run Code Online (Sandbox Code Playgroud)
但是它不起作用,因为它需要一个“ projectId”。我尝试将其设置为预生产的Firestore数据库,但随后未使用开发服务器。
有什么想法吗?
这是我的app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from '@app/app-routing.module';
import { AppComponent } from '@app/app.component';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore'; …Run Code Online (Sandbox Code Playgroud) javascript firebase angularfire2 angular google-cloud-firestore
我有ProfileModule以下路由:
// profile-routing.module
const routes: Routes = [
{
path: ':id',
component: ProfilePageComponent,
children: [
{
path: '',
redirectTo: 'feed',
pathMatch: 'full'
},
{
path: 'feed',
component: NewsFeedComponent
},
{
path: 'gallery',
component: MediasGalleryComponent
}
]
}
];
Run Code Online (Sandbox Code Playgroud)
它的工作原理如下:
ProfilePageComponent 获取路由参数中的配置文件 ID 并将其发送到 ProfilePageServiceNewsFeedComponent并MediasGalleryComponent从ProfilePageService现在,这两个页面已移入两个单独的模块(分别为NewsModule和MediasModule),我希望在此路由中延迟加载。我不能再使用 ProfilePageService。我想出了这个解决方案:
// profile-routing.module
const routes: Routes = [
{
path: ':id',
component: ProfilePageComponent,
children: [
{
path: '',
redirectTo: 'news/:id/feed', …Run Code Online (Sandbox Code Playgroud) 我试图了解当使用具有关联类型的特征时多态性是如何工作的。考虑以下特征:
trait Animal {
fn talk (&self);
}
Run Code Online (Sandbox Code Playgroud)
此特征由以下结构使用:
struct Dog;
struct Cow;
impl Animal for Dog {
fn talk (&self) {
println!("Woof");
}
}
impl Animal for Cow {
fn talk (&self) {
println!("Moo");
}
}
Run Code Online (Sandbox Code Playgroud)
然后我循环 a Vec<&Animal>,多态性在这里工作得很好:
fn main() {
let animals: Vec<&Animal> = vec![&Dog, &Cow];
for animal in &animals {
animal.talk();
}
}
// output:
// Woof
// Moo
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切都很好。现在,我向特征添加一个关联类型 Food(该类型未使用,但仅用于最小重现)。
struct Meat;
struct Herb;
trait Animal {
type Food; …Run Code Online (Sandbox Code Playgroud) 我有几个 Web 应用程序,我想将它们托管在 Google App Engine 上。最近,在我看来,定价发生了变化,免费套餐现在基于配额。我思考过以下问题:
考虑到应用程序要求和新配额,GCP 上的免费套餐应该允许我仅自由托管一个 Web 应用程序。为我的每个客户提供一个收费的 GCP 帐户,并使用他的帐户在他自己的 google 项目上托管他的 web 应用程序,以获得与 web 应用程序一样多的免费套餐怎么样?我错过了什么吗?
我正在尝试使用C++中的位数组数据结构.这是一种简单的好奇心,但我该如何解释:
uint64_t a = 1;
uint64_t b = a << 1;
cout << (a == (a << 64)) << endl; // get 1
cout << (a == (b << 63)) << endl; // get 0
Run Code Online (Sandbox Code Playgroud)
看起来像<< x是循环的时候x >= 64,但是填充时用零填充x < 64.我错了吗 ?
如果没有,解释是什么?我认为64位整数不是自然周期性的.
angular ×3
firebase ×2
javascript ×2
angularfire2 ×1
bit-shift ×1
c++ ×1
gitlab-ci ×1
node.js ×1
polymorphism ×1
rust ×1
typescript ×1