今天我在Mac OS X上发现了Git的一个bug.
例如,我将在开头提交一个名为überschrift.txt的文件,其中包含德语特殊字符Ü.从命令git status我得到以下输出.
Users-iMac: user$ git status
On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# "U\314\210berschrift.txt"
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)
似乎Git 1.7.2在Mac OS X上存在德语特殊字符的问题.是否有解决方案让Git读取文件名正确?
字段定义
/** Date. */
@Column(columnDefinition = "datetime")
private Date date;
Run Code Online (Sandbox Code Playgroud)
二传手
public void setDate(final Date date) {
DateFormat dfmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
this.date = dfmt.parse(dfmt.format(date));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
有没有人知道如何将"零日期"转换为适当的值?因为我有错误:
Cannot convert value '0000-00-00 00:00:00' from column 13 to TIMESTAMP
Run Code Online (Sandbox Code Playgroud)
即使我设置"默认"字段和setter如下:
/** Date. */
@Column
private Date date;
public void setDate(final Date date) {
this.date = date;
}
Run Code Online (Sandbox Code Playgroud)
我还会遇到同样的问题....
我使用eclipseLink和jpa.在我的persistence.xml中,我定义为生成一个create.sql文件.将生成该文件,但缺少';' - 每个sql语句的分隔符.
是否有可能在persistence.xml中或以其他方式定义分隔符?
示例persistence.xml:
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<class>de.company.project.models.User</class>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.application-location" value="/sql" />
<property name="eclipselink.create-ddl-jdbc-file-name" value="create.sql"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="drop.sql"/>
<property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
</properties>
Run Code Online (Sandbox Code Playgroud)
示例生成的sql文件:
CREATE TABLE app_user (
ID INTEGER NOT NULL,
last_name VARCHAR(50) NOT NULL,
username VARCHAR(15) NOT NULL,
user_password VARCHAR(50) NOT NULL,
first_name VARCHAR(50) NOT NULL,
PRIMARY KEY (ID))
CREATE TABLE SEQUENCE (
SEQ_NAME VARCHAR(50) NOT NULL,
SEQ_COUNT DECIMAL(38),
PRIMARY KEY (SEQ_NAME))
INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT)
values ('SEQ_GEN_TABLE', 0)
Run Code Online (Sandbox Code Playgroud) 所以 - 我有一个需要File输入的第三方库.我有一个byte array.
我不想把字节写入磁盘..我想把它保存在内存中.关于如何File从提供的内容创建一个byte array(没有写入磁盘)的任何想法?
我尝试在Java中使用JNDI在Tomcat 5.5上结合eclipseLink/JPA设置数据库连接.我已经在web.xml和context.xml中配置了JNDI资源.
数据库连接与JNDI一起使用,而不使用JPA和eclipseLink.在为eclipseLink配置persistence.xml之后,我得到了以下异常.
我不知道如何正确配置persistence.xml以使用JNDI数据源进行数据库连接.
例外
WicketMessage: Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = loginForm]] threw an exception
Root cause:
javax.naming.NamingException: This context must be accessed throught a java: URL
at org.apache.naming.SelectorContext.parseName(SelectorContext.java:686)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:121)
at javax.naming.InitialContext.lookup(InitialContext.java:396)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:110)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:16 2)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(Datab aseSessionImpl.java:579)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:380)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:157)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:214)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:202)
at de.company.myDs.controller.AbstractCrudController.getEntityManager(Unknown Source)
at de.company.myDs.controller.UserController.loadUserByName(Unknown Source)
at de.company.myDs.controller.LoginController.validateUserLogin(Unknown Source)
at de.company.myDs.pages.LoginPage$1.onSubmit(Unknown Source)
at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1534)
at org.apache.wicket.markup.html.form.Form.process(Form.java:934)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:896)
at java.lang.reflect.Method.invoke(Method.java:597) …Run Code Online (Sandbox Code Playgroud) 我创建了一个简单的MotionLayout,它几乎与协调器布局相似(动画略有不同)。
这里是这样的:

