Appropriate languages and best learning resources for Android/Server database use case [on hold]

and thnx in advance for a recommendation, sorry if being repetitive, but it’s a first question (if that’s an excuse).

I want to use a server side Db, got a 000webhost account as a possible starting point, there is a mysql server with
MariaDb/Innodb. I want to build a Db and manipulate data.

At the front end I would like just java/Android, with computing of the data here for easy testing different formula/computations. I just started learning…
Also a non-browser user interface with input/results would be here.

As a backend, as I would interpretate some comments around so far, I would need a backend in ? Javascript? to hide DB login/interns from the world.

Now what would be easoest to choose for that? Are there resources dealing with that use case (books/pdf)?
I’m in search for a good starting point for that specific case (if e.g. some of the code runs on server side, it’s of course also ok, but I’d like an as standard and all world supported and easy implementation as possible).

Last one, for recommendations, approach from (20 years ago) pascal, signal processor programming, Visual studio Basic/C++.

Thnx in advance!

Typemapping unsigned long long * on swig

I’m doing some work on trying to typemap unsigned long long * to a long[].

Here is the current binding: %apply long[] {unsigned long long *};

This gives me an issues when passing it a null array, but that’s exactly what I want to do.

Documentation for the swig project is kind of long and convoluted.

In Java how to view the payload string when making http calls using HttpEntity with restTemplate.exchange

At work we are using the following method to make Http calls to a service

public final T create(final T resource, final String username, final String password) {
    HttpHeaders writeHeaders = writeHeaders();
    HttpEntity< T > httpEntity = new HttpEntity< T >( resource, writeHeaders );
    final ResponseEntity< Void > responseEntity = restTemplate.exchange( getURI(), HttpMethod.POST, new HttpEntity< T >( resource, writeHeaders ), Void.class );

At some point restTemplate marshals the resource to send it across the network. I want to marshal the resource before the Http call is made for troubleshooting and logging purposes.

Please advise how.

Convert integer to binary and print the sum of the digits

The code below is supposed to take a integer convert it to binary and print the sum of the digits. Can you please explain to me what I am doing wrong?

import java.util.*;
import java.io.*;
import java.math.*;


class Solution {

public static void main(String args[]) {
    Scanner in = new Scanner(System.in);
    int X = in.nextInt();
    String binary = Integer.toBinaryString(X);   
    int amount = 0;  
    String input = Integer.toString(X);

  for(int b = 0; b < binary.length(); b++){

  if (binary.charAt(b) == 1){
      amount++;
      //System.err.println(binary.charAt(b));
  }


  }
    System.out.println(amount);

}
}

How to get a specific method from an implementation of an interface type, which the interface doesn’t provide?

I use a common interface which doesn’t provide a method from an implementation class. I don’t want to instantiate the concrete implementation, but still need to use this method.

Concrete question: How to make the specialMethod() available?

Interface:

public interface Filter {
    void commonMethod();
}

Implementation:

public class IpFilter implements Filter {
    @Override
    public void commonMethod() {
    }

    public void specialMethod() {
    }
}

Container class:

public class Manager {

    private final Filter filter = new IpFilter();

    public Filter getFilter() {
        return this.filter;
    }
}

Caller class:

public static void main(final String[] args) {
    final Manager manager = new Manager();
    manager.getFilter().commonMethod();
    manager.getFilter().specialMethod(); // METHOD NOT AVAILABLE
}

App installation

I made app with min sdk version15 and test it on my phone with android 6 but in another phone with android 4.4.1 or 5 l cant install it.l really don’t know what l should do to fix my app please
Please help me

AltBeacon not detect Micropchip rn4870 beacon, detect only iBeacons

I use Android Beacon Library AltBeacon. Not detect Microchip rn4870, shows only iBeacons. I use these BeaconParsers to detect all beacons around. Can someone explain how can i detect Microchip rn4870.

    beaconManager = BeaconManager.getInstanceForApplication(this);
    // To detect proprietary beacons, you must add a line like below corresponding to your beacon
    // type.  Do a web search for "setBeaconLayout" to get the proper expression.

    ArrayList<BeaconParser> parsers = new ArrayList<>();

    parsers.add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
    parsers.add(new BeaconParser().setBeaconLayout("x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15"));
    parsers.add(new BeaconParser().setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19"));
    parsers.add(new BeaconParser().setBeaconLayout("s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20v"));
    parsers.add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
    parsers.add(new BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_UID_LAYOUT));
    parsers.add(new BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT));
    parsers.add(new BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT));
    parsers.add(new BeaconParser().setBeaconLayout(BeaconParser.URI_BEACON_LAYOUT));
    parsers.add(new BeaconParser().setBeaconLayout(BeaconParser.ALTBEACON_LAYOUT));

    beaconManager.getBeaconParsers().addAll(parsers);
    beaconManager.bind(this);

