Adding own Actor to a table - libgdx

I try to add my own actor to a table which is in a group:
Following is working without using a group:
Creating a table
add myActor to the table
position table to 300,300
adding table to stage
I can see the table and I can see my own actor on the screen.
checking getX() of my actor when drawing -> 250 (my table has a with of 100)
Great !
now the problem:
Creating Group
Creating a table
add myActor to the table
adding table to Group
adding Group to stage
position group to 300,300
I can't see my actor
check getX() of my actor when drawing -> -23
What is wrong here ? What is the difference. How does positions be propagated to chlid actors ?

Probably your actor does not report its minimum, maximum and preferred size and thus the table cannot lay out properly.

Related

How do I select from a table in MySQL 8 using ST_contains?

I have a table called 'community', which has a column called coordinates, of type Point.
I have a rectangle.
I'm trying to select all the rows whose .coordinates fall within that rectangle.
Here's what I'm trying to do:
SELECT * FROM `tribemap-db`.community
WHERE ST_Contains(POLYGON(34.6002788228068 31.821252014924383,
35.21282317828298 31.821252014924383,
34.6002788228068 32.08220723021857,
35.21282317828298 32.08220723021857), community.coordinates);
This is giving me an error:
"SELECT" is not valid at this position for this server version, etc.
How do I write this query properly?
You can use the following solution:
SELECT *
FROM `tribemap-db`.`community`
WHERE ST_Contains(ST_GeomFromText('Polygon((35.21282317828298 31.821252014924383, 35.21282317828298 32.08220723021857, 34.6002788228068 32.08220723021857, 34.6002788228068 31.821252014924383, 35.21282317828298 31.821252014924383))'), `community`.`coordinates`);
demo on dbfiddle.uk
I changed the following to solve this:
You have to put the definition of the polygon as string into ST_GeomFromText to get a geometry object.
Your current definition of the polygon is not valid and not a rectangle. I changed the order of the points of the polygon to get a definition of a rectangle. I also added the first point as last point to to close the rectangle.
You can check the polygon with MySQL Workbench. There is a Spatial View and Form Editor to see the result of the definition.
Your current definition of the rectangle (with additional first point as last point too):
The changed definition of the rectangle (changed the order of points and added first point as last point too):
Are there any functions that will allow me to get a bounding rectangle from MySQL with fewer corners (say, two opposing)?
You can use ST_MakeEnvelope to create the rectangle with two opposing points:
SELECT *
FROM `tribemap-db`.`community`
WHERE ST_CONTAINS(ST_MakeEnvelope(ST_GeomFromText('Point(35.21282317828298 31.821252014924383)'), ST_GeomFromText('Point(34.6002788228068 32.08220723021857)')), `community`.`coordinates`);
-- or using syntax (without ST_GeomFromText) possible on MySQL 8.0+
SELECT *
FROM `tribemap-db`.`community`
WHERE ST_Contains(ST_MakeEnvelope(Point(35.21282317828298, 31.821252014924383), Point(34.6002788228068, 32.08220723021857)), `community`.`coordinates`);
Got it.
All I need is two opposing corners of the bounding rectangle.
And then:
SELECT *
FROM `tribemap-db`.`community`
WHERE ST_CONTAINS(ST_MakeEnvelope(
Point(34.60, 32.08),
Point(35.21, 31.82)
), community.coordinates);
That's it!

How add / edit / remove many to many relationships in google app maker using tables?

I have the following scenario centered around the relationship between 2 models: Assets and Activities.
Many Assets can be INPUT of Many Activities at parallel times.
Having that in mind - I want to create UI, which allows me to:
from the perspective of Activity:
add Assets as related to the Activity into a table by selecting them from an existing table of Assets showing all created Assets.
Be able to remove the relationship by clicking a button (which would not delete the whole record in the table).
Please help. Thank you in advance!
I tried binding custom code to an onClick event to a button, which is on the same row as the Asset record I would like to un-relate from an associated activity:
var index = widget.root.datasource.item.Assets.indexOf(widget.datasource.item);
widget.root.datasource.item.Assets.splice(index, 1);
This returns:
Cannot read property 'indexOf' of undefined
at Strategy_TableView.Panel1.Table2.Table2Body.Table2Row.Button5.onClick:1:51
I also have yet to try to find a way to add existing Assets to the related to Activities table.
Suggested code edits to get this working correctly would be:
var datasourcerelation = widget.root.datasource.relations.Services;
var index = datasourcerelation.items.indexOf(widget.datasource.item);
datasourcerelation.items.splice(index, 1);
For whatever reason referencing datasource.item.Services in relation to JS array functions does not give you the result needed. I am not sure why this is, but you have to use datasource.relations.Services instead.
In regards to adding to the relation use:
var datasourcerelation = widget.root.datasource.item.Services;
datasourcerelation.push(widget.datasource.item);
Note that in the case of adding a relation datasource.item.Services works fine. I am not sure why this is different.