打开键盘后,在内容区域中使用(几个)EditText视图将中断MotionLayout动画。动画现在有延迟,状态不正确,UI开始冻结。任何想法如何解决这个问题? 以gif格式链接到错误
使用的版本:
com.google.android.material:material:1.2.0-alpha01
androidx.constraintlayout:constraintlayout:2.0.0-beta3
Run Code Online (Sandbox Code Playgroud)
我也可以在一个小示例应用程序中重现该行为
示例layout.xml:
<androidx.constraintlayout.motion.widget.MotionLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/animation"
tools:showPaths="true">
<androidx.appcompat.widget.Toolbar
android:id="@+id/customtoolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginBottom="48dp"
android:text="title"
app:layout_constraintBottom_toTopOf="@+id/formLayout"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/image"
android:layout_width="200dp"
android:background="#ff00ff"
android:layout_height="200dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_home_black_24dp" />
<androidx.core.widget.NestedScrollView
android:id="@+id/formLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image">
<LinearLayout
android:id="@+id/formLayoutContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/container1"
android:layout_width="match_parent"
android:layout_height="200dp">
<EditText
android:id="@+id/container1EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="EditText"
android:importantForAutofill="no"
android:inputType="text"
android:lines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/container2"
android:layout_width="match_parent"
android:layout_height="200dp">
<EditText
android:id="@+id/container2EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) 我们在应用中使用Firebase云消息传递来显示推送通知.根据FirebaseInstanceId doc,Instance ID是稳定的,除非:
但是我们每次启动应用时(先前停止,没有恢复),不同的令牌通过返回FirebaseInstanceIdService onTokenRefreshed()回调.
我想知道这是否是服务的正常行为或代码中是否存在错误.
根构建gradle文件中的依赖关系:
classpath 'com.google.gms:google-services:3.0.0'
Run Code Online (Sandbox Code Playgroud)
app build gradle文件中的依赖关系:
"com.google.firebase:firebase-messaging:9.2.1"
"com.google.android.gms:play-services-base:9.2.1"
// defined at the bottom of the same file: plugin for firebase
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
FirebaseInstanceIdService:
@Override
public void onTokenRefresh() {
// Get the saved token from the shared preferences
final String oldToken = PrefsHelper.getStringValue(PREF_DEVICE_TOKEN);
Log.d(TAG, "Old token: " + oldToken);
// Get updated InstanceID token.
final String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Flutter应用程序,并认识到状态管理的意外行为。我创建了一个示例应用程序来重现此行为,您可以在下面找到代码和日志输出。
该应用程序包含一个简单的ListView,其中包含10个有状态的容器(文本+装饰)。当我向下滚动时,每个容器及其容器状态都会像预期的那样创建一次。当我再次向上滚动时,Flutter为再次出现在显示屏上的每个容器小部件重新创建每个状态(而不是容器小部件)。我希望flutter能够检索先前的状态而无需重新创建整个状态对象。我在这里做错什么了吗?
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key) {
print("MyHomePage constructor");
}
@override
_MyHomePageState createState() {
print("createState");
return _MyHomePageState();
}
}
class _MyHomePageState extends State<MyHomePage> {
_MyHomePageState() {
print("_MyHomePageState contructor");
}
void initState() {
super.initState();
print("_MyHomePageState initState");
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView.builder(
itemBuilder: (context, index) {
return ContainerWidget(index, key: ValueKey(index));
},
itemCount: 10,
));
}
}
class ContainerWidget extends StatefulWidget {
int index;
ContainerWidget(this.index, {key}) : super(key: key) {
print("ContainerWidget …Run Code Online (Sandbox Code Playgroud) 我有一个 byte[] 数组,需要转换为有效的 Excel 电子表格。转换字节数组后,Excel 电子表格必须缓存到数据库中,最好以 BLOB 形式缓存。
首先,我尝试使用以下命令创建一个 WritableWorkbook:
WritableWorkbook workbook = Workbook.createWorkbook(byteArrayOutputStream);
...
workbook.write();
Run Code Online (Sandbox Code Playgroud)
这对我来说效果很好,但我不知道如何将工作簿作为 BLOB 存储到数据库中。有可能吗?或者还有别的办法吗?
可选:我还可以使用反序列化对象来代替 byte[] 数组。
工作簿API:http://jexcelapi.sourceforge.net/resources/javadocs/2_6_10/docs/jxl/Workbook.html
Nogotofail最近由谷歌发布,我想用它来测试我创建的连接到C#服务器的Android应用程序.
我阅读了文档,我对如何使用它感到困惑.我的ubuntu在笔记本电脑上作为虚拟机运行.我在我的设备上安装了Nogotofail附带的两个Android应用程序.我相信我遵循了这些步骤,但我没有得到任何结果.有没有人用它测试和Android应用程序???
这就是git关于测试Android的文档所说的:
For testing Android devices we have included our Android client
ready to be imported into Eclipse. You will have to build the app and install it on your test device.
For testing you can use the access point nogotofail setups or
on devices >=JB you can use the OpenVPN setup and a third party VPN application to route your traffic
Run Code Online (Sandbox Code Playgroud)
我的应用程序连接到我的本地主机上的服务器:443并发送消息并从服务器接收响应.我在哪里指向在ubuntu上运行的nogotofail.mitm?我在哪里指向nogotofail android应用程序,它说主机地址?
Nogotofail刚刚于2014年11月问世,所以在教程方面没有多少......甚至没有堆栈......任何帮助都将不胜感激