问:
Total all matching integer elements in an array
I was looking over some basic questions that might be asked in an interview. Using basic for loops (No hash maps etc)I want to sum up all the matching elements in an array.For example, 6 matching elements will result in (Matched: 6) and a total of 36 in the example below.An example of this could be rolling dice, and the score is the total of all the dice that match.

```<code>public static void main(String[] args) {

    int arr[] = {6,6,6,6,6,6};
    int matched = 1;
    int value = 0;
    int total = 0;
    for(int i=0;i<arr.length;i++){
        for(int j=(i+1);j<arr.length;j++){
            if(ar[i] == ar[j]){
                matched++;
                value = ar[i];
                break;
            }
        }
        total = (matched * value);
    } // End for loop
    System.out.println("Matched:"+(matched)+"");
    System.out.println("Total:"+total);
}
</code>```

But, if the array was for example...

```<code>int arr[] = {6,1,1,6,6,6};
</code>```

The output I get will be (Matched:5) and an a total of 30.Can could I store the matching pair of 1's and add them to the total using as little basic code as possible?

答:
Here is a code fragment I just wrote. This method takes in an array of integers and creates a map of each unique integer and it's count in the list. In the second part of the method, the HashMap object countOfNumbersMap is iterated and the sum of each element is printed.

```<code>private void findSumOfMatchingNumbers(int array[]) {
    HashMap<Integer, Integer> countOfNumbersMap = new HashMap<>();

    // Setting up the map of unique integers and it's count
    for (int i = 0 ; i < array.length ; i++) {
        if (countOfNumbersMap.containsKey(array[i])) {
            int currentCount = countOfNumbersMap.get(array[i]);
            countOfNumbersMap.put(array[i], currentCount + 1);
        } else {
            countOfNumbersMap.put(array[i], 1);
        }
    }

    for (Integer integer : countOfNumbersMap.keySet()) {
        int sum = countOfNumbersMap.get(integer) * integer;
        System.out.println(String.format("Number = %d, Sum = %d", integer, sum));
    }
}
</code>```

The worst case runtime of the program is O(n).

Body:
I was looking over some basic questions that might be asked in an interview. Using basic for loops (No hash maps etc)I want to sum up all the matching elements in an array.For example, 6 matching elements will result in (Matched: 6) and a total of 36 in the example below.An example of this could be rolling dice, and the score is the total of all the dice that match.

public static void main(String[] args) {

    int arr[] = {6,6,6,6,6,6};
    int matched = 1;
    int value = 0;
    int total = 0;
    for(int i=0;i<arr.length;i++){
        for(int j=(i+1);j<arr.length;j++){
            if(ar[i] == ar[j]){
                matched++;
                value = ar[i];
                break;
            }
        }
        total = (matched * value);
    } // End for loop
    System.out.println("Matched:"+(matched)+"");
    System.out.println("Total:"+total);
}

But, if the array was for example...

int arr[] = {6,1,1,6,6,6};

The output I get will be (Matched:5) and an a total of 30.Can could I store the matching pair of 1's and add them to the total using as little basic code as possible?

Body:
Here is a code fragment I just wrote. This method takes in an array of integers and creates a map of each unique integer and it's count in the list. In the second part of the method, the HashMap object countOfNumbersMap is iterated and the sum of each element is printed.

private void findSumOfMatchingNumbers(int array[]) {
    HashMap<Integer, Integer> countOfNumbersMap = new HashMap<>();

    // Setting up the map of unique integers and it's count
    for (int i = 0 ; i < array.length ; i++) {
        if (countOfNumbersMap.containsKey(array[i])) {
            int currentCount = countOfNumbersMap.get(array[i]);
            countOfNumbersMap.put(array[i], currentCount + 1);
        } else {
            countOfNumbersMap.put(array[i], 1);
        }
    }

    for (Integer integer : countOfNumbersMap.keySet()) {
        int sum = countOfNumbersMap.get(integer) * integer;
        System.out.println(String.format("Number = %d, Sum = %d", integer, sum));
    }
}

The worst case runtime of the program is O(n).


来源: stackexchange

问:
Fill array with placeholders Javascript [IE supported]
I have an array which I get from response of google Analytics.

My array looks like this:

```<code>var mobileYesterday = [
 {hour: "00", date: "20171208", pageviews: "1"},
 {hour: "06", date: "20171208", pageviews: "1"},
 {hour: "07", date: "20171208", pageviews: "5"},
 {hour: "08", date: "20171208", pageviews: "7"},
 {hour: "09", date: "20171208", pageviews: "4"}
];
</code>```

Since a day exists out of 24 hours I would like to be able fill the array with placeholders, which will contain the date of today, the hour which isn't specified in the previous array and pageviews = 0. The array should also be ordered by hour, so that the array will look like this:

```<code> var mobileYesterday = [
     {hour: "00", date: "20171208", pageviews: "1"},
     {hour: "01", date: "20171208", pageviews: "0"},
     {hour: "02", date: "20171208", pageviews: "0"},
     {hour: "03", date: "20171208", pageviews: "0"},
     {hour: "04", date: "20171208", pageviews: "0"},
     {hour: "05", date: "20171208", pageviews: "0"},
     {hour: "06", date: "20171208", pageviews: "1"},
     {hour: "07", date: "20171208", pageviews: "5"},
     {hour: "08", date: "20171208", pageviews: "7"},
     {hour: "09", date: "20171208", pageviews: "4"},
     {hour: "10", date: "20171208", pageviews: "0"},
     {hour: "11", date: "20171208", pageviews: "0"},
     {hour: "12", date: "20171208", pageviews: "0"},
     {hour: "13", date: "20171208", pageviews: "0"}
     etc..
];
</code>```

I've tried to loop through the array with a for loop

