JavaScript : Compare two arrays

Conditions :

  • You have a arrays by structure with following :

array1 : [

{“Name” : “John”, “Age”: “24”},

{“Name”: “Kata”, “Age”: “25}

]

  • You have another arrays by structure with following:

array1 : [

{“Name”: “Kata”, “Age”: “25}

{“Name” : “John”, “Age”: “24”},

]

Expected : You want to compare equals 2 this arrays

Solution : You should have a flag to check equals or not.

var checkEquals = function compareEquals(array1, array2){

var flag = false;

for(var i = 0; i < array1.length; i++){

for(var j = 0; j < array2.length; j++){

if (array1[j].Name.toUpperCase() === array2[i].Name.toUpperCase()) {
flag = true; break;
} else {  flag = false;}}

if (flag === false) return true;}

return false;

}

Advertisement

ExtJS : Ajax asynchronous vs synchronous request

Ajax is used for get data to client side. It’s special helpful in case get data at runtime.

The structure:

Ext.Ajax.request({
    url: '/controller/GetData',
    params: {
        id: 1
    },
    timeout: 30000,
    method: GET or POST,
    async: isAsync // Synchronous or Asynchronous
    success: function(response){
        var text = response.responseText;
        var result = Ext.JSON.decode(text);
        // do something here .....
    },
    failure : function(response){
       // do something when wrong ....
   },
})

The issue of myself

On Friday this week, I had a small meeting with the team leader. The main point discussion that is he want me to improve code skills. By his way, He suggests me search and deep learning about CaseWhere project, that’s a project which we are doing. And understanding the main concepts it working.

The issue when I recognise is up 4 years of university to now, I don’t try my best and seriously to do anything about my jobs. Whatever I do, I always finish it to get the high score and prove my friend that I am a good man or a superstar.

But, if I still do this, I can’t develop my career. I recognised that up to now, I had a scare in my mind. The scare maybe begins when I was young. I always wanted to make parents fun and proud of me. So, I often created pressure for myself do well everything.

The answer for that issue is I need to find a right motivate and the good feeling about jobs. Because, when I do this, I will have a funny to overcome the scare in head and learn anything to improve my skills

And last, the sentences in a film that I like:

Follow excellence…Success will chase you

The things make me thinking

Have a hard word day.!

My finger so tired when I code all of the day. But I feel so good because I love my job day by day.

Today, I have learned the lesson “Any” in LINQ. A.Thien always teaches knowledge for me and recommend me should curious everything. I feel ashamed when heard that, but it makes me serious look myself.

The thing makes me thinking

“Am I have invest all of my power for improve code?”

How the children can easily share opinion to their parent ?

I want tell a story .When I was young, I was an obedient child and always obey parents. But one day, when I talk  my opinion with mom that I want  control my life and don’t want parent worry anymore, not must do this, do that . I have a trouble with my mom. My mom show me that I think I have grown and do not respect the opinions of her. But something not like that, I just control my life and do work that I like in that moment. And we have a big agrument. A heavy air cover both my family and my dad must have terminate it.

A quenstion in my head. Why in the culture of VietName families, whenever the children show a opinion different with their parent, they are consider wrong? And if the son want talk  about his thought, how the son do their parent to listen and understand 

I just would like to share my onw perpective as follow :

First, Let’s talk above example. Why the more I talk, the more my mother would talk. The more I want to prove right, My mother inscreasingly conservative and dertermined. Do you feel that, as my mother said, I did not listen, and so until when I say , they will not listen. So I think that, when preseting an idea with parents, let us ready listen to them, listen here are not complety accepted. That’s just show I am seriously listening to  them. Only when we calm down listen from parents, we will understands worries from them. From that, we will persuade them accept our opnion.

So, How to find a true reason to persuade parents ? I think , if you want parent to belive you, you must prove that by the details action. Example, in that case, if I could do again, I would have been prepared a clearly plants in near future. For exmple, With the current salary , I  can completely live by itself. Another reason, I just have 23 yearsold, I am very young and I want to do that I like such as travel, improve soft skils.

And the last opinion, I would says everyone in here, my parents are always love us, they can do everything for us. So that, Let’s love yours parent and do best for yous family