大佬们,python 3.7 中如何调用函数marshal.UnsafeAddrOfPinnedArrayElement(vBuffer,0) 5C

各位大佬,小弟在参考c#语言在python3.7 环境中调用以下函数,查看支持库marshal没有这个函数,也还没搞懂这个函数属于哪个模块。还是按这个方式写的。
marshal.UnsafeAddrOfPinnedArrayElement(vBuffer,0)

因此很显然出现了这个报错。图片说明

请教大佬们,如题,如何在python 中顺利调用该函数。

先感谢感谢。

2个回答

在python3.7中,要用到很多的库,有些库是默认没有安装的,所以你要先安装这个库。
安装库的方法是:
找到用管理员运行命令提示符(cmd),进入cmd后直接输入命令:pip install marshal
其次你要确定这个“.”后面的字符是正确的,不然你运行就是错误的。推荐还是在pycharm中编程把,这个软件挺好用的

qq_43670837
老刘吃瓜 这个模块里面只有几个函数load();loads();dumps();dump() 这样的函数。
大约一年之前 回复

marshal.UnsafeAddrOfPinnedArrayElement(vBuffer,0)并不是python的语法啊。
marshal的python官方文档:
https://docs.python.org/3.6/library/marshal.html
例子:
https://blog.csdn.net/mldxs/article/details/8574518
https://blog.csdn.net/ncafei/article/details/60469430

