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(); } ```
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呢?谢谢!
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,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); } });} }, }, }; ```
使用 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)
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,请各位大佬帮帮我
从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)
关于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的数据也改变了, 但没有渲染出来, 要如何才能达到预想的效果呢?
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
死磕YOLO系列,YOLOv1 的大脑、躯干和手脚
YOLO 是我非常喜欢的目标检测算法,堪称工业级的目标检测,能够达到实时的要求,它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置,当然,也能预测物体的类别。 之前我有写博文介绍过它,但是每次重新读它的论文,我都有新的收获,为此我准备写一个系列的文章来详尽分析它。这是第一篇,从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址:https://www.c
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
记一次腾讯面试:进程之间究竟有哪些通信方式?如何通信? ---- 告别死记硬背
有一次面试的时候,被问到进程之间有哪些通信方式,不过由于之前没深入思考且整理过,说的并不好。想必大家也都知道进程有哪些通信方式,可是我猜很多人都是靠着”背“来记忆的,所以今天的这篇文章,讲给大家详细着讲解他们是如何通信的,让大家尽量能够理解他们之间的区别、优缺点等,这样的话,以后面试官让你举例子,你也能够顺手拈来。 1、管道 我们来看一条 Linux 的语句 netstat -tulnp | gr...
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片
网络(8)-HTTP、Socket、TCP、UDP的区别和联系
TCP/IP协议是传输层协议,主要解决数据如何在网络中传输,而HTTP是应用层协议,主要解决如何包装数据。 一、TCP与UDP的不同 1. 是否需要建立连接。 UDP在传送数据之前不需要先建立连接;TCP则提供面向连接的服务; 2. 是否需要给出确认 对方的传输层在收到UDP报文后,不需要给出任何确认,而 TCP需要给出确认报文,要提供可靠的、面向连接的传输服务。 3.虽然UDP不提供可靠交...
简明易理解的@SpringBootApplication注解源码解析(包含面试提问)
欢迎关注文章系列 ,关注我 《提升能力,涨薪可待》 《面试知识,工作可待》 《实战演练,拒绝996》 欢迎关注我博客,原创技术文章第一时间推出 也欢迎关注公 众 号【Ccww笔记】,同时推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《提升能力,涨薪可待篇》- @SpringBootApplication注解源码解析 一、@SpringBootApplication 的作用是什
防劝退!数据结构和算法难理解?可视化动画带你轻松透彻理解!
大家好,我是 Rocky0429,一个连数据结构和算法都不会的蒟蒻… 学过数据结构和算法的都知道这玩意儿不好学,没学过的经常听到这样的说法还没学就觉得难,其实难吗?真难! 难在哪呢?当年我还是个小蒟蒻,初学数据结构和算法的时候,在忍着枯燥看完定义原理,之后想实现的时候,觉得它们的过程真的是七拐八绕,及其难受。 在简单的链表、栈和队列这些我还能靠着在草稿上写写画画理解过程,但是到了数论、图...
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
开挂的人生!那些当选院士,又是ACM/IEEE 双料Fellow的华人学者们
昨日,2019年两院院士正式官宣,一时间抢占了各大媒体头条。 朋友圈也是一片沸腾,奔走相告,赶脚比自己中了大奖还嗨皮! 谁叫咱家导师就是这么厉害呢!!! 而就在最近,新一年度的IEEE/ACM Fellow也将正式公布。 作为学术届的顶级荣誉,不自然地就会将院士与Fellow作比较,到底哪个含金量更高呢? 学术君认为,同样是专业机构对学者的认可,考量标准不一,自然不能一概而论。 但...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
代码详解:如何用Python快速制作美观、炫酷且有深度的图表
全文共12231字,预计学习时长35分钟生活阶梯(幸福指数)与人均GDP(金钱)正相关的正则图本文将探讨三种用Python可视化数据的不同方法。以可视化《2019年世界幸福报告》的数据为例,本文用Gapminder和Wikipedia的信息丰富了《世界幸福报告》数据,以探索新的数据关系和可视化方法。《世界幸福报告》试图回答世界范围内影响幸福的因素。报告根据对“坎特里尔阶梯问题”的回答来确定幸...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
(经验分享)作为一名普通本科计算机专业学生,我大学四年到底走了多少弯路
今年正式步入了大四,离毕业也只剩半年多的时间,回想一下大学四年,感觉自己走了不少弯路,今天就来分享一下自己大学的学习经历,也希望其他人能不要走我走错的路。 (一)初进校园 刚进入大学的时候自己完全就相信了高中老师的话:“进入大学你们就轻松了”。因此在大一的时候自己学习的激情早就被抛地一干二净,每天不是在寝室里玩游戏就是出门游玩,不过好在自己大学时买的第一台笔记本性能并不是很好,也没让我彻底沉...
如何写一篇技术博客,谈谈我的看法
前言 只有光头才能变强。 文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y 我一直推崇学技术可以写技术博客去沉淀自己的知识,因为知识点实在是太多太多了,通过自己的博客可以帮助自己快速回顾自己学过的东西。 我最开始的时候也是只记笔记,认为自己能看得懂就好。但如果想验证自己是不是懂了,可以写成技术博客。在写技术博客的...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
互联网公司的裁员,能玩出多少种花样?
裁员,也是一门学问,可谓博大精深!以下,是互联网公司的裁员的多种方法:-正文开始-135岁+不予续签的理由:千禧一代网感更强。95后不予通过试用期的理由:已婚已育员工更有责任心。2通知接下来要过苦日子,让一部分不肯同甘共苦的员工自己走人,以“兄弟”和“非兄弟”来区别员工。3强制996。员工如果平衡不了工作和家庭,可在离婚或离职里二选一。4不布置任何工作,但下班前必须提交千字工作日报。5不给活干+...
【设计模式】单例模式的八种写法分析
网上泛滥流传单例模式的写法种类,有说7种的,也有说6种的,当然也不排除说5种的,他们说的有错吗?其实没有对与错,刨根问底,写法终究是写法,其本质精髓大体一致!因此完全没必要去追究写法的多少,有这个时间还不如跟着宜春去网吧偷耳机、去田里抓青蛙得了,一天天的....
《面试宝典》:检验是否为合格的初中级程序员的面试知识点,你都知道了吗?查漏补缺
欢迎关注文章系列,一起学习 《提升能力,涨薪可待篇》 《面试知识,工作可待篇》 《实战演练,拒绝996篇》 也欢迎关注公 众 号【Ccww笔记】,原创技术文章第一时间推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《面试知识,工作可待篇》-Java笔试面试基础知识大全 前言 是不是感觉找工作面试是那么难呢? 在找工作面试应在学习的基础进行总结面试知识点,工作也指日可待,欢...
关于研发效能提升的思考
研发效能提升是最近比较热门的一个话题,本人根据这几年的工作心得,做了一些思考总结,由于个人深度有限,暂且抛转引入。 三要素 任何生产力的提升都离不开这三个因素:人、流程和工具,少了其中任何一个因素都无法实现。 人,即思想,也就是古人说的“道”,道不同不相为谋,是制高点,也是高层建筑的基石。 流程,即方法,也是古人说的“法”。研发效能的提升,也就是要提高投入产出比,既要增加产出,也要减...
微博推荐算法简述
在介绍微博推荐算法之前,我们先聊一聊推荐系统和推荐算法。有这样一些问题:推荐系统适用哪些场景?用来解决什么问题、具有怎样的价值?效果如何衡量? 推荐系统诞生很早,但真正被大家所重视,缘起于以”facebook”为代表的社会化网络的兴起和以“淘宝“为代表的电商的繁荣,”选择“的时代已经来临,信息和物品的极大丰富,让用户如浩瀚宇宙中的小点,无所适从。推荐系统迎来爆发的机会,变得离用户更近: 快...
相关热词 c# 时间比天数 c# oracle查询 c# 主动推送 事件 c# java 属性 c# 控制台 窗体 c# 静态类存值 c#矢量作图 c#窗体调用外部程式 c# enum是否合法 c# 如何卸载引用
立即提问