OOP: Instantiate plugin, passing parameters and accessing super class properties from sub class object

I would like to know the “best” – OOP-way – and WP-compatible – format for instantiating an object, while passing arguments ( which are defined as properties in the parent class ) – which are then cleanly and correctly available to all sub classes, which extend the parent.

I would like to know how to make $this->slug ( the parent prop ) available cleanly within the sub class, without having to pass the arguments to this class constructor.

The example code below works, but something smells wrong:

<?php

// plugin.php

namespace QPlugin;

// Define Class ##
class Plugin {

    // class properties ##
    protected $slug     = false;

    // construct ##
    public function __construct( Array $args = () ) {

        // set class props, if defined - check using null coalescing operator ##
        $this->slug     = $args('slug') ?? false ;

    }

    // public init callback ##
    public function init() {

        // setup CPT ##
        $cpt = new QPluginCPT((
            'slug'      => $this->slug,
        ));
        $cpt->init();

    }

}

// instantiate the plugin class and make the returned object available as a (optional) global variable  ##
global $q_plugin;
$q_plugin = new Plugin((
    'slug'      => 'q_cpt', // cpt slug -- singular ##
));
$q_plugin->init();

// NAMESPACE/cpt.php

namespace QPluginCPT;

class CPT {

    // construct ##
    public function __construct( Array $args = () ) {

        // store passed args ##
        $this->args = $args;

    }

    // public init callback ##
    public function init() {

        // sanity ##
        if( 
            ! isset( $this->args('slug') ) 
        ){

            error_log( 'Error in params passed to '.__CLASS__ );

            return false;

        }

        // $this->args('slug') is now available to use in register_post_type function
        // BUT, I would like to know how to make $this->slug ( the parent prop ) available cleanly, without having to pass the arguments to this class constructor

    }

}

Thanks!

plotting – Best way to get handle on the Ticks properties

There are a lot of questions already on Ticks. However I did not find a better way to handle ticks place, size etc.

I have a simple example where I want have some handle on the ticks position and size. I found the undocumented functionality ChartingScaledTicks from some of the previous questions in this forum which I think gives a great handle to tick-size. But when comes to choosing the Major/Minor ticks position I could not so far use it. And the problem is I do not know where I will get more information on this (apart from typing ?ChartingScaledTicks).

Lets take the following example where I want to set my Major ticks on even-places like 600,800,... etc.

ListLinePlot(Table({x,x},{x,500,2000,100}),
             Frame -> True,
             FrameStyle -> BlackFrame,
             FrameTicks->{{Charting`ScaledTicks({Identity,Identity},TicksLength->{.05,.02}),None},
             {Charting`ScaledTicks({Identity,Identity},TicksLength->{.05,.02})(400,2000,8),None}}

)

After playing a bit, I am able to show the Major ticks on x-axis appearing on even-100-places, the minor ticks are gone. I am sure that I am missing something for the minor ticks in the ChartingScaledTicks options but I dont know what should I do to make them reappear.
Here is an example where y-axis is automatically taking Major ticks, in the x-axis I try to force Major ticks appear at even-hundred places.

How do I set position and size of Major ticks

word – How to use Document Properties from Sharepoint in Conditional Statements?

My question and objective are very similar to the question at this link, but unfortunately the answer didn’t provide enough information for me to implement the proposed solution: How to use Document Properties from Sharepoint in MS Word Field Codes?

In SharePoint I have custom columns / properties passed from a custom Content Type to new document.

Based on those properties, I want the template to ‘autofill’ text (auto-insert an autotext). Sample logic:

If gender=female, insert paragraph1

I thought I could use the IF statement in MS Word’s QuickParts and use DocProperty fields like so:

{ IF { DOCPROPERTY Gender } = "Female" {AUTOTEXT customText} "OTHER TEXT" }

