variant

JAXB: Can't unmarshal JAXBElement<?>, getting ElementNSImpl instead

泄露秘密 提交于 2019-12-19 04:38:51
问题 Related to JAXB: How to implement a JAXB-compatible variant wrapper class?, I tried to use JAXBElement to represent "variant" or "any-type". Marshalling went fine, but during Unmarshalling, JAXB tries to assign ElementNSImpl to a JAXBElement field. Test Code (copy+paste+run) import static java.lang.System.*; import java.io.*; import java.util.*; import javax.xml.bind.*; import javax.xml.bind.annotation.*; import javax.xml.namespace.*; import org.junit.*; public class _JaxbElementProblem {

How to convert 8209 array object variant to VT_VARIANT

╄→гoц情女王★ 提交于 2019-12-18 07:22:48
问题 I am calling a COM object method that returns an array variant object of type 8209 in my PHP code. $com_VArray = $com_Object->objectMethod; //Is a 8209 variant object I want in the end to pass the converted VT_VARIANT object as a value for another COM object method which requires its input to be VT_VARIANT[12]. I am converting $com_VArray to a VT_VARIANT object variant type by issuing the following $obj_VT_VARIANT = variant_cast($com_VArray, VT_VARIANT); But then I get this following error

Why am I getting “The type parameter must be invariantly valid…” error?

旧巷老猫 提交于 2019-12-18 05:56:18
问题 I'll attempt to shorten this code example: public interface IThing { //... Stuff } public class Thing1 : IThing { } public class Thing2 : IThing { } public interface IThingView<out T> { ICollection<T> ViewAll(); } public class ThingView<T> : IThingView<T> { ICollection<T> ViewAll() { return new List<T>(); } // There's a big operation here } public interface IThingViewerFactory { public IThingView<IThing> Build(string Which); } public class ThingViewerFactory { public IThingView<IThing> Build

How can I assign a Variant to a Variant in VBA?

邮差的信 提交于 2019-12-18 03:29:06
问题 (Warning: Although it might look like one at first glance, this is not a beginner-level question. If you are familiar with the phrase "Let coercion" or you have ever looked into the VBA spec, please keep on reading.) Let's say I have an expression of type Variant , and I want to assign it to a variable. Sounds easy, right? Dim v As Variant v = SomeMethod() ' SomeMethod has return type Variant Unfortunately, if SomeMethod returns an Object (i.e., a Variant with a VarType of vbObject), Let

usage differences between _variant_t, COleVariant, CComVariant, and VARIANT and using SAFEARRAY variations

旧巷老猫 提交于 2019-12-13 17:08:34
问题 I am investigating several Visual Studio 2015 C++ project types which use ADO to access an SQL Server database. The simple example performs a select against a table, reads in the rows, updates each row, and updates the table. The MFC version works fine. The Windows console version is where I am having a problem updating the rows in the recordset. The update() method of the recordset is throwing a COM exception with the error text of: L"Item cannot be found in the collection corresponding to

How to Display a Metafield in Shopify

别等时光非礼了梦想. 提交于 2019-12-13 15:52:00
问题 We have a group of products that we want to have FREE Shipping. In order to do so, I have made their weight =0 and created a weight based shipping for 0lbs. That way the shipping passes through the cart. But...I would like to display the actual weight on the product page. I have created a metafield for the shipping weight, and I am trying to call that value to the product page, but not having any luck...... Here is what I am trying for code.... //------SHIPPING WEIGHT-------------------------

How to pass a variant object type 16396 in a COM method that requires an input value of a VT_VARIANT [12]

这一生的挚爱 提交于 2019-12-13 12:23:11
问题 I have in my PHP code, a COM object '$com_myObject' with a method 'myObjectMethod' which after I run com_print_type info($com_myObject); on it, it shows that it has the method 'myObjectMethod' declared as shown below myObjectMethod(/* VT_VARIANT [12] [in] */ $RawData) { /* Processes entered object data */ } In my code I am having another function return a variant object '$myInputObject' of type value 16396. I plan to use '$myInputObject' as the input value for 'myObjectMethod' method. print

Problems trying to construct a wrapper measuring function call time

和自甴很熟 提交于 2019-12-13 05:31:27
问题 I'm implementing some data structures, each supporting a set of commands such as INSERT value . I've used a tokenizer to generate a vector that holds each word/value. I want to be able to output to a .txt file the time every function call took, plus what the function returned if it does return something. For example, if the command is INSERT AVLTREE 4 , I want to just output the time calling avl.insert(4) took. If the command is SEARCH AVLTREE 4 , I want to output the time calling avl.search

excel/VBA how to assign the variable length of an array to integer variable

无人久伴 提交于 2019-12-13 00:53:58
问题 In excel/VBA I have this code Dim colName as Variant Dim lengthToDispl as Integer colName = Array("A", "B", "C") lengthToDispl = colName.length I get the following error 'Object Required'. It relates to the last line. How do I assign the length of an array of variable length (containing strings) to a variable (integer)? 回答1: The function you want to return the 'size' of the array is the UBound function which returns the Upper Boundary . This is often used with its counterpart, the LBound

vba-variant: how to handle Class vs. primitive types

依然范特西╮ 提交于 2019-12-12 09:54:59
问题 my function gets a collection and the items may be Objects or primitives how can I assign the item to a variant? What I do now looks something like this: Dim vItem As Variant On Error Resume Next vItem = oCollection.Item(sKey) If Err.Number = 91 Then Set vItem = oCollection.Item(sKey) On Error GoTo 0 I think it works, but I wonder if there is a better way to do it. 回答1: You may use the varType() function to test the type, alternatively if you are testing for specific types, you could use