我正在发展springboot-springsession-jdbc-demo
.当我只是运行代码时,我得到以下错误.它看起来我需要设置一些属性application.properties
,以便事先创建模式/表.必需的配置已经放置,但仍然会出错.该代码存在于https://github.com/sivaprasadreddy/spring-session-samples中
参考错误:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [DELETE FROM SPRING_SESSION WHERE LAST_ACCESS_TIME < ?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.spring_session' doesn't exist
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) ~[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:649) ~[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:870) ~[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:931) ~[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:941) ~[spring-jdbc-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.session.jdbc.JdbcOperationsSessionRepository$6.doInTransaction(JdbcOperationsSessionRepository.java:481) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.session.jdbc.JdbcOperationsSessionRepository$6.doInTransaction(JdbcOperationsSessionRepository.java:478) ~[spring-session-1.2.1.RELEASE.jar:na]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.cleanUpExpiredSessions(JdbcOperationsSessionRepository.java:478) ~[spring-session-1.2.1.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at …
Run Code Online (Sandbox Code Playgroud) 我知道有部署包,但这些是什么?它们可以包含执行 apt-get install 的 bash 脚本吗?
有什么方法可以构建使用特定 AMI 的 lambda 函数
我在我的android应用程序中使用Realm.我通过CompletionEvent从谷歌驱动器收到通知,所以我需要在服务中修改我的领域数据库.
我得到的例外是:
java.lang.IllegalStateException: Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created.
Run Code Online (Sandbox Code Playgroud)
我已经在我的Application类中设置了我的默认配置:
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(getApplicationContext())
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(realmConfiguration);
Run Code Online (Sandbox Code Playgroud)
在我的服务的onCreate中,我得到了我的Realm实例:
mRealm = Realm.getDefaultInstance();
Run Code Online (Sandbox Code Playgroud)
然后我在服务中使用这个领域实例:
mRealm.executeTransaction(realm -> {
DocumentFileRealm documentFileRealm = realm.where(DocumentFileRealm.class)
.equalTo("id", documentFileId)
.findFirst();
documentFileRealm.setDriveId(driveId);
});
Run Code Online (Sandbox Code Playgroud)
但是当执行最后一个时,应用程序会启动IllegalStateException.我不知道为什么.我不确定它是否与我在Android清单中声明服务的方式有关,所以我把它留在这里:
<service android:name=".package.UploadCompletionService" android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.drive.events.HANDLE_EVENT"/>
</intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)
可以从后台服务中调用Realm吗?我使用它的方式有什么问题?
提前致谢.
(PHP7)考虑以下代码,它尝试将函数赋值给变量,然后确保只调用一次.
class a{
static public $b;
static public function init(){
self::$b();
self::$b=function(){};
}
}
a::$b=function(){echo 'Here I do very heavy stuff, but will happen only in the first time I call init()';};
for($i=0;$i<1000;$i++){
a::init();
}
Run Code Online (Sandbox Code Playgroud)
在php7中,它会给出一个错误,它希望a::$b
是一个字符串(要调用的函数名).
如果我使用纯变量而不是静态成员,它将起作用.
我的问题是,这假设是否有效,或者是否有一个小的调整我可以做到这个没有纯粹的变量工作?
我仍然维护着许多旧的 VB6 应用程序,其中一些是 ActiveX Dll Implements IDTExtensibility2
。
今天,我在 Windows 10 上打开其中一个,尝试运行它,该行Implements IDTExtensibility2
突出显示,并出现消息“编译错误:Visual Basic 不支持自动化类型”。
我使用 Windows 7 创建了 VirtualBox,安装了 VB6,并且相同的项目运行没有问题。
我已经使用 Windows 10 好几个月了,我不太可能从未打开过任何旧的 ActiveX Dll 项目,但我不记得是否打开过。我的感觉是,我做到了,它正在工作,最近被破坏了,但我不确定,因为它们是旧项目,我很少打开它们,以进行最少的维护。
不幸的是我仍然需要维护那些古董。我需要在Windows 7虚拟机中进行维护吗?或者我有机会让它在 Windows 10 中运行吗?
react-native Dimensions.get("window").宽度为iPhone 6s返回375 ....它似乎远非正确.
`
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Dimensions
} from 'react-native';
class AwesomeProject extends Component {
render() {
return <Text style={{margin:50}}>Width: {Dimensions.get("window").width}</Text>;
}
}
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);`
Run Code Online (Sandbox Code Playgroud)
使用tf.maximum
负inf输入如下:
tf.maximum(-math.inf, -math.inf).eval()
Run Code Online (Sandbox Code Playgroud)
给出了预期的结果 -inf
但是,tf.reduce_max
在相同的输入上:
tf.reduce_max([-math.inf, -math.inf]).eval()
Run Code Online (Sandbox Code Playgroud)
给出:-3.40282e+38
min float32.
对于正无穷大输入,两个函数都会产生inf
.这是一个错误吗?
我试图将req.body保存到节点中的字符串,但每当我执行console.log(req.body.toString)时,输出为[object Object].关于我可能做错什么的任何想法?
var express = require('express');
var app = express();
var fs = require("fs");
var bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());
app.post('/addUser', function (req, res) {
console.log(req.body.toString());
res.end("thanks\n");
})
Run Code Online (Sandbox Code Playgroud)
输出是:
[object Object]
使用JSON.stringify时输出为:
" [object Object] "
Run Code Online (Sandbox Code Playgroud) 我有一个组件接收错误作为字符串或具有2个必需属性的对象.但是也可以为此道具传递null.在我当前的设置中,当传递null时,React会发出警告:
警告:失败的道具类型:
error
提供的 无效道具ErrorDialog
我应该为React改变什么来允许null | 字符串| 这个形状的物体?谢谢!
ErrorDialog.propTypes = {
onResetError: PropTypes.func.isRequired,
error: PropTypes.oneOfType([
PropTypes.shape({
id: PropTypes.number.isRequired,
defaultMessage: PropTypes.string.isRequired,
}),
PropTypes.string,
]),
};
Run Code Online (Sandbox Code Playgroud)
完整的代码是:
import React, { PropTypes } from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import { FormattedMessage } from 'react-intl';
const ErrorDialog = ({ error, onResetError }) => {
function renderError() {
if (!error) {
return null;
} else if (typeof error === 'string') …
Run Code Online (Sandbox Code Playgroud) 下面的代码在Visual Studio和g ++中编译和工作:
class A;
A* getRef(void);
char (&func(...))[2];
int main() {
bool isDefault = sizeof(func(getRef()))==2;
std::cout << isDefault << std::endl; //prints 1
return 0;
}
Run Code Online (Sandbox Code Playgroud)
下一代码仍然在Studio中编译(并且可以工作),但g ++声明这是invalid use of incomplete type 'class A'
:
class A;
A& getRef(void); //the only change
char (&func(...))[2];
int main() {
bool isDefault = sizeof(func(getRef()))==2; //g++ error here
std::cout << isDefault << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这是一个根本错误的代码,应该被编译器拒绝(如果是这样,为什么VS编译器不会产生任何警告)?或者在这个上下文中指针和引用之间是否存在一些我不知道的区别?
javascript ×2
activex ×1
android ×1
aws-lambda ×1
c++ ×1
express ×1
g++ ×1
lambda ×1
node.js ×1
php ×1
php-7 ×1
python ×1
react-native ×1
reactjs ×1
realm ×1
spring ×1
spring-boot ×1
spring-jdbc ×1
tensorflow ×1
vb6 ×1
width ×1
windows-10 ×1