unity – How can I get the name of a scriptable object via code

How can I get the name of a scriptable object, same way I would a game object gameObject.name?

I’ve tried:

object.name
scriptableObject.name
ScriptableObject.name
name
this.name

//String GetName()
WorldObjectData obj = ScriptableObject.CreateInstance<WorldObjectData>();
SerializedObject serializedObject = new SerializedObject(obj);
return serializedObject.FindProperty("m_name");

I can see that ScriptableObject extends Object, which has the .name attribute. But cant access it.

dnd 5e – Can you use your free object interaction while restrained?

You can use your free object interaction whilst Restrained

As Dale M’s answer points out, the Restrained condition says nothing about restricting your action economy, so you are able to use your free object interaction just like if you were not Restrained.

This is unlike, say, the slow spell, which does restrict what you can do on your turn (although the slow spell only makes you choose between an Action or Bonus Action, and still doesn’t take away your free object interaction, but this is just an example of a rule explicitly limiting your action economy).

I will also point out that you’re not really drawing the wand “for free”, since you are using your one and only “free object interaction” to do so, which, despite the name, isn’t really free as you can only do it once (otherwise, you wouldn’t have to drop the dagger, you could stow it instead). But that’s just a nit-pick. As Rykara points out in a comment via a related Q&A, dropping a weapon is “free”.

object oriented – What does “representing” something in memory mean in OOP?

You’ll find that everything in IT is about representation. At the end of the day the computer itself is a fluctuating cascade of electrons across sand, or the dripping of fluid through a pipe, or the relative location of gears, cams, and spindles.

Is a really tough question (no, really).

Philosophers have literally wrung each others necks over this topic for millenia.

Thought experiment:

A Tesla car is a Car. It is also a computer containing a model of the car. Which is real, and which is the representation? the Car, or the model of the Car within the Car?

The Car is obviously physical. When the Car physical changes (such as moving) the model is updated. This would imply that the model is the representation.

But…

When the model of the Car changes, so does the Car. It’s hardly imagined, no pretence need be made. So that would mean the Car is the representation of the computer’s model.

So how to properly think about this?

  • S Systems are well defined, and well prescribed operations like sorting. There may be many ways to achieve the result, but it is possible to achieve it and it is clear when it is present (or not).

  • P Systems have a well defined problem, but there is no prescribed means or sufficiently rigorous way to solve it. For example the travelling salesperson problem, or an economic simulation. We know what we want, but there isn’t a way to solve it outside of trying everything (which is impossible), approximating it (which automatically implies the result is wrong for a value of wrongness), or restrict it down to an S system which guarantees results but doesn’t solve parts of the problem.

  • E systems are emergent systems. They don’t solve the problem, they are part of the problem. Think air traffic controller system. The very act of attempting to solve the problem, changes the problem.

The model and what it represents depends entirely upon the kind of system it sits in.

In the thought experiment the model of the car, and the car are not separate things. Even though part of it is physical.

You’ll find that most textbooks talk about models representing X in the realm of S and P systems.

aes – Decrypt in chunks a ASE 128 CBC encrypted object

I have an Encrypted object in Minio, encrypted using the ASE 128 bit CBC algorithm.

The object is quite large (~50 MB) so instead of loading it into the memory completely (which may cause out of memory exception), I am retrieving it in chunks of 1MB. I need to decrypt it before use.

Is it possible to decrypt the object in this way (1MB at a time, the whole object was encrypted in one go)?
If yes, how can I do it?
I have tried decrypting 16-byte chunks which produce the following errors:

javax.crypto.BadPaddingException: Given final block not properly padded

javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher

javascript – Modify specific values within a JSON Object, return a cloned version of the object with modified values?

I am trying to modify an obj similar to this:

{
  "data": (
    {
      "id": "0923f8e0-d090-11ea-8615-9d076fb270e8",
      "pb_id": "or-portland-188",
      "state": "Oregon",
      "city": "Portland",
      "date": "2020-07-27T00:00:00.000000Z",
      "title": "Journalist shot in the face",
      "description": null,
      "data": null,
      "geocoding": { "lat": 45.5051064, "long": -122.6750261 }
    }
   )
}

I need to go into every instance of the “geocoding” key, and modify the lat/long values slightly as all of the coordinates I have are identical.

I have a function to add a small amount of randomness, but I’m having trouble accessing the values and getting the entire object with modified values returned.

If you needed to go in and change all of the lat/long values (let’s say multiply them all by 0 for demonstration sake), how would you do this?

javascript – Por que essa função retorna object e não array?

Estou estudando um pouco de JS com um projeto onde precisei converter a string em lista/array, fiz a seguinte função

function s_for_l(s){var string = new Array(); for (let i of s) {string.push(i)}; return string}

mas ela só retorna object, não array como o esperado

mathematics – Rotate Object in world space – Raytracing

I’m programming a C raytracing project.

I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it.

For each object, I have its position (x, y, z) in the world space and its 3d normalized orientation vector.

For the moment, I do nothing more than applying once of the three following functions on the 3d normalized orientation vector. I don’t know if I’m doing it right. Rotation doesn’t work well.

For example, I want to rotate my object left with the j key and right with the l key (x_rotation), up with the i key and down with the k key (y_rotation). I’m not sure how to use the z axis.

