我想检索 dynamodb 中最新插入的记录,以便每当插入新记录时,dynamodb 表都会触发 lambda 并获取该记录并将其传递给 python 脚本。
我正在用 Python 2.7 编写 lambda
import json
import boto3
from boto3.dynamodb.conditions import Key, Attr
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table("html_contents")
try:
if (record.eventName == "INSERT") {
#How to Retrieve the latest record
}
except Exception, e:
print(e)
Run Code Online (Sandbox Code Playgroud) 我有2个1d数组,我试图将它们填充到JAVA中的单个2d数组中.
例如:
a[] = {2,7}
b[] = {9,1}
Run Code Online (Sandbox Code Playgroud)
结果应该是:
result[][] = {{2,9}, {7,1}}
Run Code Online (Sandbox Code Playgroud)
这是我的代码
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Test Cases:\t");
int t = sc.nextInt();
int[] a;
int[] b;
int i, j, x;
for (int k = 0; k < t; k++) {
System.out.println("Enter 1st Array Limit:\t");
int len = sc.nextInt();
System.out.println("Enter 2nd Array Limit:\t");
int len1 = sc.nextInt();
a = new int[len];
b = …Run Code Online (Sandbox Code Playgroud) 如何在Angular 2中创建d3饼图如果我想计算EMI.我已经为EMI计算创建了应用程序.现在我想显示关于计算的PIE图表
这是emi.component.ts
import { Component } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms'
import * as D3 from 'd3';
@Component({
selector: 'emi-app',
templateUrl: 'app/emi/emi.component.html',
styleUrls:['app/emi/emi.component.css']
})
export class EmiComponent {
loanamount:number
interestrate:number
loantenure:number
emi:number
newemi:number
emiForm = new FormGroup({
loanamount: new FormControl(null, [Validators.required]),
interestrate: new FormControl(null, [Validators.required]),
loantenure: new FormControl(null, [Validators.required]),
});
calculateEmi() {
if(this.loanamount && this.interestrate && this.loantenure) {
let interestPerMonth = this.interestrate/12/100;
let numerator = Math.pow((1+interestPerMonth), this.loantenure);
let denominator = numerator - 1;
this.emi …Run Code Online (Sandbox Code Playgroud)