I am referencing MSXML6 (msxml6.dll) in a legacy VB6 application. Whether I use DOMDocument40 or DOMDocument60 I still see msxml4.dll being used along with msxml6.dll. Yet I cannot find anything else in the project that should be using either except where I parse a small configurations.
Why would I see msxml4.dll since it isn't referenced by the project? Does VB6 use msxml4 for something?
MSXML6 appears to be a new version of MSXML4 in its COM implementation, not just as a "marketing" version number.
Looking at the IDL for both in OLEView you can see this... here are some examples.
MSXML4:
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: msxml4.dll
[
uuid(F5078F18-C551-11D3-89B9-0000F81FE221),
version(4.0),
helpstring("Microsoft XML, v4.0")
]
library MSXML2
{
...
}
[
odl,
uuid(2933BF80-7B36-11D2-B20E-00C04F983E60),
helpstring("Core DOM node interface"),
dual,
nonextensible,
oleautomation
]
interface IXMLDOMNode : IDispatch {
...
}
MSXML6:
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: msxml6.dll
[
uuid(F5078F18-C551-11D3-89B9-0000F81FE221),
version(6.0),
helpstring("Microsoft XML, v6.0")
]
library MSXML2
{
...
}
[
odl,
uuid(2933BF80-7B36-11D2-B20E-00C04F983E60),
helpstring("Core DOM node interface"),
dual,
nonextensible,
oleautomation
]
interface IXMLDOMNode : IDispatch {
...
}
These are just short samples.
Specifically you can see that the UUID's of the library itself and the interfaces are the same. This means that VB6 is able to use these items from either DLL.
If you need to force it to use MSXML6 then I think you need to update the version number in your project's VBP file.
If your project references MSXML4, you should see a line like this:
Reference=*\G{F5078F18-C551-11D3-89B9-0000F81FE221}#4.0#0#..\..\..\Windows\SysWow64\msxml4.dll#Microsoft XML, v4.0
What you want instead is a line like this:
Reference=*\G{F5078F18-C551-11D3-89B9-0000F81FE221}#6.0#0#..\..\..\WINDOWS\System32\msxml6.dll#Microsoft XML, v6.0
The UUID is the same... but the version number (#6.0) is different.
Related
If I define a moddle file with bpmn-js like this
{
name: "thisArgument",
superClass: [
"Element"
],
properties: []
},
{
name: "myData",
superClass: [
"Element"
],
properties: [
{
name: "argument",
type: "thisArgument"
}
]
},
Then the resulting XML (when I call saveXML) will have an element called thisArgument, despite the fact that the name is "argument". First, is that a bug? If not, how do I control the output so that the XML contains argument rather than thisArgument? I've searched the docs and examples but can't find how to do this.
The only workaround I found was to make it type: "argument" and then define argument with a superClass of thisArgument and no extra properties (essentially making an alias). However, that only works if all instances of argument are identical. Eg. if the XML needed to be
<A><argument/></A>
<B><argument/></B>
where the argument in A has a different shape than the argument in B, then there would be a conflict since I can't define argument twice.
I can sort of answer my own question. I found this serialize option and experimented, and it mostly does what I want, but sometimes it adds an unwanted xsi:type="originalType" attribute and sometimes it doesn't. Maybe it depends on isBody but I'm not sure. If anyone knows the details of how it works, please reply.
properties: [
{
name: "argument",
type: "thisArgument",
xml: {
serialize: "xsi:type"
},
}
]
The closest thing I found to documentation on it is https://forum.bpmn.io/t/bpmn-json-documentation/1304 which describes it as "additional meta-data impecting XML serialization of a type", so I'd appreciate any extra details anyone can supply.
Update:
The docs don't mention this, but it turns out that serialize: "property" is exactly what I need. This does the same as serialize: "xsi:type" but doesn't add the xsi:type attribute.
xml: {
serialize: "property"
},
I found this by hunting the code in one of the related packages, moddle-xml.
In write.js, there's code that looks for the xsi:type or property entry:
// allow serialization via type
// rather than element name
var asType = serializeAsType(p),
asProperty = serializeAsProperty(p);
In the same file, I found some code that appears to explain why the xsi:type didn't always show up, too:
// only serialize xsi:type if necessary
if (descriptor.name === this.propertyDescriptor.type) {
return attributes;
}
I have the following request json body:
{
...
"attachmentIds": "${attachments}"
...
}
I have a properties file that includes the declaration of the corresponding placeholder
I want to set array of strings in code instead of "attachments" placeholder, but getProperties().setProperty() expects only string value.
How can I achieve it other way or is it possible at all?
Thanks!
As an option you can transform your array into the String in java code. And then pass this String as property value.
Another option, you can pass String array from code and then parse it in your json template.
For example:
String[] arr = { "1", "2", "3" };
apiMethod.addProperty("attachments", arr);
And then in your json:
{
"attachmentIds": [<#list attachments as val>"${val}"<#if val?has_next>,</#if></#list>]
}
Check freemarker documentation to get more details:
https://freemarker.apache.org/docs/ref_builtins_loop_var.html
Also please note that some of freemarker functions (including has_next) are available only in newest versions of library. So make sure to add into your dependencies list. Carina is now in process of migrating to latest freemarker version.
I'm using TypeScript and require.js to resolve dependencies in my files. I'm in a situation where I want to reference a static field of a class in an other file, but in the same internal module (same folder) and I am not able to access it, even if the Visual Studio pre-compiler does not show any error in my code.
I have the following situation :
Game.ts
class Game {
// ...
static width: number = 1920;
// ...
}
export = Game;
Launcher.ts
/// <reference path='lib/require.d.ts'/>
import Game = require("Game");
var width: number = Game.width;
console.log(width); // Hoping to see "1920"
And the TypeScript compiler is ok with all of this. However, I keep getting "undefined" at execution when running the compiled Launcher.ts.
It's the only reference problem I'm having in my project, so I guess the rest is configured correctly.
I hope I provided all necessary information, if you need more, please ask
Any help is appreciated, thanks !
Your code seems sound, so check the following...
You are referencing require.js in a script tag on your page, pointing at Launcher (assuming Launcher.ts is in the root directory - adjust as needed:
<script src="Scripts/require.js" data-main="Launcher"></script>
Remove the reference comment from Launcher.ts:
import Game = require("Game");
var width: number = Game.width;
console.log(width); // Hoping to see "1920"
Check that you are compiling using --module amd to ensure it generates the correct module-loading code (your JavaScript output will look like this...)
define(["require", "exports", "Game"], function (require, exports, Game) {
var width = Game.width;
console.log(width); // Hoping to see "1920"
});
If you are using Visual Studio, you can set this in Project > Properties > TypeScript Build > Module Kind (AMD)
If you are using require.js to load the (external) modules, the Game class must be exported:
export class Game {}
If you import Game in Launcher.ts like
import MyGame = require('Game')
the class can be referenced with MyGame.Game and the static variable with MyGame.Game.width
You should compile the ts files with tsc using option --module amd or the equivalent option in Visual Studio
I am trying to save (RavenDB build 960) the names and values of form data items passed into a Nancy Module via its built in Request.Form.
If I save a straightforward instance of a dynamic object (with test properties and values) then everything works and both the property names and values are saved. However, if I use Nancy's Request.Form then only the dynamic property names are saved.
I understand that I will have to deal with further issues to do with restoring the correct types when retrieving the dynamic data (RavenJObjects etc) but for now, I want to solve the problem of saving the dynamic names / values in the first place.
Here is the entire test request and code:
Fiddler Request (PUT)
Nancy Module
Put["/report/{name}/add"] = parameters =>
{
reportService.AddTestDynamic(Db, parameters.name, Request.Form);
return HttpStatusCode.Created;
};
Service
public void AddTestDynamic(IDocumentSession db, string name, dynamic data)
{
var testDynamic = new TestDynamic
{
Name = name,
Data = data
};
db.Store(testDynamic);
db.SaveChanges();
}
TestDynamic Class
public class TestDynamic
{
public string Name;
public dynamic Data;
}
Dynamic contents of Request.Form at runtime
Resulting RavenDB Document
{
"Name": "test",
"Data": [
"username",
"age"
]
}
Note: The type of the Request.Form is Nancy.DynamicDictionary. I think this may be the problem since it inherits from IEnumerable<string> and not the expected IEnumerable<string, object>. I think that RavenDB is enumerating the DynamicDictionary and only getting back the dynamic member-names rather than the member name / value pairs.
Can anybody tell me how or whether I can treat the Request.Form as a dynamic object with respect to saving it to RavenDB? If possible I want to avoid any hand-crafted enumeration of DynamicDictionary to build a dynamic instance so that RavenDB can serialise correctly.
Thank You
Edit 1 #Ayende
The DynamicDictionary appears to implement the GetDynamicMemberNames() method:
Taking a look at the code on GitHub reveals the following implementation:
public override IEnumerable<string> GetDynamicMemberNames()
{
return dictionary.Keys;
}
Is this what you would expect to see here?
Edit 2 #TheCodeJunkie
Thanks for the code update. To test this I have:
Created a local clone of the NancyFx/Nancy master branch from
GitHub
Added the Nancy.csproj to my solution and referenced the project
Run the same test as above
RavenDB Document from new DynamicDictionary
{
"Name": "test",
"Data": {
"$type": "Nancy.DynamicDictionary, Nancy",
"username": {},
"age": {}
}
}
You can see that the resulting document is an improvement. The DynamicDictionary type information is now being correctly picked up by RavenDB and whilst the dynamic property-names are correctly serialized, unfortunately the dynamic property-values are not.
The image below shows the new look DynamicDictionary in action. It all looks fine to me, the new Dictionary interface is clearly visible. The only thing I noticed was that the dynamic 'Results view' (as opposed to the 'Dynamic view') in the debugger, shows just the property-names and not their values. The 'Dynamic view' shows both as before (see image above).
Contents of DynamicDictionary at run time
biofractal,
The problem is the DynamicDictionary, in JSON, types can be either objects or lists ,they can't be both.
And for dynamic object serialization, we rely on the implementation of GetDynamicMemberNames() to get the properties, and I assume that is isn't there.
I'm a newer about COM. I want to write a plugin that locate in vs2008
toolbar(not toolbox).
I created an ATL project. It gived me some default codes. so i could generate a DLL. Through this way, I can add this plugin to ToolBox by TOOLs->choose tool items->COM components. But I want to add this into toolbar. So how should i do.
I add some regester info in rgs file, as follow:
HKCU{ NoRemove SOFTWARE {
NoRemove Microsoft
{
NoRemove VisualStudio
{
NoRemove 9.0
{
NoRemove AddIns
{
ForceRemove PiSvr.CalcPi
{
val CommandLineSafe = d '0'
val CommandPreload = d '1'
val Description = s 'Sample Common Add-In'
val FriendlyName = s 'Sample Common Add-In'
val LoadBehavior = d '1'
}
}
}
}
} }}
But when I started the vs2008, it told me no such interface supported. error number:80004002
The add-in connection is in registry under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\AddIns and your script looks like correct. Note you can always use regedit to check if the corresponding registry item is there in registry too, not just in your script.
0x80004002 is E_NOINTERFACE and what is probably taking place is that Visual Studio is trying to instantiate and initialize your add-in but it lacks a mandatory interface implemetnation, and Visual Studio aborts the attempt.
To troubleshoot this, debug your add-in and check what interfaces are queried, esp. those for which you return error code and indicate their absence.