Unfortunately, as is well documented (https://sharepains.com/2018/06/29/sharepoint-online-2016-document-properties-vs-docproperty), SharePoint custom properties aren’t related to DocProperties. So the “Gender” property from SharePoint isn’t accessible as a DocProperty:

enter image description here
enter image description here

Does anyone have any ideas how to make this work?

I have used VBA before, and I am open to using it if absolutely necessary. However, I wanted to avoid it so end-users don’t have trouble with macro-disabled files (employees in my organization don’t always remember to enable macros for internal macro-enabled documents and then tell me the templates don’t work!).

Thanks in advance!

(Apologies for the large photos!)

real analysis – Definition and properties of the inverse of the flow of an ODE

At lesson, the teacher considers a flow $Phi$ given by the solutions of the ode system for $tin(0, T)$ and $xinmathbb R^d$,
$$
begin{cases}
y'(s)=b(y(s), s),&sleq T\
y(t)=x
end{cases},label{1}tag{*}
$$

that is $Phi(x, t, s)=y(s)$ solving eqref{1}. He said that we will be mostly concerned with $Phi(cdot, 0, cdot)$. The field $b$ is assumed to be Lipschitz continuous in both variables and bounded.

Then, he intoduces the inverse $Psi$ of the above flow as follows: $Psi(x, 0, s)=y(s)$ satisfying
$$
begin{cases}
y'(s)=-b(y(s), t-s),&s<tleq T\
y(0)=x
end{cases},
$$

and he said that $Psi$ is such that
$$
Phi(Psi(x, 0, s), 0, s)=x,quad Psi(Phi(x, 0, s), 0, s)=x.label{2}tag{**}
$$

I do not understand eqref{2}. Can someone help me? Maybe is the definition of the inverse wrong?

Thank you

unity – Storing Prefab properties in a scene and applying them to prefab instantiated via Addressables

I am working on a small script to replace Prefabs in a scene with Addressable versions of the same prefab. This is working so far by creating a second scene with the Prefabs stripped out an a small loader object in their place. When the 2nd scene run the addressables are instantiated and everything is fine.

However, this only works for the absolute base simple case of no changes to the default prefab properties. What I am trying to solve now is storing the current settings of the prefab along with it’s addressable reference so that they can be reapplied when it is instantiated.

So far I have looked at PropertyModification to get a list of all the properties and their values, but as this is an Editor only structure it is no good for the instantiation of the objects at runtime. I was thinking I could store the property names and values, but cannot find anyway to then reapply those values back to the newly instantiated object.

Is there any way I can apply (ideally wholesale without the need of custom instantiation scripts) the stored properties to a prefab ?

Thanks in advance.

dnd 5e – If using a weapon as an improvised weapon, are any of its properties retained?

When using a weapon as an improvised weapon you are treating it as an object.:

Sometimes characters don’t have their weapons and have to attack with whatever is at hand. An improvised weapon includes any object you can wield in one or two hands, such as broken glass, a table leg, a frying pan, a wagon wheel, or a dead goblin.

However…

If the improvised weapon is similar to a real one, then at the DM’s discretion you can use its profile instead (thus gaining appropriate properties):

Often, an improvised weapon is similar to an actual weapon and can be treated as such. For example, a table leg is akin to a club. At the DM’s option, a character proficient with a weapon can use a similar object as if it were that weapon and use his or her proficiency bonus.

As for your examples:

It all depends how you are using it. Keep that in mind.

  • Would a thrown Scimitar still be a Finesse or Light weapon? No, that is not how a scimitar is usually used
  • Would a Pike still be Heavy or have Reach? Depends how it is being wielded; if held in the middle and used as a quarterstaff then it would lose both
  • Would a net still limit you to only making one attack per action? Not if you are just smacking people with it
  • Would it still have no effect on a huge or larger creature? It would not be able to restrain anyone
  • Would a Lance still have disadvantage if an enemy is nearby and require two hands (unless mounted)? If you are using it as a makeshift pike, then it would be heavy, reach, two-handed

development – Can i map the word document properties inside SharePoint document library

Inside MS word document we have the following properties:-

enter image description here

and my question is if we can map these properties inside SharePoint document library? so for example i can populate the above properties inside word document >> upload the document inside an online SharePoint document library >> then the proprieties will be automatically populated inside SharePoint?

concurrency – Does a memory transaction have ACID properties?

In Operating System Concepts

The concept of transactional memory
originated in database theory, for example, yet it provides a strategy for process
synchronization. A memory transaction is a sequence of memory read–write
operations that are atomic. If all operations in a transaction are completed, the
memory transaction is committed. Otherwise, the operations must be aborted
and rolled back. The benefits of transactional memory can be obtained through
features added to a programming language.

Furthermore, a transactional memory system can identify which
statements in atomic blocks can be executed concurrently
, such as concurrent
read access to a shared variable. It is, of course, possible for a programmer
to identify these situations and use reader–writer locks, but the task becomes
increasingly difficult as the number of threads within an application grows.

In database systems, a transaction must have ACID properties.

Does a memory transaction have ACID properties too?

  • The quote only mentions atomicity.
  • Duration seems unlikely, because memory isn’t permanent storage.
  • I am not sure about consistency.
  • I am not sure about isolation.(The second paragraph seems to talk about multiple processes/threads may or may not concurrently execute the same transaction, whereas isolation if I am correct is about multiple processes/threads concurrently execute different transactions.)

Thanks.

set theory – Reference request: Examples of research on a set with interesting properties which turned out to be the empty set

I’ve seen internet jokes (at least more than 1) between mathematicians like this one here about someone studying a set (or another object such as a group) with interesting properties. And then, after a lot of research (presumably after some years of work), find out such set couldn’t be other than the empty set, making the work of years useless, I guess.

I this something that happens commonly? Do you know any real examples of this?

P.S. Honestly I don’t known which tags to use, or even if this question fits here, so feel free to add/remove tags as needed.