I logon to an RDOSession, then:
foreach(RDOStore store in rdoSession.Stores)
{
RDOFolder folder = store.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
Debug.WriteLine(folder.FolderPath);
}
Visual Studio marks FolderPath as an error: RDOFolder does not contain a definition for FolderPath...
If I omit that line (so the code will run), then break right after getting the folder, I can add folder to the watch list and expand it. It shows no properties at all unless I expand the Dynamic View node. I can then see all the properties referred to in the Redemption docs.
My question is: how do I refer to Redemption properties like FolderPath in code? Some properties are fine -- e.g. folder.Items will compile just fine. But many are not -- like folder.FolderPath.
The FolderPath property is implemented by the IRDOFolder2 interface and derived from RDOFolder. Try to cast an instance of the RDOFolder
class to IRDOFolder2 and get the property value.
Also you may try using the Outlook object model which provides the MAPIFolder.FolderPath property which returns a string (string in C#) that indicates the path of the current folder.
Related
What is wrong with my code?
widget.woList is this datatype List<HashMap<int, ABC>>()
for (var i in widget.woList) {
print(i.toString());
}
By printing above code, I get
{5838: ABC(pid: 84201,userId: 545)}
But when I want to get only key ( print(i.key.toString());), I get below error:
Class '_HashMap<int, ABC>' has no instance getter 'key'.
Receiver: Instance of '_HashMap<int, ABC>'
Tried calling: key
I think you need to loop through the HashMap as well:
for (HashMap<int, ABC> i in list) {
i.forEach((key, value) {
print(key.toString());
print(value.toString());
});
}
Make sure you typo the "i" variable in the for with HashMap<int, ABC> to get autocompletes from your IDE.
The analyzer should give an error in your case since a Map does not contain any property with the name key. Instead the name is keys which return a Iterable of keys in the map:
https://api.dart.dev/stable/2.8.1/dart-core/Map/keys.html
A map can contain multiple keys but if you know there are only one key in the map you can do something like: i.keys.first.toString(). But if there are multiple keys you need to loop through them.
I will recommend you use auto completion in your IDE when programming in Dart and make use of the analyzer. By using the tools the SDK provides, it is much easier to browse what properties and methods there are in each class together with the documentation. And since Dart can figure out the type of lots of variables automatically, you can use the IDE to also identify the type of each variable without even running the program.
I've been playing around with a button in my storyboard, and had a hard time getting a border around it, until I found a page where it showed how to add a User Defined Runtime Attribute. I was able to make the button look as I wanted, but I wanted to know if there was a way for me to view the list of available attributes for a particular Object.
Clicking the "+" to add a new attribute doesn't provide any kind of auto-complete to show the available ones, and looking through my project code doesn't seem to reveal anything either, not surprisingly. Is there somewhere I can find all of the available attributes for all/any Objects in Xcode? Searches here on SO and in general have not shown any useful results so far.
You can achieve the same thing from code, so just check the properties of UIButton (which is available in the documentation and with autocomplete) and you're good.
You also have to make sure you are checking the properties on an UIButton instance and not the class properties.
User defined runtime attribute is a list of key paths that NIB loading subsystem uses through unarchived process. After initialisation message -setValue:forKeyPath: will be send to your unarchiving object for each key path from this list. So available attributes are not more than set union of all methods with selector sort of -setAttribute: and ivars with "_attribute" or "attribute" name.
All that public attributes you may find at public headers or documentation.
There's also possible to set private attributes, but it's not good practice. For instance, you may find all ivars by breakpoint execution inside any method and look inside "self".
I'm trying to write a Vapi file for MessagePack and am having a couple of issues, the first being that the resulting msgpack_object_print is incorrect because of the reference type of one of the parameters. The header file expects
void msgpack_object_print(FILE* out, msgpack_object o);
and my Vapi file contains
[CCode (instance_pos = 1.1)]
public void print (Posix.FILE out);
which generates the C output
msgpack_object_print (_tmp13_, &obj);
where obj is type msgpack_object *. This creates the error
examples/simple.c:173:34: error: incompatible type for argument 2 of ‘msgpack_object_print’
and it disappears if I remove the & from the generated C. So I'm wondering what my Vapi should contain to result in the correct output?
You can designated your msgpack_object class as [SimpleType] and it will be copied by value rather than by reference.
I have written a partial VAPI for MessagePack if you want to contribute back by using and testing it.
https://github.com/valum-framework/vala-extra-vapis/blob/msgpack/msgpack.vapi
Like already said, you need to use the [SimpleType] annotation on the class to have your type passed by value.
EDIT: Just adding that for bindings, it's a good thing to keep them in nemequ/vala-extra-vapis repository.
While a class usually has the same name as it's contained class - how about the filename of a struct? The below example actually works.
File names and files themselves are completely arbitrary. You can put multiple object type declarations in one file, and they need have nothing to do with the name of the file. (You can also spread out an object type declaration over multiple files, thanks to extensions.) And the names of those types are unrelated to the name of the file.
The reason for giving a file a name that has something to do with its contents is so that you can find those contents; it does not affect the behavior or compilation of the program in any way.
Okay, exceptions:
In Swift, only main.swift has special behavior based on its name - and you don't have a main.swift.
Privacy in Swift is file-based, so you want to separate object type declarations that need to keep things private from each other into separate files.
They usually do but in Swift you honestly can call any file anything you want. I have many different files with not directly related names, some with one class, some with multiple, some with just structs, some with class(es) and structs. The new class function in Xcode will give it a specific name but that was never necessary.
Trying to access a private (package internal) field got me in a strange situation.
My Class "Properties" has a internal field named '_forceAccum'.
Trying to get the value of it fails for me using this code:
InstanceMirror bodyMirror = reflect(props);
var value = propsMirror.getField(new Symbol('_forceAccum'));
but if I use this instead:
InstanceMirror bodyMirror = reflect(props);
var value = propsMirror.getField(new Symbol('_forceAccum#434525364'));
it works. (I got the "#..." from iterating through the symbols (.toString()) from the class mirror).
Is it supposed to work this way? Is it safe or will it change in the next version? (I'm using 1.7.2)
or does it just work by pure happenstance?
Your problem is that you have a library private name. It's name isn't just _forceAccum, it's a special symbol related to _forceAccum that is unique to the library, but different from a _forceAccum in another library.
To create the private symbol using mirrors, you must use MirrorSystem.getSymbol as: MirrorSystem.getSymbol("_forceAccum", libraryMirrorOfLibrary). This creates a library-private symbol for that particular library. You can't create a private symbol without either specifying the library that it's private to, or by being in the library (#_forceAccum will create the correct symbol for the library that it occurs in).
The other alternative, which you used, is to look through the library and find the already existing symbol there:
var forceAccumSymbol =
libraryMirrorOfLibrary.declarations.keys
.where((n) => MirrorSystem.getName(n) == "_forceAccum")
.first;
(if the declaration is a top-level declaration).
The _forceAccum#something name that you are seeing is the VM's way of making a name library private. It's not going to work if compiled with dart2js, and it's probably not going to have the same something on each run, so you can't can't put it into your code.
The behavior is not guaranteed.
If you were in the same library you could probably build the symbol yourself (either with #_forceAccum or with const Symbol("_forceAccum") or new Symbol("_forceAccum")).
The best way to get to the symbol from outside its library is probably to find it (testing with toString() and then cache it.