Multi tenancy with Windsor - castle-windsor

I need to implement multi-tenancy and i like the way it is solved here.
The problem implementing this scenario (in my project) is that the following code snippet
var handlerSelectors = windsorContainer.ResolveAll<IHandlerSelector>();
gives me something ( {Castle.MicroKernel.IHandlerSelector[0]}).
The following snippet should iterate through handlerSelectors but it's doing nothing !!
foreach (var handlerSelector in handlerSelectors)
{
windsorContainer.Kernel.AddHandlerSelector(handlerSelector);
}
In the debugger i can see i tries to set a value to var handlerSelector but it skips the for loop.
Am i missing something??
Thanks in advance

Mauricio Sheffer pointed me out how to correct the error! (see comments...or should i say i need a good pair of glasses?)

Related

angular dynamic (json chain) variables in ctrl variable definitions

Do you know how to use dynamic/chained variables inside a controller variable definition?
I have created this plnkr to further outline what I am trying to achieve: http://plnkr.co/edit/xOjhf8b7ZIxVhc1Id3xo
In the NodeCtrl, I am trying to dynamically access a node from a json object and I can't find the correct syntax to write out the chain.
I have tried a number of combinations but haven't found the correct way yet:
//var jsonChunk = "data." + $scope.transcendType;
$scope.tabinventory = data.$scope.transcendType;
//data;
//jsonChunk;
//function() { return "data." + $scope.transcendType; };
alert($tabinventory[0].title)
//alert($scope.tabinventory.project[0].title);
Any help you could provide would be greatly appreciated.
All the best,
Ben
Have you tried logging $scope.transcendType to make sure it's properly defined in that context?
Assuming it's properly defined, try data[$scope.transcendType].

Invalid method when method is valid

I have just started a new version of my Crysis Wars Server Side Modification called InfinityX. For better management, I have put the functions inside tables as it looks neater and I can group functions together (like Core.PlayerHandle:GetIp(player)), but I have ran into a problem.
The problem is that the specified method to get the players' name, player:GetName() is being seen as an invalid method, when the method actually is completely valid.
I would like to know if using the below structure is causing a problem and if so, how to fix it. This is the first time I've used this structure for functions, but it is already proving easier than the old method I was using.
The Code:
Event =
{
PlayerConnect = function(player)
Msg.All:CenteredConsole("$4Event$8 (Connect)$9: $3"..player:GetName().." on channel "..player.actor:GetChannel());
System.LogAlways(Default.Tag.."Incoming Connect on Channel "..player.actor:GetChannel());
Event:Log("Connect", player);
end;
};
The below code works when I bypass the function and put the code directly where it's needed:
Msg.All:CenteredConsole("$4Event$8 (Connect)$9: $3"..player:GetName().." on channel "..player.actor:GetChannel());
System.LogAlways(Default.Tag.."Incoming Connect on Channel "..player.actor:GetChannel());
The Error:
[Warning] [Lua Error] infinityx/main/core.events.lua:23: attempt to call method 'GetName' (a nil value)
PlayerConnect, (infinityx/main/core.events.lua: 23)
ConnectScript, (infinityx/main/core.main.lua: 52)
OnClientEnteredGame, (scripts/gamerules/instantaction.lua: 511)
(null) (scripts/gamerules/teaminstantaction.lua: 520)
Any clarification would be appreciated.
Thanks :)
Well, as PlayerConnect is inside the table Event, and you are calling with a ":", add self as first arg in the function, like:
PlayerConnect = function(self, player)
Clearly, player in the first block of code is not the same as player in the second block of code. The problem must be that the caller of Event.PlayerConnect is not passing the same value.
To test that your Event.PlayerConnect function works, try this in the same place as your second block of code:
Event.PlayerConnect(player)
That should work as you expect.
So, the problem comes down to how Event.PlayerConnect is called without the second block of code. I'm not familiar with that game engine so I don't know how it is done. Perhaps reviewing the documentation and/or debugging that area would help. If you print(player) or call the equivalent log function in both cases, you should see they are different. If you can't run in a debugger, you can still get a stack trace with print(debug.traceback("Accessing player, who's value is: "..player)). If there is indeed some kind of table-based player object in both cases, you can try comparing their fields to see how they are different. You might need to write a simple dumping function to help with that.

Could not resolve variable (may be a dynamic member)

I created variable with datatype object and created property for this object and asignt value to it.
var tileModel : Object = new Object();
tileModel.property = 10;
But I got warning in FDT Ide. Could not resolve variable (may be a dynamic member)
I have found that possibly solution might be use /*FDT_IGNORE*/ but I would rather solve it some clasic way.
Thank you for every answer
Use array notation as follows:
tileModel["property"] = 10;
To not have FDT flag this as an error, you'll need to adjust the parser to ignore it.
See screenshot:

Turn a partial into a json variable in the controller

Hi I need to turn the html of a partial into a json object (NOT TO BE RENDERED), but to be stored in a seperate format.
Something like this:
#json = (:partial => "/answers/likers" ,:type => :html)
Although the above obviously does not work, but hope you get the point, thanks!
Try render_to_string. It takes the same arguments as render, and just returns a string instead of outputting the data.
It looks like it's being deprecated but I can't find any new method that provides that same functionality for Rails 3. I tested it on a local Rails 3 setup, though, and it works for me. If anyone knows the "new" way to do this in Rails 3 please let me know, I'm interested now :)
Rails has a .to_json function. However, I never used this together with a partial ...

stop object referencing in as 3

I have an object and a temp object now if i do
tempObj = obj
and change stuff in tempObj they changes have an effect on obj is there a way i can stop it from doing this?
Regards
Mark
This is a standard behavior in many languages. When you do tempObj = obj you are NOT creating a duplicate object. You are creating another reference to the same object.
I don't think you can change this behavior, and certainly I don't think you should :)
What you need is creating another object, a duplicate of the original object. You can implement a function to do that. Maybe this can help
http://blog.comtaste.com/2007/10/improving_object_copy.html
Good luck!
What you are doing is making a reference to the original object not a copy of the original. You should create a deep copy of your object. It seems that someone already wrote the steps to do so...
http://www.as3dp.com/2008/09/23/actionscript-30-clone-a-prelude-to-the-prototype-design-pattern/
Hope this helps