Diary Work 23/11/2019

1.Create dashboard page for admin.

My project admin page have some good field but I don’t have a dashboard to mange that field. Create template of Admin dashboard not hard but, fetch data from the backend is quite complex. First I idea appeared in my mind is, I will inject all the field Service to dashboard component ts and on ngOnInit I will call that service and get All data form them which I will assign it to metaData has interface IMeataData I create. The interface has property is my all field that I will call. But if I follow this idea I need to call a lot of api equivalent all my field. Not good Idea.
I was thick a little bit and I have another idea . I went to backend and create a Meta Data field which I will inject all my Service I have and call all data from them. Then I pass it to api response json data type. I set up the route api and my front end is ready to send request .
In the front end I write some code can send request to api get all the data. I had all data. So the last job I need to do is bind data to the template and it has a little error. Can’t not read property of undefined. I don’t know why and I fixed it when I wrote some logic code in constructor. If not exist property that property will equal object null, and interface I set up proper with ‘?’. And it work perfectly

2.What is an indexes in database.

Indexes in database, hummm . In 1 hour to figured out what is it, I think it looks like Book index. One day, your friend told you about a book which has fantastic chapter and you want to read it immediately. You need to know what page in that book and to be quickly you refer open book index to find it and open that page. That is indexes in database. That means you need indexing when you create database to optimize performance your database queries.
You should not use indexes in some case: In the small table which don’t need indexing, it very clear right!!!. Table has create and update value very usually was very should not has indexes, because the indexes like book index, when you creating or updating in your book, you must update your book index to make senses. That is not recommend. And another case is the table has null value.
The indexes is created by 2 columns. One is search key, this column is search key and normally is primary key I though. Second column is value key like column you want indexing like first name, last name, group, etc. Example, when I indexing the first name column, the database will generate a table has 2 column, the search key and value. The value is fist name record which was sorted already, the search key is the primary key follow the first name field in origin table.And it will maximum performance if I find user according the first name field I though.
The command create index is: ‘create index index_name on table_name (column_name)’.

Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar