我正在尝试通过HTTPS连接Java Web API; 但是,抛出异常:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException
Run Code Online (Sandbox Code Playgroud)
我遵循了从在线keytool和SSL证书教程中学到的这些步骤:
我将HTTPS URL复制到浏览器中,使用Internet Explorer下载SSL证书并将其安装在浏览器中.
将证书导出到计算机上的路径,证书保存为 .cer
使用了keytool的导入选项.执行下面的命令没有任何错误.
keytool -import -alias downloadedCertAlias -keystore C:\path\to\my\keystore\cacerts.file -file C:\path\of\exportedCert.cer
Run Code Online (Sandbox Code Playgroud)我在命令提示符下提示输入密码,然后我输入了密码.
该cmd窗口打印一些证书数据与签名,我是这样一个问题提示:
相信这个证书?
我回答是的.
显示cmd提示符
证书已添加到密钥库
但是在该消息之后,显示了另一个异常:
keytool error: java.io.FileNotFoundException: C:\Program files\...\cacerts <Access Denied>
Run Code Online (Sandbox Code Playgroud)最后,当我检查密钥库时,没有添加SSL证书,我的应用程序提供了我在尝试连接时得到的相同异常:
(javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException)
Run Code Online (Sandbox Code Playgroud) 我正在尝试将作为单独帧的".jpg"文件组转换为1个单个mpeg视频".mp4"
我使用的示例参数:
frame duration = 2 secs
frame rate = 30 fps
encoder = libx264 (mpeg)
input pattern = "*.jpg"
output pattern = video.mp4
Run Code Online (Sandbox Code Playgroud)
根据(https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images)上的ffmpeg wiki说明,我发出了以下命令:
ffmpeg -framerate 1/2 -pattern_type glob -i "*.jpg" -c:v libx264 -r 30 -pix_fmt yuv420p video.mp4
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个错误:
[image2 @ 049ab120] Pattern type 'glob' was selected but globbing is not
supported by this libavformat build *.jpg: Function not implemented
Run Code Online (Sandbox Code Playgroud)
这可能意味着我的构建/版本的API模式匹配命令已更改.顺便说一下,我的windows 32bit ffmpeg下载build(ffmpeg-20150702-git-03b2b40-win32-static).
如何使用ffmpeg使用模式匹配选择一组文件?
我的项目设置是MySQL DB上的Spring MVC,Hibernate 3.2.x.
收到以下错误:
org.hibernate.QueryParameterException:找不到命名参数email
方法#1:
@Override
public Boolean isExist(String email) {
boolean flag = false;
String hql = "from com.cmgr.beans.UserAccount u where u.email = :email";
List<UserAccount> result = currentSession().createQuery(hql)
.setParameter("email", email)
.list();
UserAccount userAccount = (UserAccount)result.get(0);
if (userAccount!=null && userAccount.getEmail().equalsIgnoreCase(email)) {
flag = true;
}
return flag;
}
Run Code Online (Sandbox Code Playgroud)
方法#2:
@Override
public Boolean isExist(String email) {
boolean flag = false;
String hql = "from com.cmgr.beans.UserAccount u where u.email = :email";
List<UserAccount> result = currentSession().createQuery(hql).setString("email", email).list();
UserAccount userAccount = (UserAccount) …Run Code Online (Sandbox Code Playgroud) 我的目标是将HDMI输入视频发送到Rasberry Pi,然后改变输入HDMI(通过C/C++或Java进行图像处理)并将其发送回HDMI输出端口.
问题是Rasberry Pi只有HDMI输出端口,因此没有使用扩展板就无法发送HDMI.
1)我找到了一个试图提供扩展板的启动项目,但是这还没有资金
2)我遇到了这款带有HDMI输入的Rasberry Pi x100扩展板
问题是,我可以以编程方式检测和拦截x100上的HDMI输入端口,而不是将更改的数据发送到实际PI上的常规HDMI输出吗?
请善意提供详细的方法.
谢谢
我正在开发一个客户端到一个公开(.wsdl)契约的Web服务,它需要在请求参数上使用yyyy-MM-dd格式为1,但是基于.wsdl的自动生成的POJOS创建日期属性为Type XMLGregorianCalendar.
我的问题是不转换为XMLGregorianCalendar或从XMLGregorianCalendar转换,请参阅下面的实用程序:
public static XMLGregorianCalendar toXMLGregorianCalendar(Calendar c){
GregorianCalendar gc = new GregorianCalendar();
gc.setTimeInMillis(c.getTimeInMillis());
XMLGregorianCalendar xc= null;
try {
xc = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
} catch (DatatypeConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return xc;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是从XMLGregorianCalendar转到Date/Calendar,在调用calendar.getTime()时将额外的时间/不需要的数据添加到我的yyyy-MM-dd;
在特定的代码段中,我需要从XMLGregorianCalendar转到Date
if (repairOrderType.getCloseDate() != null) {
LOG.debug("ServiceHistoryMapper, processRepairOrders() , repairOrderType.getCloseDate() BEFORE:"
+ repairOrderType.getCloseDate());
String date = repairOrderType.getCloseDate().getYear() + "-"
+ repairOrderType.getCloseDate().getMonth() + "-"
+ repairOrderType.getCloseDate().getDay();
//Approach #1, trying to remove hour,minute,sec values by calendar.clear() method , not successful
Calendar calendar = Calendar.getInstance(); …Run Code Online (Sandbox Code Playgroud) 我在app启动时为我的类com.xyz.sample.QuickSampleApplication在gradle依赖项脚本中使用"提供的项目"时收到一个非常不寻常的ClassNotFoundException或另一个错误未捕获的翻译错误:java.lang.IllegalArgumentException:已添加:使用时gradle依赖项中的"compile project".
实际错误:
E/AndroidRuntime(17749): java.lang.RuntimeException: Unable to instantiate application com.xyz.sample.QuickSampleApplication:
java.lang.ClassNotFoundException: Didn't find class
"com.xyz.sample.QuickSampleApplication" on path: DexPathList[[zip file
"/data/app/com.uei.sample.library-2.apk"],nativeLibraryDirectories=[/data/app-
lib/com.uei.sample.library-2, /vendor/lib, /system/lib]]
Run Code Online (Sandbox Code Playgroud)
项目说明:
该com.xyz.sample.QuickSampleApplication由所用com.xyz.sample.QuickSampleActivity,并且两个类在同一包com.xyz.sample.
com.xyz.sample.QuickSampleApplication使用一个名为'quicksdklibrary'的JAR ,我在gradle中将其作为"提供的依赖项"包含在内,请参阅下面的gradle片段:
dependencies {
provided project(':quicksdklibrary')
//OR provided fileTree(dir: 'libs/MyExternalLibs', include: '*.jar')
compile 'com.android.support:appcompat-v7:21.0.0'
}
Run Code Online (Sandbox Code Playgroud)
JAR实际上在IDE中解析,构建时没有错误,JAR的内部类对我的应用程序类可见,例如:
com.xyz.sample.QuickSampleApplication或com.xyz.sample.QuickSampleActivity.
com.xyz.sample.QuickSampleApplication和com.xyz.sample.QuickSampleActivity都在AndroidManifest.xml中正确声明/拼写:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xyz.sample.library"
android:versionCode="1"
android:versionName="1.0.002">
<uses-sdk android:minSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/> …Run Code Online (Sandbox Code Playgroud) 我正在尝试从我的应用程序管理多个蓝牙事件,因此用户无需离开应用程序并尝试从Android设置搜索/配对蓝牙设备.
我能够枚举以前配对的设备,并开始发现,但我无法找到附近的设备.
背景资料:
设备=三星Galaxy S6
OS = Android 6.0.1,内核3.4.0-750027
通过Android内置的发现可以看到蓝牙设备
这是我的相关代码:
package experiment.xyz.abc;
import android.app.ListActivity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/**
*
* This activity is responsible for bluetooth device discovery, pairing, and selection.
* 1) user can search for nearby devices
* 2) pair with device
* 3) …Run Code Online (Sandbox Code Playgroud) I’m trying to creating a layout that contains a "SurfaceView" at the top with a horizontal toolbar that is section into 3 segments in the bottom, however my SurfaceView which contains camera preview is only the only element that is showing. Please point out the error in my layout xml or provide me the similar layout xml, Thanks.
Below is my layout & updates based on user recommendations
Attempt # 1 (RelativeLayout as root):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LayoutForPreview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" …Run Code Online (Sandbox Code Playgroud) I have a custom camera app , that previews the camera video output on SurfaceView and attempts to take pictures , the pics should be will be processed by "xzing "scanner API to decode any barcodes in the image.
My app previews correctly and does not throw any errors or expectations, however my onPictureTaken(byte[] imgData, Camera camera) method & PictureCallback are never called, therefore I’m unable to get the image & continue with further scanning.
Below is the actual code …
I'm trying to port a knn (k nearest neighbor search ) on a kd-tree that I wrote in Java to C.
The Java output, as expected:
Nearest to Key: 6.0,5.0,4.0
Key:6.0,5.0,4.0,min distance:0.0
Key:5.0,4.0,3.0,min distance:3.0
Key:7.0,6.0,5.0,min distance:3.0
Key:4.0,3.0,2.0,min distance:12.0
Key:3.0,2.0,1.0,min distance:27.0
Run Code Online (Sandbox Code Playgroud)
Java code, class (Its a quick implementation just to get the algorithm working before I start my port):
Nearest to Key: 6.0,5.0,4.0
Key:6.0,5.0,4.0,min distance:0.0
Key:5.0,4.0,3.0,min distance:3.0
Key:7.0,6.0,5.0,min distance:3.0
Key:4.0,3.0,2.0,min distance:12.0
Key:3.0,2.0,1.0,min distance:27.0
Run Code Online (Sandbox Code Playgroud)
Java knn method:
class kd_tree {
public int …Run Code Online (Sandbox Code Playgroud)