I have two ArrayList a Supplier and a Product and I would like to add specific products to a supplier but not the entire product list

public static ArrayList supProducts = new ArrayList();
public static ArrayList supList = new ArrayList();

static Product product001 = new Product(12345,"Tesla","X",120000,true);
static  Product product002 = new Product(12346,"Dell","Xps 13",1200,true);
static Product product003 = new Product(12347,"Apple","Iphone X",1000,true);

static  Address address001 = new Address(78,"Malone Road","Belfast","BT9 5BW", "Northern Ireland");
static  Address address002 = new Address(95,"Lisburn Road", "Belfast", "BT1 9GA","Northern Ireland");
static  Address address003 = new Address(10500, "N De Anza Blvd", "Cupertino","95014", "USA");

static Supplier supplier001 = new Supplier(111333,"Tesla", address003, SupRegion.OUTSIDE_EU, supProducts);
static Supplier supplier002 = new Supplier(111333,"Dell", address002, SupRegion.UNIITED_KINGDOM, supProducts);
static Supplier supplier003 = new Supplier(111333,"Apple", address001, SupRegion.EUROPE, supProducts);

// and I would like to add only just product001 to supplier001 and so on and to print out all products grouped by their supplier. I would like to ask your help guys.

Error Using Length() Method in Array Within a For Loop

I created an array within a for loop to generate the cube of 1-9 in descending order. My code appears to work as I am able to run it without any syntax or runtime errors. However, whenever I try to use the length() method in my for loop, I get an “array out of bounds exception”.

Here is my code without the length() method:

/**
 * This method prints out a cubes from one to nine in descending order
 */
public static void cubes()
{
    // create a fixed length array and hard code index number
    int[] values = new int[9];
    values[0] = 1;
    values[1] = 2;
    values[2] = 3;
    values[3] = 4;
    values[4] = 5;
    values[5] = 6;
    values[6] = 7;
    values[7] = 8;
    values[8] = 9;
    // Create variable to store cubed numbers
    double cubedNumber = 0;
    // Create for loop to run the array from 1-9 in descending order
    for (int counter = 8; counter > 0; counter--)
    {
        cubedNumber = Math.pow(values[counter], 3);
        System.out.println(values[counter] + " cubed is " + cubedNumber);
    }
}

This is my code using the length() method:

/**
 * This method prints out a cubes from one to nine in descending order
 */
public static void cubes()
{
    // create a fixed length array and hard code index number
    int[] values = new int[9];
    values[0] = 1;
    values[1] = 2;
    values[2] = 3;
    values[3] = 4;
    values[4] = 5;
    values[5] = 6;
    values[6] = 7;
    values[7] = 8;
    values[8] = 9;
    // Create variable to store cubed numbers
    double cubedNumber = 0;
    // Create for loop to run the array from 1-9 in descending order
    for (int counter = 8; counter <= values.length; counter--)
    {
        cubedNumber = Math.pow(values[counter], 3);
        System.out.println(values[counter] + " cubed is " + cubedNumber);
    }
}

Which gives me the following error: “java.lang.ArrayIndexOutOfBoundsException: -1
at arraysPractice.cubes(arraysPractice.java:31)” I’m required to use the length method in my for loop. Am I using the length() method incorrectly? In both instances, the program still generates the cubes per this output

java google speech api syncRecognize not returning

I’m having a problem with the google speech cloud java library.
On my desktop computer everything is working fine, but when I run the same code on my linux machine the syncRecognize Method does not return. No errors are thrown.
I did set the authentication up the same way and double checked that the environment variable is set correctly.
Is there a way to enable verbose output for the speech api, so I can get a better idea what’s going on?