我今天有 MacOS Monterey 12.0.1 远程桌面管理器免费要求我在更新后更新到 2022.1.13.0 我通过 ssh 连接到主机 - 好的。我尝试在ssh中按tab提示值,MacOS发出不知道或布局错误的声音。布局是正确的...
你能告诉我可能出了什么问题以及如何解决这个问题吗?
你好。
在应用程序中添加了一个按钮,按下对 WEB 服务的 HTTP 请求应该通过哪个按钮
package com.example.drno.android_app_1;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.*;
import java.lang.Math;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static android.util.Half.EPSILON;
import static java.lang.Math.sin;
import static java.lang.Math.cos;
import static java.lang.Math.sqrt;
import android.os.StrictMode;
public class MainActivity extends AppCompatActivity implements SensorEventListener {
private TextView textView;
private Button button;
private TextView textView_HTTP;
private Sensor mTemperature;
private final static String NOT_SUPPORTED_MESSAGE = "Sorry, sensor not available for this device.";
private TextView accelerometerlabel;
// private Sensor senAccelerometer;
private long lastUpdate = 0;
private float last_x, last_y, last_z;
private static final int SHAKE_THRESHOLD = 600;
private TextView gyroscopelabel;
private Sensor senGyroscope;
private SensorManager mSensorManager;
private Sensor mLight;
private Sensor mAccelerometer;
private String Send_http;
private final String USER_AGENT = "Mozilla/5.0";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// if (android.os.Build.VERSION.SDK_INT > 9) {
// StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
// StrictMode.setThreadPolicy(policy);
// }
// нажатие выход из приложения
button =(Button) findViewById(R.id.button_exit);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
System.exit(0);
}
});
textView=(TextView) findViewById(R.id.textView_HTTP);
// нажатие старт измерений
button =(Button) findViewById(R.id.button_start);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// new MainActivity();
onResume();
}
});
// нажатие стоп измерений
button =(Button) findViewById(R.id.button_stop);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onPause();
}
});
accelerometerlabel = (TextView) findViewById(R.id.textView_Accelerometer);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
gyroscopelabel = (TextView) findViewById(R.id.textView_Gyroscope);
senGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
}
public void sayHello(View view) throws IOException {
textView_HTTP.setText("Текст должен быть изменен");
TextView textv = (TextView)findViewById(R.id.textView_HTTP);
String url="http://31.220.63.13:5005/accelerometer";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
// optional default is GET
con.setRequestMethod("GET");
//add request header
con.setRequestProperty("User-Agent", USER_AGENT);
int responseCode = con.getResponseCode();
System.out.println("\nSending 'GET' request to URL : " + url);
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
textView_HTTP.setText(response.toString());
}
private void getRandomNumber() {
ArrayList numbersGenerated = new ArrayList();
for (int i = 0; i < 6; i++) {
Random randNumber = new Random();
int iNumber = randNumber.nextInt(48) + 1;
if(!numbersGenerated.contains(iNumber)) {
numbersGenerated.add(iNumber);
} else {
i--;
}
}
}
// HTTP GET request
private String sendGet(String URL) throws Exception {
URL obj = new URL(URL);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
// optional default is GET
con.setRequestMethod("GET");
//add request header
con.setRequestProperty("User-Agent", USER_AGENT);
int responseCode = con.getResponseCode();
System.out.println("\nSending 'GET' request to URL : " + URL);
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print result
// System.out.println(response.toString());
return(response.toString());
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
Sensor mySensor = sensorEvent.sensor;
// if (mySensor.getType() == Sensor.TYPE_AMBIENT_TEMPERATURE) {
// float ambient_temperature = sensorEvent.values[0];
// temperaturelabel.setText("Окружающая температура:\n " + String.valueOf(ambient_temperature) + getResources().getString(R.string.celsius));
// }
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
@Override
protected void onResume() {
// super.onResume();
// mSensorManager.registerListener(this, mTemperature, SensorManager.SENSOR_DELAY_NORMAL);
super.onResume();
// mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
mSensorManager.registerListener(this, mAccelerometer , SensorManager.SENSOR_DELAY_NORMAL);
mSensorManager.registerListener(this, senGyroscope , SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
// super.onPause();
// mSensorManager.unregisterListener(this);
super.onPause();
mSensorManager.unregisterListener(this);
}
}
返回一个错误
android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:384)
at android.view.View.performClick(View.java:6294)
at android.view.View$PerformClick.run(View.java:24770)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1450)
为什么以及如何解决它?
ps
在 AndroidManifest.xml 我注册了权限
<!--добавил для HTTP-->
<!--<permission android:name="android.permission.INTERNET"></permission>-->
<uses-permission android:name="android.permission.INTERNET"/>
<!--<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
<!--<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
试图添加
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
你好。
放置在应用程序中,能够读取环境温度传感器的值
temperaturelabel = (TextView) findViewById(R.id.myTemp);
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
mTemperature= mSensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);
}
if (mTemperature == null) {
temperaturelabel.setText(NOT_SUPPORTED_MESSAGE);
}
在模拟器中运行时
Name: Nexus_6_API_27 CPU/ABI: Google APIs Intel Atom (x86) Path: C:\Users\drno\.android\avd\Nexus_6_API_27.avd Target: google_apis [Google APIs] (API level 27) Skin: nexus_6 SD Card: 100M hw.dPad: no runtime.network.speed: full hw.accelerometer: yes hw.device.name: Nexus 6 vm.heapSize: 256 skin.dynamic: yes hw.device.manufacturer: Google hw.gps: yes hw.initialOrientation: Portrait image.androidVersion.api: 27 hw.audioInput: yes image.sysdir.1: system-images\android-27\google_apis\x86\ tag.id: google_apis showDeviceFrame: yes hw.camera.back: emulated hw.mainKeys: no AvdId: Nexus_6_API_27 hw.camera.front: emulated hw.lcd.density: 560 avd.ini.displayname: Nexus 6 API 27 hw.gpu.mode: auto hw.device.hash2: MD5:9b564b60b1aebee32c73ded9daa1e620 hw.ramSize: 1536 hw.trackBall: no hw.battery: yes hw.cpu.ncore: 4 hw.sdCard: yes tag.display: Google APIs runtime.network.latency: none hw.keyboard: yes hw.sensors.proximity: yes disk.dataPartition.size: 800M hw.sensors.orientation: yes avd.ini.encoding: UTF-8 hw.gpu.enabled: yes
好的
收集的 APK 上传到三星 Galaxy Note 4 应用程序返回了一个关于温度传感器不可用的错误 -抱歉,传感器不适用于此设备
请帮我找出原因。
ps项目链接
你好。
我想向应用程序添加从手机传感器读取信息的功能。
制作了 SensorActivity 类的存根
package com.example.drno.android_app_1;
import android.support.v7.app.ActionBarActivity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import com.example.drno.android_app_1.R;
import static android.content.Context.SENSOR_SERVICE;
public class MainActivity2 extends ActionBarActivity implements SensorEventListener {
}
再次发现问题,该项目没有看到android.support.v7.app.ActionBarActivity类
以前,我通过向 build.gradle 添加依赖项解决了这个问题
编译“com.android.support:support-core-utils:27.1.0”
这个项目没有工作,我不明白为什么......
你好。
尝试构建我的第一个 android 应用程序
ОС Windwows 10,
Intellige IDEA 2017.2
JDK jdk1.8.0_161
Android API 27 Platform
Gradle 4.6
Android SDK 25.5.2
已安装的软件包
返回一个错误
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find any version that matches com.android.support:appcompat-v7:27.+.
Versions that do not match:
26.0.0-alpha1
25.3.1
25.3.0
25.2.0
25.1.1
+ 31 more
Required by:
project :app
> Could not find any version that matches com.android.support:design:27.+.
Versions that do not match:
26.0.0-alpha1
25.3.1
25.3.0
25.2.0
25.1.1
+ 21 more
Required by:
project :app
如何解决这个问题呢?
你好。
添加了存储库
[ol7_optional_latest]
name=Oracle Linux $releasever Optional Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
after execute
运行 yum update 命令
yum clean all
yum --enablerepo=ol7_optional_latest clean metadata
检查存储库状态并禁用
ol7_optional_latest/x86_64 Oracle Linux 7Server Optional Latest (x86_64) disabled
如何解决问题并将其转化为 ENABLED?
你好。
要在 Oracle Linux 7.4 上安装应用程序,需要 php-mbstring 和 php-bcmath
存储库列表
Loaded plugins: replace, ulninfo
repo id repo name status
*epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,948
ol7_UEKR4/x86_64 Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux 7Server (x86_64) 335+93
ol7_latest/x86_64 Oracle Linux 7Server Latest (x86_64) 17,653+5,136
zabbix/x86_64 Zabbix Official Repository - x86_64 28
zabbix-non-supported/x86_64 Zabbix Official Repository non-supported - x86_64
您会推荐哪些存储库供 Oracle Linux 安装 php-mbstring 和 php-bcmath?
你好。
在 Linux 操作系统上
Oracle Linux Server release 6.9
NAME="Oracle Linux Server"
VERSION="6.9"
ID="ol"
VERSION_ID="6.9"
PRETTY_NAME="Oracle Linux Server 6.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:6:9:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 6"
ORACLE_BUGZILLA_PRODUCT_VERSION=6.9
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=6.9
Red Hat Enterprise Linux Server release 6.9 (Santiago)
Oracle Linux Server release 6.9
尝试从存储库安装
mysql 5.7
yum install https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
sudo rpm -ivh mysql57-community-release-el6-11.noarch.rpm
yum install mysql-community-server
我收到一个错误
Error: Package: mysql-community-client-5.7.19-1.el7.x86_64 (mysql57-community)
Requires: libc.so.6(GLIBC_2.14)(64bit)
Error: Package: perl-DBD-MySQL-4.013-3.el6.x86_64 (@public_ol6_latest)
Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit)
Removing: mysql-libs-5.1.73-8.0.1.el6_8.x86_64 (@public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Obsoleted By: mysql-community-libs-5.7.19-1.el7.x86_64 (mysql57-community)
Not found
Available: mysql-libs-5.1.47-4.el6.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.52-1.el6_0.1.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.61-1.el6_2.1.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.61-4.el6.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.66-1.el6_3.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.66-2.el6_3.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.67-1.el6_3.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.69-1.el6_4.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.71-1.el6.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.73-3.el6_5.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.73-5.el6_6.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.73-5.el6_7.1.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Available: mysql-libs-5.1.73-7.el6.x86_64 (public_ol6_latest)
libmysqlclient.so.16(libmysqlclient_16)(64bit)
Error: Package: mysql-community-server-5.7.19-1.el7.x86_64 (mysql57-community)
Requires: libsasl2.so.3()(64bit)
Error: Package: mysql-community-server-5.7.19-1.el7.x86_64 (mysql57-community)
Requires: systemd
如何解决这个问题呢?
你好。
希望通过主持人详细创建您自己的关于 zabbix 事件的自定义报告。找到一张包含事件信息的表格,
SELECT eventid, source, `object`, objectid, clock, value, acknowledged, ns
FROM zabbix.events
找到 zabbix.hosts 和 zabbix.host_inventory。
zabbix.events 与 zabbix.hosts 有什么关系?
我怀疑这可能通过objectid,但是如何......
你好。
我在表格上有 2 个日期时间选择器
我用 document.create 像这样定义它们
$(document).ready(function()
{
$('#datetime_from').datetimepicker(
{
maxDate: tdatetime,
onSelect: function(selected,evnt) {
updateDateTime_from(selected);
}
}
).datetimepicker("setDate", fdatetime);
$('#datetime_to').datetimepicker(
{
minDate: fdatetime,
onSelect: function(selected,evnt) {
updateDateTime_to(selected);
}
}
).datetimepicker("setDate", tdatetime);
});
在我定义 updateDateTime_from、updateDateTime_to 之外,以处理其中日期和时间选择的更改我尝试调整 minDate 和 maxDate 选项
function updateDateTime_from(value){
$("#datetime_to").datetimepicker("option", "minDate", value);
};
function updateDateTime_to(value){
$("#datetime_from").datetimepicker("option", "maxDate", value);
};
事实上,动态转移到值传递正确,但 minDate 和 maxDate 的变化不会发生....
错误是什么以及如何解决?
模拟https://jsfiddle.net/drno/ahvLcexq/
在 datetime_from 中更改时间 - C
datetime_to 中的 minData 正在发生变化
但是它应该将 datetime_to 中的最小时间和日期选择字段移动到 ON,但它不会移动
你好。
我正在尝试在创建表单时为选择元素添加选项属性
<script type="text/javascript" src="resources/js/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="resources/js/bootstrap.js"></script>
<script type="text/javascript" src="resources/js/bootstrap-select.min.js"></script>
<select id="main_selectpicker" class="selectpicker show-tick form-control" data-live-search="true" data-size="15"/>
像这样试过
<script type="text/javascript">
$(function(){
$.getJSON('Forward?URL=items.jsp', function (jsondata) {
...
var main_selectpicker = document.getElementById("main_selectpicker");
var option = document.createElement("option");
option.setAttribute("value", jsondata.items[i].name);
option.text = jsondata.items[i].name;
main_selectpicker.appendChild(option);
...
});
</script>
像这样
<script type="text/javascript">
$(function(){
$.getJSON('Forward?URL=items.jsp', function (jsondata) {
...
$('#main_selectpicker').append('<option value="'+jsondata.items[i].name+'">'+jsondata.imtes[i].name+'</option>');
...
});
</script>
值不会出现在 main_selectpicker 元素上
如果从所需的表单元素中删除选择器类的名称,则会出现选项。但是我需要这个分类,如何解决这个问题?
你好。
Ubuntu 16.10下安装Hadoop
Hadoop 3.0.0-alpha1
Source code repository https://git-wip-us.apache.org/repos/asf/hadoop.git -r a990d2ebcd6de5d7dc2d3684930759b0f0ea4dc3
Compiled by andrew on 2016-08-30T07:02Z
Compiled with protoc 2.5.0
From source with checksum f3a9644139eac17acbb91bfce7f68e2
This command was run using /home/hduser/hadoop/share/hadoop/common/hadoop-common-3.0.0-alpha1.jar
安装Hive 2.1.1后
#Hive environment
export HIVE_HOME=/home/hduser/hive
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:/home/hduser/Hadoop/lib/*:.
export CLASSPATH=$CLASSPATH:/home/hduser/hive/lib/*:.
hive-env.sh
export HADOOP_HOME=/home/hduser/hadoop
和db-derby-10.13.1.1
#Derby environment
export DERBY_HOME=/home/hduser/derby
export PATH=$PATH:$DERBY_HOME/bin
export CLASSPATH=$CLASSPATH:$DERBY_HOME/lib/derby.jar:$DERBY_HOME/lib/derbytools.jar
hive-site.xml 元存储配置
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby://localhost:1527/metastore_db;create=true </value>
<description>
jdbc:derby:;databaseName=metastore_db;create=true
JDBC connect string for a JDBC metastore.
To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
</description>
</property>
当我尝试运行配置单元时出现错误
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hduser/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hduser/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Logging initialized using configuration in jar:file:/home/hduser/hive/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:591)
at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:531)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:226)
at org.apache.hadoop.hive.ql.metadata.Hive.<init>(Hive.java:366)
at org.apache.hadoop.hive.ql.metadata.Hive.create(Hive.java:310)
at org.apache.hadoop.hive.ql.metadata.Hive.getInternal(Hive.java:290)
at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:266)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:558)
... 9 more
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1654)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:80)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:130)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:101)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3367)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3406)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3386)
at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:3640)
at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:236)
at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:221)
... 14 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1652)
... 23 more
Caused by: java.lang.IllegalArgumentException: Unrecognized Hadoop major version number: 3.0.0-alpha1
at org.apache.hadoop.hive.shims.ShimLoader.getMajorVersion(ShimLoader.java:169)
at org.apache.hadoop.hive.shims.ShimLoader.loadShims(ShimLoader.java:136)
at org.apache.hadoop.hive.shims.ShimLoader.getHadoopShims(ShimLoader.java:95)
at org.apache.hadoop.hive.metastore.ObjectStore.getDataSourceProps(ObjectStore.java:476)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:278)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:76)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:136)
at org.apache.hadoop.hive.metastore.RawStoreProxy.<init>(RawStoreProxy.java:58)
at org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:67)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:599)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:564)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:626)
at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:416)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:78)
at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:84)
at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:6490)
at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:238)
at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:70)
... 28 more
哪个版本的 hive (derby) 可以与 Hadoop 3.0.0 一起使用。或者这是其他方面的问题?有哪些可能的解决方案?
你好。
我正在为 KPI 图表准备一个数据数组
数据准备功能
function culcJson() {
var jsonObj = ${json_text};
var newJSON=[];
var KPI=[];
var jsonResult = [];
var a = 0;
do {
var value=jsonObj.SucceededCount[a].SucceededCount_MEAS_VALUE/(jsonObj.SucceededCount[a].SucceededCount_MEAS_VALUE+jsonObj.FailedCount[a].FailedCount_MEAS_VALUE)*100;
KPI.push(value);
a += 1;
} while (a < jsonObj.FailedCount.length)
return KPI;
}
对于我使用的图形部分
$(function () {
var KPI=[];
var jsonObj = ${json_text};
if (jsonObj!=null){KPI=culcJson();}
$('#container4').highcharts({
chart: {
zoomType: 'x'
},
title: {
text: '${TITLE}'
},
xAxis: {
categories: [<c:forEach var="row" items="${SCRIPT_FailedCount.rows}">"${row.DATE__CURRENT__CHECK}",</c:forEach>]
},
yAxis: {
title: {
text: ''
}
},
plotOptions: {
area: {
fillColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
},
marker: {
radius: 2
},
lineWidth: 1,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
},
series: [
{
name: 'KPI',
data: KPI
}
]
});
});
如果你保持原样,那么一切都很好。显示了图形,但我想将 KPI 值的小数位数减少到 2。简单固定(2)
KPI.push(value.toFixed(2));
之后,图形不再显示。
控制台中没有错误。
可能是什么问题以及如何解决?
你好。
我有一个示例 SOAP 请求
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP:Body>
<GetParameter xmlns="http://examples/2001">
<request>
<MonCode xmlns="http://newsite/mon">Latency</MonCode>
<TimeFrom xmlns="http://newsite/mon">2016-10-26T11:00</TimeFrom>
<TimeTo xmlns="http://newsite/mon">2016-10-26T12:00</TimeTo>
</request>
</GetParameter>
</SOAP:Body>
</SOAP:Envelope>
使用 SAAJ API 在 JAVA 中形成 SOAP 请求
以下代码
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
envelope.addNamespaceDeclaration("soap", "http://schemas.xmlsoap.org/soap/envelop/");
SOAPBody body = message.getSOAPBody();
SOAPElement bodyElement = body.addChildElement("GetParameter");
bodyElement.setAttribute("xmlns", "http://examples/2001");
bodyElement = body.addChildElement("request");
SOAPElement paramsElement = bodyElement.addChildElement("MonCode");
paramsElement.setAttribute("xmlns", "http://newsite/mon");
paramsElement.addTextNode("Latency");
paramsElement = bodyElement.addChildElement("TimeFrom");
paramsElement.setAttribute("xmlns", "http://newsite/mon");
paramsElement.addTextNode("2016-10-26T11:00");
paramsElement = bodyElement.addChildElement("TimeTo");
paramsElement.setAttribute("xmlns", "http://newsite/mon");
paramsElement.addTextNode("2016-10-26T12:00");
结果我收到这样的 SOAP 请求
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelop/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header/>
<SOAP-ENV:Body>
<GetParameter xmlns=""/>
<request>
<MonCode xmlns="">Latency</MonCode>
<TimeFrom xmlns="">2016-10-26T11:00</TimeFrom>
<TimeTo xmlns="">2016-10-26T12:00</TimeTo>
</request>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
一切都很好,但是属性“ http://examples/2001 ”“ http://newsite/mon ”的值在某处消失了。
我的错误是什么以及如何解决这个问题?
你好。
这种类型的 JSON 是从文件中加载的
{
"from_excel":[
{
"solution":"Fisrt",
"num":"1"
},
{
"solution":"Second",
"num":"2"
},
{
"solution":"third",
"num":"3"
}
]
}
我正在尝试使用org.json.simple.*库以这种方式在 Java 中解析这个 JSON
Object obj = parser.parse(new FileReader("E:\\json.txt"));
JSONObject jsonObject = (JSONObject) obj;
out.println(jsonObject.get("from_excel"));
JSONObject obj_new = (JSONObject) jsonObject.get("from_excel");
JSONArray solution = (JSONArray) obj_new.get("solution");
Iterator iterator = solution.iterator();
while (iterator.hasNext()) {
out.println(iterator.next());
}
但我在某处犯了一个错误......
这部分代码有效
Object obj = parser.parse(new FileReader("E:\\json.txt"));
JSONObject jsonObject = (JSONObject) obj;
out.println(jsonObject.get("from_excel"));
如何使用此库正确解析此 JSON(使用它不是教条,我已准备好考虑任何其他工作选项)?
你好。
决定第一次尝试 custon taglib
java类
包 EN.Tags.Examples; 导入 javax.servlet.jsp.tagext.*; 导入 javax.servlet.jsp.*; 导入java.io.*; 公共类 CustomAttribute 扩展 SimpleTagSupport { 私人字符串消息; public void setMessage(String msg) { this.message = 味精; } StringWriter sw = new StringWriter(); 公共无效 doTag() 抛出 JspException、IOException { 如果(消息!=空){ /* 使用来自属性的消息 */ JspWriter out = getJspContext().getOut(); out.println("第一个自定义标签:"+ message ); } 别的 { /* 使用正文中的消息 */ getJspBody().invoke(sw); getJspContext().getOut().println(sw.toString()); } } }
custom_tag_attribute.tld 位于 WEB-INF/jstl/custom_tag_attribute.tld
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>CustomAttribute</short-name>
<tag>
<name>Hello</name>
<tag-class>RU.Tags.Examples.CustomAttribute</tag-class>
<body-content>scriptless</body-content>
<attribute>
<name>message</name>
</attribute>
</tag>
</taglib>
在 JSP 中调用自定义标签库
examples.jsp 位于项目的根文件夹newproject/examples.jsp
<%@ taglib uri="/WEB-INF/jstl/custom_tag_attribute.tld" prefix="CustomAttribute" %>
<CustomAttribute:Hello message="This is custom tag" />
一切都会好起来的,但是如果项目在根文件夹中工作,则此选项有效,例如 localhost: 8000/examples.jsp
如果以这种方式访问 http://localhost/newproject/examples.jsp ,则会出现错误
HTTP 状态 500 - 无法找到 URI 的标签库“CustomAttribute”:/WEB-INF/jstl/custom_tag_attribute.tld 类型异常报告 消息无法为 URI 找到标签库“CustomAttribute”:/WEB-INF/jstl/custom_tag_attribute.tld 说明 服务器遇到内部错误,无法完成此请求。 例外 org.apache.jasper.JasperException:无法找到 URI 的标签库“CustomAttribute”:/WEB-INF/jstl/custom_tag_attribute.tld
如何消除这个错误?
你好。
需要在仅通过代理具有 Internet 连接的服务器上下载适用于 python(3.5)/OS Windows 的软件包。我尝试使用此选项,但没有用,因为。pip 不能正确识别密码,它有一个特殊的功能是 # 符号。
“C:\Program Files\Python35\scripts\pip.exe” –-proxy http://user_proxy:pwd#123@proxy.new.ru:1111 install requests
在密码中转义 # 的正确方法是什么?
p.s. 我也试过这个
“C:\Program Files\Python35\scripts\pip.exe” --proxy "http://user_proxy:pwd#123@proxy.new.ru:1111" 安装请求 “C:\Program Files\Python35\scripts\pip.exe” --proxy http://"user_proxy:pwd#123"@proxy.new.ru:1111 安装请求 “C:\Program Files\Python35\scripts\pip.exe” --proxy http://user_proxy:"pwd#123"@proxy.new.ru:1111 安装请求
结果是否定的:-(
你好。
我正在尝试从 JSP 传递 JSON。
<c:set var="json_text">
[{"TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_ALL", "VALUE": 635 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "QUALITY", "VALUE": 99.84 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_ALL", "VALUE": 642 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "QUALITY", "VALUE": 99.84 }]
</c:set>
<script type="text/javascript">
var jsonString='<c:out value="${json_text}"/>';
var jsonObj = JSON.parse(jsonString);
</script>
重现 未捕获的语法错误:位置 2 的 JSON 中的意外标记 &
但是,如果您将整个内容直接复制到 Java 脚本中,那么一切正常。
<script type="text/javascript">
var jsonString='[{"TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_ALL", "VALUE": 635 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "QUALITY", "VALUE": 99.84 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_ALL", "VALUE": 642 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "QUALITY", "VALUE": 99.84 }]';
var jsonObj = JSON.parse(jsonString);
</script>
告诉我有什么问题。
ps首先想到的是in var jsonString=''; 只传递了一个字符串,但以这种方式检查
<script type="text/javascript">
var JSONFromJSTL='<c:out value="${json_text}"/>';
jsonResult.push("Вывод JSON="+JSONFromJSTL);
result_json.innerHTML = jsonResult.join('<br>');
</script>
在
<div id="result_json"></div>
这个结果被发送
JSON 输出= [{"TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "COUNT_ALL", "VALUE": 635 }, { "TIME_STAMP": "2016-07-25 02: 30:22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:30:22", "COUNTER": "QUALITY", "VALUE": 99.84 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "COUNT_ALL", "VALUE": 642 }, { "TIME_STAMP": "2016-07-25 02:31 :22", "COUNTER": "COUNT_BAD", "VALUE": 1 }, { "TIME_STAMP": "2016-07-25 02:31:22", "COUNTER": "QUALITY", "VALUE": 99.84 }]
那些。正是需要什么。
你好。
需要将有关数据库连接的信息传输到单独的文件中。我尝试使用此选项,但我仍然无法理解文件的物理位置db.properties
属性 prop = new Properties(); InputStream inputStream = FetchData.class.getClassLoader().getResourceAsStream("/db.properties"); prop.load(inputStream); Stringdriver = prop.getProperty("驱动程序"); 字符串 url = prop.getProperty("url"); String user = prop.getProperty("用户"); String password = prop.getProperty("密码");
试图张贴/web-inf/classes/db.properties
但找不到它。试图指定一个绝对路径 - 结果也是负面的。
他应该在哪里?