```<code>var array = [];
    var date = moment().format("YYYYMMDD");

    var hourPlaceholder;
    for(var i = 0; i < 24; i++){
        if(i < 10){
            hourPlaceholder = '0'+i;
        }
        if(i > 9){
            hourPlaceholder = i;
        }

       for (var k = 0; k < mobileYesterday.length; k++){
           if(!mobileYesterday[k].uur == hourPlaceholder){
              var array_record = [
                  { "hour": hourPlaceholder, "date": date, "pageviews":0}
              ]
               array.push(array_record);
           }else{
               array.push(mobileYesterday[k]);
           }
       }
    }
    console.log(JSON.stringify(array));
</code>```

But this just returns the most weirdest array ever:

```[[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"}]
```

答:
Given the structure of your array, mobileYesterday.indexOf(10) will return -1 always.

Also, mobileYesterday[k].uur  will always be undefined, since there is no property called uur in your object.

Use Array constructor along with map

```<code>var pad2 = ( int ) => ( "0" + int ).slice( -2 );
var output = Array(24).join("0").split("").map( function(it, in){
  in = pad2(in);
  var doesExists = mobileYesterday.find( s => s.hour == in ); //find existing object
  if( !!doesExists )
  {
     return doesExists;
  }
  else
  {
     return { hour : in, date : "20171208", pageviews : 0 }; //if object doesn't exists return a new one
  }
});
</code>```

Demo

var mobileYesterday = [
 {hour: "00", date: "20171208", pageviews: "1"},
 {hour: "06", date: "20171208", pageviews: "1"},
 {hour: "07", date: "20171208", pageviews: "5"},
 {hour: "08", date: "20171208", pageviews: "7"},
 {hour: "09", date: "20171208", pageviews: "4"}
];

var pad2 = (int) => ("0" + int).slice(-2);
var output = Array(24).join("0").split("").map(function(it, ind ) {
  ind = pad2( ind );
  var doesExists = mobileYesterday.find(s => s.hour == ind );
  if (!!doesExists) {
    return doesExists;
  } else {
    return {
      hour: ind ,
      date: "20171208",
      pageviews: 0
    }; //if object doesn't exists return a new one
  }
});
console.log( output );```

ContentLicense: CC BY-SA 3.0

Body:
I have an array which I get from response of google Analytics.

My array looks like this:

var mobileYesterday = [
 {hour: "00", date: "20171208", pageviews: "1"},
 {hour: "06", date: "20171208", pageviews: "1"},
 {hour: "07", date: "20171208", pageviews: "5"},
 {hour: "08", date: "20171208", pageviews: "7"},
 {hour: "09", date: "20171208", pageviews: "4"}
];

Since a day exists out of 24 hours I would like to be able fill the array with placeholders, which will contain the date of today, the hour which isn't specified in the previous array and pageviews = 0. The array should also be ordered by hour, so that the array will look like this:

 var mobileYesterday = [
     {hour: "00", date: "20171208", pageviews: "1"},
     {hour: "01", date: "20171208", pageviews: "0"},
     {hour: "02", date: "20171208", pageviews: "0"},
     {hour: "03", date: "20171208", pageviews: "0"},
     {hour: "04", date: "20171208", pageviews: "0"},
     {hour: "05", date: "20171208", pageviews: "0"},
     {hour: "06", date: "20171208", pageviews: "1"},
     {hour: "07", date: "20171208", pageviews: "5"},
     {hour: "08", date: "20171208", pageviews: "7"},
     {hour: "09", date: "20171208", pageviews: "4"},
     {hour: "10", date: "20171208", pageviews: "0"},
     {hour: "11", date: "20171208", pageviews: "0"},
     {hour: "12", date: "20171208", pageviews: "0"},
     {hour: "13", date: "20171208", pageviews: "0"}
     etc..
];

I've tried to loop through the array with a for loop

var array = [];
    var date = moment().format("YYYYMMDD");

    var hourPlaceholder;
    for(var i = 0; i < 24; i++){
        if(i < 10){
            hourPlaceholder = '0'+i;
        }
        if(i > 9){
            hourPlaceholder = i;
        }

       for (var k = 0; k < mobileYesterday.length; k++){
           if(!mobileYesterday[k].uur == hourPlaceholder){
              var array_record = [
                  { "hour": hourPlaceholder, "date": date, "pageviews":0}
              ]
               array.push(array_record);
           }else{
               array.push(mobileYesterday[k]);
           }
       }
    }
    console.log(JSON.stringify(array));

But this just returns the most weirdest array ever:

[[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],[{"hour":"00","date":"20171207","pageviews":0}],{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"},{"hour":"01","date":"20171207","pageviews":"1"},{"hour":"07","date":"20171207","pageviews":"5"},{"hour":"08","date":"20171207","pageviews":"7"},{"hour":"09","date":"20171207","pageviews":"8"},{"hour":"10","date":"20171207","pageviews":"8"},{"hour":"11","date":"20171207","pageviews":"9"},{"hour":"12","date":"20171207","pageviews":"9"},{"hour":"13","date":"20171207","pageviews":"6"},{"hour":"14","date":"20171207","pageviews":"5"},{"hour":"15","date":"20171207","pageviews":"6"},{"hour":"16","date":"20171207","pageviews":"7"},{"hour":"17","date":"20171207","pageviews":"7"},{"hour":"18","date":"20171207","pageviews":"4"},{"hour":"19","date":"20171207","pageviews":"7"},{"hour":"20","date":"20171207","pageviews":"5"},{"hour":"21","date":"20171207","pageviews":"8"},{"hour":"22","date":"20171207","pageviews":"5"},{"hour":"23","date":"20171207","pageviews":"3"}]

Body:
Given the structure of your array, mobileYesterday.indexOf(10) will return -1 always.

Also, mobileYesterday[k].uur  will always be undefined, since there is no property called uur in your object.

Use Array constructor along with map

var pad2 = ( int ) => ( "0" + int ).slice( -2 );
var output = Array(24).join("0").split("").map( function(it, in){
  in = pad2(in);
  var doesExists = mobileYesterday.find( s => s.hour == in ); //find existing object
  if( !!doesExists )
  {
     return doesExists;
  }
  else
  {
     return { hour : in, date : "20171208", pageviews : 0 }; //if object doesn't exists return a new one
  }
});

Demo

var mobileYesterday = [
 {hour: "00", date: "20171208", pageviews: "1"},
 {hour: "06", date: "20171208", pageviews: "1"},
 {hour: "07", date: "20171208", pageviews: "5"},
 {hour: "08", date: "20171208", pageviews: "7"},
 {hour: "09", date: "20171208", pageviews: "4"}
];

var pad2 = (int) => ("0" + int).slice(-2);
var output = Array(24).join("0").split("").map(function(it, ind ) {
  ind = pad2( ind );
  var doesExists = mobileYesterday.find(s => s.hour == ind );
  if (!!doesExists) {
    return doesExists;
  } else {
    return {
      hour: ind ,
      date: "20171208",
      pageviews: 0
    }; //if object doesn't exists return a new one
  }
});
console.log( output );


问:
Change URL without removing history in Angularjs
I'm using 'ui.router' and '$state.go' to redirect page,

'navbar' of my project looks like this.

```<code><ul class="sidebar-menu">
    <li class="active">
        <a ui-sref="root.menu({brand_id:nav.brand_id})">
            <i class="fa fa-building-o"></i>
            <span> {{nav.navInfo.menu.auth_name}}</span>
        </a>
    </li>
    <li>
        <a ui-sref="root.picture({brand_id:nav.brand_id})">
            <i class="fa fa-book"></i>
            <span> {{nav.navInfo.picture.auth_name}}</span>
        </a>
    </li>
    ...
