【发布时间】:2022-08-09 18:59:50
【问题描述】:
将发布请求发送到 Spring Boot 数据库。
错误信息是 E/ERROR: java.io.IOException: 不允许到本地主机的明文 HTTP 流量
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
JSONObject newUserJsonObject = new JSONObject();
try {
newUserJsonObject.put(\"email\", email.getText().toString());
newUserJsonObject.put(\"password\", password.getText().toString());
newUserJsonObject.put(\"kanton\", kanton.toString());
int intAge = Integer.parseInt(age.getText().toString());
newUserJsonObject.put(\"age\", intAge);
} catch (JSONException e) {
Log.e(\"ERROR\", e.getMessage());
}
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, newUserJsonObject, response -> openLoginActivity(), error -> Log.e(\"ERROR\", error.getMessage()));
queue.add(jsonObjectRequest);
}else
//incorrect
Toast.makeText(RegisterActivity.this, \"WRONG DATA\", Toast.LENGTH_SHORT).show();
}
});
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
toLogin.setOnClickListener(v -> openLoginActivity());
和
此帖子已隐藏。您在 3 小时前删除了此帖子。 我想在查询中获取属性的平均值,但只获取 Last 360 数据的平均值
我的查询是
@Query(nativeQuery = true, value = \"SELECT AVG(m.temperature), AVG(m.eCO2), AVG(m.humidity), AVG(m.pressure) FROM Measures as m join Devices d on devices_id = d.id where d.id = :devicesId order by m.id desc LIMIT 360\")
列出 findAverageFromTodayByUserId(@Param(\"devicesId\") int devicesId); 该代码在没有平均功能的情况下工作
@Query(value = \"SELECT * FROM Measures as m join Devices d on devices_id = d.id where d.id = :devicesId order by m.id desc LIMIT 360\", nativeQuery = true)
列出 findAllFromTodayByUserId(@Param(\"devicesId\") int devicesId);
public static void main(String[] args) {
int num2 = --num1;
Test test = new Test();
System.out.println(num2 + \" \" + num1 + \" \" + num1++ + \" \" + num1 + \" \" + (9 % 1));
System.out.println(test instanceof Test);
System.out.println(32 << 8); // left * binary digit of right + 1
System.out.println(8192 >> 8); // left / binary digit of right + 1
System.out.println(~9); // -1*value -1
// -> filter and Runnable. lambda function
Runnable r = () -> {
System.out.println(\"Thread is running...\");
};
Thread t2 = new Thread(r);
t2.start();
System.out.println((byte) (Byte.MAX_VALUE + 1));
String string = \"hello world bye moon\", stringTwo;
String[] newStringArray;
newStringArray = string.split(\" \");
stringTwo = newStringArray[0] + \" \" + newStringArray[1];
System.out.println(stringTwo);
String string2 = \"hello world bye moon\";
String firstTwo = string2.replaceAll(\"(\\\\w+ \\\\w+ \\\\w+).*\", \"$1\");
System.out.println(firstTwo); // hello world
String string3 = \"hello world bye moon\";
String stringTwo2 = string3.substring(0, string.indexOf(\' \', string.indexOf(\' \')+1));
System.out.println(stringTwo2);
String s = \"hello world people\";
System.out.println(firstTwoWords(s, 3));
}
}
感谢帮助
标签: android