I’m starting to despair, can you please help me?

I will be very grateful for your help 🙂

t_vec       x_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x;
    res.y = vec.y * cos(alpha) - vec.z * sin(alpha);
    res.z = vec.y * sin(alpha) + vec.z * cos(alpha);
    return (res);
}

t_vec       y_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.z * sin(alpha) + vec.x * cos(alpha);
    res.y = vec.y;
    res.z = vec.z * cos(alpha) - vec.x * sin(alpha);
    return (res);
}

t_vec       z_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x * cos(alpha) - vec.y * sin(alpha);
    res.y = vec.x * sin(alpha) + vec.y + cos(alpha);
    res.z = vec.z;
    return (res);
}

c# – Avoiding the not calling Dispose() more than once on an object warning

I am trying to avoid the warning CA2202, to not call Dispose more than once time on an object. I have already deleted one of them, but I do not think it works I need the Dispose() for both cases. Unless after the second catch I use a finally, as far as I know it would not include the first finally.

    private void A_B_Switching_FormClosing(object sender, FormClosingEventArgs e)
    {
        try
        {
            try
            {
                // Does something
            }
            catch(Exception ex)
            {
                // Does something
            }

            finally
            {
                //does something
                this.Dispose();
            }
        }
        catch(Exception ex)
        {
            Console.WriteLine("Exception in " + this.GetType().Name + ".cs: " + System.Reflection.MethodBase.GetCurrentMethod().Name + "(): " + ex.Message);

            this.Dispose();
        }
    }

plotting – Part specification is longer than depth of object

everyone! I’m a bit new to Mathematica. Could you help me plot this:

TheoreticalT(n2_, k2_, 
   w_) := (2*cn2(n2, k2)*(n1 + n3)*E^(
     I (2 (Pi) w  d2 (cn2(n2, k2) - 1))/
      c))/((n1 + cn2(n2, k2))*(n3 + cn2(n2, k2)) - (cn2(n2, k2) - 
        n1)*(cn2(n2, k2) - n3)*E^(I (2 cn2(n2, k2) 2 (Pi) w d2 )/c));
TheoreticalT2(n4_, k4_, 
   w_) := (2*cn4(n4, k4)*(n1 + n3)*E^(
     I (2 (Pi) w  d2 (cn4(n4, k4) - 1))/
      c))/((n1 + cn4(n4, k4))*(n3 + cn4(n4, k4)) - (cn4(n4, k4) - 
        n1)*(cn4(n4, k4) - n3)*E^(I ( 2 cn4(n4, k4) 2 (Pi) w d2)/c));
TheoreticalT3(n6_, k6_, 
   w_) := (2*cn6(n6, k6)*(n1 + n3)*
     E^(-I (2 (Pi) w  d2 (cn6(n6, k6) - 1))/
      c))/((n1 + cn6(n6, k6))*(n3 + cn6(n6, k6)) - (cn6(n6, k6) - 
        n1)*(cn6(n6, k6) - n3)*E^(I ( 2 cn6(n6, k6) 2 (Pi) w d2)/c));

I followed the same method in saving and plotting equations from my other equations but it doesn’t work for this one. Here’s what I’ve been doing:

(*saving the Theoretical Transmittance data*)
TheoreticalTdata = 
  Table({freq((i)), Re(TheoreticalT((i))), Im(TheoreticalT((i)))}, {i,
     1, np});
TheoreticalT2data = 
  Table({freq((i)), Re(TheoreticalT2((i))), 
    Im(TheoreticalT2((i)))}, {i, 1, np});
TheoreticalT3data = 
  Table({freq((i)), Re(TheoreticalT3((i))), 
    Im(TheoreticalT3((i)))}, {i, 1, np});

(*Plotting the Theoretical Transmittance*)
ListPlot({Table({freq((i)), Abs(TheoreticalT((i)))}, {i, 1, np}), 
  Table({freq((i)), Abs(TheoreticalT2((i)))}, {i, 1, np}), 
  Table({freq((i)), Abs(TheoreticalT3((i)))}, {i, 1, np})},
 PlotRange -> {{fmin, fmax}, All}, Joined -> True, Frame -> True, 
 FrameLabel -> {"Frequency (THz)", "Transmittance"}, 
 PlotLabel -> "Transmittance", PlotStyle -> {Red, Green, Blue})
(*Legend:
Red: Sample 1, Green: Sample 2, Blue: Sample 3*)

And here are some of the errors that I’ve been encountering:

Part::partd: Part specification TheoreticalT((1)) is longer than depth
of object.

Hope you could help. Thanks!

python – Cloud function triggered by object created storage getting file not found error

I have a cloud function configured to be triggered on objects finalize/create in a storage bucket. This was running well for a while. However recently I start to getting some errors FileNotFoundError when trying to read the file. But if I try download the file through the gsutil or the console works fine.

Code sample:

def main(data, context):
    full_filename = data('name')
    bucket = data('bucket')
    df = pd.read_csv(f'gs://{bucket}/{full_filename}') # intermittent raises FileNotFoundError 

The errors occurs most often when the file was overwritten. The bucket has the object versioning enabled.

There are something I can do?