</ul>
</code>```

Each page show table which has list of items first.

Let us supposed a situation.

When I am in 'menu' page, I search a keyword.

Following my code, URL changes including keyword.

For example, this works like

Before searching :

/menu?page=1&offset=0&limit=10

After searching :

/menu?page=1&offset=0&limit=10&searchKey=menu_name&searchString=pizza

.

.

Then, I click 'menu' tab in 'navbar' to get entire list again.

At this time, I wanted to change URL using trigger ui-sref or $(location) or something.

When using $(location).attr('href', url), changing URL successfully

but if I clicked browser back button, browser history did not maintain.

And also I've used window.location.href, window.location.replace but same result.

How can I maintain history in this case?

I'm ready for trying all ways of your suggestions!

.

.

PS.

If this is not enough explanation, please give me feedback.

Actually, I have no idea how to explain this more specifically. :(

And I've tried this in 'js', not 'controller'.

There was no special reason that I've done this in 'js'.

Just I thought that might be more easy way.

Thanks in advance!

.

.

UPDATE

I can change page by clicking each tabs on 'navbar'.

This works using ui-sref and perfect.

My main problem is, for example, when '.active' class is in 'menu' tab,

click 'menu' tab once again, ui-sref did not work.

So I used $location, window or something in 'js',

after this what I've gotten was 'removed history'.

I want to make page in initialized status when I clicked 'menu' tab like.

Before click tab :

/menu?page=1&offset=0&limit=10&searchKey=menu_name&searchString=pizza

After click tab :

/menu?page=1&offset=0&limit=10

One more, I'm putting ?page=1&offset=0&limit=10 into URL manually,

so what I just have to do is firing ui-sref or changing URL without removing history.

答:
Have you tried to use angular service $location?
for example:

$location.path("/main_page");

Then you maybe need to use $scope.$applyAsync();

Update (after comments below)

```<code>services.service("$way", ["$location", function ($location) {
    var self = this;
    var lastBack;            //last page where you was
    this.way = new Array();
    var LIMIT_LENGTH = 30;   //limit of route history
    var curScope = null;     //current scope
    var active = true;       //is service active

    this.step = function (path, $scope) {
        curScope = $scope;
        if (lastBack != path) {
            lastBack = null;
            this.way.push(path);
            if (this.way.length > LIMIT_LENGTH) {
                this.way.shift();
            }

        }
    }

    this.goBack = function () {
        if (active) {
            var path = back();
            lastBack = path;
            if (path != "/") {
                $location.path(path);
                curScope.$applyAsync();
            }
        }
    }

    this.setActive = function (_active) {
        active = _active;
    }

    this.refresh = function () {
        this.way = new Array();
    }

    function back() {
        if (self.way.length > 1) {
            self.way.pop();
            Log.o("WAY_BACK", self.way);
            return self.way[self.way.length - 1];
        }
    }
}]);
</code>```

Example:

```<code>$way.step("/blog", $scope);  //add page to path
$way.step("/main", $scope);  //add page to path
$way.goBack(); // now you on /blog page
</code>```

Body:
I'm using 'ui.router' and '$state.go' to redirect page,

'navbar' of my project looks like this.

             {{nav.navInfo.menu.auth_name}}

             {{nav.navInfo.picture.auth_name}}

    ...

Each page show table which has list of items first.

Let us supposed a situation.

When I am in 'menu' page, I search a keyword.

Following my code, URL changes including keyword.

For example, this works like

Before searching :

/menu?page=1&offset=0&limit=10

After searching :

/menu?page=1&offset=0&limit=10&searchKey=menu_name&searchString=pizza

.

.

Then, I click 'menu' tab in 'navbar' to get entire list again.

At this time, I wanted to change URL using trigger ui-sref or $(location) or something.

When using $(location).attr('href', url), changing URL successfully

but if I clicked browser back button, browser history did not maintain.

And also I've used window.location.href, window.location.replace but same result.

How can I maintain history in this case?

I'm ready for trying all ways of your suggestions!

.

.

PS.

If this is not enough explanation, please give me feedback.

Actually, I have no idea how to explain this more specifically. :(

And I've tried this in 'js', not 'controller'.

There was no special reason that I've done this in 'js'.

Just I thought that might be more easy way.

Thanks in advance!

.

.

UPDATE

I can change page by clicking each tabs on 'navbar'.

This works using ui-sref and perfect.

My main problem is, for example, when '.active' class is in 'menu' tab,

click 'menu' tab once again, ui-sref did not work.

So I used $location, window or something in 'js',

after this what I've gotten was 'removed history'.

I want to make page in initialized status when I clicked 'menu' tab like.

Before click tab :

/menu?page=1&offset=0&limit=10&searchKey=menu_name&searchString=pizza

After click tab :

/menu?page=1&offset=0&limit=10

One more, I'm putting ?page=1&offset=0&limit=10 into URL manually,

so what I just have to do is firing ui-sref or changing URL without removing history.

Body:
Have you tried to use angular service $location?
for example:

$location.path("/main_page");

Then you maybe need to use $scope.$applyAsync();

Update (after comments below)

services.service("$way", ["$location", function ($location) {
    var self = this;
    var lastBack;            //last page where you was
    this.way = new Array();
    var LIMIT_LENGTH = 30;   //limit of route history
    var curScope = null;     //current scope
    var active = true;       //is service active

    this.step = function (path, $scope) {
        curScope = $scope;
        if (lastBack != path) {
            lastBack = null;
            this.way.push(path);
            if (this.way.length > LIMIT_LENGTH) {
                this.way.shift();
            }

        }
    }

    this.goBack = function () {
        if (active) {
            var path = back();
            lastBack = path;
            if (path != "/") {
                $location.path(path);
                curScope.$applyAsync();
            }
        }
    }

    this.setActive = function (_active) {
        active = _active;
    }

    this.refresh = function () {
        this.way = new Array();
    }

    function back() {
        if (self.way.length > 1) {
            self.way.pop();
            Log.o("WAY_BACK", self.way);
            return self.way[self.way.length - 1];
        }
    }
}]);

Example:

$way.step("/blog", $scope);  //add page to path
$way.step("/main", $scope);  //add page to path
$way.goBack(); // now you on /blog page


问:
How to align/set/put/style two div next to each other
I have some problem with my CSS and HTML. I can't style the 2 footer items to be on the same line. Is there something wrong with how I have my divs and styles?

Suggestion to make better code is very welcome. I have tried float, inline-block.

/*footer*/
footer {
  color:white;
  background-color: #c2b180;
}
.button-social {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px 10px 20px;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}
a {
  text-decoration: none;
}
.sameline.block {
  float:left;
  width:50%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<footer>
  <div class="sameline.block">
  <div class="about-this-page">
      <h3>About this page</h3>
      <p>Made by Duy Ta</p>
  </div>
    <div class="around-the-web">
      <h3>Around the Web</h3>
       <i class="fa fa-linkedin"></i>
       <i class="fa fa-github"></i>
       <i class="fa fa-twitter"></i>
  </div>
  </div>
  <div id="footer-below">qlip ©
    <script>document.write(new Date().getFullYear())</script>. All Rights Reversed
  </div>
</footer></code>```

