C++/WinRT ApplicationDataContainer without a package identity - c++

I'm experimenting with a Windows Console Application (C++/WinRT) and so far successfully made use out of the the Storage API and a few others with no issues. Now i'd like to try and use the ApplicationDataContainer class instead of making use of Winreg.h.
I've followed the C++ code example from here and tried my own things:
https://learn.microsoft.com/en-us/uwp/api/windows.storage.applicationdatacontainer?view=winrt-19041
It seems that creating a settings object relies on a package identity which I don't want to use.
ApplicationDataContainer localSettings{ ApplicationData::Current().RoamingSettings() }; // Error
// winrt::hresult 0x80073d54 : The process has no package identity.
I understand that ApplicationData::Current() relies on using an identity. But it seems like the only way to make use of ApplicationDataContainer is to initialize in these two ways:
ApplicationDataContainer localSettings{ ApplicationData::Current().LocalSettings() };
// Or
ApplicationDataContainer localSettings{ ApplicationData::Current().RoamingSettings() };
Is there any way make use of the ApplicationDataContainer API without a package identity, or perhaps another way to initialize this class?
This is also a learning experience so it doesn't matter if the solution only gives partial use of the api. Easy access to local/roaming folders isn't necessary either. I'm happy to store the settings file in a custom location.

Related

I'm trying to get a bacic example of AWS transfer manager use working, but their example fails to compile

I'm trying to get the basic C++ TransferManager example provided by AWS at:
https://aws.amazon.com/blogs/aws/aws-sdk-for-c-now-ready-for-production-use/
to build. If fails to compile because it reports that
Aws::Transfer::TransferManager transferManager(transferConfig);
is an inacessable private function, yet everything I can find on the web uses some variant of this.
The header provides this constructor:
static std::shared_ptr Create(const TransferManagerConfiguration& config);
and even an explicit call to Create() has the same private scope error message.
Can anyone help me with whatever I'm overlooking?

Drawing custom 3d shapes

I am attempting to create a custom object using Cinder C++ on windows with Visual Studio. I am hoping to find a solution that allows you to point to a object with BatchRef object, and which can be used in the same way as any other BatchRef.
I have already tried searching through the official websites tutorials and documentation, and while it does an excellent job of listing all the classes, functions, etc, it does a exceedingly slim job of covering the usage of most of those, with only the return type and arguments listed.
Ideally, we could call the custom shape something like myShape and it could be used in the following manner in my App::draw() override: (with mShader already defined someplace else)
gl::BatchRef bRef;
gl::pushModelMatrix();
bRef = gl::Batch::create( myShape() , mShader );
bRef -> draw();
gl::popModelMatrix();
If the documentation has instructions for this, feel free to point me that way. I was unable to find it, but that does not mean that it does not exist.

Directory.members().insert is not working using the Java client library

I'm using the Java client library for the Directory API from here: https://developers.google.com/api-client-library/java/apis/admin/directory_v1
I have insert user and insert group working fine, but for some reason when I try to insert a member, it doesn't work. There is no exception thrown. Here is the code:
Member member = new Member();
member.setEmail("someemail#mydomain.com");
member.setRole("MEMBER");
//member.setKind("admin#directory#member"); not sure if I need this. tried with and without
member.setType("USER"); // docs say "MEMBER" but doesn't seem true. Tried both
client.members().insert(myGroupId, member);
You don't need to set kind nor type.
After "client.members().insert(myGroupId, member);" do you call execute ?

Coldfusion 8 - mapping conflict causes "argument is not of interface type" error

I have been researching this, and cannot seem to find anything about it.
We work on CF8. When my coworker tried installing my latest code updates, he started seeing errors that the argument supplied to a function was not of the specified interface type. Worked fine for me. Same set up. Sometimes it works for him. Also have the problem on our dev server.
I have since been able to isolate and reproduce the problem locally.
Here is the set up.
I have 2 mappings on the server:
"webapp/" goes to c:\webroot\
"packages/" goes to c:\webroot\[domain]
Then I created an interface, call it ISubject and a component that implements it, called Person, and saved both under packages. Here is the declaration for Person:
cfcomponent implements="packages.ISubject"
Finally, there is a component, called SubjectMediator with a function, called setSubject, that wants an object of the ISubject interface type. Here is the argument declaration for setSubject:
cfargument name="subject_object" type="packages.ISubject"
To implement:
variables.person = createObject("component", "packages.Person").Init();
variables.subjectMediator = createObject("component", "packages.SubjectMediator ").Init();
variables.subjectMediator.setSubject(variables.person);
That last line throws the error that Person is not of type ISubject. If I do isInstanceOf() on Person against ISubject it validates fine.
So the reason this is happening? Dumping getMetaData(variables.person) shows me that the interface path is webapp.[domain].ISubject. And indeed, if I change the type attribute of the argument to use this path instead of packages.ISubject, all is fine again.
Coldfusion seems to be arbitrarily choosing which mapping to resolve the interface to, and then simply doing a string comparison for check the type argument?
Anyone had to contend with this? I need the webapp mapping, and I cannot change all references to "packages" to "webapp.[domain]." I also am not able in this instance to use an application-specific mapping for webapp. While any of these 3 options would circumvent the issue, I'm hoping someone has some insight...
The best I've got is to set argument type to "any" and then check isInstanceOf() inside the function... Seems like poor form.
Thanks,
Jen
Can you move the contents of the packages mapping to outside the webroot? This seems like the easiest way to fix it.

StructureMap RegistrationConvention for decorator pattern

I'm using the decorator pattern to implement caching for my Repositories as such:
IFooRepository()
IFooRepository FooRepository()
IFooRepository CachedFooRepository(IFooRepository fooRepository)
The Cached repository checks the cache for the requested object and if it doesn't exist, calls the FooRepository to retrieve and store it. I'm currently registering these types with StructureMap using the following method:
For<IFooRepository>().Use<CachedFooRepository()
.Ctor<IFooRepository>().Use<FooRepository>();
This works fine, but as the number of cached repositories grows, registering each one individually is becoming unwieldy and is error prone. Seeing as I have a common convention, I'm trying to scan my assembly using a custom IRegistrationConvention, but I can't seem to figure out how to pass the FooRepository to the constructor of CachedFooRepository in the void Process(Type type, Registry registry) function.
I've found examples to do something like:
Type interfaceType = type.GetInterface(type.Name.Replace("Cached", "I"));
registry.AddType(interfaceType, type);
or
Type interfaceType = type.GetInterface(type.Name.Replace("Cached", "I"));
registry.For(interfaceType).Use(type);
But neither method will allow me to chain the .Ctor. What am I missing? Any ideas?