小编Yas*_*nik的帖子

DynamoDB 验证异常 - 关键元素与架构不匹配

我正在尝试从我的 DynamoDB 中获取一个项目,但收到以下错误

ValidationException: 提供的关键元素与架构不匹配

代码的创建项目部分有效。但没有 Get 项目。

Table Info:
Table Name: movieTable
Primary Partition Key: itemID
Primary Sort Key: sortKey
Run Code Online (Sandbox Code Playgroud)

这是创建和更新的代码:

        var fbUserId;
        var params;
        var keyText;
        var attText;
        var valText;
        var dynamodb = null;
        var docClient = null;
        var appId = '405140756489952'; //from facebook
        var roleArn = 'arn:aws:iam::042765862882:role/Verzosa'; //from AWS IAM
        var resultData = null;

        document.getElementById('putThis').onclick = function () {
            dynamodb = new AWS.DynamoDB({ region: 'us-west-2' });
            docClient = new AWS.DynamoDB.DocumentClient({ service: dynamodb });
            keyText = document.getElementById("keyValue").value;
            attText …
Run Code Online (Sandbox Code Playgroud)

javascript amazon-web-services amazon-dynamodb

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

在手表模式下运行有角度的端到端测试

当前,每次更改规范文件时,以及每次此命令重建整个项目时,我都会运行ng e2e!有没有一种方法可以运行测试而无需重建整个项目,就像ng test一样。

protractor angular angular-e2e

5
推荐指数
2
解决办法
638
查看次数

Angular 4 错误:无法激活已激活的插座

我知道在SO中已经有一些关于这个错误的问题,但没有一个有任何有见地的答案。

我有 2 个并排组件,我试图在路由之间导航时为它们的宽度设置动画。我的路由配置如下所示:

export const routes = [
{ path: '', component: IndexComponent, children:
    [
        { path: 'home', children:
            [
                { path: '', component: FirstComponent, outlet: 'first', data: { state: 'a' } },
                { path: '', component: SecondComponent, outlet: 'second', data: { state: 'b' } }
            ]
        },
        { path: 'about', children:
            [
                { path: '', component: FirstComponent, outlet: 'first', data: { state: 'b' } },
                { path: '', component: SecondComponent, outlet: 'second', data: { state: 'a' …
Run Code Online (Sandbox Code Playgroud)

angular

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

heroku 中的“未为 webpack-dev-server 启用 HMR”错误

我已经在 Heroku 上部署了我的 angular 应用程序。构建成功,但是当我 在浏览器控制台中访问我的应用程序的URL 时。发生错误,即HMR is not enabled for webpack-dev-server! Are you using the --hmr flag for ng serve?。为什么会这样?

我的 main.ts

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment.hmr';
import {hmrBootstrap} from './hmr';

if (environment.production) {
  enableProdMode();
}

const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);

if (environment.hmr) {
  if (module[ 'hot' ]) {
    hmrBootstrap(module, bootstrap);
  } else {
    console.error('HMR …
Run Code Online (Sandbox Code Playgroud)

heroku node.js webpack angular

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

Angular2+ 渲染组件时根本不需要任何包装标签

我的子组件如下所示:

...
@Component({
    selector: '[child-component]'
    templateUrl: './child.template.html'
})
...
Run Code Online (Sandbox Code Playgroud)

我的父模板如下:

<span child-component [someInput]="123"></span>
Run Code Online (Sandbox Code Playgroud)

现在我想渲染子组件的内容,而<span>周围没有容器。我不想在父组件的模板中出现任何容器,只需要子组件模板的内容。

我已经尝试过其他一些标签了。

  • <ng-content>(根本没有渲染任何东西)
  • <ng-template>(嵌入模板上的组件:)
  • <ng-container>(无法在“节点”上执行“appendChild”)

提前致谢!

dom angular2-directives angular2-template angular2-ngcontent angular

5
推荐指数
2
解决办法
7551
查看次数

Protractor - 配置文件“tsconfig.json”中的“文件”列表为空。(18002)

我想使用protractor.jsv5.x在我的 Angular项目中实现 e2e 。但是当我运行命令时

\n\n

ng e2e -s false

\n\n

我在下面收到此错误,谁能告诉我如何解决此问题?

\n\n
[15:58:11] E/launcher - Error: TSError: \xe2\xa8\xaf Unable to compile TypeScript\nThe \'files\' list in config file \'tsconfig.json\' is empty. (18002)\n    at load (F:\\Commutatus\\yop-v3\\node_modules\\ts-node\\src\\index.ts:159:13)\n    at service (F:\\Commutatus\\yop-v3\\node_modules\\ts-node\\src\\index.ts:285:32)\n    at shouldIgnore (F:\\Commutatus\\yop-v3\\node_modules\\ts-node\\src\\index.ts:293:21)\n    at Object.require.extensions.(anonymous function) [as .ts] (F:\\Commutatus\\yop-v3\\node_modules\\ts-node\\src\\index.ts:302:11)\n    at Module.load (internal/modules/cjs/loader.js:599:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:530:3)\n    at Module.require (internal/modules/cjs/loader.js:637:17)\n    at require (internal/modules/cjs/helpers.js:22:18)\n    at F:\\Commutatus\\yop-v3\\node_modules\\protractor\\node_modules\\jasmine\\lib\\jasmine.js:84:5\n[15:58:11] E/launcher - Process exited with error code 100\n
Run Code Online (Sandbox Code Playgroud)\n\n

这是我的tsconfig.json(位于e2e文件夹内)-

\n\n …

protractor e2e-testing angular angular-e2e

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

Android Gradle构建错误-配置':classpath'的工件

运行命令tns run android或时出现以下错误tns debug android。直到我.gradle/gradle.properties从中删除文件夹之前,它都无法正常工作C:\Users\yash\.gradle\gradle.properties,现在我无法撤消它。

我收到的50个错误中有1个是:

Could not resolve all artifacts for configuration ':classpath'.
Could not resolve org.ow2.asm:asm:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.1
         project : > com.android.tools.build:gradle:3.3.1 > com.android.tools.build:builder:3.3.1
         project : > com.android.tools.build:gradle:3.3.1 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
Run Code Online (Sandbox Code Playgroud)

NS版本

 "nativescript": {
    "id": "org.nativescript.chennaivolunteers",
    "tns-ios": {
      "version": "5.0.0"
    },
    "tns-android": {
      "version": "5.2.1"
    }
}
Run Code Online (Sandbox Code Playgroud)

app.gradle

...

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
} …
Run Code Online (Sandbox Code Playgroud)

android gradle android-gradle-plugin nativescript

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

Excel堆积的条形图未正确绘制

我正在使用Axlsx gem在rails上生成关于ruby的excel图表。我的要求是生成一个堆积的条形图,但是它以阶梯格式生成,请参阅此处的图像。为了生成图表,我使用了以下代码,

sheet.add_chart(Axlsx::BarChart, start_at: "B5", end_at: "I20", title: "Test Title", grouping: :stacked) do |chart|
    chart.barDir = :col
    chart.add_series(data: sheet["C3:E3"], labels: sheet["C2:E2"], title: sheet["C1"])
    chart.add_series(data: sheet["F3:H3"], labels: sheet["C2:E2"], title: sheet["F1"])
  end
Run Code Online (Sandbox Code Playgroud)

当我在Microsoft Excel中手动编辑生成的图表并将其设置Series Overlap为100%时,我将获得所需的输出,请参考此处的图像

ruby-on-rails axlsx stacked-chart excel-charts

5
推荐指数
0
解决办法
33
查看次数

Angular 2中的语法突出显示

我正在使用angular 2创建简单的Web应用程序。这里有两个组件。首先基本上是带有一些数据行的表。当单击行时,与行对应的数据将显示在第二个组件中。数据是XML,并加载到代码元素中。看起来像

@Component
export class TableComponent {
    items: Data[];
    selectedItemsXml: string;
    // ...other stuff

    //when row is clicked
    toggleSelectedRow(rowIndex: number) {
        // ...other stuff related to change row's background color
        this.selectedItemsXml = this.items[i].xml;
    }
    // ...other stuff again
}

//TableComponent's template
<div>
    <table>
        ...
        ...*ngFor="let item of items; let i = index;"...
        <tr (click)="toggleSelectedRow(i)">
            <td>{{item.id}}</td>
            <td>{{item.time}}</td>
        </tr>
        ...
    </table>
</div>
<xml-detail [xml]="selectedItemsXml"></xml-detail>

@Component
export class XmlDetailComponent {
    @Input() xml: string;
}

//XmlDetailComponent's template
<div>
    <pre><code>{{xml}}</code></pre>
</div>
Run Code Online (Sandbox Code Playgroud)

一切工作正常,直到我想为xml添加语法突出显示。首先,我想使用插件ng2-prism,但是我遇到了使其无法正常运行的问题。在git repo中看到问题后,我将其丢弃。我接下来尝试的是根据这篇文章使用Highlight.js创建指令:Highlight.js不适用于Angular 2 …

syntax-highlighting angular

4
推荐指数
2
解决办法
5408
查看次数

从 observable 的 finalize 方法返回一个 observable

具体案例是这样的:AngularFirebase 文档说为了从上传的文件中获取下载 URL,你需要这样做:

const task = this.storage.upload(filePath, file);

// observe percentage changes
// get notified when the download URL is available
task.snapshotChanges().pipe(
    finalize(() => this.downloadURL = fileRef.getDownloadURL() )
 )
.subscribe();
}
Run Code Online (Sandbox Code Playgroud)

现在,我有一个上传方法,我想从中返回一个可观察的字符串。我的方法签名看起来像:

upload(file :File) :Observable<string> {

......

}
Run Code Online (Sandbox Code Playgroud)

我试过这样做:

return <Observable<string>>task.snapshotChanges().pipe(
        finalize(() => {
            const url = fileRef.getDownloadURL();
            console.log('download url is ',url);
            return url;
        })
    );
Run Code Online (Sandbox Code Playgroud)

但这不起作用,因为原始 observable 中还有其他类型快照更改的元素。

现在我的问题是,如何使用示例中的代码有效地返回我想要的类型

rxjs firebase angular

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