答:
Use flexbox on your container .sameline-block. You can then add margin and/or padding and other styles to your flex children .about-this-page and .around-the-web.

/*footer*/
footer {
  color:white;
  background-color: #c2b180;
}
.button-social {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px 10px 20px;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}
a {
  text-decoration: none;
}
.sameline-block {
  display: flex;
  flex-wrap: nowrap;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<footer>
  <div class="sameline-block">
    <div class="about-this-page">
        <h3>About this page</h3>
        <p>Made by Duy Ta</p>
    </div>
     <div class="around-the-web">
        <h3>Around the Web</h3>
         <i class="fa fa-linkedin"></i>
         <i class="fa fa-github"></i>
         <i class="fa fa-twitter"></i>
    </div>
  </div>
  <div id="footer-below">qlip ©
    <script>document.write(new Date().getFullYear())</script>. All Rights Reversed
  </div>
</footer></code>```

Body:
I have some problem with my CSS and HTML. I can't style the 2 footer items to be on the same line. Is there something wrong with how I have my divs and styles?

Suggestion to make better code is very welcome. I have tried float, inline-block.

/*footer*/
footer {
  color:white;
  background-color: #c2b180;
}
.button-social {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px 10px 20px;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}
a {
  text-decoration: none;
}
.sameline.block {
  float:left;
  width:50%;
}

 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

About this page

Made by Duy Ta

Around the Web

qlip ©
    . All Rights Reversed

Body:
Use flexbox on your container .sameline-block. You can then add margin and/or padding and other styles to your flex children .about-this-page and .around-the-web.

/*footer*/
footer {
  color:white;
  background-color: #c2b180;
}
.button-social {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px 10px 20px;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
}
a {
  text-decoration: none;
}
.sameline-block {
  display: flex;
  flex-wrap: nowrap;
}

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<footer>
  <div class="sameline-block">
    <div class="about-this-page">
        <h3>About this page</h3>
        <p>Made by Duy Ta</p>
    </div>
     <div class="around-the-web">
        <h3>Around the Web</h3>
         <a class="button-social" href="#"><i class="fa fa-linkedin"></i></a>
         <a class="button-social" href="#"><i class="fa fa-github"></i></a>
         <a class="button-social" href="#"><i class="fa fa-twitter"></i></a>
    </div>
  </div>
  <div id="footer-below">qlip ©
    <script>document.write(new Date().getFullYear())</script>. All Rights Reversed
  </div>
</footer>


问:
How do I compile C# code as a library instead of an executable?
I have a C# console application in Visual Studio 2010. It has a Main() method as well as a bunch of utility classes. I'd like those utility classes to be available to other solutions. From reading online it seems that I need to compile it as a Class Library (DLL). So here's what I did:

Went in Visual Studio to "Project > [ProjectName] Properties > Application" and changed "Output type" from "Console Application" to "Class Library"

Rebuilt; ProjectName.dll was created in bin/Debug.

Created a new Console Application

Solution Explorer > Add Reference > browse to ProjectName.DLL, select it.

However, neither IntelliSense nor the Object Browser could find the classes inside that DLL.

I tried recompiling several different Console Applications as Class Libraries and got the same result. I also noticed that it works if I initially create the solution as a Class Library, but not if I convert it to one later.

Any tips?

答:
What I've always done (since this is what you do with C++ static libraries, which is what I normally use - though I think it has some advantages for C# too) is add the class library's project to the solution, then add a reference to it in the project (or projects) that uses it.
When you go to add a reference, the list of potential references includes items from the solution, so it should be fairly obvious what to do. You should then get intellisense for your library.

One advantage of doing things this way is that if you need to edit files in the library project, it's very straightforward because they are close to hand, and the project then gets rebuilt automatically when you compile the solution.

ContentLicense: CC BY-SA 2.5

OwnerDisplayName: please delete me


问:
find the string with maximum number of lower case characters in java 8
I need to find the string with a maximum number of lowercases characters from Given List.

This is how i am currently doing

```<code>public static void main(String[] args) {

        List<String> list  = new ArrayList<>();

        list.add("Strig a with ABDD");
        list.add("STR dfd  BC dsff");

        OptionalLong max = list.stream().map(s->countLowerCase(s)).mapToLong(i->Long.valueOf(i)).max();
        System.out.println(max);

    }

    private static long countLowerCase(String inputString) {
        return inputString.chars().filter((s)->Character.isLowerCase(s)).count();
    }
</code>```

is there any better way of doing this?

答:
Yes, there is a static methods in Comparator interface which may help you to make your above code a little bit shorter:

```<code>System.out.println(list.stream()
        .max(Comparator.comparingLong(s -> s.chars().filter(Character::isLowerCase).count())).get()
        .chars().filter(Character::isLowerCase).count());
</code>```

Your output will be: 9

Body:
I need to find the string with a maximum number of lowercases characters from Given List.

This is how i am currently doing

public static void main(String[] args) {

        List<String> list  = new ArrayList<>();

        list.add("Strig a with ABDD");
        list.add("STR dfd  BC dsff");

        OptionalLong max = list.stream().map(s->countLowerCase(s)).mapToLong(i->Long.valueOf(i)).max();
        System.out.println(max);

    }

    private static long countLowerCase(String inputString) {
        return inputString.chars().filter((s)->Character.isLowerCase(s)).count();
    }

is there any better way of doing this?

Body:
Yes, there is a static methods in Comparator interface which may help you to make your above code a little bit shorter:

System.out.println(list.stream()
        .max(Comparator.comparingLong(s -> s.chars().filter(Character::isLowerCase).count())).get()
        .chars().filter(Character::isLowerCase).count());

Your output will be: 9


问:
Code formatting in Visual Studio Code is not working on C# code
This question already has an answer here: How do you format code in Visual Studio Code?

All the answers provided in this question are not working with C# code.

I just copied my controller file and opened it in Visual Studio Code. I tried to format code with Shift + Alt + F (both right and left shifts in windows)

But it didn't work.

Is there a solution for this?

The same shortcut is working for HTML and JavaScript files.

答:
In my case the problem was related with the code formatting extension.

I was using C# for "Visual Studio Code (powered by OmniSharp)" (ms-vscode.csharp) extension for formatting. However, after a while the "format document" context menu has gone missing. And the key combination for formatting "Shift+Alt+F" stopped working.

After some research I have found that there is a new extension called "C# FixFormat" (Leopotam.csharpfixformat) for formatting C# documents which says in their description: "there is bug in omnisharp and they are fixing the issue temporarily".

After installing "C# FixFormat" extension I can now format documents again.

ContentLicense: CC BY-SA 4.0


答:
You have to specify float for right elements also</p>

```<code>#footer-below {float: right; width: 50%;}
</code>```

Title: How to align/set/put/style two div next to each other

Body:
You have to specify float for right elements also

#footer-below {float: right; width: 50%;}


答:
A class name can't contain a dot.

So change it to for example samelineblock

Then select the divs that are a direct child of that element and give them an inline-block.

You can adjust the width by setting it.

/*footer*/

footer {
  color: white;
  background-color: #c2b180;
}

.button-social {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px 10px 20px;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

a {
  text-decoration: none;
}

.samelineblock>div {
  display: inline-block;
  width: 40%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<footer>
  <div class="samelineblock">
    <div class="about-this-page">
      <h3>About this page</h3>
      <p>Made by Duy Ta</p>
    </div>
    <div class="around-the-web">
      <h3>Around the Web</h3>
      <i class="fa fa-linkedin"></i>
      <i class="fa fa-github"></i>
      <i class="fa fa-twitter"></i>
    </div>
  </div>
  <div id="footer-below">qlip ©
    <script>
      document.write(new Date().getFullYear())
    </script>. All Rights Reversed
  </div>
</footer></code>```

Body:
A class name can't contain a dot.

So change it to for example samelineblock

Then select the divs that are a direct child of that element and give them an inline-block.

You can adjust the width by setting it.

/*footer*/

footer {
  color: white;
  background-color: #c2b180;
}

.button-social {
  background-color: #4CAF50;
  color: white;
  padding: 10px 20px 10px 20px;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

a {
  text-decoration: none;
}

.samelineblock>div {
  display: inline-block;
  width: 40%;
}

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<footer>
  <div class="samelineblock">
    <div class="about-this-page">
      <h3>About this page</h3>
      <p>Made by Duy Ta</p>
    </div>
    <div class="around-the-web">
      <h3>Around the Web</h3>
      <a class="button-social" href="#"><i class="fa fa-linkedin"></i></a>
      <a class="button-social" href="#"><i class="fa fa-github"></i></a>
      <a class="button-social" href="#"><i class="fa fa-twitter"></i></a>
    </div>
  </div>
  <div id="footer-below">qlip ©
    <script>
      document.write(new Date().getFullYear())
    </script>. All Rights Reversed
  </div>
</footer>


问:
How to adjust QTextEdit to fit it's contents
I'm developing a Qt Application and I'm trying to find a way to use QTextEdit as a label with long text without the scroll bar. In my ui I have a QScrollArea and inside of it I want to place a couple off QTextEdit widgets and I only want use scrolling inside QScrollArea. Problem is that no matter how I try to resize the QTextEdit it seems it has a maximum height and cuts of text, even if I set the size manually and QTextEdit::size returns the correct value.

I did the same thing with QLabel and it works fine, but in this case I need some methods that are only provided in QTextEdit.

I found this post:
Resizing QT's QTextEdit to Match Text Height: maximumViewportSize()

And the answer given was the following:

I have solved this issue. There were 2 things that I had to do to get
  it to work:

Walk up the widget hierarchy and make sure all the size policies made
  sense to ensure that if any child widget wanted to be big/small, then
  the parent widget would want to be the same thing.

This is the main
  source of the fix. It turns out that since the QTextEdit is inside a
  QFrame that is the main widget in a QScrollArea, the QScrollArea has a
  constraint that it will not resize the internal widget unless the
  "widgetResizable" property is true. The documentation for that is
  here: http://doc.qt.io/qt-4.8/qscrollarea.html#widgetResizable-prop.
  The documentation was not clear to me until I played around with this
  setting and got it to work. From the docs, it seems that this property
  only deals with times where the main scroll area wants to resize a
  widget (i.e. from parent to child). It actually means that if the main
  widget in the scroll area wants to ever resize (i.e. child to parent),
  then this setting has to be set to true. So, the moral of the story is
  that the QTextEdit code was correct in overriding sizeHint, but the
  QScrollArea was ignoring the value returned from the main frame's
  sizeHint.

The problem is that I have no idea how to access the QTextEdit's QScrollArea to enable widgetResizable. Can anyone explain how I can achieve this or suggest a different way of resizing QTextEdit to perfectly fit it's content?

答:
In ui i defined QTextEdit *textEdit object. I write it as height scalable-content :

```<code>int count = 0;
QString str = "";

// set textEdit text
ui->textEdit->setText("hfdsf\ncsad\nfsc\dajkjkjkjhhkdkca\n925");
str = ui->textEdit->toPlainText();

for(int i = 0;i < str.length();i++)
    if(str.at(i).cell() == '\n')
        count++;

// resize textEdit (width and height)
ui->textEdit->resize(ui->textEdit->fontMetrics().width("this is the max-length line in qlabel")
         , ui->textEdit->fontMetrics().height() * (count + 2));
</code>```

Notice : this work if you change QTextEdit font face or size! just in height scalable (before every thing set your QTextEdit frameShape to BOX).

if you want do width scalable-content, you should do these steps :

read QTextEdit(textEdit object) text as line to line

calculate every line length

select maximum of line length

use of QTextEdit::fontMetrics().width(QString str) for investigate str size in width

I hope this can help you...

Body:
In ui i defined QTextEdit *textEdit object. I write it as height scalable-content :

int count = 0;
QString str = "";

// set textEdit text
ui->textEdit->setText("hfdsf\ncsad\nfsc\dajkjkjkjhhkdkca\n925");
str = ui->textEdit->toPlainText();

for(int i = 0;i < str.length();i++)
    if(str.at(i).cell() == '\n')
        count++;

// resize textEdit (width and height)
ui->textEdit->resize(ui->textEdit->fontMetrics().width("this is the max-length line in qlabel")
         , ui->textEdit->fontMetrics().height() * (count + 2));

Notice : this work if you change QTextEdit font face or size! just in height scalable (before every thing set your QTextEdit frameShape to BOX).

if you want do width scalable-content, you should do these steps :

read QTextEdit(textEdit object) text as line to line

calculate every line length

select maximum of line length

use of QTextEdit::fontMetrics().width(QString str) for investigate str size in width

I hope this can help you...


答: You are accessing 420 rows by primary key which will probably lead to an index access path. This could access 2 index pages and one data page per key. If these are in cache, the query should run fast. If not, every page access that goes to disk will incur the usual disk latency. If we assume 5ms disk latency and 80% cache hits, we arrive at 420*3*0.2*5ms=1.2 seconds which is on the order of what you're seeing.</p>

Title: MySQL Query IN() Clause Slow on Indexed Column

Body:
I Have a MySQL query that is being generated by a PHP script, the query will look something like this:

SELECT * FROM Recipe_Data WHERE 404_Without_200 = 0 AND Failures_Without_Success = 0 AND RHD_No IN (10, 24, 34, 41, 43, 51, 57, 59, 61, 67, 84, 90, 272, 324, 402, 405, 414, 498, 500, 501, 510, 559, 562, 595, 632, 634, 640, 643, 647, 651, 703, 714, 719, 762, 765, 776, 796, 812, 814, 815, 822, 848, 853, 855, 858, 866, 891, 920, 947, 956, 962, 968, 1049, 1054, 1064, 1065, 1070, 1100, 1113, 1119, 1130, 1262, 1287, 1292, 1313, 1320, 1327, 1332, 1333, 1335, 1340, 1343, 1344, 1346, 1349, 1352, 1358, 1362, 1365, 1482, 1495, 1532, 1533, 1537, 1549, 1550, 1569, 1571, 1573, 1574, 1596, 1628, 1691, 1714, 1720, 1735, 1755, 1759, 1829, 1837, 1844, 1881, 1919, 2005, 2022, 2034, 2035, 2039, 2054, 2076, 2079, 2087, 2088, 2089, 2090, 2091, 2092, 2154, 2155, 2156, 2157, 2160, 2162, 2164, 2166, 2169, 2171, 2174, 2176, 2178, 2179, 2183, 2185, 2186, 2187, 2201, 2234, 2236, 2244, 2245, 2250, 2255, 2260, 2272, 2280, 2281, 2282, 2291, 2329, 2357, 2375, 2444, 2451, 2452, 2453, 2454, 2456, 2457, 2460, 2462, 2464, 2465, 2467, 2468, 2469, 2470, 2473, 2474, 2481, 2485, 2487, 2510, 2516, 2519, 2525, 2540, 2545, 2547, 2553, 2571, 2579, 2580, 2587, 2589, 2597, 2602, 2611, 2629, 2660, 2662, 2700, 2756, 2825, 2833, 2835, 2858, 2958, 2963, 2964, 3009, 3090, 3117, 3118, 3120, 3121, 3122, 3123, 3126, 3127, 3129, 3130, 3133, 3135, 3137, 3138, 3139, 3141, 3142, 3145, 3146, 3147, 3151, 3152, 3155, 3193, 3201, 3204, 3219, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3231, 3232, 3233, 3234, 3235, 3237, 3239, 3246, 3250, 3253, 3259, 3261, 3291, 3315, 3328, 3377, 3381, 3383, 3384, 3385, 3387, 3388, 3389, 3390, 3396, 3436, 3463, 3465, 3467, 3470, 3471, 3484, 3507, 3515, 3554, 3572, 3641, 3672, 3683, 3689, 3690, 3692, 3693, 3694, 3697, 3698, 3705, 3711, 3713, 3715, 3716, 3717, 3719, 3720, 3722, 3726, 3727, 3732, 3737, 3763, 3767, 3770, 3771, 3772, 3773, 3803, 3810, 3812, 3816, 3846, 3847, 3848, 3851, 3874, 3882, 3902, 3903, 3906, 3908, 3916, 3924, 3967, 3987, 4006, 4030, 4043, 4045, 4047, 4058, 4067, 4107, 4108, 4114, 4115, 4131, 4132, 4133, 4137, 4138, 4139, 4140, 4141, 4142, 4146, 4150, 4151, 4152, 4153, 4157, 4158, 4160, 4163, 4166, 4167, 4171, 4179, 4183, 4221, 4225, 4242, 4257, 4435, 4437, 4438, 4443, 4446, 4449, 4450, 4451, 4452, 4454, 4460, 4550, 4557, 4618, 4731, 4775, 4804, 4972, 5025, 5026, 5039, 5042, 5294, 5578, 5580, 5599, 5602, 5649, 5726, 5779, 5783, 5931, 5934, 5936, 5939, 5940, 5941, 5978, 6044, 6056, 6113, 6116, 6118, 6122, 6123, 6125, 6127, 6128, 6129, 6130, 6131, 6135, 6141, 6145, 6147, 6150, 6152, 6153, 6154, 6160, 6166, 6169);

The column RHD_No is the primary key for this database, and there are about 400,000 rows total. The problem is, the query is extremely slow, it's often around 2 seconds, but I've seen it get as long as 10.

When I try to explain the query, everything seems like it should be fine:

+----+-------------+-------------+-------+---------------+---------+---------+------+------+-------------+
| id | select_type | table       | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
+----+-------------+-------------+-------+---------------+---------+---------+------+------+-------------+
|  1 | SIMPLE      | Recipe_Data | range | PRIMARY       | PRIMARY | 4       | NULL |  420 | Using where |
+----+-------------+-------------+-------+---------------+---------+---------+------+------+-------------+

When I profile the query I get:

mysql> show profile;
+--------------------------------+----------+
| Status                         | Duration |
+--------------------------------+----------+
| starting                       | 0.000015 |
| checking query cache for query | 0.000266 |
| Opening tables                 | 0.000009 |
| System lock                    | 0.000004 |
| Table lock                     | 0.000006 |
| init                           | 0.000115 |
| optimizing                     | 0.000038 |
| statistics                     | 0.000797 |
| preparing                      | 0.000047 |
| executing                      | 0.000002 |
| Sending data                   | 2.675270 |
| end                            | 0.000007 |
| query end                      | 0.000003 |
| freeing items                  | 0.000071 |
| logging slow query             | 0.000002 |
| logging slow query             | 0.000058 |
| cleaning up                    | 0.000005 |
+--------------------------------+----------+

I've been working on this problem for a long time and I haven't been able to find a solution. Is there anything overtly wrong with this query? I don't see how looking at 420 rows should take 2+ seconds.


问:
laravel APi resource Call to undefined method Illuminate\Database\Query\Builder::mapInto()
i have Post and User model with one to one relation and it works good:

```<code>//User.php

public function post(){
    return $this->hasOne(Post::class);
}

// Post.php

public function user() {
    return $this->belongsTo(User::class);
}
</code>```

now i create API resources:

```<code>php artisan make:resource Post
php artisan make:resource User
</code>```

I need to return all post with an api call then i set my route:

```<code>//web.php: /resource/posts

Route::get('/resource/posts', function () {
    return PostResource::collection(Post::all());
});
</code>```

this is my Posts resource class:

```<code><?php

namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
use App\Http\Resources\User as UserResource;

class Posts extends Resource
{
/**
 * Transform the resource into an array.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function toArray($request)
{
      return [
        'id' => $this->id,
        'title' => $this->title,
        'slug' => $this->slug,
        'bodys' => $this->body,
        'users' => UserResource::collection($this->user),
        'published' => $this->published,
        'created_at' => $this->created_at,
        'updated_at' => $this->updated_at,
    ];

}
}
</code>```

this is the error:

```<code>Call to undefined method Illuminate\Database\Query\Builder::mapInto()
</code>```

if i remove:

```<code>'users' => UserResource::collection($this->user),
</code>```

it's work but i need to include relations in my api json, i have read and followed the doc at https://laravel.com/docs/5.5/collections.

this is my User resource class:

```

```namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class User extends Resource
{
/**
 * Transform the resource into an array.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function toArray($request)
{
   return [
       'user_id' => $this->user_id,
       'name' => $this->name,
       'lastname' => $this->lastname,
       'email' => $this->email
   ];
}
}
```

any ideas where am i wrong?

答:
The problem is that you use UserResource::collection($this->user) and you have just one element not a collection so you can replace it with new UserResource($this->user) like this :

```<code>return [
    'id' => $this->id,
    'title' => $this->title,
    'slug' => $this->slug,
    'bodys' => $this->body,
    'users' => new UserResource($this->user),
    'published' => $this->published,
    'created_at' => $this->created_at,
    'updated_at' => $this->updated_at,
];
</code>```

Body:
i have Post and User model with one to one relation and it works good:

//User.php

public function post(){
    return $this->hasOne(Post::class);
}

// Post.php

public function user() {
    return $this->belongsTo(User::class);
}

now i create API resources:

php artisan make:resource Post
php artisan make:resource User

I need to return all post with an api call then i set my route:

//web.php: /resource/posts

Route::get('/resource/posts', function () {
    return PostResource::collection(Post::all());
});

this is my Posts resource class:

<?php

namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
use App\Http\Resources\User as UserResource;

class Posts extends Resource
{
/**
 * Transform the resource into an array.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function toArray($request)
{
      return [
        'id' => $this->id,
        'title' => $this->title,
        'slug' => $this->slug,
        'bodys' => $this->body,
        'users' => UserResource::collection($this->user),
        'published' => $this->published,
        'created_at' => $this->created_at,
        'updated_at' => $this->updated_at,
    ];

}
}

this is the error:

Call to undefined method Illuminate\Database\Query\Builder::mapInto()

if i remove:

'users' => UserResource::collection($this->user),

it's work but i need to include relations in my api json, i have read and followed the doc at https://laravel.com/docs/5.5/collections.

this is my User resource class:

```

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class User extends Resource
{
/**
 * Transform the resource into an array.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function toArray($request)
{
   return [
       'user_id' => $this->user_id,
       'name' => $this->name,
       'lastname' => $this->lastname,
       'email' => $this->email
   ];
}
}

any ideas where am i wrong?

Body:
The problem is that you use UserResource::collection($this->user) and you have just one element not a collection so you can replace it with new UserResource($this->user) like this :

return [
    'id' => $this->id,
    'title' => $this->title,
    'slug' => $this->slug,
    'bodys' => $this->body,
    'users' => new UserResource($this->user),
    'published' => $this->published,
    'created_at' => $this->created_at,
    'updated_at' => $this->updated_at,
];


问:
Upload IMessage Extension
We already publish the IOS application, Now we want to publish its message extension. Is this possible ? .If yes then How? Additional question is that how to upload separate iMessage extensions. what are the steps?
Any help would be appreciated. Thanks in advance. </p>

答:
Is this possible ?

Sure

How?

Add new extension to your exist project and share it to iTunes. In the new build it will be appear.

what are the steps?

There are a lot of tutorials about creation of iMessage extension. Try to use them. In several words: link

Check this link too - iMessage integration to your app

upload iMessage app seperatly

iMessage applications can be developed and distributed in two ways:

As an extension to an existing application:

create other project add new iMessage extension there.

customize your project scheme and target settings inside one app. In both cases you should generate new certificates and profiles if you want to share it separately

As an extension which is an independent application

Title: Upload IMessage Extension


问:
This.props returning undefined?
I'm currently passing data into my component via props, and for some reason it's showing up as undefined.
From my parent component perspective I have the following pass 2 props, data and header.

```<code>class ContractTable extends Component {
constructor(props) {
    super(props);
    this.state = {
        data: []
    };
}

render() {
    return (
        <div>
            <p></p>
            <MuiThemeProvider>
                <TableTest
                    data={this.state.data}
                    header={[
                        {
                            name: "First Name",
                            prop: "firstName"
                        },
                        {
                            name: "Last Name",
                            prop: "lastName"
                        },
                        {
                            name: "Age",
                            prop: "age"
                        },
                        {
                            name: "Height",
                            prop: "height"
                        },
                        {
                            name: "Address",
                            prop: "address"
                        }
                    ]}
                />
            </MuiThemeProvider>
            <p></p>
        </div>
    );
}
</code>```

I try to grab the props and set it as my state, but when I log this.props.data or this.props.header it returns undefined. Why is this?

```<code>import React, { Component } from 'react';
import {
Table,
TableBody,
TableHeader,
TableHeaderColumn,
TableRow,
TableRowColumn,
} from 'material-ui/Table';

class TableTest extends Component {
constructor(props) {
    super(props);

    this.state = {
        data: props.data,
        header: props.header
    }

    this.row = this.row.bind(this);
}

row = (currentValue, index, header) => (
    <TableRow key={`t-${index}`}>
        {
            header.map((headerName, index) => (
                <TableRowColumn key={`trc-${index}`}>
                    {currentValue[headerName.prop]}
                </TableRowColumn>
            ))
        }
    </TableRow>
);

render() {
    return 'hello'
}
}

export default TableTest;
</code>```

答: Its an antipattern to set a state that is directly derivable from props, you would rather use the props directly. Also if you use the props to set state and you need to update state based on props change, you would also need to implement componentWillReceiveProps function

Title: This.props returning undefined?

Body:
I'm currently passing data into my component via props, and for some reason it's showing up as undefined.
From my parent component perspective I have the following pass 2 props, data and header.

class ContractTable extends Component {
constructor(props) {
    super(props);
    this.state = {
        data: []
    };
}

render() {
    return (

            <MuiThemeProvider>
                <TableTest
                    data={this.state.data}
                    header={[
                        {
                            name: "First Name",
                            prop: "firstName"
                        },
                        {
                            name: "Last Name",
                            prop: "lastName"
                        },
                        {
                            name: "Age",
                            prop: "age"
                        },
                        {
                            name: "Height",
                            prop: "height"
                        },
                        {
                            name: "Address",
                            prop: "address"
                        }
                    ]}
                />
            </MuiThemeProvider>

    );
}

I try to grab the props and set it as my state, but when I log this.props.data or this.props.header it returns undefined. Why is this?

import React, { Component } from 'react';
import {
Table,
TableBody,
TableHeader,
TableHeaderColumn,
TableRow,
TableRowColumn,
} from 'material-ui/Table';

class TableTest extends Component {
constructor(props) {
    super(props);

    this.state = {
        data: props.data,
        header: props.header
    }

    this.row = this.row.bind(this);
}

row = (currentValue, index, header) => (
    <TableRow key={`t-${index}`}>
        {
            header.map((headerName, index) => (
                <TableRowColumn key={`trc-${index}`}>
                    {currentValue[headerName.prop]}
                </TableRowColumn>
            ))
        }
    </TableRow>
);

render() {
    return 'hello'
}
}

export default TableTest;