How to Re-Initialize MONO.mono_load_runtime_and_bcl - mono

After mono load runtime, We have set of new dlls, which needs to be loaded on demand, is there are a way to re-initialize MONO.mono_load_runtime_and_bcl or destroy and re-load again?

Related

Do I need to memory map/unmap a buffer every time the content of the buffer changes?

I'm doing a Vulkan project that renders into an outgoing stream instead of presenting it (no swapchain et al): the rendered image is copied to another image (vkCmdCopyImage) then that later image is memory mapped (vkMapMemory), data is copied somewhere else then it is unmapped (vkUnmapMemory). This is happing at every frame. Is there a way to map the (second) image once, enter the main loop (render a frame at each cycle) then unmap it as part of the application clean-up ?
I tried this but it looks like whenever something is copied to the image, the earlier mapping doesn't work and it has to be unmapped and mapped again.
It is never necessary in Vulkan to unmap memory you have mapped. Even deleting the memory implicitly unmaps it.
However, it is necessary to synchronize access to that memory properly. For modifying an image on the GPU, using execution&memory dependencies to ensure the availability and visibility of the GPU modifications to the host, events that the CPU can wait on/test to ensure that the modification is visible, and if the memory is not host-coherent you will need to invoke vkInvalidateMappedMemoryRanges to ensure visibility of such changes to the host.

Javafx dynamically fxml load at Runtime

I have an application that cover a wide number of use cases each with completely independent workflows but workflows are pretty static after installation.
I have therefore created an HBox placeholder that will load the workflow for an installation.
Is there a way to dynamically load a section of the fxml from a database or a separate file archive? This fpml will have to have its own set of images and resources needed to achieve the workflows functionality.
TBH, I don't know where to start on this one.
Regards
I do not quite understand your problem. You can modify the scene graph at any time you want. So, of course it is possible to load a part of the scene graph from an FXML file at any time and hook it up to the already existing part. In your controller you have access to your HBox placeholder and when you have loaded the second part of the scene graph you can just add it via hbox.getChildren().add(newpart), were newpart is the root node of your second scene graph part. Of course you have to make sure that the layout works correctly for your constellation.
Your question seems nonsense because the FXML is always loaded dynamically. My guess is you are confused because most of the examples use FXML in the same bundle as the classes and so are loaded trough the getResource method. But the FXML loader takes any kind of InputStream, so you can just open a database blob or a file as an InputStream and give that InputStream as an argument to the loader. Be sure to catch the runtime exceptions though :)
Hope this helps.

Objective c - Core Data saving approach

I have some NSManagedObject subclass in my app, and I'm trying to understand when and how to save changes.
I will try to explain myself, for example class A is NSManagedObject subclass.
During app life cycle I do:
App launched
...
Create an instance of class A
...
Change some properties of A instance
...
App go to background
...
App becomes active again
...
Change some more properties of A instance
...
App terminates
When do I need to call [context save:] ??
Do I call it after every change in A instance? Or maybe I call it only when app go to background?
Should I call it after creation or deletion of any A instance?
A nice approach is place UIManagedDocument in your AppDelegate. Then you can call [context save] whenever some change occurs in the app (like a crash). The order I like to follow is something like:
Create UIManagedDocument object (in application did load or wherever)
and assign it to a property
Setup the document (check whether it exist on disk or is already open, etc.. and respond accordingly)
Pass the UIManagedObjectContext to the initial UIViewController in your app (from there you can pass the context to other view controllers)
UIManaged document will save the context for you.
Take a look at the UIManagedDocument documentation to configure persistent store options (you send an NSDictionary of options to your UIManagedDocument instance, see the first example through the link below).
UIManagedDocument documentation:
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIManagedDocument_Class/Reference/Reference.html
Also see the CoreData lecture and demo (lectures 13 and 14) of the iPhone and iPad application development course with Paul Hegarty available free on iTunesU (Fall 2011).
The data will not be saved to the persistent store until you call save. So, it depends on what you want in your app. If you want it to be able to recover the last value it ever had, then you should save after each modification.
Easy change is to just save after making modifications.
You could do something a bit more fancy, like only save after some set amount of time, so many changes are grouped together... and catch any event that will put your app in the background and then save...
But, that's what UIManagedDocument does automatically for you, so you could just use that instead.
Depending on the amount of changes that you make and the volume of data that needs to be saved with each change, yo can choose to save a little or a lot. If you are just saving a string or a number or a bool, then go ahead and call save: on your context as soon as the changes were made.
If it is a lot of data, you may want to coalasce your changes and then save it on a background queue so that you are not blocking the main queue. This way you are not waiting to go to the background to perform your saves.
Tim

Dynamically change parts (DLLs) when using a DirectoryCatalog

Using MEF, after adding new plugins (DLLs containing parts) to plugins folder, calling a refresh on DirectoryCatalog would update container (if recomposition is allowed) and new added plugins become accessible.
My question is what if we need to replace a DLL (part) dynamically ?
I tried this but all loaded parts are locked (write-protected) by MEF and cannot be replaced.
It's .NET that has a lock on your DLLs. You can't unload assemblies from an AppDomain, and while they are loaded there will normally be a lock. You can enable shadow copying for the AppDomain to let you delete the DLLs. They would still be loaded but the DirectoryCatalog would see they were gone when you called Refresh and remove them from the catalog.

How to control a movieclip that was loaded using loadclip() in AS2?

This is in AS2. I'm loading an external AS2 swf using the loadclip function.
But I don't know how to call its gotoAndPlay or stop functions. How do I reference to them?
When I trace the loaded file it says
_level0.mcContainer.instance42
The object path always varies every load like now it's instance42 sometimes it becomes instance7 or instance10.
Ok. I was wrong. instance42 refers to the anonymous instances inside the loaded swf. upon loading the loaded clip replaces the container movieclip, hence I can refer to the loaded swf using mcContainer.