qq_43670837
老刘吃瓜 回复lyhsdy: 你给出的是找到符合条件的对象的相对位置。我现在需要找的是对象(例如自定义的类结构数据的起始内存地址)的首地址。有这样的函数么?谢谢老大的指导
大约一年之前 回复
weixin_39416561
lyhsdy 回复老刘吃瓜: 你要找元素列表内的元素位置?? list.index(obj)??
大约一年之前 回复
qq_43670837
老刘吃瓜 这个模块里面只有几个函数load();loads();dumps();dump() 这样的函数。好像没有我要找的函数相应功能。
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
snownlp给词性标注训练时出错。
我已经浏览了许多给snownlp训练的文章,千篇一律,大致内容如下: ``` 现在提供训练的包括分词,词性标注,情感分析,而且都提供了我用来训练的原始文件 以分词为例 分词在`snownlp/seg`目录下 ~~~~{python} from snownlp import seg seg.train('data.txt') seg.save('seg.marshal') #from snownlp import tag #tag.train('199801.txt') #tag.save('tag.marshal') #from snownlp import sentiment #sentiment.train('neg.txt', 'pos.txt') #sentiment.save('sentiment.marshal') ~~~~ 这样训练好的文件就存储为`seg.marshal`了,之后修改`snownlp/seg/__init__.py`里的`data_path`指向刚训练好的文件即可 ``` 然而没有解决我的问题! 我的问题有两点: 1、我按照上面的写了这两行代码如下 ``` tag.train('199801.txt') tag.save('tag.marshal') ``` 然后 ``` snow = SnowNLP('嗨你好') print(snow.words) for tag in snow.tags: print(tag) ``` 结果就报错了 ``` File "/usr/local/lib/python3.6/dist-packages/snownlp/__init__.py", line 42, in tags tags = tag.tag(words) File "/usr/local/lib/python3.6/dist-packages/snownlp/tag/__init__.py", line 43, in tag return map(lambda x: x[1], tag_all(words)) File "/usr/local/lib/python3.6/dist-packages/snownlp/tag/__init__.py", line 39, in tag_all return tagger.tag(words) File "/usr/local/lib/python3.6/dist-packages/snownlp/utils/tnt.py", line 139, in tag wd = log(self.wd.get((s, w))[1])-log(self.uni.get(s)[1]) ValueError: math domain error ``` 2、自己给添加了训练词汇后不管用!求大神帮忙
.net 调用Excel 中 VBA宏 返回值-2146826273
private void button1_Click(object sender, EventArgs e) { try { object oMissing = System.Reflection.Missing.Value; Excel.Application oExcel = new Excel.Application(); oExcel.Visible = true; Excel.Workbooks oBooks = oExcel.Workbooks; Excel._Workbook oBook = null; oBook = oBooks.Open(Application.StartupPath.ToString()+"\\ts.xlsm", oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing); // RunMacro(oExcel, new Object[] { "Sheet1.DoKbTest" }); // RunMacro(oExcel, new Object[] { "Sheet1.DoKbTestWithParameter", "传个参数给你" }); RunMacro(oExcel, new Object[] { "Sheet1.aa()" }); oBook.Close(false, oMissing, oMissing); System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook); oBook = null; System.Runtime.InteropServices.Marshal.ReleaseComObject(oBooks); oBooks = null; oExcel.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel); oExcel = null; } catch (Exception ex) { Debug.Print(ex.ToString()); } } /// <summary> /// 调用excel中VBA /// </summary> /// <param name="oApp"></param> /// <param name="oRunArgs"></param> private void RunMacro(object oApp, object[] oRunArgs) { try { object o = null; o= oApp.GetType().InvokeMember("Run", System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.InvokeMethod, null, oApp, oRunArgs); } catch (Exception ex) { Debug.Print(ex.ToString()); } } 这个是EXCEL中代码 Public Function aa() aa = "1123" End Function 程序返回的O 一直是 -2146826273 。。无论VBA中返回什么值都是 -2146826273
C#中如何计算类占空间大小??
C#中如何计算类占空间大小?? 我用sizeof不行 用using System.Runtime.InteropServices;的Marshal.SizeOf(p)报异常。
C# 调用C++ DLL 参数OpenCvSharp.Mat如何传递
**C# 调用C++ Dll 函数的参数有一个cv:Mat 请问如何实现调用** C++代码 ``` SITREACH_API int SitReachInit(const Mat matSrc, void* pAnchors, double dRange = 60, double dMinVal = -22.5, bool bDrawAnchor = false, bool bDrawLine = false, bool bDrawContour = false); ``` C# 调用(直接传OpenCvSharp.Mat会报错:行了 QueryInterface 调用,请求提供 COM 可见的托管类“OpenCvSharp.Mat”的类接口。不过,由于该类是从非 COM 可见的类“OpenCvSharp.DisposableCvObject”派生的,QueryInterface 调用将失败。这样做的目的是避免非 COM 可见的基类受 COM 版本规则的约束。) ``` [DllImport("LibSitReach64.dll",EntryPoint = "SitReachInit", CallingConvention = CallingConvention.Cdecl)] extern static int SitReachInit(Mat matSrc, IntPtr pointer, double dRange = 60, double dMinVal = -22.5, bool bDrawAnchor = false, bool bDrawLine = false, bool bDrawContour = false); SitReachInit(matFrame, intptr, 60, -22.5, true, true,false) ``` 如果传递指针,报错:类型“OpenCvSharp.Mat”不能作为非托管结构进行封送处理;无法计算有意义的大小或偏移量。 ``` int sizeMat = Marshal.SizeOf(mat) * 1;//报错 IntPtr intptrMat = Marshal.AllocHGlobal(sizeMat); Marshal.StructureToPtr(matFrame, intptrMat, false); ``` 懂得大神,请问怎么做?
求问,webService接口调用第一次总是失败,之后就成功,为什么??
我调用webservice服务的接口,发送请求数据,为什么第一次调用接口的时候,总是失败,报错,然后紧接着我在继续调用,就成功了,不报错了,有大神能解释一下为什么吗?代码和报错如下: 报错: webService方法推送技术标准开始了================= 推送失败: javax.xml.ws.soap.SOAPFaultException: Marshalling Error: Error writing request body to server at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161) at com.sun.proxy.$Proxy482.syncTechStds(Unknown Source) at cn.com.ebpm.ep.factor.pgc.law.powerController.pushTechDataByWebService(powerController.java:631) at cn.com.ebpm.ep.factor.pgc.law.TEST.submitTechData(TEST.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.com.ebpm.ep.filter.XssFilter.doFilter(XssFilter.java:79) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.javafilter.util.AssertionThreadLocalFilter.doFilter(AssertionThreadLocalFilter.java:56) at com.sgcc.isc.ualogin.client.filter.IsoSSOAssertionThreadLocalFilter.doFilter(IsoSSOAssertionThreadLocalFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.javafilter.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:76) at com.sgcc.isc.ualogin.client.filter.IscSSOHttpServletRequestWrapperFilter.doFilter(IscSSOHttpServletRequestWrapperFilter.java:22) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.javafilter.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:203) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.javafilter.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:127) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.jasig.cas.client.javafilter.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:80) at com.sgcc.isc.ualogin.client.filter.IscSingleSignOutFilter.doFilter(IscSingleSignOutFilter.java:47) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.com.ebpm.ep.filter.SqlInjectionFilter.doFilter(SqlInjectionFilter.java:62) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.com.ebpm.ep.filter.LoginTimeOutFilter.doFilter(LoginTimeOutFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.com.ebpm.ep.filter.SessionFilter.doFilterInternal(SessionFilter.java:18) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380) at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:388) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:354) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1551) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Caused by: javax.xml.bind.MarshalException - with linked exception: [java.io.IOException: Error writing request body to server] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:313) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:236) at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:95) at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:617) at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:241) at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:238) at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:118) at org.apache.cxf.wsdl.interceptors.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139) ... 70 more Caused by: java.io.IOException: Error writing request body to server at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3191) at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3174) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51) at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69) at com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput.write(UTF8XmlOutput.java:396) at com.sun.xml.internal.bind.v2.runtime.output.Encoded.write(Encoded.java:152) at com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput.writeName(UTF8XmlOutput.java:226) at com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput.endTag(UTF8XmlOutput.java:270) at com.sun.xml.internal.bind.v2.runtime.output.NamespaceContextImpl$Element.endElement(NamespaceContextImpl.java:489) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.endElement(XMLSerializer.java:303) at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:160) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:144) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:343) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:685) at com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:143) at com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:146) at com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:116) at com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:318) at com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:325) at com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:61) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:483) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:308) ... 84 more ========开始调用技术标准接口了======== webService方法推送技术标准开始了================= 推送完成,返回值:OK 看上面:紧跟着在调用返回ok,就表示成功了。 调用的代码如下: cn.com.ebpm.webservice.teachstd.YDTFIGATE ydtfigate = new cn.com.ebpm.webservice.teachstd.YDTFIGATE(); cn.com.ebpm.webservice.teachstd.SOAServicePort service = ydtfigate.getSOAService(); SyncTechStdsRequest requestData = new SyncTechStdsRequest(); TechStd techBean = null; TechStdCategorys techstdcategorysBean = null; TechStdItem techItemBean = null; List techCategorysList = this.sqlSession.selectList("cn.com.ebpm.ep.factor.pgc.law.power.getTechStdCategory", null); List techList = this.sqlSession.selectList("cn.com.ebpm.ep.factor.pgc.law.power.getTechStd", null); List techItemList = this.sqlSession.selectList("cn.com.ebpm.ep.factor.pgc.law.power.getTechStdItem", null); for (Map map : techList) { techBean = new TechStd(); techBean.setAt152((String)map.get("AT_152")); techBean.setAt55((String)map.get("AT_55")); techBean.setAt593((String)map.get("AT_593")); techBean.setObjectGuid((String)map.get("OBJECT_GUID")); techBean.setObjectName((String)map.get("OBJECT_NAME")); techBean.setParentGuid((String)map.get("PARENT_GUID")); requestData.getTechStds().add(techBean); } for (Map map : techCategorysList) { techstdcategorysBean = new TechStdCategorys(); techstdcategorysBean.setIsparent((String)map.get("ISPARENT")); techstdcategorysBean.setObjectGuid((String)map.get("OBJECT_GUID")); techstdcategorysBean.setObjectName((String)map.get("OBJECT_NAME")); techstdcategorysBean.setObjFlag((String)map.get("OBJ_FLAG")); techstdcategorysBean.setParentGuid((String)map.get("PARENT_GUID")); requestData.getTechStdCategorys().add(techstdcategorysBean); } for (Map map : techItemList) { techItemBean = new TechStdItem(); techItemBean.setAt55((String)map.get("AT_55")); techItemBean.setAt9((String)map.get("AT_9")); techItemBean.setFactorGuid((String)map.get("FACTOR_GUID")); techItemBean.setItemGuid((String)map.get("ITEM_GUID")); techItemBean.setItemName((String)map.get("ITEM_NAME")); requestData.getTechStdItems().add(techItemBean); } Client proxy = ClientProxy.getClient(service); HTTPConduit conduit = (HTTPConduit)proxy.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setConnectionTimeout(180000L); policy.setReceiveTimeout(300000L); conduit.setClient(policy); SyncTechStdsResponse response = service.syncTechStds(requestData); replayCode = response.getReplyCode(); System.out.println("推送完成,返回值:" + replayCode);
为什么 Golang 中序列化与反序列的函数一般命名为 marshal 与 Unmarshal 呢?
比如 json.Marshal() 与 json.Unmarshal() 等
Bitmap 创建的时候弹出参数错误 异常 求专家解答一下
static void Main(string[] args) { byte[] imageData = { 255, 0, 0, 255 }; int size = Marshal.SizeOf(imageData[0]) * imageData.Length; IntPtr mem = Marshal.AllocHGlobal(size); Marshal.Copy(imageData,0,mem,4); Bitmap bmp = new Bitmap(1, 1,0, PixelFormat.Format32bppPArgb,mem); Marshal.FreeHGlobal(mem); } ![图片说明](https://img-ask.csdn.net/upload/201501/28/1422415150_892407.jpg)
C#调用libVLC出错的问题
最初,我参考了 http://www.cnblogs.com/haibindev/archive/2011/12/21/2296173.html 下载源码,并编译,提示出错:堆栈不对齐。 修改了 [DllImport("libvlc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]之后,再编译,提示 ![图片说明](https://img-ask.csdn.net/upload/201512/03/1449131497_95198.jpg) 调试后发现,在调用vlc _ new 函数之后,并没有成功创建实例,导致报错。 ![图片说明](https://img-ask.csdn.net/upload/201512/03/1449131757_532987.jpg) 但是,我在网上找了很多,竟然发现没有对此问题的回答。 请大神帮忙解答下,如何解决这个问题。 我的编译环境是vs2010 .net4.0 附: ``` public static IntPtr libvlc_new(string[] arguments) { PointerToArrayOfPointerHelper argv = new PointerToArrayOfPointerHelper(); argv.pointers = new IntPtr[11]; for (int i = 0; i < arguments.Length; i++) { argv.pointers[i] = Marshal.StringToHGlobalAnsi(arguments[i]); } IntPtr argvPtr = IntPtr.Zero; try { int size = Marshal.SizeOf(typeof(PointerToArrayOfPointerHelper)); argvPtr = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(argv, argvPtr, false); return libvlc_new(arguments.Length, argvPtr); } finally { for (int i = 0; i < arguments.Length + 1; i++) { if (argv.pointers[i] != IntPtr.Zero) { Marshal.FreeHGlobal(argv.pointers[i]); } } if (argvPtr != IntPtr.Zero) { Marshal.FreeHGlobal(argvPtr); } } } ```
vb.net调用Excel后怎么关闭Excel进程
下面这样一段代码,创建一个Excel文件,写入数据,再关闭,但是每执行一次,电脑就增加了一个Excel进程,请大神们解答怎么才能关闭Excel进程,试过代码中的方法,不行 Sub creatExcel(number As String) Dim ApplicationPath As String Dim SaveFileName As String ApplicationPath = Application.StartupPath & "\Data\" ApplicationPath = ApplicationPath & Now.ToString("yyy") & "\" & Now.ToString("MMdd") If Directory.Exists(ApplicationPath) = False Then '判断是否存在该路径,如果不存在则创建路径 Directory.CreateDirectory(ApplicationPath) End If SaveFileName = ApplicationPath & "\" & number & ".xlsx" Dim Excelobjict As New Microsoft.Office.Interop.Excel.Application Excelobjict.Visible = False '可见 Excelobjict.Workbooks.Add() Excelobjict.Columns(1).columnwidth = 100 Excelobjict.Columns(2).columnwidth = 30 Excelobjict.Columns(1).font.size = 28 Excelobjict.Columns(2).font.size = 28 Excelobjict.Range("A1").Select() Excelobjict.ActiveCell.FormulaR1C1 = "d1111" Excelobjict.Range("A2").Select() Excelobjict.ActiveCell.FormulaR1C1 = "xxx" Excelobjict.Range("A3").Select() Excelobjict.ActiveCell.FormulaR1C1 = "3" Excelobjict.ActiveWorkbook.SaveAs(SaveFileName) Excelobjict.ActiveWorkbook.Close() System.Runtime.InteropServices.Marshal.ReleaseComObject(Excelobjict) 'Excelobjict.Quit() Excelobjict = Nothing GC.Collect() End Sub
Xstream 对象转xml 出现Cannot reference implicit element
调用 xStream 的 toXML方法,就出现如下错误,汗啊 toXML 传入的是一个action: com.thoughtworks.xstream.converters.ConversionException: Could not call java.util.concurrent.ConcurrentHashMap.writeObject() : Could not call java.util.Collections$SynchronizedList.writeObject() : Cannot reference implicit element ---- Debugging information ---- implicit-element : [] referencing-element : /com.travelsky.tdp.pkgStock.view.travelb2b.PproductInfoAction/container/factories/entry/com.opensymphony.xwork2.inject.ContainerBuilder_-4/outer-class/factories/entry[2]/com.opensymphony.xwork2.inject.Scope_-2_-1/instance/reflectionProvider/ognlUtil/defaultConverter/typeConverter/defaultTypeConverter/objectFactory/appContext/servletContext/context/attributes/java.util.concurrent.ConcurrentHashMap/org.apache.catalina.util.DefaultAnnotationProcessor/context/bindings/entry/org.apache.naming.NamingEntry/value/bindings/entry/org.apache.naming.NamingEntry/value/cachedChannelsTransactional/dynamic-proxy/handler/target/_connection/_workService/executor/workers/java.util.concurrent.ThreadPoolExecutor_-Worker/thread/group/threads/net.sf.ehcache.store.DiskStore_-SpoolAndExpiryThread/outer-class/freeSpace/java.util.Collections_-SynchronizedCollection/default/mutex ------------------------------- message : Could not call java.util.Collections$SynchronizedList.writeObject() cause-exception : com.thoughtworks.xstream.core.AbstractReferenceMarshaller$ReferencedImplicitElementException cause-message : Cannot reference implicit element ------------------------------- message : Could not call java.util.concurrent.ConcurrentHashMap.writeObject() cause-exception : com.thoughtworks.xstream.converters.ConversionException cause-message : Could not call java.util.Collections$SynchronizedList.writeObject() : Cannot reference implicit element ---- Debugging information ---- implicit-element : [] referencing-element : /com.travelsky.tdp.pkgStock.view.travelb2b.PproductInfoAction/container/factories/entry/com.opensymphony.xwork2.inject.ContainerBuilder_-4/outer-class/factories/entry[2]/com.opensymphony.xwork2.inject.Scope_-2_-1/instance/reflectionProvider/ognlUtil/defaultConverter/typeConverter/defaultTypeConverter/objectFactory/appContext/servletContext/context/attributes/java.util.concurrent.ConcurrentHashMap/org.apache.catalina.util.DefaultAnnotationProcessor/context/bindings/entry/org.apache.naming.NamingEntry/value/bindings/entry/org.apache.naming.NamingEntry/value/cachedChannelsTransactional/dynamic-proxy/handler/target/_connection/_workService/executor/workers/java.util.concurrent.ThreadPoolExecutor_-Worker/thread/group/threads/net.sf.ehcache.store.DiskStore_-SpoolAndExpiryThread/outer-class/freeSpace/java.util.Collections_-SynchronizedCollection/default/mutex ------------------------------- ------------------------------- at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:103) at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:215) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:98) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:38) at com.thoughtworks.xstream.XStream.marshal(XStream.java:837) at com.thoughtworks.xstream.XStream.marshal(XStream.java:826) at com.thoughtworks.xstream.XStream.toXML(XStream.java:815) at com.travelsky.tdp.pkgStock.logic.util.FM_XMLTools.Object2Xml(FM_XMLTools.java:39) at com.travelsky.tdp.pkgStock.rest.ContentTypeInterceptor.handleResult(ContentTypeInterceptor.java:67) at com.travelsky.tdp.pkgStock.rest.ContentTypeInterceptor.intercept(ContentTypeInterceptor.java:54) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at cn.org.rapid_framework.web.scope.FlashFilter.doFilterInternal(FlashFilter.java:28) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at javacommon.filter.LoggerMDCFilter.doFilterInternal(LoggerMDCFilter.java:54) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 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:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 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:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675) at java.lang.Thread.run(Thread.java:619) Caused by: com.thoughtworks.xstream.converters.ConversionException: Could not call java.util.Collections$SynchronizedList.writeObject() : Cannot reference implicit element ---- Debugging information ---- implicit-element : [] referencing-element : /com.travelsky.tdp.pkgStock.view.travelb2b.PproductInfoAction/container/factories/entry/com.opensymphony.xwork2.inject.ContainerBuilder_-4/outer-class/factories/entry[2]/com.opensymphony.xwork2.inject.Scope_-2_-1/instance/reflectionProvider/ognlUtil/defaultConverter/typeConverter/defaultTypeConverter/objectFactory/appContext/servletContext/context/attributes/java.util.concurrent.ConcurrentHashMap/org.apache.catalina.util.DefaultAnnotationProcessor/context/bindings/entry/org.apache.naming.NamingEntry/value/bindings/entry/org.apache.naming.NamingEntry/value/cachedChannelsTransactional/dynamic-proxy/handler/target/_connection/_workService/executor/workers/java.util.concurrent.ThreadPoolExecutor_-Worker/thread/group/threads/net.sf.ehcache.store.DiskStore_-SpoolAndExpiryThread/outer-class/freeSpace/java.util.Collections_-SynchronizedCollection/default/mutex ------------------------------- message : Could not call java.util.Collections$SynchronizedList.writeObject() cause-exception : com.thoughtworks.xstream.core.AbstractReferenceMarshaller$ReferencedImplicitElementException cause-message : Cannot reference implicit element ------------------------------- at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:103) at com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:215) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:56) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.ArrayConverter.marshal(ArrayConverter.java:45) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:55) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.extended.DynamicProxyConverter.marshal(DynamicProxyConverter.java:60) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:55) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64) at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:157) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:148) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:118) at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58) at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:104) at com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:84) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322) at java.util.concurrent.ConcurrentHashMap.writeObject(ConcurrentHashMap.java:1247) at sun.reflect.GeneratedMethodAccessor282.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:99) ... 176 more Caused by: com.thoughtworks.xstream.core.AbstractReferenceMarshaller$ReferencedImplicitElementException: Cannot reference implicit element ---- Debugging information ---- implicit-element : [] referencing-element : /com.travelsky.tdp.pkgStock.view.travelb2b.PproductInfoAction/container/factories/entry/com.opensymphony.xwork2.inject.ContainerBuilder_-4/outer-class/factories/entry[2]/com.opensymphony.xwork2.inject.Scope_-2_-1/instance/reflectionProvider/ognlUtil/defaultConverter/typeConverter/defaultTypeConverter/objectFactory/appContext/servletContext/context/attributes/java.util.concurrent.ConcurrentHashMap/org.apache.catalina.util.DefaultAnnotationProcessor/context/bindings/entry/org.apache.naming.NamingEntry/value/bindings/entry/org.apache.naming.NamingEntry/value/cachedChannelsTransactional/dynamic-proxy/handler/target/_connection/_workService/executor/workers/java.util.concurrent.ThreadPoolExecutor_-Worker/thread/group/threads/net.sf.ehcache.store.DiskStore_-SpoolAndExpiryThread/outer-class/freeSpace/java.util.Collections_-SynchronizedCollection/default/mutex ------------------------------- at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:58) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78) at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63) at com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.defaultWriteObject(SerializableConverter.java:176) at com.thoughtworks.xstream.core.util.CustomObjectOutputStream.defaultWriteObject(CustomObjectOutputStream.java:80) at java.util.Collections$SynchronizedCollection.writeObject(Collections.java:1602) 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.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:99) ... 350 more ========================================= <?xml version="1.0" encoding="UTF-8" ?> null ========================================= 2014-05-14 14:34:14,680 [1167244/[SHA325]stest/127.0.0.1/20bb88da3c7442988693c52d3eb8dc6f - /fproduct/travelb2b/pproduct-info!list.shtml] ERROR org.apache.struts2.dispatcher.Dispatcher - Exception occurred during processing request: getWriter() has already been called for this response java.lang.IllegalStateException: getWriter() has already been called for this response at org.apache.catalina.connector.Response.getOutputStream(Response.java:580) ~[catalina.jar:6.0.35] at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:183) ~[catalina.jar:6.0.35] at com.travelsky.tdp.pkgStock.rest.ContentTypeInterceptor.handleResult(ContentTypeInterceptor.java:76) ~[ContentTypeInterceptor.class:na] at com.travelsky.tdp.pkgStock.rest.ContentTypeInterceptor.intercept(ContentTypeInterceptor.java:54) ~[ContentTypeInterceptor.class:na] at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) ~[xwork-core-2.3.15.1.jar:2.3.15.1] at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) ~[struts2-core-2.3.15.1.jar:2.3.15.1] at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) ~[struts2-core-2.3.15.1.jar:2.3.15.1] at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) [struts2-core-2.3.15.1.jar:2.3.15.1] at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) [struts2-core-2.3.15.1.jar:2.3.15.1] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.35] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.35] at cn.org.rapid_framework.web.scope.FlashFilter.doFilterInternal(FlashFilter.java:28) [rapid-core-4.0.3.jar:na] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.35] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.35] at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.35] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.35] at javacommon.filter.LoggerMDCFilter.doFilterInternal(LoggerMDCFilter.java:54) [stock-core-rapidframework-1.1-SNAPSHOT.jar:na] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.35] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.35] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:6.0.35] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.35] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.35] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.35] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.35] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:6.0.35] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.35] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) [catalina.jar:6.0.35] at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877) [tomcat-coyote.jar:6.0.35] at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594) [tomcat-coyote.jar:6.0.35] at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675) [tomcat-coyote.jar:6.0.35] at java.lang.Thread.run(Thread.java:619) [na:1.6.0_10-rc2] 2014-5-14 14:34:14 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet default threw exception java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:906) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:586) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at cn.org.rapid_framework.web.scope.FlashFilter.doFilterInternal(FlashFilter.java:28) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at javacommon.filter.LoggerMDCFilter.doFilterInternal(LoggerMDCFilter.java:54) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 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:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 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:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675) at java.lang.Thread.run(Thread.java:619)
c#调用c++dll函数时参数传递的问题?怎样正确传值?
在c++项目cpptest.dll中定义: struct A { int X; int Y; }; extern "C" __declspec(dllexport) int fun1(A *a); int fun1(A *a) { return a->X; } 在C#项目中定义: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] class A { public int X; public int Y; } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate int dofun(ref A a1); class Program { static void Main(string[] args) { //1. 动态加载C++ Dll int hModule = NativeMethod.LoadLibrary("cpptest.dll"); if (hModule == 0) return; //2. 读取函数指针 IntPtr intPtr = NativeMethod.GetProcAddress(hModule, "fun1"); //3. 将函数指针封装成委托 dofun dofun1 = (dofun)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(dofun)); A a1 = new A(); a1.X = 1; a1.Y = 2; Console.WriteLine(dofun1(ref a1)); } } 为什么每次运行输出都不相同,且数字不是1也不是2,而是类似7825552,14052168,21507032?该如何修改呢?
对 COM 组件的调用返回了错误 HRESULT E_FAIL。
此错误的实例(1) 1。 隐藏调用堆栈 在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) 在 Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail() 在 Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.LookupTypeSymbol() 在 Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.get_TypeKind() 在 EnvDTE.CodeTypeRef.get_TypeKind() 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.GetUrtTypeFromVsType(CodeTypeRef vsType) 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnTypePopulateMembers(Object sender, EventArgs e) 在 System.CodeDom.CodeTypeDeclaration.get_Members() 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.CodeTypeDeclarationPopulator.OnPopulateMembers(Object sender, EventArgs e) 在 System.CodeDom.CodeTypeDeclaration.get_Members() 在 System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration) 在 System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) 在 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) 在 System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
c#调用DLL回调函数问题,硬盘录像机,NetSdk.dll,H264_DVR
最近使用C#编写一个摄像头的本地监控及录像程序,硬件开发商把所有的功能实现封装到DLL里了,我通过C#调用之。 具体要实现的功能如下: 1、摄像头通过DAS功能,主动向监控主机的IP发送数据。 2、监控主机监听固定端口,处理接收到的数据。 我自己的思路: 1、新建一个Dictionary存储已上线设备的信息。 2、程序初始化H264_DVR_Init(DisCallback, 0),DisCallback为断线回调函数,设备断线后将设备信息从Dictionary剔除。 3、程序通过调用DLL中的H264_DVR_StartActiveRigister(port, ActiveRegCallBack, 0))方法开始监听端口,ActiveRegCallBack为设备上线后的回调函数,能够得到上线设备的信息。 遇到的问题: 现在程序能够正常的运行,设备发送数据也能接受并显示,但是如果有一个已连接的设备断线后,当这个设备再次连接时或新设备上线时程序就崩溃,显示VSHOST32.EXE已停止工作,即使关闭项目属性中“启用visual studio承载进程”后也会崩溃。 现将部分代码贴上,感谢大神!跪谢! //---------------------------------------------------------------------------------------------------- //初始化SDK public void InitSDK() { DisCallback = new XMSDK.DisConnectCallBackDelegate(DisConnectBackCall); GC.KeepAlive(DisCallback); if (XMSDK.H264_DVR_Init(DisCallback, 0)) { Console.Write(NowTime() + "系统初始化,成功!"); 系统实时信息.AppendText(DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToLongTimeString().ToString() + " : " + "系统初始化,成功!"); File.AppendAllText(LogSavePath, NowTime() + "系统初始化,成功!", Encoding.UTF8); } else { Console.Write(NowTime() + "系统初始化,失败!"); 系统实时信息.AppendText(NowTime() + "系统初始化,失败!"); File.AppendAllText(LogSavePath, NowTime() + "系统初始化,失败!", Encoding.UTF8); } } //---------------------------------------------------------------------------------------------------- //断线回掉函数,输出断线信息,停止RealPlay、PC端录像 void DisConnectBackCall(int lLoginID, string pchDVRIP, int nDVRPort, IntPtr dwUser) { ActiveRegListStruct ActiveRegListOne; ActiveRegList.TryGetValue(lLoginID, out ActiveRegListOne); Message = new MessageStruct(); Message.msg = "设备:" + ActiveRegListOne.RasID + "(" + ActiveRegListOne.SerialNumber + ")" + ",断线!"; ShowMessage(); if (XMSDK.H264_DVR_StopLocalRecord(ActiveRegListOne.RealPlayID)) { ActiveRegListOne.RecordingTime = -1; Message = new MessageStruct(); Message.msg = "设备:" + ActiveRegListOne.RasID + "(" + ActiveRegListOne.SerialNumber + ")" + ",停止PC端录像!"; ShowMessage(); } if (XMSDK.H264_DVR_StopRealPlay(ActiveRegListOne.RealPlayID, (uint)ActiveRegListOne.Handle)) { ActiveRegListOne.RealPlayID = -1; Message = new MessageStruct(); Message.msg = "设备:" + ActiveRegListOne.RasID + "(" + ActiveRegListOne.SerialNumber + ")" + ",停止实时监视!"; ShowMessage(); } if (ActiveRegList.ContainsKey(lLoginID)) { ActiveRegList.Remove(lLoginID); } AddToTreeView(); } //---------------------------------------------------------------------------------------------------- //设备主动注册 public void StartActiveRigister() { int port = 9300; ActiveRegCallBack = new XMSDK.ActiveRigisterCallBackDelegate(ActiveRigisterCallBack); if (XMSDK.H264_DVR_StartActiveRigister(port, ActiveRegCallBack, 0)) { PrintMessage("远程设备主动注册监听,成功!"); PrintMessage("开始监听:" + port.ToString() + "端口,等待设备连接。"); } else { PrintMessage("远程设备主动注册监听开始,失败!"); } } //---------------------------------------------------------------------------------------------------- //主动监听回调函数 public void ActiveRigisterCallBack(int lLoginID, IntPtr pBuf, uint dwBufLen, uint dwUser) { H264_DVR_ACTIVEREG_INFO ActiveClientInfo; ActiveClientInfo = (H264_DVR_ACTIVEREG_INFO)Marshal.PtrToStructure(pBuf, typeof(H264_DVR_ACTIVEREG_INFO)); if (ActiveRegList.Count < 6) { ActiveRegListStruct ActiveRegListOne; ActiveRegListOne.LoginID = lLoginID; ActiveRegListOne.RasID = ActiveClientInfo.deviceSarialID; ActiveRegListOne.SerialNumber = ActiveClientInfo.deviceInfo.sSerialNumber; ActiveRegListOne.VideoOutChannel = ActiveClientInfo.deviceInfo.iVideoOutChannel; ActiveRegListOne.deviceInfo = ActiveClientInfo.deviceInfo; ActiveRegListOne.RealPlayID = -1; ActiveRegListOne.RecordingTime = -1; ActiveRegListOne.isSetKeepLifeTime = XMSDK.H264_DVR_SetKeepLifeTime(lLoginID, 1, 1 * 2); ActiveRegListOne.Handle = HandleArray[ActiveRegList.Count]; ActiveRegList.Add(lLoginID, ActiveRegListOne); NowActiveReg = ActiveRegListOne; //---------------------------------------------------------------------------------------------------- //更新设备列表TreeView AddToTreeView(); //---------------------------------------------------------------------------------------------------- //开始RealPlay和PC端录像 StartRealPlayLocalRecord(); } else { MessageBox.Show("当前连接数过多,本系统最多支持6个通道连接!"); } } class XMSDK { public delegate void DisConnectCallBackDelegate(int lLoginID, string pchDVRIP, int nDVRPort, IntPtr dwUser); //断线回调函数,回调出当前已经断开的设备 public delegate void ActiveRigisterCallBackDelegate(int lLoginID, IntPtr pBuf, uint dwBufLen, uint dwUser); [DllImport("NetSdk.dll")] public static extern bool H264_DVR_Init(DisConnectCallBackDelegate cbDisConnect,uint dwUser); //SDK初始化 [DllImport("NetSdk.dll")] public static extern bool H264_DVR_StartActiveRigister(int nPort, ActiveRigisterCallBackDelegate cbFunc, uint dwDataUser); //远程设备主动注册监听 [DllImport("NetSdk.dll")] public static extern bool H264_DVR_StopActiveRigister(); //远程设备主动注册监听 [DllImport("NetSdk.dll")] public static extern int H264_DVR_RealPlay(int lLoginID, ref H264_DVR_CLIENTINFO lpClientInfo); [DllImport("NetSdk.dll")] public static extern bool H264_DVR_StopRealPlay(int lLoginID, uint dwUser); [DllImport("NetSdk.dll")] public static extern bool H264_DVR_StartLocalRecord(int lRealHandle, string szSaveFileName, int type); [DllImport("NetSdk.dll")] public static extern bool H264_DVR_StopLocalRecord(int lRealHandle); [DllImport("NetSdk.dll")] public static extern bool H264_DVR_SetKeepLifeTime(int lLoginID, int perKeeplifeTime, int detectDisconTime); [DllImport("NetSdk.dll")] public static extern int H264_DVR_GetLastError(); [DllImport("NetSdk.dll")] public static extern bool H264_DVR_Cleanup(); } public struct ActiveRegListStruct { public int LoginID; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public String RasID; //RAS-ID 类似于laizhou [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public String SerialNumber;//设备序列号 MAC地址 唯一标识符 public int VideoOutChannel; //单个设备输出通道数 public bool isSetKeepLifeTime; //设置心跳时间是否成功的返回值,1 成功,0 失败 public int RealPlayID; //执行RealPlay方法的返回值,用于LoaclRecord public int RecordingTime;//显示已录像多长时间,-1为没有开始录像 public IntPtr Handle; //Handle public H264_DVR_DEVICEINFO deviceInfo; } //---------------------------------------------------------------------------------------------------- //已连接的设备列表 public static Dictionary<int, ActiveRegListStruct> ActiveRegList = new Dictionary<int, ActiveRegListStruct>();
使用Marshal.SizeOf(typeof(Brcomm.S_BR_FILE_INFO))获取大小调试失败
各位大家好,C#调用c++ Dll调试出错,希望大家能帮助我,急。。。。。谢谢 Dll中的原数据结构 注意:如下的结构必须以1 字节为单位对齐。请在自己使用的开发语言中注意对结构进行修饰。 struct S_BR_DATETIME { unsigned char cYear, cMonth, cDate; unsigned char cHour, cMin, cSec; }; struct S_BR_FILE_INFO {    unsigned int iFileLength; //文件长度    unsigned int iFileNo; //文件号    char szFileName[32]; //文件名    S_BR_DATETIME stCreateDateTime; //文件被创建的时间    S_BR_DATETIME stModifyDateTime; //文件被修改的时间 }; c#引用如下 [StructLayout(LayoutKind.Sequential)] public struct S_BR_DATETIME { public byte cYear; public byte cMonth; public byte cDate; public byte cHour; public byte cMin; public byte cSec; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct S_BR_FILE_INFO { public UInt32 iFileLength; public UInt32 iFileNo; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public string szFileName; [MarshalAs(UnmanagedType.LPStruct)] public S_BR_DATETIME stCreateDateTime; //对于结构体中的指针数组,一般采用IntPtr数组 [MarshalAs(UnmanagedType.LPStruct)] public S_BR_DATETIME stModifyDateTime; //对于结构体中的指针数组,一般采用IntPtr数组 } 使用Marshal.SizeOf(typeof(Brcomm.S_BR_FILE_INFO))获取大小调试失败 提示“类型“SeriaportEXR.Brcomm+S_BR_FILE_INFO”不能作为非托管结构进行封送处理;无法计算有意义的大小或偏移量。” 怎么解决类,急。。。。
C# 请教这个设置多显示器复制扩展的类怎么调用?麻烦各位了!
``` #region Copyright (C) 2005-2011 Team MediaPortal // Copyright (C) 2005-2011 Team MediaPortal // http://www.team-mediaportal.com // // MediaPortal is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // MediaPortal is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with MediaPortal. If not, see <http://www.gnu.org/licenses/>. #endregion #region using using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; #endregion namespace ImageViewer { public class W7RefreshRateHelper { #region consts private const uint SIZE_OF_DISPLAYCONFIG_PATH_INFO = 72; private const uint SIZE_OF_DISPLAYCONFIG_MODE_INFO = 64; private const uint QDC_ALL_PATHS = 1; private const uint DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2; private const uint DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE = 1; public const uint SDC_TOPOLOGY_INTERNAL = 0x00000001; public const uint SDC_TOPOLOGY_CLONE = 0x00000002; public const uint SDC_TOPOLOGY_EXTEND = 0x00000004; public const uint SDC_TOPOLOGY_EXTERNAL = 0x00000008; public const uint SDC_TOPOLOGY_SUPPLIED = 0x00000010; public const uint SDC_USE_DATABASE_CURRENT = (SDC_TOPOLOGY_INTERNAL | SDC_TOPOLOGY_CLONE | SDC_TOPOLOGY_EXTEND | SDC_TOPOLOGY_EXTERNAL); private const uint SDC_USE_SUPPLIED_DISPLAY_CONFIG = 0x00000020; private const uint SDC_VALIDATE = 0x00000040; private const uint SDC_APPLY = 0x00000080; private const uint SDC_ALLOW_CHANGES = 0x00000400; private const uint SDC_NO_OPTIMIZATION = 0x00000100; private const uint SDC_SAVE_TO_DATABASE = 0x00000200; private const uint SDC_PATH_PERSIST_IF_REQUIRED = 0x00000800; private const uint SDC_FORCE_MODE_ENUMERATION = 0x00001000; private const uint SDC_ALLOW_PATH_ORDER_CHANGES = 0x00002000; #endregion #region DLL imports [DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern long GetDisplayConfigBufferSizes([In] uint flags, [Out] out uint numPathArrayElements, [Out] out uint numModeArrayElements); [DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern long QueryDisplayConfig([In] uint flags, ref uint numPathArrayElements, IntPtr pathArray, ref uint numModeArrayElements, IntPtr modeArray, IntPtr currentTopologyId); [DllImport("user32.dll", CharSet = CharSet.Unicode)] private static extern long SetDisplayConfig(uint numPathArrayElements, IntPtr pathArray, uint numModeArrayElements, IntPtr modeArray, uint flags); #endregion #region private members private static int GetModeInfoOffsetForDisplayId(uint displayIndex, IntPtr pModeArray, uint uNumModeArrayElements) { int offset; int modeInfoType; // there are always two mode infos per display (target and source) offset = (int)(displayIndex * SIZE_OF_DISPLAYCONFIG_MODE_INFO * 2); // out of bounds sanity check if (offset + SIZE_OF_DISPLAYCONFIG_MODE_INFO >= uNumModeArrayElements * SIZE_OF_DISPLAYCONFIG_MODE_INFO) { return -1; } // check which one of the two mode infos for the display is the target modeInfoType = Marshal.ReadInt32(pModeArray, offset); if (modeInfoType == DISPLAYCONFIG_MODE_INFO_TYPE_TARGET) { return offset; } else { offset += (int)SIZE_OF_DISPLAYCONFIG_MODE_INFO; } modeInfoType = Marshal.ReadInt32(pModeArray, offset); if (modeInfoType == DISPLAYCONFIG_MODE_INFO_TYPE_TARGET) { return offset; } // no target mode info found, this should never happen else { return -1; } } #endregion #region public members public static double GetRefreshRate(uint displayIndex) { uint uNumPathArrayElements = 0; uint uNumModeArrayElements = 0; IntPtr pPathArray = IntPtr.Zero; IntPtr pModeArray = IntPtr.Zero; IntPtr pCurrentTopologyId = IntPtr.Zero; long result; UInt32 numerator; UInt32 denominator; double refreshRate; // get size of buffers for QueryDisplayConfig result = GetDisplayConfigBufferSizes(QDC_ALL_PATHS, out uNumPathArrayElements, out uNumModeArrayElements); if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: GetDisplayConfigBufferSizes(...) returned {0}", result); return 0; } // allocate memory or QueryDisplayConfig buffers pPathArray = Marshal.AllocHGlobal((Int32)(uNumPathArrayElements * SIZE_OF_DISPLAYCONFIG_PATH_INFO)); pModeArray = Marshal.AllocHGlobal((Int32)(uNumModeArrayElements * SIZE_OF_DISPLAYCONFIG_MODE_INFO)); // get display configuration result = QueryDisplayConfig(QDC_ALL_PATHS, ref uNumPathArrayElements, pPathArray, ref uNumModeArrayElements, pModeArray, pCurrentTopologyId); // if failed log error message and free memory if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: QueryDisplayConfig(...) returned {0}", result); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return 0; } // get offset for a display's target mode info int offset = GetModeInfoOffsetForDisplayId(displayIndex, pModeArray, uNumModeArrayElements); // if failed log error message and free memory if (offset == -1) { //Log.Error("W7RefreshRateHelper.GetRefreshRate: Couldn't find a target mode info for display {0}", displayIndex); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return 0; } // get refresh rate numerator = (UInt32)Marshal.ReadInt32(pModeArray, offset + 32); denominator = (UInt32)Marshal.ReadInt32(pModeArray, offset + 36); refreshRate = (double)numerator / (double)denominator; //Log.Debug("W7RefreshRateHelper.GetRefreshRate: QueryDisplayConfig returned {0}/{1}", numerator, denominator); // free memory and return refresh rate Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return refreshRate; } public static bool SetRefreshRate(uint displayIndex, double refreshRate) { uint uNumPathArrayElements = 0; uint uNumModeArrayElements = 0; IntPtr pPathArray = IntPtr.Zero; IntPtr pModeArray = IntPtr.Zero; IntPtr pCurrentTopologyId = IntPtr.Zero; long result; UInt32 numerator; UInt32 denominator; UInt32 scanLineOrdering; UInt32 flags; // get size of buffers for QueryDisplayConfig result = GetDisplayConfigBufferSizes(QDC_ALL_PATHS, out uNumPathArrayElements, out uNumModeArrayElements); if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: GetDisplayConfigBufferSizes(...) returned {0}", result); return false; } // allocate memory or QueryDisplayConfig buffers pPathArray = Marshal.AllocHGlobal((Int32)(uNumPathArrayElements * SIZE_OF_DISPLAYCONFIG_PATH_INFO)); pModeArray = Marshal.AllocHGlobal((Int32)(uNumModeArrayElements * SIZE_OF_DISPLAYCONFIG_MODE_INFO)); // get display configuration result = QueryDisplayConfig(QDC_ALL_PATHS, ref uNumPathArrayElements, pPathArray, ref uNumModeArrayElements, pModeArray, pCurrentTopologyId); // if failed log error message and free memory if (result != 0) { // Log.Error("W7RefreshRateHelper.GetRefreshRate: QueryDisplayConfig(...) returned {0}", result); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return false; } // get offset for a display's target mode info int offset = GetModeInfoOffsetForDisplayId(displayIndex, pModeArray, uNumModeArrayElements); // if failed log error message and free memory if (offset == -1) { //Log.Error("W7RefreshRateHelper.GetRefreshRate: Couldn't find a target mode info for display {0}", displayIndex); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return false; } // TODO: refactor to private method // set proper numerator and denominator for refresh rate UInt32 newRefreshRate = (uint)(refreshRate * 1000); switch (newRefreshRate) { case 23976: numerator = 24000; denominator = 1001; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 24000: numerator = 24000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 25000: numerator = 25000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 30000: numerator = 30000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 50000: numerator = 50000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 59940: numerator = 60000; denominator = 1001; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; case 60000: numerator = 60000; denominator = 1000; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; default: numerator = (uint)(newRefreshRate / 1000); denominator = 1; scanLineOrdering = DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; break; } // set refresh rate parameters in display config Marshal.WriteInt32(pModeArray, offset + 32, (int)numerator); Marshal.WriteInt32(pModeArray, offset + 36, (int)denominator); Marshal.WriteInt32(pModeArray, offset + 56, (int)scanLineOrdering); // validate new refresh rate flags = SDC_VALIDATE | SDC_USE_SUPPLIED_DISPLAY_CONFIG; result = SetDisplayConfig(uNumPathArrayElements, pPathArray, uNumModeArrayElements, pModeArray, flags); // adding SDC_ALLOW_CHANGES to flags if validation failed if (result != 0) { //Log.Debug("W7RefreshRateHelper.SetDisplayConfig(...): SDC_VALIDATE of {0}/{1} failed", numerator, denominator); flags = SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGES; } else { //Log.Debug("W7RefreshRateHelper.SetDisplayConfig(...): SDC_VALIDATE of {0}/{1} succesful", numerator, denominator); flags = SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG; } // configuring display result = SetDisplayConfig(uNumPathArrayElements, pPathArray, uNumModeArrayElements, pModeArray, flags); // if failed log error message and free memory if (result != 0) { //Log.Error("W7RefreshRateHelper.SetDisplayConfig(...): SDC_APPLY returned {0}", result); Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return false; } // refresh rate change successful Marshal.FreeHGlobal(pPathArray); Marshal.FreeHGlobal(pModeArray); return true; } public static bool SetScreen(uint displayModel) { return SetDisplayConfig(0, IntPtr.Zero, 0, IntPtr.Zero, SDC_APPLY | displayModel) == 0; } #endregion } } ```
C#调用c++的dll执行带字符串参数的函数时遇到的问题
我在c++项目中实现函数: extern "C" __declspec(dllexport) int FUNC1(const char* xmlSta, char* fileOut) { return 0; } 然后编译成动态库a.dll,并在C#项目中引用, 用静态加载的方式,是可以运行的,代码如下(只写调用的部分): [DllImport("a.dll", EntryPoint = "FUNC1", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] public static extern int FUNC1(string xmlSta, StringBuilder fileOut); StringBuilder sbr = new StringBuilder(10); int r1 = FUNC1("abc ", sbr); //可以运行! 但是用动态加载的方式,却报错,代码如下: public static class NativeMethod { [DllImport("kernel32.dll", EntryPoint = "LoadLibrary")] public static extern int LoadLibrary( [MarshalAs(UnmanagedType.LPStr)] string lpLibFileName); [DllImport("kernel32.dll", EntryPoint = "GetProcAddress")] public static extern IntPtr GetProcAddress(int hModule, [MarshalAs(UnmanagedType.LPStr)] string lpProcName); [DllImport("kernel32.dll", EntryPoint = "FreeLibrary")] public static extern bool FreeLibrary(int hModule); } /// <summary> /// 函数指针 /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> delegate int FUNC1(string xmlSta, StringBuilder fileOut); class Program { static void Main(string[] args) { StringBuilder sbr = new StringBuilder(10); //1. 动态加载C++ Dll int hModule = NativeMethod.LoadLibrary(@"a.dll"); if (hModule == 0) return; //2. 读取函数指针 IntPtr intPtr = NativeMethod.GetProcAddress(hModule, "FUNC1"); //3. 将函数指针封装成委托 FUNC1 cFUNC1 = (FUNC1)Marshal.GetDelegateForFunctionPointer(intPtr, typeof(FUNC1)); //4. 测试 Console.WriteLine(cFUNC1("abc ", sbr)); Console.Read(); } } 报错信息是:托管调试助手“PInvokeStackImbalance”在“E:\WCF\CPP\bin\test.vshost.exe”中检测到问题。 其他信息: 对 PInvoke 函数“test!test.FUNC1::Invoke”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。 两种方式不都一样吗?为什么第二种方式会报错?因为第一种方式有时运行很慢,要等很久,所以我想用第二种方式在程序启动时先LoadLibrary,之后就不会出现很慢的情况,但是第二种方式总是出错,只有在参数没有字符串类型的情况下才能运行,但是确实需要传字符串参数,哪位高手能够给个指点,代码该如何修改呢?
Go语言中一个函数返回类型为 map[string]interface{},如何将其强制转换为string类型呢?
如题,返回result map[string]interface{} 1、尝试使用result.(string)强制转换,发现会报错,如下图 ![图片说明](https://img-ask.csdn.net/upload/201905/03/1556864970_600946.png) 2、尝试使用Marshal和Unmarshal,也失败,如下图 ![图片说明](https://img-ask.csdn.net/upload/201905/03/1556866705_136458.png) ![图片说明](https://img-ask.csdn.net/upload/201905/03/1556866750_540128.png)
用vb.net(或C#)调用C++编写的DLL时遇到的问题
这部分是在c++中可以正常工作的部分,其声明如下: extern "C" int LHD_Main(unsigned char *pImage, RECT *rcRoi,int w, int h, char *PlateCharacters, RECT *rectPlateLocation, int *PlateReliability, int nMod); 调用如下 //加载图片 IplImage *image = cvLoadImage(file_name,-1); if (image == NULL) { printf("image is not exist!\n"); return -1; } //BGR数据 unsigned char *pRawData = (unsigned char *)malloc(image->width*image->height*image->nChannels); if (NULL == pRawData) { printf("memalloc error\n"); return -1; } int pitch = image->nChannels*image->width; int width = image->width; int height = image->height; //转换成3通道图像 for (int y = 0; y < image->height; y++) { for (int x = 0; x <image->width; x++) { *(pRawData + y*pitch + 3*x) = ((unsigned char *)(image->imageData + image->widthStep*y))[3*x]; *(pRawData + y*pitch + 3*x + 1) = ((unsigned char *)(image->imageData + image->widthStep*y))[3*x+1]; *(pRawData + y*pitch + 3*x + 2) = ((unsigned char *)(image->imageData + image->widthStep*y))[3*x+2]; } } char cFileName[128]; sprintf_s(cFileName,"%s","京"); cProvince[0] = cFileName[0]; cProvince[1] = cFileName[1]; LHD_Init(LPR_WIDTH, LPR_HEIGHT, cProvince); //start license plate recognition module,宽高减少1是图像坐标从0开始 RECT recttROI = {0,0,image->width -1, image->height- 1};//设置区域 RECT rectPlate = {0,0,0,0};//输出定位结果 RECT rectTmp = {0,0,0,0}; int nblePlate = 0;// char HPHM[128] = {'0'};// char mHPHM[128] = {'0'}; int mnblePlate = 0; bool m_bLPR = 0; if(LHD_Main(pRawData,&recttROI,width,height, HPHM, &rectTmp,&nblePlate, i)) 这些代码是可以正常工作的。 下面我在VB.NET中如此声明 <DllImport("LPR.dll", EntryPoint:="LHD_Main", CallingConvention:=CallingConvention.Cdecl)> _ Public Shared Function LHD_Main(ByRef pImage As Byte, ByRef rcRoi As RECT, ByVal w As Int32, ByVal h As Int32, ByRef PlateCharacters As Byte, ByRef rectPlateLocation As RECT, ByRef PlateReliability As Int32, ByVal nMod As Integer) As Int32 End Function Public Structure RECT Dim left As Int32 Dim top As Int32 Dim right As Int32 Dim bottom As Int32 End Structure 调用如下 Dim cProvince(1) As byte cProvince(0) = &HBE cProvince(1) = &HA9 LHD_Init(768, 288, cProvince(0)) Dim path As String = "d:\pic\rtemp.jpg" Dim rImage As IntPtr = Emgu.CV.CvInvoke.cvLoadImage(path, Emgu.CV.CvEnum.LOAD_IMAGE_TYPE.CV_LOAD_IMAGE_COLOR) Dim mImage As Emgu.CV.Structure.MIplImage = CType(System.Runtime.InteropServices.Marshal.PtrToStructure(rImage, GetType(Emgu.CV.Structure.MIplImage)), Emgu.CV.Structure.MIplImage) Dim RawData(mImage.width * mImage.height * mImage.nChannels) Dim TempData(mImage.imageSize) As Byte Marshal.Copy(mImage.imageData, TempData, 0, mImage.imageSize) Dim p = mImage.nChannels * mImage.width Dim w = mImage.width Dim h = mImage.height '转换成3通道图像 For y = 0 To h - 1 For x = 0 To w - 1 RawData(y * p + 3 * x) = TempData(3 * x + mImage.widthStep * y) RawData(y * p + 3 * x + 1) = TempData(3 * x + mImage.widthStep * y + 1) RawData(y * p + 3 * x + 2) = TempData(3 * x + mImage.widthStep * y + 2) Next Next Dim recttROI As New RECT recttROI.left = 0 recttROI.top = 0 recttROI.right = mImage.width - 1 recttROI.bottom = mImage.height - 1 Dim rectPlate As New RECT Dim rectTmp As New RECT Dim mnblePlate As Integer = 0 Dim HPHM(127) As Byte Dim rw As Integer = mImage.width Dim rh As Integer = mImage.height For i = 0 To 8 Dim result As Integer = LHD_Main(RawData(0), recttROI, rw, rh, HPHM(0), rectTmp, mnblePlate, i) 运行后在LHD_Main处报错: **尝试读取或写入受保护的内存。这通常指示其他内存已损坏。** 求问怎么解决!
VS2008 C# winform 64位程序动态调用VC++ 64位DLL LoadLibrary成功 但是GetProcAddress返回值为0
如果通过 Vs MFC 中调用这个64DLL 用同样的方式动态调用获取函数地址成功,就不知道C#里面为什么返回0。通过Marshal返回值为126. 64DLL是 通过VC6.0建立的程序然后用vs2010自动转换的然后编译生成的64位的DLL.2008建的也不行
130 个相见恨晚的超实用网站,一次性分享出来
相见恨晚的超实用网站 持续更新中。。。
我花了一夜用数据结构给女朋友写个H5走迷宫游戏
起因 又到深夜了,我按照以往在csdn和公众号写着数据结构!这占用了我大量的时间!我的超越妹妹严重缺乏陪伴而 怨气满满! 而女朋友时常埋怨,认为数据结构这么抽象难懂的东西没啥作用,常会问道:天天写这玩意,有啥作用。而我答道:能干事情多了,比如写个迷宫小游戏啥的! 当我码完字准备睡觉时:写不好别睡觉! 分析 如果用数据结构与算法造出东西来呢? ...
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱 极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件, 选择安装到U盘(按照操作无需更改) 三、重启进入pe系统 1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12) 选择需要启...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Linux(服务器编程):15---两种高效的事件处理模式(reactor模式、proactor模式)
前言 同步I/O模型通常用于实现Reactor模式 异步I/O模型则用于实现Proactor模式 最后我们会使用同步I/O方式模拟出Proactor模式 一、Reactor模式 Reactor模式特点 它要求主线程(I/O处理单元)只负责监听文件描述符上是否有事件发生,有的话就立即将时间通知工作线程(逻辑单元)。除此之外,主线程不做任何其他实质性的工作 读写数据,接受新的连接,以及处...
HAL 硬件抽象层介绍
和你一起终身学习,这里是程序员Android本篇文章主要介绍Android开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:和你一起终身学习,这里是程序员 Android本篇文章主要介绍Android开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:一、HAL 概述一、HAL 概述HAL定义了供硬件供应商实施的标准接口,该接口使Android无需考虑底层驱动程序的实现。使用HA...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
致 Python 初学者们!
作者 | 许向武 责编 | 屠敏 出品 | CSDN 博客 前言 在 Python 进阶的过程中,相信很多同学应该大致上学习了很多 Python 的基础知识,也正在努力成长。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 Python 这门编程语言,从2009年开始单一使用 Python 应对所有的开发工作,直至今
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
使用 Angular 打造微前端架构的 ToB 企业级应用
这篇文章其实已经准备了11个月了,因为虽然我们年初就开始使用 Angular 的微前端架构,但是产品一直没有正式发布,无法通过生产环境实践验证可行性,11月16日我们的产品正式灰度发布,所以是时候分享一下我们在使用 Angular 微前端这条路上的心得(踩过的坑)了额,希望和 Angular 社区一起成长一起进步,如果你对微前端有一定的了解并且已经在项目中尝试了可以忽略前面的章节。 什么是微前...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
拿下微软、Google、Adobe,印度为何盛产科技圈 CEO?
作者 | 胡巍巍 出品 | CSDN(ID:CSDNnews) 世界500强中,30%的掌舵人,都是印度人。 是的,你没看错。这是近日《哈佛商业评论》的研究结果。 其中又以微软CEO萨提亚·纳德拉(Satya Nadella)、和谷歌CEO桑达尔·皮查伊(Sundar Pichai,以下简称劈柴)最为出名。 微软CEO萨提亚·纳德拉(Satya Nadella) 其他著名印度...
Linux(内核剖析):19---中断总体概述
一、为什么要引入中断? 任何操作系统内核的核心任务,都包含有对连接到计算机上的硬件设备进行有效管理,如硬盘、蓝光碟机、键盘、鼠标、3D 处理器,以及无线电等。而想要管理这些设备,首先要能和它们互通音信才行。众所周知,处理器的速度跟外围硬件设备的速度往往不在一个数量级上,因此,如果内核采取让处理器向硬件发出一个请求,然后专门等待回应的办法,显然差强人意。既然硬件的响应这么慢,那么内核就应该在此期间...
程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
深度学习笔记------卷积神经网络
深度学习笔记------卷积神经网络
一文带你入门Linux
文章目录1.1 Linux的概述:1.1.1 什么是Linux:1.1.1.1 学习Linux之前先了解Unix1.1.1.2 Linux的概述:1.1.1.3 Linux的历史:1.1.1.4 Linux系统的应用:1.1.1.5 Linux的版本1.1.1.6 Linux的主流版本1.2 Linux的安装:1.2.1 虚拟机安装:1.2.1.1 什么是虚拟机1.2.1.2 安装VmWare1....
普通三本毕业,我怎么一路艰辛进入阿里的
英雄不问出处? 自古以来就有这样一句话,真的英雄不问出处吗?这句话太挫了。普通三本院校的我,大四的时候居然都不知道什么是校招,所以出处太重要了。这也是没有机会参加阿里校招的原因,毕竟校招门槛比社招还是要低的,最重要的是校招进入阿里能让你的起点比别人更高。 有幸可以社招进入阿里,了解了校招的思路,赶紧介绍给学弟们,现在我们三本院校的小学弟今年居然有 3 个人通过了阿里的校招。下面我也把这份宝贵的经...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
强烈推荐10本程序员在家读的书
很遗憾,这个春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终将会...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
新型冠状病毒全国疫情接口Api
返回json示例 { "errcode":0,//0标识接口正常 "data":{ "date":"2020-01-30 07:47:23",//实时更新时间 "diagnosed":7736,//确诊人数 "suspect":12167,//疑是病例人数 "death":170,//死亡人数 "cur...
智力题(程序员面试经典)
NO.1  有20瓶药丸,其中19瓶装有1克/粒的药丸,余下一瓶装有1.1克/粒的药丸。给你一台称重精准的天平,怎么找出比较重的那瓶药丸?天平只能用一次。 解法 有时候,严格的限制条件有可能反倒是解题的线索。在这个问题中,限制条件是天平只能用一次。 因为天平只能用一次,我们也得以知道一个有趣的事实:一次必须同时称很多药丸,其实更准确地说,是必须从19瓶拿出药丸进行称重。否则,如果跳过两瓶或更多瓶药...
疫情防控,开发者集结出战!
作者 | 屠敏出品 | CSDN(ID:CSDNnews)2020 年伊始,病毒肆虐,人心惶惶。截止北京时间 1 月 31 日 15 时 30 分,全国确诊新型冠状病毒肺炎的数字已达到了...
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问

相似问题

1
C++ 结构体在C#中托管调用,编译报错误is not supported by the language
1
C# 调用C++ DLL 参数OpenCvSharp.Mat如何传递
2
C#调用dll,使用intPtr接收char*返回值不一致
1
redis使用@Cacheable缓存返回值,发送header【Accept:application/xml】请求返回xml数据异常
1
Go语言中一个函数返回类型为 map[string]interface{},如何将其强制转换为string类型呢?
1
c语言调用动态库中的函数,不能获取返回值,但C#可以,不知c代码该如何改进?vs2017环境下。
2
Fabric第一个应用中,如何改写fabcar的智能合约,对数据的某一个属性进行查询获取所有满足条件的数据。
2
VS2008 C# winform 64位程序动态调用VC++ 64位DLL LoadLibrary成功 但是GetProcAddress返回值为0
2
为什么 Golang 中序列化与反序列的函数一般命名为 marshal 与 Unmarshal 呢?
2
C++CLR编程读取Windows系统日志数组越界错误
2
c# 键盘按下后键值显示问题 keys.return和keys.enter相等但显示为return
1
snownlp给词性标注训练时出错。
1
C#对接C++,回调函数返回IntPtr事件信息转成结构体时出错
1
c++结构体(里含指针)如何快捷转化为byte数组
2
基于Emgucv查找表的伪彩色处理 查找表报错?
0
Best Cow Line, Gold 完成、实现的过程
1
请教!这段处理图片的代码是什么作用。
1
使用go将数据put进etcd报错
0
求问,webService接口调用第一次总是失败,之后就成功,为什么??