Tuesday, May 5, 2020

angular reactive form

https://medium.com/better-programming/how-to-handle-errors-of-angular-reactive-forms-with-three-lines-of-code-3caaa1eb8324 

Saturday, May 2, 2020

DynamoDB Details




  • Amazon DynamoDB has a default limit of 20 global secondary indexes per table, in practice, you can index across far more than 20 data fields




Basic of Dynamodb:

  1. https://medium.com/tensult/core-concepts-of-amazon-dynamodb-a265a3fc70a (Basic ***)

Local Secondary Index vs Global Secondary Index
  1. https://stackoverflow.com/questions/56265577/dynamodb-local-secondary-index-vs-global-secondary-index
  2. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SecondaryIndexes.html ( Dynamodb official difference)
  3. https://stackoverflow.com/questions/55484683/dynamodb-table-index-design-gloabl-index-or-local/55485322#5548532 (***)
Differences:
  • LSIs cannot be modified or deleted without deleting and recreating the whole table. GSIs can be created/removed at any time with no impact to the main table.
  • LSIs cause you to have a limit of 10 GB of data per partition key. Without a LSI, there is a limit of 10 GB per partition, but you won’t notice that because DynamoDB can split your data for a single partition key across multiple partitions if necessary.
  • When using a LSI, the 400kb item size limit applies to the item plus all of its LSI projections. An item in a GSI is counted separately from the item in the main table.
  • Provisioned capacity of GSIs can be scaled independently of the main table, whereas LSIs share the same capacity as the base table.



  • Fast retrieval
  • Auto scaling to control costs
  • Query and scanning allow for different use cases
  • Can get very expensive very fast
  • Sharding and hot spotting are hidden problems that can cause ALOT of head ache
  • Not relational or transactional at all

Single-Table Design for a application:




calculate RCU and WCU with the data
https://stackoverflow.com/questions/42494900/how-to-calculate-read-capacity-unit-and-write-capacity-unit-for-dynamodb/42520860 (***********)



What is throttling(Rejected) in DynamoDB?
AWS DynamoDB Throttling. In a DynamoDB table, items are stored across many partitions according to each item's partition key. ... When a request is made, it is routed to the correct partition for its data, and that partition's capacity is used to determine if the request is allowed, or will be throttled(Rejected)


Getting Started with Amazon Web Services | A Complete Beginner Roadmap



Friday, May 1, 2020

ExpressionChangedAfterItHasBeenCheckedError



Relevant change detection operations steps
A running Angular application is a tree of components. During change detection Angular performs checks for each component which consists of the following operations performed in the specified order:
fddf

Possible fixes of ExpressionChangedAfterItHasBeenCheckedError:
Asynchronous update: use setTimeout
 setTimeout(() => {
            this.parent.name = 'updated name';
        });
Forcing change detection: use the changeDetection
constructor(private cd: ChangeDetectorRef) {
    }

    ngAfterViewInit() {
        this.cd.detectChanges();
    }



Sunday, April 26, 2020

AWS Lambda (serverless service)


AWS Lambda (server-less service)

https://github.com/serverless/serverless/issues/2372 (********** serverless folder structure)









Getting Started with Amazon Web Services | A Complete Beginner Roadmap

Thursday, April 16, 2020

Angular library create command



Go to the lib folder of nodejs then run these 4 command 


ng new ngx-charts --create-application=false

cd ngx-charts

ng generate library ngx-charts

ng generate application ngx-charts-test

Monday, April 13, 2020

angular project publish to github page



command need to follow
npm install -g angular-cli-ghpages
🌹 ng build --prod --base-href https://[username].github.io/[repo]/
🌹 ngh --dir=dist/[project-name]

You need to change <base href="/"> to <base href="./">

ng build ngx-datagrid-test --prod --base-href https://tusharghoshbd.github.io/ngx-datagrid


ngh --dir=dist/ngx-datagrid-test

some important commands use for angular


ng build [project_name] // for library ex "ng build ngx-datatable"

ng build [project_name] --prod //here project name option and only build js file in dist folder

ng serve [project_name] --prod // here project name option and run server in production mode



Can't load angular generated webpage (ng build --prod)


The problem is you're trying to run the application without a server serving the js bundles generated by Angular. Angular will load the js asynchronously.
An option run live-server on the compiled directory
// Install live-server if you haven't
npm install -g live-server

// Run live-server on you dist
cd <project-compile-dist-path>
live-server

// Note: if you don't want to install live-server globally you
// can use npx
npx live-server <path-to-directory>
https://stackoverflow.com/questions/58878123/cant-load-angular-generated-webpage-ng-build-prod





Autoboxing and Unboxing

  Autoboxing  is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper cl...