ActorSystem.Create() ignores config - akka.net

I am trying to instantiate an actor system with non-default behaviour (e.g. clustering or remoting) but no matter what I do the ActorSystem always ends up with default configuration. The config object and settings object appear correct (e.g. actor.provider == cluster) but the actual run-time object always has defaults.
I've tried constructing the config many different ways. With App.config cdata and by manually parsing a config file with ConfigurationFactory and passing it in to Create. I had the problem with 1.4.3 and with 1.3.17.
I downloaded the Akka source code and debugged it. Stepping through the Create method I found that the root HoconObject's items dictionary contains 2 entries with the key "akka". One entry is mine, the other looks like a fallback. The getter method resolves the fallback.
I guess there is some weird string formatting happening...
[Update] There seems to be confusion about what is actually happening. Here is a screen-shot of what HoconObject looks like when it works:
In the screen-shot you can clearly see a single entry in the Items dictionary for "akka" that is set to "provider=cluster", which isn't the default and is coming from the config file. The previous screen-shot shows 2 entries, one of which is "provider=cluster" and the other is clearly the default that Akka injects. Both key = "akka". The bug causes Akka to select the default rather than the override.
I understand that Hocon allows overrides from defaults but that isn't what's happening. Again, if you look at the source code for HoconObject you'll see the screen-shot is of a plain .Net dictionary called 'Items' and the TryGetValue is the .Net implementation... not a Hocon implementation.
This is obviously a parsing bug that cases Akka to behave incorrectly and throw no exceptions.

I don't have enough reputation to post my question as a comment.
Do you have a code I can use to replicate the problem? A code snippet of how you build your config would be fine.
I downloaded the Akka source code and debugged it. Stepping through the Create method I found that the root HoconObject's items dictionary contains 2 entries with the key "akka". One entry is mine, the other looks like a fallback. The getter method resolves the fallback.
Yes, this is the actual behavior of a HoconValue. a HoconValue is a list of value fragments that will be converted into a proper data type when you call the appropriate getter function. For example, the HoconValue instance that you see in your debug session is actually 2 HoconObject fragments, and the proper merged object can be retrieved by calling the GetObject() function of that HoconValue instance.

Related

How to differentiate if a TBO is called when importing new Document vs for any other operations

We are trying to add one additional feature to our method for TBO. The feature needs to be executed only when a new document for that object type is imported and should not be executed in any other case like checkin checkout or any changes in attributes.
However the new code is getting called everytime we make any changes to attribute to that document.
We have put that code in doSave() method.
I tried isNew method for distinguish between newly imported Document and other scenarios, however could not get success, may be missing the usage details of the method.
Can anyone suggest anything?
We are on Documentum version 7.2.
I always use isNew() method to check is object new or versioned, I don't remember having problems with it at any DFC version.
Only one thing that comes in mind is to make sure you don't use super.doSave() while inside the code since right after it method will return false.
But this is expected behaviour.
If you really need to do this - some calulations based on programatically preset data - make sure you use value saved within local variable throughout your code.
If you think you are experiencing bug with the method try with another DFC version or report a bug to the Support.

Changing page content with custom scheme in WebKitGTK1

I have an app using the WebKitGTK1 API with WebKit-GTK 2.4.9 on Linux. (This is the current version in Debian Jessie and versions 2.5+ don't support the v1 API.)
I've implemented a custom URI scheme for loading entire basic page content by using a resource-request-starting handler, which parses the incoming URI via webkit_web_resource_get_uri and if it matches the custom scheme, generates some HTML content and calls webkit_network_request_set_uri to replace the original URI with a base64'd data: URI containing the content to render. (This is similar to the accepted answer of this question.)
This mostly works well, and my handler is called on each request (including repeated requests with the same original URI) and generates the correct content -- but somewhere upstream the browser appears to render only the first returned data for any given original URI, even if the data URI I generate is different.
Possibly of note is that webkit_web_resource_get_uri returns the original non-data: URI even after calling webkit_network_request_set_uri, so I assume this URI is being cached, and in turn is then being used as a key in some higher-level component to cache the data instead of using the real URI from the request.
Unfortunately this appears to be a G_PARAM_CONSTRUCT_ONLY property and there doesn't appear to be any public API to set and/or clear it so that it uses the rewritten URI of the request instead. Is there some way to force GTK to set the property after construction anyway? As far as I can tell it does have a setter method internally, and the getter would do the Right Thing™ if the internal property were reset to NULL.
Or is there some better method to force WebKit to render the new data: URI despite anything it thinks to the contrary?
For the moment I've worked around it by including the values that make it generate different data in the original custom URI (passed to webkit_web_view_load_uri or in links in the generated page). This does work but it's a bit ugly, and could be problematic if I forget to add something in the future, or if something changes generation but is not known in advance. It seems a bit silly that it goes to all the trouble of raising the event that generates the correct data, only to throw it away later, (presumably) due to an URI comparison on the wrong URI.
I suppose using a known-unique value (eg. sequential incrementing id) would also work, and resolve some of the unknown-in-advance issues, but that's no less ugly.

What is Injectable and Embeddable?

I have heard about both terms Injectable and Embeddable many times, but I am not getting actual meaning of it.
Please help me to understand both clearly.
Injectable means that something can be created and added to the main script while the script is running.
Embeddable means something can be added to a script or code before running it i.e before compilation or running of the script.
For better understanding lets take a website with a textbox as a context.
Now, In the textbox, suppose its very basic one. So, I can add a javascript into the textbox and when I will submit, it will run my JS script. This way, I am injecting my own script into the main page.
Now, suppose, I add an Iframe of another website to the HTML file of my website. In this way, when the website will be viewed, it contains the iframe. In this way, the Iframe is embedded to the website.
Injectable means that the object can be created and injected at run time. This is a hint to the compiler that this object will be managed outside the scope of the compilation and can be used at runtime to determine if the object was intended to be injected.
Embeddable means that the object can be serialized and stored in a column instead of as a separate table when the containing object is persisted. That also implies the lifetime of the embedded object is the same as the lifetime of the containing object.

WCF Generated Proxy Crashes Monodroid and Monotouch

I've generated a proxy client for my WCF RIA service class via slsvcutil.exe as described in the Xamarin "Introduction to Web Services" document, however when I try to make a call to one of the async methods, my "completed" event handler never gets called -- after a couple of minutes, the app simply terminates from the Android emulator (it does the same thing in Monotouch as well).
After several days of troubleshooting, I finally found the source of the crash, but have no idea how to fix it. I suspect it's a bug in Mono somewhere, but don't know how to troubleshoot any further.
My generated proxy has a class defined like so:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name = "ChangeSetEntry", Namespace = "DomainServices")]
[System.Runtime.Serialization.KnownTypeAttribute(typeof(SL5Proxy.ChangeSetEntry[]))]
public partial class ChangeSetEntry : object
{
...
}
(The code above is greatly simplified - there are about a dozen KnownTypeAttribute() lines, but I've determined that the one shown above is the source of the problem. It's important to note that the ChangeSetEntry object does not have any reference to a ChangeSetEntry[] array.)
I found that if I simply comment out the
[System.Runtime.Serialization.KnownTypeAttribute(typeof(SL5Proxy.ChangeSetEntry[]))]
line from the proxy code, everything works 100% correct and my async "completed" handler is called exactly as expected. I don't know why slsvcutil.exe generates the problematic KnownTypeAttribute() line, but it does.
My guess is that there's some kind of infinite recursion that gets created when the ChangeSetEntry class tells the runtime serializer that ChangeSetEntry[] is a known type -- the runtime tries to resolve the known type, comes back to ChangeSetEntry and does it all again.
So I'm curious if anyone else has seen this issue, whether it's a known problem and whether there is a workaround -- perhaps some way to suppress the generation of the KnownTypeAttribute() lines from slsvcutil.exe

