精华内容
下载资源
问答
  • vb资源 mscommon介绍 

    2008-09-15 21:10:51
    mscommon介绍 mscommon介绍 mscommon介绍 mscommon介绍 mscommon介绍 mscommon介绍 
  • MSCOMMON串口控件

    2018-12-13 13:48:18
    压缩包里面包含了mscomm需要安装的3个文件,包含了mscomm.reg和mscomm32.dep、mscomm32.ocx,还附上了mscomm在delphi xe2中的安装说明,和程序在非开发的电脑上使用时出错的解决办法,另:有一份测试用的源码,网上...
  • 主要是编写了一个拍照的程序,其中还包含了mscommon控件的使用实例,拍照采用的是vfw格式,值得收藏哦
  • 用API函数打开 MS CommonDialog对话框
  • ms-普通 微服务公共库教程
  • IllegalArgumentException in class: cn.chengtech.ms.common.entity.BaseModel,getter method of property: id org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException

    错误如下:

    IllegalArgumentException in class: cn.chengtech.ms.common.entity.BaseModel,getter method of property: id

    org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred calling getter ofcn.chengtech.ms.common.entity.BaseModel.id; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter ofcn.chengtech.ms.common.entity.BaseModel.id

       atorg.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)

       atorg.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)

       at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)

       at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)

       at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:683)

       at cn.chengtech.ms.common.dao.BaseDao.save(BaseDao.java:149)

       at cn.chengtech.ms.common.service.BaseService.saveOrUpdate(BaseService.java:65)

       atcn.chengtech.test.sections.projects.service.ProjectsService.saveOrUpdateProjects(ProjectsService.java:56)

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)

       atorg.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

       atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

       atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

       atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

       at $Proxy261.saveOrUpdateProjects(Unknown Source)

       atcn.chengtech.test.sections.projects.action.ProjectsAction.saveOrUpdateProjects(ProjectsAction.java:119)

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)

       atcom.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)

       atcn.chengtech.ms.common.web.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:37)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)

       at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atorg.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atorg.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)

       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atorg.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at cn.chengtech.ms.common.web.interceptor.SystemInterceptor.intercept(SystemInterceptor.java:101)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)

       at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)

       atorg.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

       atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

       atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

       at org.ecside.filter.ECSideFilter.doFilter(ECSideFilter.java:188)

       atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

       atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

       at java.lang.Thread.run(Thread.java:619)

    Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter ofcn.chengtech.ms.common.entity.BaseModel.id

       at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)

       atorg.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:206)

       atorg.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3619)

       at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3335)

       at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)

       at org.hibernate.engine.ForeignKeys$Nullifier.isNullifiable(ForeignKeys.java:160)

       at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:92)

       atorg.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:70)

       atorg.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:311)

       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)

       atorg.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:144)

       atorg.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)

       atorg.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)

       atorg.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)

       atorg.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)

       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)

       at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)

       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)

       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)

       atorg.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:686)

       atorg.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:1)

       at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)

       ... 89 more

    Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@11f7bf4

       at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:169)

       ...110 more

    以上是第一个错误,还有一个错误如下:

     

    org.hibernate.QueryException: Unable to resolve path [engineering.id], unexpectedtoken [engineering] [select count(*) fromcn.chengtech.test.sections.projects.entity.Projects where delFlag='1' andengineering.id = '4081a8a25711d7e8015711ded5a90023' ]

       atorg.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:219)

       at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:108)

       at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:176)

       at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:482)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4326)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1212)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3525)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1690)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)

       at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)

       at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:251)

       at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)

       at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)

       at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)

       at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)

       at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)

       at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)

       at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)

       at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)

       at cn.chengtech.ms.common.dao.BaseDao.getRecordCount(BaseDao.java:288)

       atcn.chengtech.test.sections.projects.service.ProjectsService.getProjectsCount(ProjectsService.java:24)

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       atorg.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)

       atorg.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

       atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

       atorg.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

       at $Proxy261.getProjectsCount(Unknown Source)

       at cn.chengtech.test.sections.projects.action.ProjectsAction.listProjectsJson(ProjectsAction.java:72)

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)

       at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)

       atcn.chengtech.ms.common.web.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:37)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)

       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)

       atorg.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atorg.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atorg.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)

       atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atorg.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcom.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       atcn.chengtech.ms.common.web.interceptor.SystemInterceptor.intercept(SystemInterceptor.java:101)

       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)

       at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)

       at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)

       at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

       atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

       at org.ecside.filter.ECSideFilter.doFilter(ECSideFilter.java:188)

       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

       at java.lang.Thread.run(Thread.java:619)

     

    其实,这两个错误都是由于一个字段配置错误导致的,错误字段修改之前如下:

    Project.hbm.xml:

    <many-to-one name="engineeringId" class="Engineerings" lazy="false">
               <column name="engineeringId" length="32">
        <comment>项目类别Id</comment>
       </column>
          </many-to-one>

    错误原因:many-to-one是多对一的映射关系,Project 类有属性是Engineering以及EngineeringId,而Engineering是一个对象,EngineeringId则是Engineering对象对应的Id,那么,在配置的,<many-to-one name的值应该是engineering,而不是engineeringId,出错的原因是因为字段配置错误导致。一开始的错误显示说是因为BaseModel的id之类的错误,其实如果BaseModel设置的id以及其他属性确定下来了就不会错误了。

    总结:这次是本人在设计一个标段模块管理时遇到的错误。因为配置字段不对,导致了在对数据的增删查改过程也无法正常执行,上面的第二段错误就是在显示数据的时候抛出的,字段没配置正确,新增数据的时候是无法将数据正常保存到数据库的。如果发现自己写的程序无法正确执行,那么,从头开始检查自己的程序,仔细再仔细,因为有时候错误的原因来自于小细节。还是需要勤加练习,增强自己的代码敏感度。

    展开全文
  • Table of Contents ...how to install CLISP and SBCL on MS WindowsLisp modes on Emacshow to install SLIMEsome minimal SLIME customizationtroubleshooting SLIME customization gone wrongfirst things to k

    Goal of this article is to show that it is now easy to install these stuff on MS Windows (or at least on Windows 7 & 8). Like boiling rice, it turns out to be easy. To be fair, maybe it wasn’t easy in old days.

    Readers are assumed to be long time Emacs users who are at least familiar with Emacs key notation and are assumed to be Common Lisp beginners. I will also assume you are using the latest stable version of GNU Emacs.

    1. how to install CLISP and SBCL on MS Windows

    CLISP and SBCL are two Common Lisp implementations. Let’s install both because choosing between jajangmyeon and jjamppong is hard.

    SBCL stands for Steel Bank Common Lisp. I don’t know what CLISP stands for but you need to know that it does NOT stand for Common Lisp. (Elisp still stands for Emacs Lisp, unofficially.)

    1.1. Installing CLISP

    How I installed it is I downloaded the installer from
    http://sourceforge.net/projects/clisp/files/latest/download
    and I chose “Typical” during installation.

    1.2. checking if installation was successful

    Open Command Prompt and type clisp and enter. It will show CLISP REPL. Now you can type (+ 1 1) and press enter to see that it evaluates to 2.

    1.3. Installing SBCL

    How I installed it is I downloaded an installer from https://github.com/akovalenko/sbcl-win32-threads/wiki and ran it. There are many installers on that page and “MSI package for 32-bit Windows” is probably what you want.

    ( Update: the other day, I installed using an installer from the official SBCL page, and it works.)

    1.4. checking if installation was successful

    You may have to reboot your computer. Then open Command Prompt and type sbcl and enter, and so on.

    2. Lisp modes on Emacs

    Before we start, let’s get familiar with some Lisp mode names in Emacs. Vanilla Emacs provides at least three Lisp major modes:

    • emacs-lisp-mode (major mode just for Emacs Lisp)
    • lisp-mode (major mode for other lisp dialects)
    • lisp-interaction-mode (major mode derived from emacs-lisp-mode for the scratch buffer.)

    Paredit and SLIME are Lisp minor modes and they are not shipped with Emacs.

    3. how to install SLIME

    You can install SLIME from MELPA. See how to install just one package from MELPA and not others

    Update: You can also use quicklisp to install SLIME but I have not tested that way of installation. The rest of this article is tested only for SLIME installed from MELPA.

    4. some minimal SLIME customization

    SLIME doesn’t work out of the box.

    Your Emacs init file probably has these two lines somewhere:

    (package-initialize)
    (setq package-enable-at-startup nil)
    

    Now you need to put the following code somewhere after those two lines:

    (setq inferior-lisp-program "sbcl")
    (setq slime-auto-connect 'ask)
    
    (defun my-slime-setup ()
      (require 'slime)
      (slime-setup))
    (defvar my--slime-setup-done nil)
    (defun my-slime-setup-once ()
      (unless my--slime-setup-done
        (my-slime-setup)
        (setq my--slime-setup-done t)))
    (defadvice lisp-mode (before my-slime-setup-once activate)
      (my-slime-setup-once))
    

    Then restart Emacs and create a new lisp file in Emacs. (the file name should be something like blahblah.lisp) SLIME mode should be automatically enabled on that buffer and you should see the word Slime in the mode line. Now write the following Common Lisp code in that buffer:

    (mapcar #'+
            (list 10 20 30)
            (list 1 2 3))
    

    Try to evaluate that form by using either C-M-x which is bound to slime-eval-defun (for evaluating a top level form), or C-x C-e which is bound to slime-eval-last-expression (for evaluating the last expression before cursor), or C-c C-r which is bound to slime-eval-region (for evaluating the selected region). Wait enough and the result of evaluation will be displayed in the echo area. Not so different from evaluating Emacs Lisp forms. When you evaluate a Common Lisp form for the first time, SLIME spends some time starting up a Common Lisp process and setting up a connection to it, and when it’s the first time starting up such a process, SLIME spend some more extra time doing some stuff. It may take a long time.

    5. troubleshooting SLIME customization gone wrong

    When you start changing the main structure of my example SLIME customization code, things may go wrong but don’t worry, this section might help you.

    When you manually do M-x slime (which you don’t have to with my customization example) and it results in this message:

    apply: Searching for program: permission denied, lisp
    

    it may mean that your Emacs init file did not make sure slime-setup to be called, or that the value of inferior-lisp-program is lisp.

    When you press C-M-x on a Common Lisp buffer and it says:

    Process lisp does not exist
    

    it may mean that SLIME mode is off for some reason or that the value of inferior-lisp-program is lisp.

    When you press C-M-x on a Common Lisp buffer and it says:

    slime-connection: Not connected.
    

    it may mean that your Emacs init file did not make sure slime-setup to be called or that you forgot to do M-x slime.

    6. first things to know about using SLIME

    A bit of diversion first. Let’s check the four must features of Lisp editors:

    1. indentation
    2. selecting a form
    3. clipboard management
    4. inserting the closing paren automatically for you.

    You indent your Common Lisp code using TAB or C-M-\ the same as usual. Selecting forms can be done by pressing C-M-SPC multiple times (after maybe moving up using C-M-u multiple times), again the same as you already do with Emacs Lisp code. For clipboard management, you are already either using Emacs’s kill ring feature or an external clipboard manager. Now the fourth thing: automatic insertion of a closing parenthesis upon your insertion of an open parenthesis. You are probably already using something for that, ParEdit or SmartParens or AutoPair or electric pair mode. If not, time to choose. I have an article on how to install AutoPair. AutoPair is stable and is a team player. ParEdit is also stable, is only for Lisp modes, and it bans you from making unmatched parens, and that’s a good thing, but some may not like that. SmartParens and electric pair mode are the new kids. If you want me to choose one for you, I choose ParEdit if you can live with three keys <C-left>, <C-right>, <C-backspace> doing odd things, or if you know how to unbind those keys. End of diversion.

    The key C-M-i is bound to slime-complete-symbol which is for completion of function names and so on. That is again just like when you are editing Emacs Lisp code.

    Now try writing the following Common Lisp code but this time using C-M-i to help you complete dolist and print (pretend that you forgot the spelling for dolist)

    (dolist (num (list 1 3 5 7 10 1 1 1 1 1))
      (if (evenp num)
          (progn
            (print "found an even number. gonna return it")
            (return num))
          (print num)))
    

    Now evaluate that using C-M-x. The eval result 10 will be shown. Where’s the output from print? The output is in the *inferior-lisp* buffer. You have to switch to it to see the output. OK, this one was a bit different from evaluating Emacs Lisp code involving print, but even in Emacs Lisp buffers, when you evaluate a form that prints a long output, you switch to the *Messages* buffer to see it. If you don’t like switching to the *inferior-lisp* buffer, you may want to try these commands: slime-pprint-eval-last-expression and slime-pprint-eval-region.

    You might have noticed something happening in the echo area when you were writing the dolist form. That’s the command slime-space (bound to SPC) showing argument lists of Common Lisp functions for you. Just like the ElDoc minor mode that you probably use with Emacs Lisp buffers. This feature only starts working after SLIME starts a Lisp connection, but you know that is guaranteed to happen when you evaluate a form or use C-M-i to complete a function name.

    Try evaluating the following Common Lisp code:

    (/ 1 0)
    

    Just as you expected, an error is signaled and you are now in debugger. How do you get out then? How to quit this debugger? You should see a new submenu in the menu bar: SLDB. That stands for SLime DeBugger mode. From that submenu, you can find a way to quit the debugger. Or if you have time, you can press C-h m to start learning how to use SLDB.

    7. looking up Common Lisp documentation

    When you invoke the command slime-documentation-lookup (bound to C-c C-d h and a menu item), it will look up the documentation for symbol at point and open the web page for it.

    8. downloading Common Lisp HyperSpec (CLHS) for use in SLIME

    You don’t have to download it to look things up, but if you want offline access, you can download it from LispWorks Downloadable Documentation.

    To connect your downloaded documentation to SLIME, extract the downloaded archive and you will get a folder with name Hyperspec, and then you move that folder to the Emacs bin directory, or its parent directory, or its grandparent directory, Put the following code in Emacs init file.

    (defun my-hyperspec-setup ()
      (let ((dir (locate-dominating-file invocation-directory "HyperSpec/")))
        (if dir
            (progn
              (setq common-lisp-hyperspec-root (expand-file-name "HyperSpec/" dir)))
          (warn "No HyperSpec directory found"))))
    

    and add my-hyperspec-setup to my-slime-setup like this:

    (defun my-slime-setup ()
      (my-hyperspec-setup)
      (require 'slime)
      (slime-setup))
    

    and restart Emacs.

    Now when you invoke slime-documentation-lookup it will open the local web page instead.

    9. further customization how

    When you see this from others code

    (require 'slime)
    (slime-setup)
    
    (blahblahblah)
    (blahblah)
    (blahblah)
    

    the right way to replicate that in your own Emacs would be to add the relevant part to my-slime-setup like this:

    (defun my-slime-setup ()
      ;; (my-hyperspec-setup)
      (require 'slime)
      (slime-setup)
    
      (blahblahblah)
      (blahblah)
      (blahblah))
    

    10. why the unusual way of customization

    The reason for the odd way of invoking my-slime-setup in my code is so that my-slime-setup gets called when you open a Common Lisp file the first time and not during Emacs startup. This is so that my code does not slow down Emacs startup.

    11. how to visually distinguish common lisp buffers from emacs lisp buffers.

    You can put this in your init file to make parenthesis of Common Lisp code (and Scheme and Clojure) to be a bit red to distinguish Common Lisp buffers from Emacs Lisp buffers.

    ;;; Red the color of Common Lisp
    ;;; Black the color of Emacs Lisp
    
    (defface my-common-lisp-paren-face
      '((((class color) (background dark))
         (:foreground "sienna3"))
        (((class color) (background light))
         (:foreground "sienna3")))
      "Face used for common lisp parentheses.")
    
    (dolist (mode '(scheme lisp clojure))
      (font-lock-add-keywords
       (intern (concat (symbol-name mode) "-mode"))
       '(("(\\|)" . 'my-common-lisp-paren-face))))
    

    Or you may want to do the other way around.

    13. some differences between CLISP and SBCL

    Doubly nested backquote forms are handled in different but still CLHS-compatible ways. See CLHS “innermost backquoted form should be expanded first” meaning – Stack Overflow to see how two seemingly different ways may be equivalent in a way after all.

    展开全文
  • mscommon.c: void ms_init(){  ….  /* register builtin MSFilter's */ //这侧内置的一些filter  for (i=0;ms_filter_descs[i]!=NULL;i++){  ms_filter_register(ms_filter_descs[i]);  }
    mscommon.c:

    void ms_init(){
      ….  
         /* register builtin MSFilter's */    //这侧内置的一些filter
        for (i=0;ms_filter_descs[i]!=NULL;i++){
          ms_filter_register(ms_filter_descs[i]);
        }
    。。。

    ********************************
    其中ms_filter_descs如下:
     MSFilterDesc * ms_filter_descs[]={
    35 &ms_alaw_dec_desc,
    36 &ms_alaw_enc_desc,
    37 &ms_ulaw_dec_desc,
    38 &ms_ulaw_enc_desc,
    39 &ms_file_player_desc,
    40 &ms_rtp_send_desc,
    41 &ms_rtp_recv_desc,
    42 &ms_dtmf_gen_desc,
    43 &ms_file_rec_desc,
    44 &ms_speex_dec_desc,
    45 &ms_speex_enc_desc,
    46 &ms_gsm_dec_desc,
    47 &ms_gsm_enc_desc,
    48 &ms_speex_ec_desc,
    49 &ms_tee_desc,
    50 &ms_conf_desc,
    51 //&alsa_write_desc,
    52 //&alsa_read_desc,
    53 //&oss_read_desc,
    54 //&oss_write_desc,
    55 //&ms_arts_read_desc,
    56 //&ms_arts_write_desc,
    57 //&ms_v4l_desc,
    58 //&ms_sdl_out_desc,
    59 //&ms_h263_enc_desc,
    60 //&ms_h263_dec_desc,
    61 &ms_join_desc,
    62 #ifndef DISABLE_RESAMPLE
    63 &ms_resample_desc,
    64 #endif
    65 &ms_volume_desc,
    66 &ms_ice_desc,
    67 &ms_equalizer_desc,
    68 NULL
    69 };
    ******************

    在ms_filter_register(ms_filter_descs[i]);后有个非常重要的方法:
        ms_message("Registering all soundcard handlers");
        cm=ms_snd_card_manager_get();  //获取声卡管理器 MSSndCardManager
        for (i=0;ms_snd_card_descs[i]!=NULL;i++){                  

           ms_snd_card_manager_register_desc(cm,ms_snd_card_descs[i]);   //通过声卡描述数组,来注册一系列的声卡
        
        }


    *****************下面所有的分析就是针对ms_snd_card_manager_register_desc方法*********************

    注册声卡,通过声卡描述来注册声卡到声卡管理器 MSSndCardManager

    下面来看看ms_snd_card_manager_register_desc方法(mssndcard.c 113行)
    void ms_snd_card_manager_register_desc(MSSndCardManager *m, MSSndCardDesc *desc){
        m->descs=ms_list_append(m->descs,desc);
        card_detect(m,desc);
    }
    继续->
    static void card_detect(MSSndCardManager *m, MSSndCardDesc *desc){
        if (desc->detect!=NULL)
            desc->detect(m);
    }

    detect是结构体_MSSndCardDesc的一个指针函数。请看->mssndcard.h 101行:
    struct _MSSndCardDesc{
        const char *driver_type;
        MSSndCardDetectFunc detect;
        MSSndCardInitFunc init;
        MSSndCardSetLevelFunc set_level;
        MSSndCardGetLevelFunc get_level;
        MSSndCardSetCaptureFunc set_capture;
        MSSndCardSetControlFunc set_control;
        MSSndCardGetControlFunc get_control;
        MSSndCardCreateReaderFunc create_reader;
        MSSndCardCreateWriterFunc create_writer;
        MSSndCardUninitFunc uninit;
        MSSndCardDuplicateFunc duplicate;
        MSSndCardUnloadFunc unload;

    };

    在88行有: typedef void (*MSSndCardDetectFunc)(MSSndCardManager *obj);

    在mscommon.c 中定义了ms_snd_card_descs ,请看->

    static MSSndCardDesc * ms_snd_card_descs[]={
    #ifdef __ALSA_ENABLED__
        &alsa_card_desc,
    #endif
    #ifdef HAVE_SYS_SOUNDCARD_H
        &oss_card_desc,
    #endif
    #ifdef __ARTS_ENABLED__
        &arts_card_desc,
    #endif
    #ifdef WIN32
        &winsnd_card_desc,
    #endif
    #ifdef __DIRECTSOUND_ENABLED__
        &winsndds_card_desc,
    #endif
    #ifdef __PORTAUDIO_ENABLED__
        &pasnd_card_desc,
    #endif
    #ifdef __MACSND_ENABLED__
        &ca_card_desc,
    #endif

    #ifdef __PULSEAUDIO_ENABLED__
        &pulse_card_desc,
    #endif

    #if TARGET_OS_IPHONE
        &au_card_desc,
    #endif
    #ifdef __MAC_AQ_ENABLED__
        &aq_card_desc,
    #endif
    #ifdef ANDROID
        &msandroid_sound_card_desc,
    #endif
    NULL
    };

    在line482查到了android 的声卡描述 (注意这个是个全局变量)
    #ifdef ANDROID
    extern MSSndCardDesc msandroid_sound_card_desc;
    #endif

    在msandroid.cpp中找到了msandroid_sound_card_desc的赋值操作。
    MSSndCardDesc msandroid_sound_card_desc = {
    /*.driver_type=*/"ANDROID SND",
    /*.detect=*/msandroid_sound_detect,
    /*.init=*/msandroid_sound_init,
    /*.set_level=*/msandroid_sound_set_level,
    /*.get_level=*/msandroid_sound_get_level,
    /*.set_capture=*/msandroid_sound_set_source,
    /*.set_control=*/NULL,
    /*.get_control=*/NULL,
    /*.create_reader=*/msandroid_sound_read_new,
    /*.create_writer=*/msandroid_sound_write_new,
    /*.uninit=*/msandroid_sound_uninit,
    /*.duplicate=*/msandroid_sound_duplicate
    };

    好了,android的声卡描述终于找到了,现在回过头来看看mssndcard.c 中的
    static void card_detect(MSSndCardManager *m, MSSndCardDesc *desc){
        if (desc->detect!=NULL)
            desc->detect(m);
    }
    在  msandroid_sound_card_desc 中 detect的值为:msandroid_sound_detect
    那么在msandroid.cpp中找到这个方法:

    void msandroid_sound_detect(MSSndCardManager *m){
        ms_debug("msandroid_sound_detect");
        MSSndCard *card=msandroid_sound_card_new();
        ms_snd_card_manager_add_card(m,card);
    }

    先看msandroid_sound_card_new();

    MSSndCard *msandroid_sound_card_new(){
        MSSndCard *card=ms_snd_card_new(&msandroid_sound_card_desc);
        card->name=ms_strdup("Android Sound card");
        return card;
    }

    在mssndcard.c中查看ms_snd_card_new方法:

    MSSndCard * ms_snd_card_new(MSSndCardDesc *desc){
        return ms_snd_card_new_with_name(desc,NULL);
    }

    MSSndCard * ms_snd_card_new_with_name(MSSndCardDesc *desc,const char* name) {
        MSSndCard *obj=(MSSndCard *)ms_new(MSSndCard,1);
        obj->desc=desc;
        obj->name=name?ms_strdup(name):NULL;
        obj->data=NULL;
        obj->id=NULL;
        obj->capabilities=MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK;
        if (desc->init!=NULL)
            desc->init(obj);
        return obj;
    }

    结果发现最终还是调到了msandroid.cpp中的init方法:

    可惜的是可惜的是!!!!!msandroid.cpp 中msandroid_sound_card_desc的init值为 msandroid_sound_init,它的方法体
    是空的!!!
    void msandroid_sound_init(MSSndCard *card){
    }

    傻眼了!!!!,虽然init是空的,但是呢,毕竟一个MSSndCard被创建出来了,在方法ms_snd_card_new_with_name中,
    而且这个MSSndCard中初始化了desc,name,capabilities的值。只是没有init而已!!

    好吧,先停一停,回到msandroid.cpp中的

    void msandroid_sound_detect(MSSndCardManager *m){
        ms_debug("msandroid_sound_detect");
        MSSndCard *card=msandroid_sound_card_new();
        ms_snd_card_manager_add_card(m,card);
    }
    从一路跟踪msandroid_sound_card_new下来,发现card是有值了,现在就把这个声卡添加到声卡管理器中:
    在mssndcard.c 103 ->
    void ms_snd_card_manager_add_card(MSSndCardManager *m, MSSndCard *c){
        ms_message("Card '%s' added",ms_snd_card_get_string_id(c));
        m->cards=ms_list_append(m->cards,c);
    }

    *****************ms_init方法中的 ms_snd_card_manager_register_desc方法 分析技术*********************




     
    展开全文
  • 简单的串口助手程序开发

    千次阅读 2016-10-20 23:04:38
    1.简介 之前在烽火集团实习的时候,...在串口程序开发过程中,有两个很得力的助手——“CserialPort”和“MSCommon”。这里,仅尝试了利用MSCommon空间进行最基本的串口助手开发,也是受益匪浅。 2.一步一步开发

    1.简介

    之前在烽火集团实习的时候,开发串口通信程序用的都是纯C++。感觉串口程序开发很考验人的逻辑思考能力。不过,现在好了,科研工作中,一切已存在的“利器”都可以用来为自己的“idea”服务。
    在串口程序开发过程中,有两个很得力的助手——“CserialPort”和“MSCommon”。这里,仅尝试了利用MSCommon空间进行最基本的串口助手开发,也是受益匪浅。

    2.一步一步开发程序

    1.利用先前点击打开链接介绍的加载MSCommon控件的方法设计对话框面板,如下图所示:



    2.改变各控件的ID号以及添加相应的空间变量:


    3.初始化串口,设置MSComm控件的属性
    OOL CSerialCommDlg::OnInitDialog()
    {
    	CDialogEx::OnInitDialog();
    
    	// 将“关于...”菜单项添加到系统菜单中。
    
    	// IDM_ABOUTBOX 必须在系统命令范围内。
    	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    	ASSERT(IDM_ABOUTBOX < 0xF000);
    
    	CMenu* pSysMenu = GetSystemMenu(FALSE);
    	if (pSysMenu != NULL)
    	{
    		BOOL bNameValid;
    		CString strAboutMenu;
    		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
    		ASSERT(bNameValid);
    		if (!strAboutMenu.IsEmpty())
    		{
    			pSysMenu->AppendMenu(MF_SEPARATOR);
    			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    		}
    	}
    
    	// 设置此对话框的图标。  当应用程序主窗口不是对话框时,框架将自动
    	//  执行此操作
    	SetIcon(m_hIcon, TRUE);			// 设置大图标
    	SetIcon(m_hIcon, FALSE);		// 设置小图标
    
    	///初始化代码///
    	m_ctrlComm.put_CommPort(1);//选择COM1
    
    	m_ctrlComm.put_InputMode(1);      //设置输入方式为二进制方式
    	m_ctrlComm.put_InBufferSize(1024);//设置输入缓冲区大小
    	m_ctrlComm.put_OutBufferSize(512);//设置输出缓冲区大小
    
    	//通信协议:波特率9600 无校验 传输位数8  停止位1
    	m_ctrlComm.put_Settings(_T("9600,n,8,1"));//提示const char* 与 LPCTSTR不兼容
    	//打开串口
    	if (!m_ctrlComm.get_PortOpen())
    		m_ctrlComm.put_PortOpen(TRUE);
    
    	m_ctrlComm.put_RThreshold(1);//每当串口缓冲区又多于或等于1个字符的时候将
    	                             //引发一个接收数据的OnCommon事件
    	m_ctrlComm.put_InputLen(0);  //设置当前接受区数据长度为0
    	m_ctrlComm.get_Input();      //先预读缓冲区以清除残留数据
    	return TRUE;
    }
    串口初始化部分其实就是三个过程:选择串口及开辟缓存区、设定通信协议、打开串口并监控串口线程消息。

    4.添加串口消息处理函数OnComm()
    void CSerialCommDlg::Oncomm()
    {//接收串口数据并传递到显示窗口
    	VARIANT variant_inp;
    	COleSafeArray safearray_inp;
    	LONG len, k;
    	BYTE rxdata[2048];
    	CString strtemp;
    	if (m_ctrlComm.get_CommEvent() == 2 )     //事件值为2表示接受缓冲区内有字符
    	{
    		variant_inp = m_ctrlComm.get_Input(); //读缓冲区
    		safearray_inp = variant_inp;          //数据类型转换
    		len = safearray_inp.GetOneDimSize();  //得到有效数据长度
    		for (k = 0; k < len; k++)
    			safearray_inp.GetElement(&k, rxdata + k); //转换为BYTE型数组
    		for (k = 0; k < len; k++)
    		{
    			BYTE bt = *(char*)(rxdata + k); //字符型
    			strtemp.Format(_T("%c"),bt);    //将字符送入临时变量中保存
    			                                //const char 与 const wchar_t不兼容
    			m_strEditRxData += strtemp;
    		}
    	}
    	UpdateData(FALSE);
    }
    MSComm控件一般就是用事件驱动方式从串口接收数据,也就是消息处理,当串口有事件发生时,程序调用消息消息函数来处理数据。该函数代码的主要任务是从串口接收数据并显示在接收编辑框中。
    在这里不得不说的是我们会经常碰到的程序错误:“ const char* 与LPCTCTR类型不匹配 ”、“ const char 和 const wchar_t 类型不匹配”。在这里,我们利用“-T()”函数处理就好了。

    5.发送消息设置
    void CSerialCommDlg::OnClickedButtonManualsend()
    {
    	UpdateData(TRUE);
    	m_ctrlComm.put_Output(COleVariant(m_strEditTxData));//发送数据
    }
    首先通过更新命令,实时更新成员变量值,然后利用串口对象将该数据发送出去。

    6.双串口配置
    利用虚拟串口软件Virtual Serial Ports Driver XP设置一对串口,如下图所示:
    7.实验结果:

    3.心得感受

    利用MSComm进行串口程序开发大大提高了编程效率!关键在于串口消息的实时监控,并设定适当的消息处理函数。最典型的就是获得串口接收到的数据(当然了也包括这些数据的算法处理)。


    展开全文
  • IE6下Ms Ajax Lib 调用Ajaxtoolkit时Common_InvalidPaddingUnit未定义总是显示未定义究其原因在于中文的资源文件 ScriptResources.zh-CHS.resx并未对Common_InvalidPaddingUnit进行定义,所以只能强行将Common.js中...
  • 需要做特定场景中物体检测的数据集,对于数据标记中一些基本的思路,方法,原则没有比较系统的认识。所以,希望通过参考一些常用的检测相关的数据集的制作思路和方法,提升自己数据集的质量;
  • 可实现串口的收发,使用mscommon控件
  • VS2015中配置MSComm通讯控件和注意事项

    万次阅读 多人点赞 2016-10-20 17:05:49
    1.MSCommon通讯控件前文回顾 MSComm 作为一个串行通讯控件。在为程序员串口通讯编程节省了很多时间,基于对话框的应用中加入一个MSComm控件非常简单。 MSComm控件提供了两种处理通信的方法: 事件驱动 事件驱动...
  • 最近在搭建springcloud项目时,启动项目时,由于外网无法访问搭建在阿里云服务器的kafka队列,从而报org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms. 百度了各种资料...
  • Common Subsequence

    千次阅读 2017-06-19 10:34:04
    Common Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1415 Accepted Submission(s): 759   Problem Descri
  • 串口调试助手

    2012-03-16 09:27:45
    这是一个串口调试助手源程序,使用mscommon组件编写
  • linphone交叉编译问题

    2017-02-17 02:53:31
    /usr/bin/ld: .libs/mscommon.o: Relocations in generic ELF (EM: 40) /usr/bin/ld: .libs/mscommon.o: Relocations in generic ELF (EM: 40) /usr/bin/ld: .libs/mscommon.o: Relocations in generic ELF (EM: 40)...
  • org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms. 原因是producer client的Jar包版本与kafka集群版本,不兼容!
  • 问题描述 kafka producer/...org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms. 解决办法 假如:kafka broker部署在172.17.162.198(主机名为myhost01)机器。...
  • 关于org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.问题的解决 今天在测试自己编写的kafka消息发送接收小例子时,一直报org.apache.kafka.common.errors....
  • 我们使用微软Çommon在CO NTEXT(MS COCO)O bjects为这个项目。 它是用于场景理解的大规模数据集。 该数据集通常用于训练和基准化对象检测,分段和字幕算法。 有关下载数据的说明,请参见下面的“数据”部分。 ...
  • Longest Common Prefix

    2014-06-09 21:06:19
    Write a function to find the longest common prefix string amongst an array of strings. 很简单的一道题目,但是我写了两个不一样的版本,运行时间确实数倍之差。。贴代码如下: 版本1: class Solution { ...
  • ISSUE: npm run test-local egg-init 自动生成目录,选择 simple选项 输入 egg-test-local ... common-bin [EggBin] origin argument `test` +0ms common-bin [EggBin] add command `autod` from `/Users/cc/Docume
  • 由于功能开发需要,将kafka的版本由0.9.0.1升级为1.1.0版本。升级完成后,测试producer发送消息功能。 1.首先修改了pom文件中kafka相关的jar包,修改为1.1.0版本的。 2.测试发送消息发现失败。...
  • 前言:网上很多说是hosts的问题,我经过测试发现不是,经过我自己测试,介绍三种针对大部分问题的解决方法 1.未开放防火墙端口或关闭防火墙 防火墙一般本地测试才会关闭,线上一般都是开启的,建议还是添加端口 ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 89,340
精华内容 35,736
热门标签
关键字:

MScommon