Categories
discuss

Internal test track set as inactive on Google Play Console

I uploaded and published an app for internal testing, yet the play store console shows it as inactive. It also is not showing up on the App Store even though my email is included as a tester, and I’ve clicked the opt-in link, which tells me to download it on the store, but it is not on the store.

Is there a step I am missing or a way to activate the track?

Edit: Been over a couple weeks now, the track is still inactive – so clearly its not just about waiting… Is there something else I can do?

enter image description here

Answer

For me the solution was to add at least one country for the live release / production track (however, in my case there’s no live release published yet). It seems that this setting is used for the inner testing release as well, no matter you have any live releases or not. It may be true for other settings that you can only set for the live release (like category, etc.).

Check your list of countries your app is available in. If you can find only dashes in each country’s row, try selecting at lease one country.

Categories
discuss

Elasticsearch: could not find java in bundled jdk at …/jdk/bin/java

When I try to run .bin/elasticsearch, I get the following error:

could not find java in bundled jdk at /home/ubuntu/Elastic Search/elasticsearch-7.8.0/jdk/bin/java

I have absolutely no idea what’s going on. I know this topic has been created before, but I haven’t found a way to fix. For java -version I get:

openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

Can anyone help me please? Thank you!

Answer

The most probable reason for the above error is that JAVA_HOME is not set

  1. To display JAVA_HOME variable path, run this command echo $JAVA_HOME

If nothing appears then follow the below steps:

  1. To see all the java versions installed in Ubuntu, use this command:

sudo update-alternatives --config java

  1. Set your java path using this. – export JAVA_HOME=<YOUR-JAVA-PATH>
Categories
discuss

Combining two lists to make a unique list (based on certain field logic)

I have a specific problem I am trying to solve, and need some assistance with.

I have a POJO with three fields:

  • ID
  • Date
  • Weighted Number

This POJO can be populated from the DB or an external endpoint and will return a list of said POJO. Now we end up with two seperate lists with similar infomation. These lists will be unordered and varying in size (sometimes empty).

How can I combine these two lists to create a single unique list based on the ID?

  • If the IDs are the same, choose the one which has the latest date
  • If the IDs and dates are the same, choose the one with the higher weighted number
  • If all are the same, it doesn’t matter – choose either.

My solution is very cumbersome and ugly to read – it involved two nested loops and 3 pairs of if-else statements. Is there a better way, more efficient way of doing it.

Here is some sample code:

import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class Scrap2 {

    public static void main(String[] args) {

        MyEntity one = new MyEntity("A", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 10);
        MyEntity two = new MyEntity("B", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 10);
        MyEntity three = new MyEntity("C", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 10);
        MyEntity four = new MyEntity("D", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 10);

        List<MyEntity> listOne = Arrays.asList(one, two, three, four);

        MyEntity aaa = new MyEntity("A", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 10);
        MyEntity bbb = new MyEntity("B", new Date(2020 - 1900, Calendar.OCTOBER, 25), 20);
        MyEntity ccc = new MyEntity("D", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 20);
        MyEntity ddd = new MyEntity("E", new Date(2020 - 1900, Calendar.SEPTEMBER, 25), 20);

        List<MyEntity> listTwo = Arrays.asList(aaa, bbb, ccc, ddd);

        for (MyEntity listItem : combineTwoLists(listOne, listTwo)) {
            System.out.println(listItem);
        }

    }

    private static List<MyEntity> combineTwoLists(List<MyEntity> listOne, List<MyEntity> listTwo) {
       
        return Arrays.asList(listOne.get(0), listTwo.get(1), listOne.get(2), listTwo.get(2), listTwo.get(3));
    }
}


class MyEntity {

    private final String id;
    private final Date date;
   private final Integer weightedNumber;

    public MyEntity(String id, Date date, Integer weightedNumber) {
        this.id = id;
        this.date = date;
        this.weightedNumber = weightedNumber;
    }

    @Override
    public String toString() {
        return "MyEntity{" +
                "id='" + id + ''' +
                ", date=" + date +
                ", weightedNumber=" + weightedNumber +
                '}';
    }

    public String getId() {
        return id;
    }

    public Date getDate() {
        return date;
    }

    public Integer getWeightedNumber() {
        return weightedNumber;
    }
}

The output should be something like this (can be unordered/unsorted):

MyEntity{id='A', date=Fri Sep 25 2020, weightedNumber=10} 
MyEntity{id='B', date=Sun Oct 25 2020, weightedNumber=20} 
MyEntity{id='C', date=Fri Sep 25 2020, weightedNumber=10} 
MyEntity{id='D', date=Fri Sep 25 2020, weightedNumber=20} 
MyEntity{id='E', date=Fri Sep 25 2020, weightedNumber=20}

Answer

You can join both lists first then get the max by date then weightedNumber using Comparator with BinaryOperator.maxBy for the same id to create a map using Collectors.toMap.Then takes the value of the map in new ArrayList.

return new ArrayList<MyEntity>(
    Stream.concat(listOne.stream(), listTwo.stream())
          .collect(Collectors.toMap(MyEntity::getId, Function.identity(),
                   BinaryOperator.maxBy(Comparator.comparing(MyEntity::getDate)
                                          .thenComparing(MyEntity::getWeightedNumber))))
          .values());
Categories
discuss

How to format a Date with Luxon?

With moment.js, you can format a date this way:

const date = moment("2010-10-22T21:38:00");
const data = date.format("LL - LT") 
console.log(data)
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.0/moment.min.js" integrity="sha512-Izh34nqeeR7/nwthfeE0SI3c8uhFSnqxV0sI9TvTcXiFJkMd6fB644O64BRq2P/LA/+7eRvCw4GmLsXksyTHBg==" crossorigin="anonymous"></script>

How to do the same thing with Luxon? I’ve tried:

const date = luxon.DateTime.fromISO("2010-10-22T21:38:00" );
const data = luxon.DateTime.fromFormat(date, "DATETIME_SHORT")
// output => script error
<script src="https://cdn.jsdelivr.net/npm/luxon@1.25.0/build/global/luxon.min.js"></script>

Answer

const date = DateTime.fromISO("2010-10-22T21:38:00")
const humanReadable = date.toLocaleString(DateTime.DATETIME_MED);

console.log(humanReadable); // =>  October 22, 9:38 PM

Source: https://github.com/moment/luxon/blob/master/docs/formatting.md

You can read more about the possible formats here: https://github.com/moment/luxon/blob/master/docs/formatting.md#the-basics

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..