Why is Mage_Persistent breaking /api/wsdl?soap

I get the following error within Magento CE 1.6.1.0
Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /home/dev/env/var/www/user/dev/wdcastaging/lib/Zend/Controller/Response/Abstract.php:586) in /home/dev/env/var/www/user/dev/wdcastaging/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 119
when accessing /api/soap/?wsdl
Apparently, a session_start() is being attempted after the entire contents of the WSDL file have already been output, resulting in the error.
Why is magento attempting to start a session after outputting all the datums? I'm glad you asked. So it looks like controller_front_send_response_after is being hooked by Mage_Persistent in order to call synchronizePersistentInfo(), which in turn ends up getting that session_start() to fire.
The interesting thing is that this wasn't always happening, initially the WSDL loaded just fine for me, initially I racked my brains to try and see what customization may have been made to our install to cause this, but the tracing I've done seems to indicate that this is all happening entirely inside of core.
We have also experienced a tiny bit of (completely unrelated) strangeness with Mage_Persistent which makes me a little more willing to throw my hands up at this point and SO it.
I've done a bit of searching on SO and have found some questions related to the whole "headers already sent" thing in general, but not this specific case.
Any thoughts?
Oh, and the temporary workaround I have in place is simply disabling Mage_Persistent via the persistent/options/enable config data. I also did a little bit of digging as to whether it might be possible to observe an event in order to disable this module only for the WSDL controller (since that seems to be the only one having problems), but it looks like that module relies exclusively on this config flag to determine it's enabled status.
UPDATE: Bug has been reported: http://www.magentocommerce.com/bug-tracking/issue?issue=13370
I'd report this is a bug to the Magento team. The Magento API controllers all route through standard Magento action controller objects, and all these objects inherit from the Mage_Api_Controller_Action class. This class has a preDispatch method
class Mage_Api_Controller_Action extends Mage_Core_Controller_Front_Action
{
public function preDispatch()
{
$this->getLayout()->setArea('adminhtml');
Mage::app()->setCurrentStore('admin');
$this->setFlag('', self::FLAG_NO_START_SESSION, 1); // Do not start standart session
parent::preDispatch();
return $this;
}
//...
}
which includes setting a flag to ensure normal session handling doesn't start for API methods.
$this->setFlag('', self::FLAG_NO_START_SESSION, 1);
So, it sounds like there's code in synchronizePersistentInf that assumes the existence of a session object, and when it uses it the session is initialized, resulting in the error you've seen. Normally, this isn't a problem as every other controller has initialized a session at this point, but the API controllers explicitly turns it off.
As far as fixes go, your best bet (and probably the quick answer you'll get from Magento support) will be to disable the persistant cart feature for the default configuration setting, but then enable it for specific stores that need it. This will let carts
Coming up with a fix on your own is going to be uncharted territory, and I can't think of a way to do it that isn't terribly hacky/unstable. The most straight forward way would be a class rewrite on the synchronizePersistentInf that calls it's parent method unless you've detected this is an API request.
This answer is not meant to replace the existing answer. But I wanted to drop some code in here in case someone runs into this issue, and comments don't really allow for code formatting.
I went with a simple local code pool override of Mage_Persistent_Model_Observer_Session to exit out of the function for any URL routes that are within /api/*
Not expecting this fix to need to be very long-lived or upgrade-friendly, b/c I'm expecting them to fix this in the next release or so.
public function synchronizePersistentInfo(Varien_Event_Observer $observer)
{
...
if ($request->getRouteName() == 'api') {
return;
}
...
}