我试图在VBA中访问COM公开的方法.
问题:我在VBA中看到了所有默认方法(例如GetHashCode,GetType和ToString),但没有看到COM接口的一部分,特别是写成COM可见的(如下getStringValue()所示).
设置细节:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace SimpleCOMAssembly
{
[ComVisible(true), GuidAttribute("4153A1AC-ECE9-4f66-B56C-1DDEB6514D5D")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
interface IGetMyString
{
[DispId(1)]
string getStringValue();
}
}
Run Code Online (Sandbox Code Playgroud)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace SimpleCOMAssembly
{
[ComVisible(true), GuidAttribute("0A3D4D65-CF50-4020-BF13-77001F8AAABE")]
[ProgId("SimpleCOMAssembly.GetMyString")]
[ClassInterface(ClassInterfaceType.None)]
public class GetMyString : IGetMyString
{
public GetMyString() { }
[ComVisible(true), …Run Code Online (Sandbox Code Playgroud) 知道为什么我得到这个例外吗?
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myService' defined in class path resource [context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy54 implementing org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,net.sf.cglib.proxy.Factory,org.springframework.beans.factory.InitializingBean] to required type [com.mycompany.service.dao.MyDAO] for property 'myDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy54 implementing org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,net.sf.cglib.proxy.Factory,org.springframework.beans.factory.InitializingBean] to required type [com.mycompany.service.dao.MyDAO] for property 'myDAO': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) …Run Code Online (Sandbox Code Playgroud) 我打算将一些"和平"(你可以称之为组织)带到我在家里做的个人工作(小项目等).
我想使用a SCM和a issue tracker来捕获提交并自动将它们显示为更改集等.
请注意,所有上述应用程序都应该用于个人用途,因此更喜欢某些东西,FOSS并且在系统要求方面也需要超轻量级.
您有什么推荐的吗?
编辑: 以下是我的一些疑虑/担忧:
Git用GitHub看起来很不错.但我对公开代码库不太满意GitHub.你说什么?GitHub提供问题跟踪器?我的意思是,我可以在GitHub提供的问题跟踪器上打开一个问题并针对该问题提交吗?SCM(在我的笔记本电脑上)并使用remote issue tracker像FogBugz这样的东西吗?但我只是不明白远程问题跟踪器如何捕获我的提交.任何的想法?更新:
我终于Mercurial和BitBucket一起去了.到目前为止工作真棒!
resultMap在iBatis中定义时,它提供了一个选项javaType,jdbcType用于将每个属性设置为列映射.
例如
<resultMap id="employee" class="com.mycompany.Employee">
<result property="firstName" column="first_name" javaType="?" jdbcType="?"/>
</resultMap>
Run Code Online (Sandbox Code Playgroud)
想知道什么时候我们应该定义javaType和jdbcType?我已经看到映射它只是工作而没有定义这些属性,而在其他人我们必须定义它们.
编辑:有关上述问题,请参阅下面的选定答案.
另外,我们是否有详尽的清单javaType,jdbcType应该定义哪些?
编辑: javaType应该是众所周知的类型如之一java.lang.String,java.util.Date
而jdbcType应走出的java.sql.Types中
提前致谢!
我只是在想,我什么时候应该真正考虑在 Spring 中加载多个应用程序上下文?到目前为止,我一直在合并上下文文件,<include>以便仅加载一个应用程序上下文。
您是否知道何时在同一 JVM 中使用多个应用程序上下文?
我有一个场景,工作单位定义为:
Update table T1 in database server S1
Update table T2 in database server S2
Run Code Online (Sandbox Code Playgroud)
我希望上述工作单元完全发生或根本不发生(如同任何数据库事务一样).我怎样才能做到这一点?我广泛搜索并发现这篇文章接近我期待的内容,但这似乎对Hibernate非常具体.
我使用Spring,iBatis和Tomcat(6.x)作为容器.
我试图理解JavaScript缩小和压缩过程,并对这些问题有几个问题:
有人可以帮我知道上面的内容吗?
我实际上需要缩小我的JavaScript文件的那种情况让我们说在第5行发生了一个JavaScript错误.X.对于缩小的文件,要知道哪个代码块在生产中导致该错误将非常困难,因为这些行都包含在缩小的文件中.在这种情况下你们如何调查和调试?另一个用户还提到了在IE6中打包/缩小javascript失败的调试问题- 如何调试?问题(虽然略微具体到IE6).
对一列进行分组,并根据过滤后的值汇总其中一列。
像下面的示例一样,我要为每种“种类”的动物计算性别为“雄性”的动物的数量
import pandas as pd
df = pd.DataFrame({'kind': ['cat', 'dog', 'cat', 'dog'],
'height': [9.1, 6.0, 9.5, 34.0],
'gender': ['male', 'female', 'female', 'female']})
df.groupby('kind').agg({'height': 'min', 'gender': lambda g: (g == 'male').count()})
Run Code Online (Sandbox Code Playgroud)
我得到的输出(这是错误的)
kind height gender
cat 9.1 2
dog 6.0 2
Run Code Online (Sandbox Code Playgroud)
预期产量:
kind height gender
cat 9.1 1
dog 6.0 0
Run Code Online (Sandbox Code Playgroud) abstract class AbstractBase {
abstract void print();
AbstractBase() {
// Note that this call will get mapped to the most derived class's method
print();
}
}
class DerivedClass extends AbstractBase {
int value = 1;
@Override
void print() {
System.out.println("Value in DerivedClass: " + value);
}
}
class Derived1 extends DerivedClass {
int value = 10;
@Override
void print() {
System.out.println("Value in Derived1: " + value);
}
}
public class ConstructorCallingAbstract {
public static void main(String[] args) {
Derived1 derived1 …Run Code Online (Sandbox Code Playgroud) 我有现有的COM接口.我不想创建一个将新接口公开为COM(带有新GUID)的.net程序集,但接口的结构必须相同.
如何创建一个公开此接口的.net类(C#)?
[
odl,
uuid(1ED4C594-DDD7-402F-90DE-7F85D65560C4),
hidden,
oleautomation
]
interface _IFlashPhase : IUnknown {
[propget]
HRESULT _stdcall ComponentName(
[in] short i,
[out, retval] BSTR* pVal);
[propput]
HRESULT _stdcall ComponentName(
[in] short i,
[in] BSTR pVal);
[propget]
HRESULT _stdcall ComponentMolePercent(
[in] short i,
[out, retval] double* pVal);
[propput]
HRESULT _stdcall ComponentMolePercent(
[in] short i,
[in] double pVal);
[propget]
HRESULT _stdcall ComponentFugacity(
[in] short i,
[out, retval] double* pVal);
[propput]
HRESULT _stdcall ComponentFugacity(
[in] short i,
[in] double pVal);
};
Run Code Online (Sandbox Code Playgroud) 我收到以下错误:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:203)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:93)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:130)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#0' defined in class path resource [common-application-context.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean …Run Code Online (Sandbox Code Playgroud) 以下是我存储数据的数据结构和更新数据的方法.
ConcurrentHashMap<String, MyOrder> myOrder = new ConcurrentHashMap<String, MyOrder>();
public void updateOrder(MyData DR) {
MyOrder Orderlist = myOrder.get(DR.keyID);
Orderlist.getCanceled().add(DR);
if (Orderlist.getCanceled().size() == 10) {
Orderlist.getCanceled().remove(0);
}
/* remove order when cancelled */
Iterator<MyData> itr = Orderlist.getNewOrder().iterator();
MyData drm = null;
while (itr.hasNext()) {
drm = itr.next();
if (drm.ClOrdID.equalsIgnoreCase(DR.ClOrdID)) {
Orderlist.getNewOrder().remove(drm);
getTable().get(drm.InsKey).getCompOrder().remove(drm);
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我有下面的方法,通过轮询每秒访问一次,以通过上面的并发哈希映射检索网页中的一些数据,该哈希映射也随时更新数据,并在订单被删除时更新.
/* accessed for data display every second */
public List<MyOrder> getMyDataList(String keyID) {
List<MyOrder> orderList = new ArrayList<MyOrder>();
try {
if (myOrder.containsKey(keyID)) {
orderList.add(myOrder.get(keyID));
} …Run Code Online (Sandbox Code Playgroud)