failed cast to "AIControllet type" Bluprint class - casting

In ue4enter image description here, I've created a blueprint class from AIController and then another Blueprint class from character. However, when I try to cast my character controller into AIC_Enemy (name of the class derived by AIController) this fails. I'm sending also the pictures with the content of the two classes. Please let me know if you need additional information. In the two images, I'm showing the content of interest of the two classes

I solved the issue. In the pawn setting of the enemy I created I had to put as AI Controller type the one I created while by default I had the unreal class AIController

Related

NSClassFromString custom class for cocos2dx

I have 50 more classes to load at runtime. I know the class name as string.
I need to load all the classes from string name. like NSClassFromString, custom class of NSClassFromString for cocos2dx
Don't think it is possible, as methods like NSClassFromString requires reflection. If you wanna just configure what objects do you want to create on this launch, you can create some object that will create needed objects for given string keys(class names in your case).

Django ManyToMany with inheritance

I've checked a number of SO articles and I don't believe there is any way to accomplish what I want to do, but before I abandon Django I wanted to articulate the question itself and see if I missed something.
I'm implementing a graph (nodes, edges) which can contain subclasses of a base type. That is, an edge can connect a base class to a subclass, or a subclass to a subclass, etc . . . I want to be able to pull all the edges for a given object, find the objects these edges point to, and call some function on these terminal objects. I was hoping that I could call the function in a polymorphic way, but I can't figure out a way to make that happen.
class Node(models.Model):
...
def dosomething():
class SpecialNode(Node):
...
def dosomething():
class Edge(models.Model):
#yes, related_name is weird, but this seems to be what makes sense
source = models.ForeignKey(Node, related_name='targets')
target = models.ForeignKey(Node, related_name='sources')
With this structure I can do:
sourceedges = node.sources.all()
for sourceedge in sourceedges:
sourceedge.source.dosomething()
But the "dosomething" function is always called on the Node object, even if source is actually a SpecialNode object.
I've tried doing this with django_polymorphic but I don't believe this supports M2M inheritance through an Edge object (this is required for other reasons in my app).
I've tried to use contenttypes, but I think you're only allowed one generic relation per class. Edge, in other words, can't have 2 different generic relations in it.
I imagine I could establish an object called an Endpoint which would have just a single generic relation on it, then link the Edge object to it like so:
class Endpoint(models.Model)
...
content_object = generic.GenericForeignKey(...)
class Edge(models.Model)
source = models.ForeignKey(Endpoint, related_name='targets')
target = models.ForeignKey(Endpoint, related_name='sources')
But this introduces another level of indirection in my model and I start to feel like the framework is coding me rather than the other way around :)
Anyway, if someone has figured out a way to get this particular use case done, please let me know. A better way than what I suggested above would be welcome, as I currently like a lot of things I get out of the box with Django.
Thanks

What's the difference between ember.js extend and create?

What's the difference between ember.js Object methods extend and create?
TLDR: You will find the answer in Ember guides: classes and instances.
Sometimes I see that one in the examples and sometimes the other. In particular, what's the difference between Em.Application.extend({}) and Em.Application.create({})?
If I declare my app like this, what does it mean?
Ember.Application.create({
MyController : Ember.ArrayController.extend({
}),
});
How can I access the instance of MyController? Do I need to create it somehow? I need to push some data into it.
The dead simple answer is that extend defines a new JS Class which inherits from the class you're extending, but does not create an instance of that class. create creates an instance of the class.
Em.Application is a particular case, because you're creating a namespace, not an object instance. I don't know when you'd ever want to extend Em.Application.
App = Em.Application.create(); // I have a new Em.Application namespace
App.A = Em.Object.extend(); // I have defined a new class, App.A,
// which inherits from Em.Object
var a = App.A.create(); // a now contains an instance of App.A.
I'd suggest you read "Naming Conventions", too.
ETA: And "Understanding Ember Objects", as suggested in zaplitny's comment.
From what little I understand, in layman's terms, you extend when you want to define a new object idea with properties that will never change(except for reopen), and exist throughout all versions of this object.
You create when you want to work with a particular individual (instance of) object. In other words, something with properties that will be changed by actions or other particular instances.
Often you only need to create relationships between objects, you don't need to speak about particular individual objects, but rather the idea of the object. Therefore, you don't need to create every time you extend.
Hopefully I'm understanding it correctly.

