javascript – Why doesn't console.log work within a loop within a function within an object (a loop within a method)?

I am trying to place each number in one of three categories.

let restaurants = {
bills: (124, 48, 268, 180, 42),
    calcTip: function () {
        for (let i = 0; i < this.bills.lenght; i++) {
            if (this.bills(i) < 50) {
            } else if (this.bills(i) >= 50 && this.bills(i) <= 200) {
            } else {


I don't understand why you are not logging in to the console!

unity – Prevent Animation Tab From Changes the position of an object

I am quite new to Unity. I am using the latest version. When I try to make an open door animation, it works well with the rotation. But when I add the position property, it takes it to Vector3 – (40,12.5,7.5) – instead of (10,2.5,15) in the first frame. I try to change the value but it reappears after writing. Please help

How to protect the JavaScript object?

I am creating a website for a real estate agency. And, right now I am using some JavaScript objects as data. However, my concern is how I protect it once the website is active. Like, anyone can see this data. Also, using JavaScript objects is a good way to do it?

Can I use Unity to edit an object created in Blender?

I imported a character from Blender. The character is made of metabolas and, therefore, is not imported correctly. I am trying to edit the character within Unity using the platform of the original Blender object.

The problem I encounter is that I can only access the bones when the object is instantiated. The armor / armor object is not displayed in the project resource folder, and double-clicking on the top-level object only opens in Blender.

Is there a way to make Unity treat the imported Blender object as a native Unity object that can be edited as normal? Any other suggestions welcome.

Screenshots for reference:
enter the description of the image here

enter the description of the image here

github – AttributeError: the object & # 39; str & # 39; It has no attribute & # 39; form & # 39;

I am trying to run this script on my image for image classification using the CNN model:

import cv2
import tensorflow as tf

CATEGORIES = ("Banana", "Bare soil", "Okra", "Sugarcane")

def prepare(file):
    IMG_SIZE = 50
    img_array = cv2.imread(file, cv2.IMREAD_GRAYSCALE)
    new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))
    return new_array.reshape(-1, IMG_SIZE, IMG_SIZE, 1)

model = tf.keras.models.load_model("CNN.model")

image = r"C:/Users/admin/Desktop/Final Train Dataset/Dataset/Test/one.jpg" #your image path

prediction = model.predict((image))
prediction = list(prediction(0))

But, getting the following error:

AttributeError: 'str' object has no attribute 'shape'

What is a type of object in conventional OO languages: a class, an interface, an abstract class, a metaclass?

In Types and programming languages by Pierce, Section 18.6 Simple classes in Chapter 18 Imperative objects says:

We must emphasize that These classes are values, not types. We can also
If we wish, create many classes that generate objects of the same type.
In the main object-oriented languages ​​such as C ++ and Java, classes have more
complex state: they are used as compile time types and as runtime
Data structures.
This point is discussed further in §19.3.

The only place that Section 19.3 Systems of nominal and structural type says about the classes is:

These type names play a crucial role in the Java subtype relationship. When
a new name is introduced (in a class or interface definition), the programmer
explicitly declares which classes and interfaces the new one extends (or, in
the case of a new class and an existing interface, "implements"). The compiler
check these statements to make sure the facilities provided by the new
class or interface really extend those of each superclass or superinterface—
This verification corresponds to the subtype of registration in a written lambda calculation. the
The subtype relationship is now defined between type names as reflective and transient.
sitive closing of the declared relationship of immediate subtype. If a name does not have
been declared as a subtype of another, so it is not.

Does the previous quotation or other places in Section 19.3 explain the second sentence highlighted in the first appointment in Section 18.6, that is, why

In the main object-oriented languages ​​such as C ++ and Java, classes have more
complex state: they are used as compile time types and as runtime
Data structures

? (I don't see Section 19.3 mentioning that a class is a type of object in the main OO languages, and even explains it).

In Chapter 18 Imperative objects, is an interface a type of object?

In the main OO languages ​​(like Java, C #, I'm not sure if C ++ has an interface),

  • Is an interface a type of object?

    An interface seems like a kind of classes, since many classes can implement the same interface. As a class is a type of object, it is an interface a kind?

  • Is an abstract class essentially the same concept as an interface? (In terms of being a kind of class or something else)

I have a related publication some time ago: Is the implementation relationship between an interface and a class an instantiation or inheritance relationship, or none? It also introduces the "metaclass" concept of Python, and my confusion between interface, class, abstract class and metaclass. Appreciate if you could also take that into account.

Thank you.

unit: how do I get an object to rotate in world space through RigidBody.AddTorque?

I'm really getting discouraged because I can't seem to understand how to rotate my object through Rigidbody. Add Torque as if it were on a figurative global turn table instead of a local turn table. Another way to describe it is that I want to calculate a torque vector that will rotate the yaw of the object and keep it upright regardless of its inclination without rolling it. This is a problem for me because I want my player to remain straight without finishing upside down because they were thrown and decided to turn.

Someone else had posted about the same problem in a different forum, but did not receive much help, however, it provided this really useful picture describing the problem:

Local vs. Global

Notice how the left object tilts and then rotates with respect to its own local coordinates, but the one on the right rotates with respect to the global coordinates instead of rolling like the one on the left.

How I can get this? Is there something obvious that I am forgetting or forgetting? Am I explaining it well?

dnd 5e: Can a character with good / neutral alignment tune in to a sensitive magic object with evil alignment?

There are no rules on who can be specifically tuned to sensitive magic objects, so normal rules apply. If the element does not say that only a specific alignment can / cannot be tuned to it, then any alignment can be tuned to it.

An example of this (as noted in the Medix2 response) is the Moonblade, which says:

(Requires tuning of an elf or half elf of good neutral alignment)

Hazirawn has nothing to suggest some kind of alignment limitation, so any alignment can tune into it.

When the user conflicts with the article, the article can make demands

Now, as to what happens when a user with a conflicting alignment is tuned to him, the rules for sensitive magic objects go into some details:

A sensitive element has a will of its own, shaped by its personality and alignment. If its bearer acts in the opposite way to the alignment or purpose of the element, a conflict may arise. When such a conflict occurs, the object performs a charisma check challenged by the bearer charisma check. If the article wins the contest, it makes one or more of the following demands (the list is omitted)

Therefore, although it is not explicitly limited to alignment-based conflicts, it seems very likely that a user who builds a weapon that opposes its alignment would conflict with the special purpose of that weapon (if it has one) at some point and the rules describe how to treat it (up to and including the element that takes control of the user).

The Hoard of the Dragon Queen does not take into account any particular objective or behavior of Hazirawn, but a DM can (and probably would) do some things to make it interesting.

dnd 5e: Can the True Resurrection spell resurrect a creature originally created by True Polymorph from an object?

Since you specifically said that you are killed before becoming permanent, it depends on whether you are using the original Rules as intended or if you go with the optional rule of the Xanathar All Guide.

According to this quality control, if you cast a spell without a valid target (which would be the True Polymorphed object in this case), the spell space is not consumed and nothing happens. To summarize Jeremy Crawford's statements in the Sage Advice segment, one of the Dragon Talk podcasts here (specifically at 1:12 pm for ~ 7.5 minutes), "illegal targeting" is a void in the written rules (from the date of the podcast) and is open mainly to DM to choose how to handle it. That said, there is an intention of how it should be handled, which is that the cast must still take the cast time, but the spell will not occur and will not consume a spell space. The reason for the taste of this is that he sees the spells as essentially trying to make a magical connection between the caster and the target. When that connection is established, the energy of the spell is consumed by producing the effect of the spell, but if the target is not one, the spell may make a connection, nothing happens and that energy is not spent.

While Xanathar says that YOU actually use the spell space.

Invalid spell targets

A spell specifies what a caster can aim with him: any type of creature, a creature of a certain type (humanoid or beast, for example), an object, an area, the caster or something else. But what happens if a spell points to something that is not a valid target? For example, someone could throw a lovely person over a creature that is believed to be a humanoid, without knowing that the target is a vampire. If this problem arises, treat it with the following rule.

If you cast a spell on someone or something that cannot be affected by the spell, nothing happens to that target, but if you used a spell space to cast the spell, the space is still spent. If the spell normally has no effect on a target that succeeds in a save shot, the invalid target seems to have succeeded in its save shot, even though it did not attempt one (without giving indications that the creature is in fact an invalid target) Otherwise, you perceive that the spell did nothing to the target.

We know that the creature will once again be an object when it reaches 0 HP, as specifically indicated by True Polymorph

The transformation lasts for the duration, or until the target falls to 0 hit points or dies.

So, to give an order of events of a kind here

  1. I threw TP on my couch and made it a goblin for simplicity and I call it Greg
  2. Greg immediately flees
  3. About 30 minutes later I am still concentrating on the spell because I want to make it permanent.
  4. Around that time, Greg fights and disintegrates
  5. My cleric friend comes and sees him disintegrate
  6. She kills whatever killed him and then, being too optimistic, throws TR and in the absence of a body says his name

This is where it gets difficult. One of two things happens, but more or less they share the same end result that the sofa goblin doesn't resurrect.

Or you go through the original RAI and spend an hour casting the spell and she says Greg and then nothing happens.

Or B, you follow Xanathar's rule, which makes you spend an hour casting the spell, you say Greg at the end and spend the space (and I suppose diamonds and holy water are worth 25,000 in gold).

Whatever happens, Greg died and became an object again when his HP hit 0, which makes him an invalid target.

java – editable JSF dataTable does not display object attributes

I need to do an activity with a JSF list where I can add, edit and delete registered users. I was able to register new people, but when I started using cellEdit to edit the records, I noticed that none of the attributes of the objects appear in the list beyond the ID, and I don't know what the error in the code is. When testing, I noticed that people are being saved in the list, but nothing appears in the data table.

Xhtml code:

    Lista de pessoas




ManagerBean code:

package br.senai;

import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

public class GerenciadorBean {
    int id = 1;
    private List listPessoas = new ArrayList();
    private Pessoa pessoa = new Pessoa();
    public void inserir(){
        pessoa = new Pessoa();
    public Pessoa getPessoa(){
        return pessoa;
    public List getPessoas(){
        return listPessoas;
    public void setPessoa(Pessoa pessoa){
        this.pessoa = pessoa;
} code:

package br.senai;

public class Pessoa {
    private String nome;
    private String email;
    private int id;

    public Pessoa(String nome, String email){
        this.nome = nome; = email; = id;

    public Pessoa(){}

    public int getId() {
        return id;

    public void setId(int id) { = id;

    public String getNome() {
        return nome;

    public void setNome(String nome) {
        this.nome = nome;

    public String getEmail() {
        return email;

    public void setEmail(String email) { = email;


I started now at JSF and I don't know what to do. Any help is welcome!