adding multiple entries side by side in talend

I have customer_data.csv as follows:
first_name,last_name,cust_no
Test,User1,12345
Test,User2,99999
My address_Details.csv is as follows:
addr_type,line1,line2,line3,cust_no
work,x,y,z,12345
school,a,b,c,12345
Homehome, ,m, ,n, ,o, ,12345
work,1,2,3,99999
My final output should be as follows:
first_name,last_name,cust_no,no_of_addrs,add_type,line1,line2,line3
test,User1,12345,3,work,x,y,y,school,a,b,c,home,m,n,o
test,User2,99999,1,work,1,2,3,,,,,,,,
Where each id has the number of entries joined together?
I used map
I have gotten the following result:
Test|User1|12345|work|x|y|z
Test|User1|12345|school|a|b|c
Test|User1|12345|home|m|n|o
Test|User2|99999|work|1|2|3
What component must I use instead?
1st: the main must be customer_data.csv and the lookup must be address_Details.csv.
2nd: if you want to reject customer without any address, in the tMap, click on the wrench in the lookup table then select "inner join" and on the outpu table, click the wrench and select "catch lookup inner join reject" to True (False is the default).
Regards,
TRF

LibGdx: How do I use Table Add Actor At (int index, Actor actor)?

Is there any examples of this method being used? I'm not sure what index represents. Is it a row or column number ?
Please help.
Table extends WidgetGroup extends Group. So Table is ultimately also a Group and actually Group is the one defining the addActorAt(int, Actor) method.
That being said, Table does not override this method, which is why it should not be used. Using it will not work. Instead use only the Table.add(...) methods and ignore the addActor... ones.
If you want to insert a cell somewhere at the "beginning" of the Table, you will usually have to do a Table.clear() and set up all rows and columns from the beginning.

Best Practice for Master-Detail relationship when ALL combinations are required

I need to understand best practice for below scenario:
1) A school can have multiple classes (grades)
2) A school can have multiple events
3) Event is associated with minimum one class or it can be all school event (i.e. applicable for all classes in the school)
I have typical table structure
Event table (to store events), Class (to store class) and event_class (association table)
1) I insert a row inside 'event_class' table when an event gets associated with class
2) If it is a school event then, assuming a school has 20 classes, I insert 20 records inside 'event_class' table
In theory I know above is correct and would work.
My question is: In case when no of classes get increased from 20 to <>; what's should be the approach? If it is an all school event then shall I just store a flag at header level and use left/right join to get list of events? I am trying to understand what's normally practice.
Thanks in advance
Manisha
I don't know if this would count as 'Best' practice, but I've certainly seen it a lot in the wild, and therefore is probably at least 'Good' practice.
The Event table should probably have a 'type' column - defined by you, could be numeric or text ('class' or 'school', 0 or 1, etc.). Then, there would only be entries in the event_class table for events of type 'class'.
When retrieving class-specific data for class_id, your join logic would look like:
SELECT * FROM event, event_class
WHERE event_class.class_id = this_class.id
AND event.type = 'class'
AND event.id = event_class.event_id
If you wanted all the class AND school event data for class_id, it would look like:
SELECT * FROM event, event_class
WHERE (event_class.class_id = this_class.id
AND event.type = 'class'
AND event.id = event_class.event_id)
OR event.type = 'school'
Mind the parentheses on the second one to make sure the boolean logic works correctly. None of this is tested I'm afraid - just an idea. There are probably ways of optimising the joins, but for 20 classes, it's likely not worth the effort.