when should I use BOM to XOM mapping ExtenderName in ILOG Jrules

In the rule studio BOM editor , there is BOM to XOM mapping window and it asks for execution name and extender name. I can write java code in a separate project and import it as BOM. So what is the purpose of this extender mechanism ? As always IBM doc says how to do it. But doesn't tell why !
As far as I remember the first displayed is execution:
It is used when you create a "Virtual Member" meaning in Ilog terminology: a method or attribute or class which doesn't rely on a XOM.
Remember that you can create an empty BOM or you can add a method or attribute in a BOM class based on a XOM
The easiest example is "age" NO database will ever store such field but you could had a piece a logic in a "virtual attribute or method" in order to do the comparison between Date of birth and today.
If you create a class from scratch (not an attribute or method) a kind of "Virtual Object" you still need to tell JRules how to consider this Object at runtime.
So you use this field to tell JRules, here is a virtual class based on no XOM but at execution time use it as an java.lang.Object
I never used this field with any other Class than java.lang.Object
Does it make sense?
Second one is really like "extends" in pure java. Never used it... No need.
Hope it helps
To complete Damien answer :
The "execution name" field is also used when your bom class don't have the same name as the xom class.
From the Jrules 7.0.2 doc :
For example, in your BOM, there is a business class named ShoppingCart. You need to map this business class to an execution class called Cart in the XOM. To do the mapping, select the class ShoppingCart, and in the BOM Editor specify Cart as the Execution name.

Scala template accessing model object properties in Play 2.0

I have a simple question regarding accessing member variables of a model object.
I have the following model objects:
#Entity
public class Person extends Model{
#Id
public Long id;
public String name;
}
#Entity
public class Account extends Model{
#Id
public String email;
public String password;
#OneToOne
public Person person;
}
So far so good, Any given person can have a single account. The Account object is copied from the zentask example. After authentication I redirect to the index page which displays the user realname as stated in the Person.name member variable. The Account object is inserted in the page just as with the zentasks example like so:
Account.find.byId(Controller.request().username());
Now the following strange things happen in the template which i do not understand:
#account.person.name
results in a Null value inserted in the template while calling:
#account.person.getName() or #account.person.getName
results as expected with the correct name inserted from the person object.
#account.person
shows the .toString() of the person object, also correctly showing the name.
So to summarize: What is wrong with the code above? Why can I call the account.person value without any problems, but when I call account.person.name this does not work anymore
Thank you in advance!
Richard
This is because JPA uses Aspects to intercept getter usage and fill-in the missing data from objects that are lazy-loaded. I don't know what conventional thinking is, but I would not use public members ever with JPA for this reason, it will break the framework consistently.
If you really want to use public members, you'll have to mark relationships as eager fetching:
#OneToMany(fetch=FetchType.EAGER)
or explicitly fetch all of the object tree you'll need in your template (ugh).
In your case, the relationship, a OneToOne is defined on the other side of the relationship, if you define it on the Account side, it should fetch eager by default. I forget if you can define OneToOne on both entities, I think you can, but you might have to fiddle with it a bit.
Overall, don't use public members with JPA, it will break. Better yet, ditch JPA and use Anorm instead, it maps to the problem domain much more successfully than JPA. Issues like this consistently cause JPA implementations to take up twice as much implementation time as anyone seems able to predict.
I just stumbled upon an answer posted by Guillaume Bort, which explains things.
Read here:
https://groups.google.com/d/topic/play-framework/CNjH3w_yF6E/discussion
Hope this helps!
Because of lazy loading the values in the field only get loaded when you access them from the class itself.(something that, in normal circumstances would use a setter/getter
In order to load the values you ether have to write getters and setters.
Or you can create a methode that checks every value.
you can add the following methode to your Account Entity:
public void checker(){
if(email==null){}
if(password==null){}
if(person==null){}
}
this will load every value, but won't reduce performance