General Getters and Setters设置,提示the type contains no fields,请问各位大神怎么解决?

新建javabean,右键source,进行General Getters and Setters设置时,提示the type contains no fields or all fields have getters/setters already图片说明

尝试下载更新lombok插件,但是没有用
在csdn也搜了相关问题,发现似乎没有人遇到这种问题,哭liao

1个回答

目测你 useBean 写成了 useBeann

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java源码中一个抽象类初始化方法中包含一个super(),该怎么理解
``` package org.apache.http.params; import java.util.Set; /** * Abstract base class for parameter collections. * Type specific setters and getters are mapped to the abstract, * generic getters and setters. * * @since 4.0 * * @deprecated (4.3) use configuration classes provided 'org.apache.http.config' * and 'org.apache.http.client.config' */ @Deprecated public abstract class AbstractHttpParams implements HttpParams, HttpParamsNames { /** * Instantiates parameters. */ protected AbstractHttpParams() { super(); } @Override public long getLongParameter(final String name, final long defaultValue) { final Object param = getParameter(name); if (param == null) { return defaultValue; } return ((Long) param).longValue(); } ```
unity c#中为什么不能直接更改transform.position.x的值?
The reason you can't directly alter the position vector is because it's actually a copy, not the actual position stored on the transform. transform.position <--- returns a copy of the position transform.position.x <--- the "x" value of the copy transform.position.x = 7.0f <--- sets the "x" value on the copy C# throws an error because you're setting the "x" value on a copy, which is then destroyed. It's a pointless line that if the compiler didn't pick up on it, could cause a tonne of hair pulling. UnityScript gets around this when it compiles by converting your code and firing the C# setter: transform.position.x = 7.0f when compiled in UnityScript, translates (more or less) to: var tempVector : Vector3 = transform.position; tempVector.x = 7.0f; transform.position = tempVector; You can infer that because if you replicate this with a custom C# class, you can track as the getters/setters are invoked. 权威资料是这样解释的。这个如何解释,transform.position(position是Vector3类型的),transform是类。vector3是结构体的,vector3创建的可以直接修改x值,为什么这个position.x就不可以,实在不明白了?
vuex模块化后,调用commit,dispatch报错
路过的大哥们帮忙看看,谢谢 vuex 如下: ``` const layoutModule = { state:{ userInfoId:{}, userHeadImgFile:{}, userHeadImg:"https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png", personInfo:{ username:'', }, }, getters:{ getUserHeadImgFile(state){ return state.userHeadImgFile; }, getUserInfoId(state){ return state.userInfoId; }, getUserHeadImg(state){ return state.userHeadImg; }, getPersonalInfo(state){ return state.personInfo; } }, mutations:{ setUserHeadImgFile(state,file){ state.userHeadImgFile = file; }, setUserInfoId(state,id){ state.userInfoId = id; }, setUserHeadImg(state,headImg){ state.userHeadImg = headImg; }, setPersonInfo(state,personInfo){ state.personInfo = personInfo; } }, actions:{ uploadHeadImg({commit,state},file){ var formData = new FormData(); formData.append('file',file); formData.append('userInfoId',parseInt(state.userInfoId)); Vue.http.post('/userInfo/uploadHeadImg',formData, {headers: { 'Content-Type': 'multipart/form-data' }}, ).then(function(res){ var result = res.data; if(result.code=="200"){ commit("setUserHeadImgFile",file); } }) }, } }; const store = new Vuex.Store({ modules:{ layout : layoutModule, } }); export default store; ``` vue实例中调用: this.$store.layout.commit("setUserInfoId", result.data.userInfoId); 报错: Error in v-on handler: "TypeError: Cannot read property 'commit' of undefined" found in 应该怎么正确调用commit,dispatch,getters呢?谢谢!
使用 javamail 连接 SMTP 时的错误
这是我发送一个邮件使用的代码: public String get_subject() { return _subject; } public void set_subject(String _subject) { this._subject = _subject; } public Mail() { _host = "mail.messagingengine.com"; _port = "587"; _sport = "587"; _user = ""; // username _pass = ""; // password _from = ""; // email sent from _subject = ""; // email subject _body = ""; // email body _debuggable = false; // debug mode on or off - default off _auth = true; // smtp authentication - default on _multipart = new MimeMultipart(); // There is something wrong with MailCap, javamail can not find a // handler for the multipart/mixed part, so this bit needs to be added. MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); CommandMap.setDefaultCommandMap(mc); } public Mail(String user, String pass) { this(); _user = user; _pass = pass; } public boolean send() throws Exception { Properties props = _setProperties(); if (!_user.equals("") && !_pass.equals("") && _to.length > 0 && !_from.equals("") && !_subject.equals("") && !_body.equals("")) { Session session = Session.getInstance(props, this); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(_from)); InternetAddress[] addressTo = new InternetAddress[_to.length]; for (int i = 0; i < _to.length; i++) { addressTo[i] = new InternetAddress(_to[i]); } msg.setRecipients(MimeMessage.RecipientType.TO, addressTo); msg.setSubject(_subject); msg.setSentDate(new Date()); // setup message body BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText(_body); _multipart.addBodyPart(messageBodyPart); // Put parts in message msg.setContent(_multipart); Transport.send(msg); return true; } else { return false; } } public void addAttachment(String filename) throws Exception { BodyPart messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(filename); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(filename); _multipart.addBodyPart(messageBodyPart); } @Override public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(_user, _pass); } private Properties _setProperties() { Properties props = new Properties(); props.put("mail.messagingengine.com", _host); // mail.messagingengine.com if (_debuggable) { props.put("mail.debug", "true"); } if (_auth) { props.put("mail.smtp.auth", "true"); } props.put("mail.smtp.port", _port); props.put("mail.smtp.socketFactory.port", _sport); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); return props; } // the getters and setters public String getBody() { return _body; } public void setBody(String _body) { this._body = _body; } // more of the getters and setters ….. } 在命令 transport.send(msg);后出现的错误: javax.mail.MessagingException: Could not connect to SMTP host: mail.messagingengine.com, port: 587; nested exception is: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1f81518: Failure in SSL library, usually a protocol error error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:683 0x4025bc93:0x00000000)
刚开始接触vuex,login.vue文件中this.$store.state.token,总是报错——无法解析$store
我想实现一个登录功能,在login.vue文件下面 ``` if (this.$store.state.token) { that.$router.push('/'); console.log(this.$store.state.token); } else { that.$router.replace('/login'); } ``` 这里的this.$store一直提示无法解析,可我该引入的都引入了呀,实在不知道为什么会出这种错误,望各位大神帮帮我 store.js文件 ``` import Vue from 'vue'; import Vuex from 'vuex'; Vue.use(Vuex); const state = { token: localStorage.getItem('token') ? localStorage.getItem('token') : '', //token }; export default new Vuex.Store({ state, getters: { getStorage(state) { if (!state.token) { state.token = JSON.parse(localStorage.getItem(key)); } return state.token } }, mutations: { setToken(state, token) { state.token = token.value; localStorage.setItem("token", token.token); }, deleteToken(state) { state.token = ""; localStorage.removeItem("token") } } }) ``` main.js ``` import store from './store'; ////////////////// //中间代码省略了 ///////////////// new Vue({ el: '#app', store, router: router, render: h => h(App) }); ``` login.vue ``` import {mapMutations} from 'vuex'; export default { name: "login", data: function () { return { loginText: '用户登录', account: '', password: '', value: '', single: false }; }, methods: { ...mapMutations(['setToken']), doLogin: function () { $('#userinfo .error-note').removeClass('error-note-show'); var user = {}; user.username = this.account; user.password = this.password; const that = this; $.ajax({ url: "http://localhost:9090/auth/login", type: "POST", contentType: "application/json", dataType: "text", data: JSON.stringify(user), success: function (data, status, xhr) { var token = xhr.getResponseHeader("token"); that.setToken({token: token}); that.$router.push({path: "/"}); var storage = window.localStorage; console.log(storage.getItem("token")); if (this.$store.state.token) { that.$router.push('/'); console.log(this.$store.state.token); } else { that.$router.replace('/login'); } }, error: function (res) { console.log("返回格式错误" + res); } });} }, }, }; ```
从User POJO中再抽取出AbstractUser有什么优势?
记不起来是哪次看到有一个这样子的讲法,从POJO中再进行一次抽象,如从User中再使用AbstractUser,这样子做有什么好处呢?是为了序列化的应用吗? 今天在MyEclipse的生成代码中又一次看到了,请帮忙解答一下。 [b]问题补充:[/b] 如果这种抽象操作是一对一(一个POJO对应两个类,***和Abstract***)的关系呢?这种情况有没有可能哦? [b]问题补充:[/b] 很谢谢各位,我记起来了,那次书上是说为了代码生成器而产生的,好像是为了代码生成器不会重复覆盖修改的POJO而进行的,是在《Pro Web 2.0 Application Development with GWT》一书中,原文如下: [code="java"] One additional best practice that I like to maintain is to keep all persisted properties of a class in an abstract class in their own package. This practice is almost certainly necessary if you plan to use any code generation tools, but even if you don’t, the separation of a class’s custom business methods from its properties and getter/setter methods is still a nice habit to get into and will leave us with cleaner code. The practice is pretty much mandatory for code generation tools, because most of these tools will simply overwrite whatever objects they’re in the process of creating. That means that if you edit the generated files, you’ll lose all your changes. Storing the bean properties and their getters and setters in an abstract class will help us avoid this problem and will clean up our objects to boot. [/code] 意思就是将业务逻辑写在子类中,这样当需要重复修改域模型的话,就不会因为被代码生成器覆盖掉写的业务逻辑了。
VUEJS 当两个页面调用同一个状态,state改变之后vuex.getters并不能刷新
最近在做一个项目是这么个情况,一个组件文件下包含另一个组件。。。 main组件先执行了一遍 this.$store.getters 这时候子组件还没执行ajax所以没数据状态为空。。当子组件执行了获取状态 那他的状态应该为 XX值,现在就是他不是实时更新的。。只有手动F2 点击一下VUE 查看错误信息他会变也就是有值了。。。 ![图片说明](https://img-ask.csdn.net/upload/201710/09/1507540455_679241.png) ![图片说明](https://img-ask.csdn.net/upload/201710/09/1507540466_979546.png) ![图片说明](https://img-ask.csdn.net/upload/201710/09/1507540478_612957.png)
opencv3.0.0出现无法解析的外部命令
opencv3.0.0出现无法解析的外部命令 头文件代码: #if !defined COLORDETECT #define COLORDETECT #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> class ColorDetector { private: // minimum acceptable distance int maxDist; // target color cv::Vec3b target; // image containing color converted image cv::Mat converted; bool useLab; // image containing resulting binary map cv::Mat result; public: // empty constructor // default parameter initialization here ColorDetector() : maxDist(100), target(0, 0, 0), useLab(false) {} // extra constructor for Lab color space example ColorDetector(bool useLab) : maxDist(100), target(0, 0, 0), useLab(useLab) {} // full constructor ColorDetector(uchar blue, uchar green, uchar red, int mxDist = 100, bool useLab = false) : maxDist(mxDist), useLab(useLab) { // target color setTargetColor(blue, green, red); } // Computes the distance from target color. int getDistanceToTargetColor(const cv::Vec3b& color) const { return getColorDistance(color, target); } // Computes the city-block distance between two colors. int getColorDistance(const cv::Vec3b& color1, const cv::Vec3b& color2) const { return abs(color1[0] - color2[0]) + abs(color1[1] - color2[1]) + abs(color1[2] - color2[2]); // Or: // return static_cast<int>(cv::norm<int,3>(cv::Vec3i(color[0]-color2[0],color[1]-color2[1],color[2]-color2[2]))); // Or: // cv::Vec3b dist; // cv::absdiff(color,color2,dist); // return cv::sum(dist)[0]; } // Processes the image. Returns a 1-channel binary image. cv::Mat process(const cv::Mat &image); cv::Mat operator()(const cv::Mat &image) { cv::Mat input; input = image; if (useLab) { // Lab conversion cv::cvtColor(image, input, CV_BGR2Lab); } cv::Mat output; // compute absolute difference with target color cv::absdiff(input, cv::Scalar(target), output); // split the channels into 3 images std::vector<cv::Mat> images; cv::split(output, images); // add the 3 channels (saturation might occurs here) output = images[0] + images[1] + images[2]; // apply threshold cv::threshold(output, // input image output, // output image maxDist, // threshold (must be < 256) 255, // max value cv::THRESH_BINARY_INV); // thresholding type return output; } // Getters and setters // Sets the color distance threshold. // Threshold must be positive, otherwise distance threshold // is set to 0. void setColorDistanceThreshold(int distance) { if (distance < 0) distance = 0; maxDist = distance; } // Gets the color distance threshold int getColorDistanceThreshold() const { return maxDist; } // Sets the color to be detected void setTargetColor(uchar blue, uchar green, uchar red) { // BGR order target = cv::Vec3b(blue, green, red); if (useLab) { // Temporary 1-pixel image cv::Mat tmp(1, 1, CV_8UC3); tmp.at<cv::Vec3b>(0, 0) = cv::Vec3b(blue, green, red); // Converting the target to Lab color space cv::cvtColor(tmp, tmp, CV_BGR2Lab); target = tmp.at<cv::Vec3b>(0, 0); } } // Sets the color to be detected void setTargetColor(cv::Vec3b color) { target = color; } // Gets the color to be detected cv::Vec3b getTargetColor() const { return target; } }; #endif 主函数代码: #include<iostream> #include<opencv2/opencv.hpp> #include<opencv2/highgui/highgui.hpp> #include<opencv2/core/core.hpp> #include"colordetector.h" int main() { // 1. Create image processor object ColorDetector cdetect; // 2. Read input image cv::Mat image = cv::imread("Schluss.jpg"); if (image.empty()) return 0; // 3. Set input parameters cdetect.setTargetColor(250, 219, 133); // here blue sky // 4. Process the image and display the result cv::namedWindow("result"); cv::imshow("result", cdetect.process(image)); // or using functor ColorDetector colordetector(250, 219, 133, // color 45, true); // Lab threshold cv::namedWindow("result (functor)"); cv::imshow("result (functor)", colordetector(image)); cv::waitKey(); return 0; } 依赖的库添加了: D:\opencv\build\x64\vc12\lib\opencv_ts300.lib D:\opencv\build\x64\vc12\lib\opencv_world300.lib D:\opencv\build\x64\vc12\staticlib\opencv_imgproc300.lib D:\opencv\build\x64\vc12\staticlib\IlmImf.lib D:\opencv\build\x64\vc12\staticlib\ippicvmt.lib D:\opencv\build\x64\vc12\staticlib\libjpeg.lib D:\opencv\build\x64\vc12\staticlib\libpng.lib D:\opencv\build\x64\vc12\staticlib\libtiff.lib D:\opencv\build\x64\vc12\staticlib\libwebp.lib D:\opencv\build\x64\vc12\staticlib\opencv_calib3d300.lib D:\opencv\build\x64\vc12\staticlib\opencv_core300.lib D:\opencv\build\x64\vc12\staticlib\opencv_features2d300.lib D:\opencv\build\x64\vc12\staticlib\opencv_flann300.lib D:\opencv\build\x64\vc12\staticlib\opencv_hal300.lib D:\opencv\build\x64\vc12\staticlib\opencv_highgui300.lib D:\opencv\build\x64\vc12\staticlib\opencv_imgcodecs300.lib D:\opencv\build\x64\vc12\staticlib\opencv_imgproc300.lib D:\opencv\build\x64\vc12\staticlib\opencv_ml300.lib D:\opencv\build\x64\vc12\staticlib\opencv_objdetect300.lib D:\opencv\build\x64\vc12\staticlib\opencv_photo300.lib D:\opencv\build\x64\vc12\staticlib\opencv_shape300.lib D:\opencv\build\x64\vc12\staticlib\opencv_stitching300.lib D:\opencv\build\x64\vc12\staticlib\opencv_superres300.lib D:\opencv\build\x64\vc12\staticlib\opencv_video300.lib D:\opencv\build\x64\vc12\staticlib\opencv_videoio300.lib D:\opencv\build\x64\vc12\staticlib\opencv_videostab300.lib D:\opencv\build\x64\vc12\staticlib\zlib.lib 解决方案配置是Release x64 刚开始学OpenCV,请各位大佬帮帮我
关于Hibernate延迟加载的问题
遇到一个问题,例如: [code="java"] public Class Parent{ private String id; //other fields ... public Parent(){} //setters & getters ... public boolean equals(Object o){ //核心是判断两个对象的id是否一样 .... } } public Class Child{ private String id; private Parent parent; //other fields ... public Child(){} //getters & setters ... } [/code] 在Hibernate中配置Child中关联Parent,而且是延迟加载,查询from Child where ... 之后,session关闭,这时调用 Child的getParent().getId()不会去取抓取Parent对象,但是调用Child的getParent().equals(anotherParent)后就需要抓取对象,然后报错could not initialize proxy - no Session,异常中有一句: at com.td.model.Parent_$$_javassist_1.equals(Parent_$$_javassist_1.java) 为啥equals的时候要抓取?有办法让调用equals的时候不去抓取么? 谢谢
ibatis查询结果映射的问题
问题描述: 我使用的ibatis框架,现在有两个类,一个User一个Template,多对一的关系,即一个用户只能选择一个模板,一个模板可以被多个用户选择。 User.class [code="java"] public class User { private Long userId; private String email; private String username; private String password; private Template template; //getters and setters... } [/code] Template.class [code="java"] public class Template { private Long templateId; private String name; //getters and setters... } [/code] resultMap [code="xml"] <sqlMap namespace="Template"> <resultMap id="base" class="Template"> <result column="template_id" property="templateId" /> <result column="name" property="name" /> <result column="path" property="path" /> </resultMap> </sqlMap> <sqlMap namespace="User"> <resultMap id="base" class="User"> <result column="user_id" property="userId" /> <result column="email" property="email" /> <result column="username" property="username" /> <result column="password" property="password" /> <result property="template" resultMap="Template.base" /> </resultMap> <select id="loginByUsername" parameterClass="User" resultMap="base"> <![CDATA[ select user_id, template_id, email, username, password from user as u where u.password = #password# and u.username = #username# ]]> </select> </sqlMap> [/code] 如果是这样设置,运行loginByUsername会有以下异常: [code="java"] Exception in thread "main" com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in net/ing100/microblog/po/mapping/Template.xml. --- The error occurred while applying a result map. --- Check the Template.base. --- Check the result mapping for the 'name' property. --- Cause: com.ibatis.sqlmap.client.SqlMapException: Error getting nested result map values for 'template'. Cause: java.sql.SQLException: Column 'name' not found. at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:204) at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82) at net.ing100.microblog.dao.impl.UserDAOImpl.loginByEmail(UserDAOImpl.java:12) at net.ing100.microblog.test.dao.TestUserDAO.main(TestUserDAO.java:32) Caused by: com.ibatis.sqlmap.client.SqlMapException: Error getting nested result map values for 'template'. Cause: java.sql.SQLException: Column 'name' not found. at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setNestedResultMappingValue(ResultMap.java:467) at com.ibatis.sqlmap.engine.mapping.result.ResultMap.applyNestedResultMap(ResultMap.java:395) at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setResultObjectValues(ResultMap.java:380) at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:64) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:385) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300) at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189) at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221) at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189) ... 7 more Caused by: java.sql.SQLException: Column 'name' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1093) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488) at com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342) at com.ibatis.sqlmap.engine.type.StringTypeHandler.getResult(StringTypeHandler.java:35) at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619) at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345) at com.ibatis.sqlmap.engine.mapping.result.ResultMap.setNestedResultMappingValue(ResultMap.java:454) ... 15 more [/code] 请问像这种查询,template_id如何装配到template.templateId中去,并且不要出什么column'name'的异常?
使用vuex,更新了stores中的state,为何在视图上没有更新体现呢?
vue小白一枚来求解,代码是这样的 **组件.vue** ``` <template> <div class="top-ad-section" v-bind:class="{ show: isShowAdStatus }"></div> </template> <script> export default { mounted() { setTimeout(() => { console.log(this.$store.getters.getTopAdStatus, 'before lllll'); this.$store.dispatch('toggleTopAd'); console.log(this.$store.getters.getTopAdStatus, 'after'); }, 200); }, computed: { isShowAdStatus() { return this.$store.getters.getTopAdStatus; } } }; </script> ``` **这段代码要实现的功能是:** 在组件加载200ms后改变store中的state的值,使用this.$store.dispatch('toggleTopAd')来改变,这个值可以用this.$store.getters.getTopAdStatus取到,这时候打印出的值是正确的state里的值,可是并没有体现在视图里,不知道是哪里写的有问题了 小白一枚,求大神指点。 以前写react的时候主要用mobx做状态管理,感觉vuex的状态管理至少在形式上是跟redux更接近的?
vuex里的state如何监听?
写了一个购物车,添加商品时多次点击同一个商品只显示数量1,添加第二件商品时第一件商品的数量就变成正确的了,数据变化时没有监听到变化,请问各位大佬该怎么解决? store.js: ```state:{ isLogin:false, car:[] }, getters:{ clearUp:function(state){ return state.car.sort(function(m,n){n-m}) } }, mutations:{ addCar:function(state,g){ var swi = -1 for(var i in state.car){ if(state.car[i].id == g.id){ swi = i break } } //console.log(swi) if (swi != -1){ state.car[swi].num ++ }else{ g.num = 1 state.car.push(g) } //console.log(state.car) } } ``` 监听页: ```computed:{ chuan:function(){ return this.$store.getters.clearUp } }, watch:{ clearUp:function(){ console.log(this.$store.state.car) return this.$store.state.car } } ``` 结构: ```<div v-for="(n,i) in chuan" class="car"> <img :src="n.imgName" alt=""> <p>{{n.name}}</p> <p class="num">数量:{{n.num}} <input type="button" value=" - " @click="minus(i)"> <input type="text" :value="n.num"> <input type="button" value=" + "> 个 </p> <span>总价:{{n.num*n.price}}元</span> </div> ```
新手求解一个hibernate3.6.10的问题
先贴代码: User类: public class User { private Integer id; private String nickName; private String password; private String familyName; private String name; private String fullName; private Boolean gender; private String nameStyle; private Date registerDate; private Date lastLoginDate; // getters和setters省略 } User.hbm.xml映射文件: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="org.maxwell.app.domain"> <class name="User" table="users" lazy="true"> <id name="id" column="user_id" length="11" type="int" > <generator class="identity" /> </id> <property name="nickName" column="nick_name" length="20" unique="true" not-null="true" /> <property name="password" length="20" not-null="true" /> <property name="familyName" column="family_name" length="20" /> <property name="name" length="20" /> <property name="gender" type="java.lang.Boolean" /> <property name="nameStyle" column="name_style" type="string" length="1" /> <property name="registerDate" type="timestamp" column="register_date" /> <property name="lastLoginDate" type="timestamp" column="last_login_date" /> <property name="fullName" formula="( select concat(u.family_name, u.name) from users u where u.user_id= id)" /> </class> </hibernate-mapping> 测试类: public class TestNews { public static void main(String[] args) { Configuration config = new Configuration().configure(); SessionFactory sf = config.buildSessionFactory(); Session session = sf.openSession(); Transaction tx = session.beginTransaction(); User u = new User().setNickName("Maxwell").setPassword("1234") .setFamilyName("张").setName("飞扬").setNameStyle("E") .setRegisterDate(new Date()).setLastLoginDate(new Date()); session.save(u); System.out.println(u); User u2 = (User) session.load(User.class, new Integer(1)); System.out.println(u2); tx.commit(); session.close(); sf.close(); } } 请问为什么会报出下面这样的错误呢? Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not load an entity: [org.maxwell.app.domain.User#1] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.loader.Loader.loadEntity(Loader.java:2041) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3294) at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:147) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090) at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1026) at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:176) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215) at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190) at org.maxwell.app.domain.User_$$_javassist_0.getFullName(User_$$_javassist_0.java) at org.maxwell.app.domain.TestNews.main(TestNews.java:25) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'user0_.id' in 'where clause' 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:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2324) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate.loader.Loader.getResultSet(Loader.java:1953) at org.hibernate.loader.Loader.doQuery(Loader.java:802) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) at org.hibernate.loader.Loader.loadEntity(Loader.java:2037) ... 14 more
关于vue.js验证输入与旧密码是否一致
如何用vue.js写一个 修改密码中 验证旧密码是否写错 ,先谢谢大佬帮忙了 <template> <div class="app-container"> <el-form ref="page" :rules="rules" :model="page" label-position="right" label-width="100px" style="width: 400px; margin-left:50px;"> <el-form-item label="旧密码" prop="oldPassword"> <el-input v-model="page.oldPassword" type="password" /> </el-form-item> <el-form-item label="新密码" prop="newPassword"> <el-input v-model="page.newPassword" type="password" /> </el-form-item> <el-form-item label="确认密码" prop="confirmPassword"> <el-input v-model="page.confirmPassword" type="password" /> </el-form-item> </el-form> <div slot="footer" class="dialog-footer" style="margin-left: 150px"> <el-button type="primary" @click="submitForm('page')">提交</el-button> </div> </div> </template> <script> import waves from '@/directive/waves' // 水波纹指令 import { changePwd } from '@/api/system' export default { name: 'PwdPage', directives: { waves }, data() { var validatePass = (rule, value, callback) => { if (value === '') { callback(new Error('请输入密码!')) } else { if (this.page.confirmPassword !== '') { this.$refs.page.validateField('confirmPassword') } callback() } } var validatePass2 = (rule, value, callback) => { if (value === '') { callback(new Error('请再次输入密码!')) } else if (value !== this.page.newPassword) { callback(new Error('两次输入密码不一致!')) } else { callback() } } return { page: { oldPassword: '', newPassword: '', confirmPassword: '' }, rules: { oldPassword: [ { required: true, message: '请输入旧密码!', trigger: 'blur' }, { min: 6, max: 64, message: '长度在6-64个字符!', trigger: 'blur' } ], newPassword: [ { required: true, message: '请输入新密码!', trigger: 'blur' }, { min: 6, max: 64, message: '长度在6-64个字符!', trigger: 'blur' }, { validator: validatePass, trigger: 'blur' } ], confirmPassword: [ { required: true, message: '请输入确认密码!', trigger: 'blur' }, { validator: validatePass2, trigger: 'blur' } ] } } }, methods: { submitForm(formName) { this.$refs[formName].validate((valid) => { if (valid) { const userName = this.$store.getters.name const { oldPassword, newPassword } = this.page changePwd({ userName, oldPassword, newPassword }).then(resp => { }) } else { return false } }) } } } </script> <style scoped> </style>
hibernate不能自动建出表,总是在insert的时候说对象表不存在...
//Student.java package domain; import java.io.Serializable; public class Student implements Serializable { private String id; private String name; private String cardId; private int age; //getters and setters } //hibernate.cfg.xml <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.show_sql">true</property> <property name="format_sql">true</property> <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost/student</property> <property name="hibernate.connection.username">stuAdmin</property> <property name="hibernate.connection.password">stuAdmin</property> <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property> <property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.max_size">20</property> <property name="hibernate.c3p0.timeout">300</property> <property name="hibernate.c3p0.max_statements">50</property> <property name="hibernate.c3p0.idle_test_period">3000</property> <mapping resource="domain/Student.hbm.xml"/> </session-factory> </hibernate-configuration> //Student.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="domain"> <class name="Student" table="STUDENT"> <id name="id"> <generator class="uuid.hex"/> </id> <property name="cardId"/> <property name="name"/> <property name="age"/> </class> </hibernate-mapping>
一个挺常见的myeclipse问题,求大神指点:
Dept类如下: public class Dept implements Serializable { private String id; private Set<User> users = new HashSet<User>(0); private String deptName;//部门名称 private Dept parent; //父部门 自关联 子部门与父部门 多对一 private Integer state;//状态 1代表启用 0代表停用 } 每个属性我都已经添加了getters和setters方法 数据库链接和sessionFactory代码如下: <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver" /> <property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:xe" /> <property name="user" value="test" /> <property name="password" value="wwwa6102792" /> </bean> <!-- 2.sessionFactory--> <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <property name="configLocation" value="classpath:hibernate.cfg.xml"></property> </bean> Dept.hbm.xml如下: <hibernate-mapping package="cn.itcast.jk.domain"> <class name="Dept" table="DEPT_P"> <id name="id" column="DEPT_ID"> <generator class="uuid"></generator> </id> <property name="deptName" column="DEPT_NAME"></property> <property name="state" column="STATE"></property> <!-- 自关联 子部门与父部门 多对一 --> <many-to-one name="parent" class="Dept" column="PARENT_ID"></many-to-one> <!-- private Set<User> user = new HashSet<User>(0); --> <set name="users"> <key column="DEPT_ID"></key> <one-to-many class="User"/> </set> </class> </hibernate-mapping> 问题代码如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.boot.MappingException: Association [cn.itcast.jk.domain.Dept.users] references an unmapped entity [cn.itcast.jk.domain.Dept.users] : origin(cn/itcast/jk/domain/Dept.hbm.xml) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Caused by: org.hibernate.boot.MappingException: Association [cn.itcast.jk.domain.Dept.users] references an unmapped entity [cn.itcast.jk.domain.Dept.users] : origin(cn/itcast/jk/domain/Dept.hbm.xml) at org.hibernate.boot.model.source.internal.hbm.ModelBinder$AbstractPluralAttributeSecondPass.bindCollectionTable(ModelBinder.java:3138) at org.hibernate.boot.model.source.internal.hbm.ModelBinder$AbstractPluralAttributeSecondPass.doSecondPass(ModelBinder.java:3076) at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1655) at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.processSecondPasses(InFlightMetadataCollectorImpl.java:1623) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:278) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724) at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:416) at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:401) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 21 more 下面还有几个警告: 警告: The web application [jk28_parent] registered the JDBC driver [oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 警告: The web application [jk28_parent] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.util.TimerThread.mainLoop(Timer.java:552) java.util.TimerThread.run(Timer.java:505) 警告: The web application [jk28_parent] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method)
hibernate自关联问题
&nbsp;&nbsp;&nbsp; 比如我要定义一个用户实体,如User。在这个用户实体里面,我想要定义用户的好友、黑名单和关注对象。于是我用了Set&lt;User&gt;的方式,然后在配置文件中使用了&lt;Set&gt;的配置,Set内使用many-to-many方式。我的目的就是让User自关联对多对,生成一个中间表,如User_friends。这样一来在运行的时候没问题,能生成所有预想的表,且能插入数据到User_INFO(User对应的表)中,但无论如何都不能将数据写入到对多对的关联表中。请高手们赐教,感谢不尽。 <br /> <br /><pre name="code" class="java"> package org.fantasizer.blog.core.entity; import java.io.Serializable; import java.util.Date; import java.util.Set; /** * [CN]用户实体 * * @author Marco Jee * @date 2010-11-1 */ @SuppressWarnings("serial") public class User implements Serializable { // ----------------------Instance Variables---------------------------// private Long id;// primary key private String loginname;// 登录名 private String nickname;// 昵称 private String password;// 密码MD5码 private String email;// email private Date birthdate;// 生日 private String gender;// 性别 private String marriage;// 婚姻状况 private String msn;// msn private String qq;// qq private String phone;// 电话号码 private String realname;// 真实姓名 private String country;// 国家 private String address;// 地址 private String birthplace;// 出生地 private String schoolname; private String strongSuit;// 特长 private String personalSign;// 个性签名 private Date lastLoginTime;// 上次登录时间 private Date lastLogoutTime;// 上次注销时间 private Date registerTime;// 注册时间 private Date loginTime;// 本次登录时间 private Integer loginCount;// 登录次数 private String lastIp;// 上次登录IP private String ip;// 本次登录IP private Boolean disabled;// 是否可用 private String picture;// 头像路径 private Set&lt;User&gt; friends;// 好友 private Set&lt;User&gt; attentions;// 关注对象 private Set&lt;User&gt; blcaklist;// 黑名单 // ----------------------Getters and Setters---------------------------// //Getters和Setters以及equals与hashCode方法由于太长,在此省略 } </pre> <br /><pre name="code" class="xml"> &lt;?xml version="1.0"?&gt; &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt; &lt;hibernate-mapping package="org.fantasizer.blog.core.entity"&gt; &lt;class name="User" table="user_info" lazy="false"&gt; &lt;id name="id" column="userid"&gt; &lt;generator class="native" /&gt; &lt;/id&gt; &lt;property name="loginname" column="loginname" type="string" length="20" unique="true" not-null="true" /&gt; &lt;property name="nickname" column="nickname" type="string" length="20" not-null="true" /&gt; &lt;property name="password" column="password" type="string" length="50" not-null="true" /&gt; &lt;property name="email" column="email" type="string" length="50" not-null="true" unique="true" /&gt; &lt;property name="birthdate" column="birthdate" type="date" /&gt; &lt;property name="gender" column="gender" type="string" length="6" /&gt; &lt;property name="marriage" column="marriage" type="string" length="6" /&gt; &lt;property name="msn" column="msn" type="string" length="50" /&gt; &lt;property name="qq" column="qq" type="string" length="50" /&gt; &lt;property name="phone" column="phone" type="string" length="15" /&gt; &lt;property name="realname" column="realname" type="string" length="50" /&gt; &lt;property name="country" column="country" type="string" length="50" /&gt; &lt;property name="address" column="address" type="string" length="100" /&gt; &lt;property name="birthplace" column="birthplace" type="string" length="100" /&gt; &lt;property name="schoolname" column="schoolname" type="string" length="50" /&gt; &lt;property name="strongSuit" column="strongSuit" type="string" length="200" /&gt; &lt;property name="personalSign" column="personalSign" type="string" length="200" /&gt; &lt;property name="lastLoginTime" column="lastLoginTime" type="timestamp" /&gt; &lt;property name="lastLogoutTime" column="lastLogoutTime" type="timestamp" /&gt; &lt;property name="registerTime" column="registerTime" type="timestamp" /&gt; &lt;property name="loginTime" column="loginTime" type="timestamp" /&gt; &lt;property name="loginCount" column="loginCount" type="java.lang.Integer" /&gt; &lt;property name="lastIp" column="lastIp" type="string" length="15" /&gt; &lt;property name="ip" column="ip" type="string" length="15" /&gt; &lt;property name="disabled" column="disabled" type="boolean" /&gt; &lt;property name="picture" column="picture" type="string" length="100" /&gt; &lt;set name="friends" inverse="true" table="user_friends" lazy="false"&gt; &lt;key column="userid" /&gt; &lt;many-to-many class="User" column="friendid" /&gt; &lt;/set&gt; &lt;set name="attentions" inverse="true" table="User_attentions"&gt; &lt;key column="userid" /&gt; &lt;many-to-many class="User" column="attentionid" /&gt; &lt;/set&gt; &lt;set name="blcaklist" inverse="true" table="user_blacklist"&gt; &lt;key column="userid" /&gt; &lt;many-to-many class="User" column="blcaklistid" /&gt; &lt;/set&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </pre> <br /> <br />另外补充一下,使用Hibernate的时候,想UserRelationship这样的类能不能当成实体?即表达的不是独立的实体,而是表示实体与实体之间关系的,谢谢各位~ <br/><strong>问题补充</strong><br/><div class="quote_title">txc_tang 写道</div> <div class="quote_div"> <p>帮你写了一个Annotation的实体类,映射关系劳烦你自己转换下,希望对你有用,呵呵</p> <pre name="code" class="java">package com.bebig.shopping.model; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; @Entity @Table(name = "tbl_QQUser") public class QQUser { private Long id;// primary key private String loginname;// 登录名 private String nickname;// 昵称 private String password;// 密码MD5码 private String email;// email private Date birthdate;// 生日 private String gender;// 性别 private String marriage;// 婚姻状况 private String msn;// msn private String qq;// qq private String phone;// 电话号码 private String realname;// 真实姓名 private String country;// 国家 private String address;// 地址 private String birthplace;// 出生地 private String schoolname; private String strongSuit;// 特长 private String personalSign;// 个性签名 private Date lastLoginTime;// 上次登录时间 private Date lastLogoutTime;// 上次注销时间 private Date registerTime;// 注册时间 private Date loginTime;// 本次登录时间 private Integer loginCount;// 登录次数 private String lastIp;// 上次登录IP private String ip;// 本次登录IP private Boolean disabled;// 是否可用 private String picture;// 头像路径 private Set&lt;QQUser&gt; friends = new HashSet&lt;QQUser&gt;();// 好友 private Set&lt;QQUser&gt; attentions= new HashSet&lt;QQUser&gt;();// 关注对象 private Set&lt;QQUser&gt; blcaklist= new HashSet&lt;QQUser&gt;();// 黑名单 public String getAddress() { return address; } @ManyToMany(cascade={CascadeType.ALL}) @JoinTable(name = "tbl_QQUserAndAttentions", joinColumns = { @JoinColumn(name = "userId") }, inverseJoinColumns = { @JoinColumn(name = "attentionId") }) public Set&lt;QQUser&gt; getAttentions() { return attentions; } public Date getBirthdate() { return birthdate; } public String getBirthplace() { return birthplace; } @ManyToMany(cascade={CascadeType.ALL}) @JoinTable(name = "tbl_QQUserAndBlcaklist", joinColumns = { @JoinColumn(name = "userId") }, inverseJoinColumns = { @JoinColumn(name = "blcaklistId") }) public Set&lt;QQUser&gt; getBlcaklist() { return blcaklist; } public String getCountry() { return country; } public Boolean getDisabled() { return disabled; } public String getEmail() { return email; } @ManyToMany(cascade={CascadeType.ALL}) @JoinTable(name = "tbl_QQUserAndFriends", joinColumns = { @JoinColumn(name = "userId") }, inverseJoinColumns = { @JoinColumn(name = "friendId") }) public Set&lt;QQUser&gt; getFriends() { return friends; } public String getGender() { return gender; } @Id @GeneratedValue public Long getId() { return id; } public String getIp() { return ip; } public String getLastIp() { return lastIp; } public Date getLastLoginTime() { return lastLoginTime; } public Date getLastLogoutTime() { return lastLogoutTime; } public Integer getLoginCount() { return loginCount; } public String getLoginname() { return loginname; } public Date getLoginTime() { return loginTime; } public String getMarriage() { return marriage; } public String getMsn() { return msn; } public String getNickname() { return nickname; } public String getPassword() { return password; } public String getPersonalSign() { return personalSign; } public String getPhone() { return phone; } public String getPicture() { return picture; } public String getQq() { return qq; } public String getRealname() { return realname; } public Date getRegisterTime() { return registerTime; } public String getSchoolname() { return schoolname; } public String getStrongSuit() { return strongSuit; } public void setAddress(String address) { this.address = address; } public void setAttentions(Set&lt;QQUser&gt; attentions) { this.attentions = attentions; } public void setBirthdate(Date birthdate) { this.birthdate = birthdate; } public void setBirthplace(String birthplace) { this.birthplace = birthplace; } public void setBlcaklist(Set&lt;QQUser&gt; blcaklist) { this.blcaklist = blcaklist; } public void setCountry(String country) { this.country = country; } public void setDisabled(Boolean disabled) { this.disabled = disabled; } public void setEmail(String email) { this.email = email; } public void setFriends(Set&lt;QQUser&gt; friends) { this.friends = friends; } public void setGender(String gender) { this.gender = gender; } public void setId(Long id) { this.id = id; } public void setIp(String ip) { this.ip = ip; } public void setLastIp(String lastIp) { this.lastIp = lastIp; } public void setLastLoginTime(Date lastLoginTime) { this.lastLoginTime = lastLoginTime; } public void setLastLogoutTime(Date lastLogoutTime) { this.lastLogoutTime = lastLogoutTime; } public void setLoginCount(Integer loginCount) { this.loginCount = loginCount; } public void setLoginname(String loginname) { this.loginname = loginname; } public void setLoginTime(Date loginTime) { this.loginTime = loginTime; } public void setMarriage(String marriage) { this.marriage = marriage; } public void setMsn(String msn) { this.msn = msn; } public void setNickname(String nickname) { this.nickname = nickname; } public void setPassword(String password) { this.password = password; } public void setPersonalSign(String personalSign) { this.personalSign = personalSign; } public void setPhone(String phone) { this.phone = phone; } public void setPicture(String picture) { this.picture = picture; } public void setQq(String qq) { this.qq = qq; } public void setRealname(String realname) { this.realname = realname; } public void setRegisterTime(Date registerTime) { this.registerTime = registerTime; } public void setSchoolname(String schoolname) { this.schoolname = schoolname; } public void setStrongSuit(String strongSuit) { this.strongSuit = strongSuit; } }</pre> </div> <p>哥们儿,非常感谢你的回复。不过我对Annotation理解不深呀,只有继续坐等了。。</p> <p> </p> <p>在此感谢~~</p>
在使用重载函数时出现的问题
class IPM { private: // Sizes cv::Size m_origSize; cv::Size m_dstSize; // Points std::vector<cv::Point2f> m_origPoints; std::vector<cv::Point2f> m_dstPoints; // Homography cv::Mat m_H; cv::Mat m_H_inv; // Maps cv::Mat m_mapX, m_mapY; cv::Mat m_invMapX, m_invMapY; void createMaps(); public: IPM( const cv::Size& _origSize, const cv::Size& _dstSize, const std::vector<cv::Point2f>& _origPoints, const std::vector<cv::Point2f>& _dstPoints ); // Apply IPM on points cv::Point2d applyHomography(const cv::Point2d& _point, const cv::Mat& _H); cv::Point3d applyHomography( const cv::Point3d& _point, const cv::Mat& _H); cv::Point2d applyHomography(const cv::Point2d& _point); cv::Point3d applyHomography( const cv::Point3d& _point); cv::Point2d applyHomographyInv(const cv::Point2d& _point); cv::Point3d applyHomographyInv( const cv::Point3d& _point); void applyHomography( const cv::Mat& _origBGR, cv::Mat& _ipmBGR, int borderMode = cv::BORDER_CONSTANT); void applyHomographyInv( const cv::Mat& _ipmBGR, cv::Mat& _origBGR, int borderMode = cv::BORDER_CONSTANT); // Draw void drawPoints( const std::vector<cv::Point2f>& _points, cv::Mat& _img ) const; //******************************************************************************************** //* SETTERS AND GETTERS //******************************************************************************************** cv::Mat getH() const { return m_H; } cv::Mat getHinv() const { return m_H_inv; } void getPoints(std::vector<cv::Point2f>& _origPts, std::vector<cv::Point2f>& _ipmPts); }; IPM::IPM( const Size& _origSize, const Size& _dstSize, const vector<Point2f>& _origPoints, const vector<Point2f>& _dstPoints ): m_origSize(_origSize), m_dstSize(_dstSize), m_origPoints(_origPoints), m_dstPoints(_dstPoints){ m_H = getPerspectiveTransform( m_origPoints, m_dstPoints ); m_H_inv = m_H.inv(); createMaps(); } IPM::IPM ipm( Size(imgG.cols, imgG.rows), Size(imgG.cols, imgG.rows), orgPts, dstPts ); // IPM object ipm.applyHomography( imgG, imgIpm ); 鼠标放在IPM::IPM ipm时会出现无法确定需要哪个重载函数 错误提示“IPM::{ctor}”: 函数调用缺少参数列表;请使用“&IPM::{ctor}”创建指向成员的指针 “ipm”: 找不到标识符
vue 改变一个地方, 其他地方自动渲染改变,该如何实现呢?
我想做一个自动切换语言的页面, 目前遇到的问题便是数据改变了, 但是view无法渲染。 思路: 在vuex中创建了 store,state,getter跟mutations 代码 ``` // state export default { currentlanguage: 'cn', // 当前语言 } ``` ``` // getters export default { getlan: (state) => { return state.lan }, getcurrentlanguage: (state) => { return state.currentlanguage } } ``` ``` import * as types from './mutation-type' export default { [types.SET_LAN] (state, currentlanguage) { console.log(currentlanguage) state.currentlanguage = currentlanguage.lan } } ``` app.vue 中调用 ![图片说明](https://img-ask.csdn.net/upload/201809/12/1536742288_15696.jpeg) index.vue 中调用 ![图片说明](https://img-ask.csdn.net/upload/201809/12/1536742369_290519.jpeg) 得到的结果 ![图片说明](https://img-ask.csdn.net/upload/201809/12/1536742404_317258.jpg) 出来中文的版本完全没问题 ![图片说明](https://img-ask.csdn.net/upload/201809/12/1536742438_65810.jpeg) 切换为英文的时候, 就上面导航变了, 还有state的数据也改变了, 但没有渲染出来, 要如何才能达到预想的效果呢?
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
小白学 Python 爬虫(25):爬取股票信息
人生苦短,我用 Python 前文传送门: 小白学 Python 爬虫(1):开篇 小白学 Python 爬虫(2):前置准备(一)基本类库的安装 小白学 Python 爬虫(3):前置准备(二)Linux基础入门 小白学 Python 爬虫(4):前置准备(三)Docker基础入门 小白学 Python 爬虫(5):前置准备(四)数据库基础 小白学 Python 爬虫(6):前置准备(...
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
世界上最牛的网络设备,价格低廉,其貌不扬......
夜深人静,电视和电脑都已经关机休息,但是我还在默默工作,我安静地趴在你家中的某个地方,7*24小时不眠不休,任劳任怨,目的只有一个,能让你舒服地躺在床上,畅快地刷手机!没错,这就是我,...
《面试宝典》2019年springmvc面试高频题(java)
前言 2019即将过去,伴随我们即将迎来的又是新的一年,过完春节,马上又要迎来新的金三银四面试季。那么,作为程序猿的你,是否真的有所准备的呢,亦或是安于本职工作,继续做好手头上的事情。 当然,不论选择如何,假如你真的准备在之后的金三银四跳槽的话,那么作为一个Java工程师,就不可不看了。如何在几个月的时间里,快速的为即将到来的面试进行充分的准备呢? 1、什么是Spring MVC ?简单...
一名大专同学的四个问题
【前言】   收到一封来信,赶上各种事情拖了几日,利用今天要放下工作的时机,做个回复。   2020年到了,就以这一封信,作为开年标志吧。 【正文】   您好,我是一名现在有很多困惑的大二学生。有一些问题想要向您请教。   先说一下我的基本情况,高考失利,不想复读,来到广州一所大专读计算机应用技术专业。学校是偏艺术类的,计算机专业没有实验室更不用说工作室了。而且学校的学风也不好。但我很想在计算机领...
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
python爬取百部电影数据,我分析出了一个残酷的真相
2019年就这么匆匆过去了,就在前几天国家电影局发布了2019年中国电影市场数据,数据显示去年总票房为642.66亿元,同比增长5.4%;国产电影总票房411.75亿元,同比增长8.65%,市场占比 64.07%;城市院线观影人次17.27亿,同比增长0.64%。 看上去似乎是一片大好对不对?不过作为一名严谨求实的数据分析师,我从官方数据中看出了一点端倪:国产票房增幅都已经高达8.65%了,为什...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试一个ArrayList我都能跟面试官扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
2020年1月中国编程语言排行榜,python是2019增长最快编程语言
编程语言比例 排名 编程语言 最低工资 工资中位数 最低工资 最高工资 人头 人头百分比 1 rust 20713 17500 5042 46250 480 0.14% 2 typescript 18503 22500 6000 30000 1821 0.52% 3 lua 18150 17500 5250 35000 2956 0.84% 4 go 17989 16...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
工作十年的数据分析师被炒,没有方向,你根本躲不过中年危机
2020年刚刚开始,就意味着离职潮高峰的到来,我身边就有不少人拿着年终奖离职了,而最让我感到意外的,是一位工作十年的数据分析师也离职了,不同于别人的主动辞职,他是被公司炒掉的。 很多人都说数据分析是个好饭碗,工作不累薪资高、入门简单又好学。然而今年34的他,却真正尝到了中年危机的滋味,平时也有不少人都会私信问我: 数据分析师也有中年危机吗?跟程序员一样是吃青春饭的吗?该怎么保证自己不被公司淘汰...
作为一名大学生,如何在B站上快乐的学习?
B站是个宝,谁用谁知道???? 作为一名大学生,你必须掌握的一项能力就是自学能力,很多看起来很牛X的人,你可以了解下,人家私底下一定是花大量的时间自学的,你可能会说,我也想学习啊,可是嘞,该学习啥嘞,不怕告诉你,互联网时代,最不缺的就是学习资源,最宝贵的是啥? 你可能会说是时间,不,不是时间,而是你的注意力,懂了吧! 那么,你说学习资源多,我咋不知道,那今天我就告诉你一个你必须知道的学习的地方,人称...
那些年,我们信了课本里的那些鬼话
教材永远都是有错误的,从小学到大学,我们不断的学习了很多错误知识。 斑羚飞渡 在我们学习的很多小学课文里,有很多是错误文章,或者说是假课文。像《斑羚飞渡》: 随着镰刀头羊的那声吼叫,整个斑羚群迅速分成两拨,老年斑羚为一拨,年轻斑羚为一拨。 就在这时,我看见,从那拨老斑羚里走出一只公斑羚来。公斑羚朝那拨年轻斑羚示意性地咩了一声,一只半大的斑羚应声走了出来。一老一少走到伤心崖,后退了几步,突...
立即提问