Argument 1 passed to App\\Service\\SecurityService::__construct() must be an instance of League\\OAuth2\\Server\\AuthorizationServer - symfony5.4

I used an AuthorizationServer of League\OAuth2\Server\AuthorizationServer in my constructor and added in
Service.yaml
App\Service\SecurityService:
arguments: ['#form.server_params', '#service_container']
But showing an error of Argument 1 passed to App\Service\SecurityService::__construct() must be an instance of League\OAuth2\Server\AuthorizationServer, instance of Symfony\Component\Form\Util\ServerParams given, called in C:\xampp\htdocs\codeLibrary\code_library\var\cache\dev\Container5BmKxp9\getSecurityControllerService.php on line 29

Related

Using Gio.SimpleAction argument in stateless action

The documentation for Gio.SimpleAction.new says that I can specify a name, which is a string, and a parameter type, which is a GLib.VariantType (or None). If I specify a GLib.VariantType for the second argument, how do I specify its value?
I know that I can specify an argument in the connect call for the action, but then the first argument in the handler gets None. It seems as if it could be useful to specify a value for that argument, but I am not seeing how that is done.
You specify it's value in g_action_activate.
Thus, you do the following, e.g. for boolean:
vtype = GLib.VariantType.new("b")
action = Gio.SimpleAction.new("name", vtype)
# action.connect ("activate", handler, *args)
value = GLib.Variant.new_boolean (True)
a.activate(value)

Can you pass by reference in PeopleCode?

I'm new to PeopleCode and as I'm learning functions, I noticed that in PeopleCode, we'd normally pass value using %PATIENT_ID. A friend told me that you can also pass by reference in PeopleCode but how?
PeopleCode passes by reference for functions.
Function addOne(&num As integer)
&num = &num + 1
End-Function;
Local integer &val = 9;
addOne(&val);
MessageBox(0, "", 0, 0,String(&val));
Results in 10
If you are using App Classes it behaves differently
for methods:
Pass by value for simple types (string, int, number,etc)
Pass by reference for objects (rowsets, records, app classes)
Can pass by reference for simple types using the OUT keyword in the parameter list
method addOne(&num as integer out)
Functions which are defined in the same context as the executing code, e.g. page/component/record/field event PeopleCode, always consider parameters as refernces.
Within Application Classes, parameters of simple types on methods can be defined with the 'out' key word to state that they are a references. Methods also automatically pass parameters as references for complex types. Think: "If there is a lot of data, it is a reference"
This documentation will be very helpful for you.
https://docs.oracle.com/cd/E26239_01/pt851h3/eng/psbooks/tpcr/chapter.htm?File=tpcr/htm/tpcr07.htm
Passing Parameters with Object Data Types
Parameters with object data types are always passed by reference:
/* argument passed by reference */
method storeInfo(&f as File);
If you specify the out modifier for a method parameter with an object
data type, it becomes a reference parameter. This means that the
parameter variable is passed by reference instead of the object that
it is pointing at when passed.
For example, if you pass an object parameter with the out modifier:
method myMethod(&arg as MyObjectClass);
Local MyObjectClass &o1 = create MyObjectClass("A");
Local MyOtherObjectClass &o2 = create MyOtherObjectClass();
&o2.myMethod(&o1);
And inside myMethod this occurs:
Method myMethod
&arg = create MyObjectClass("B");
end-method;
Since the method argument is reassigned within the body of myMethod,
&o1 does not point at the new instance of MyObjectClass (initialized
with "B") after the method call completes. This is because &o1 still
references the original instance of MyObjectClass.
However, if &o1 had been passed with the out modifier, after the
method call completes, &o1 points at whatever the parameter was last
assigned to; in this case, the new instance of MyObjectClass. The
parameter, rather than the object, is passed by reference. Using
the Out Specification for a Parameter
In the following example, a class, AddStuff, has a single public
method, DoAdd. This adds two numbers together, then assigns them as
different numbers. In the signature of the method declaration, the
first parameter is not declared with an out statement, while the
second one is.
class AddStuff
​method DoAdd(&P1 as number, &P2 as number out);
​end-class;
method DoAdd
&X = &P1 + &P2;
&P1 = 1;
&P2 = 2;
end-method;
In the following PeopleCode example, an object named &Aref is
instantiated from the class AddStuff. Two parameters, &I and &J are
also defined.
local AddStuff &Aref = Create AddStuff();
local number &I = 10;
local number &J = 20;
The following code example is correct. &J is changed, because of the
outstatement in the method signature, and because the value is being
passed by reference. The value of &I is not updated.
&Aref.DoAdd(&I, &J); /* changes &J but not &I */
The following code example causes a design time error. The second
parameter must be passed by reference, not by value.
&Aref.DoAdd(10, 20); /* error - second argument not variable */

Trying to understand Ruby's getter setter rules

What I can't understand is the
def initialize(awesome_level2)
#awesome_level2 = awesome_level2
Does the #awesome_level2 have to have the same name as awesome_level2?
It seems if I change it, it doesn't work properly
class Awesome
attr_accessor :awesome_level2
def initialize(awesome_level2)
p awesome_level2 #100
#awesome_level2 = awesome_level2
P #awesome_level2 #100
end
end
awesome_sauce = awesome.new(100)
puts awesome_sauce.awesome_level2 #100 where is awesome_level2 from?
awesome_sauce.awesome_level = 99
puts awesome_sauce.awesome_level #99
attr_accessor is a convenience method that creates getter and setter methods for the symbols you pass as arguments. You can then access the instance variable it creates directly, in this case #awesome_level2. Note that this has the # symbol in front of it, which indicates it's an instance variable. This is different from a local variable or a method parameter which does not have the # sign. Therefore in your initialize method, the variable names #awesome_list2 and awesome_list2 are different and can hold different values.
As #Prescott has said, it seems as though you were trying to set your instance variable #awesome_list2 to the argument passed to your initializer, awesome_list2, but accidentally wrote it with a capital A, which is just going to set it to nil since an object with the name Awesome_list2 (note the capital 'A') doesn't exist (I presume).

Matlab calling superclass abstract constructor syntax seems strange

I am trying to call a superclass constructor from the inheriting class.
The official syntax in matlab documentation is:
obj = obj#SuperClass(ArgumentList);
However the editor seems to warn that:
the variable `obj` might be used before it is defined.
Moreover, if I try to run the code I get an error "The left operand of "#" must be the method name."
What could be wrong?
I found out that this is a result of a typo of the sub-class constructor function name. Minimal reconstruction of the problem appears below:
classdef SuperDemo < handle
methods
function obj = SuperDemo(opt)
disp(['in super ', opt])
end
end
end
classdef SubDemo < SuperDemo
methods
function obj = SubDemoo(opt) % NOTICE THE TYPO SubDemoo
disp(['in sub ', opt])
obj = obj#SuperDemo(opt);
end
end
end
If you call s = SubDemo('hello') you will get the error:
Error using SubDemo Error: File: SubDemo.m Line: 5 Column: 19 "#"
Within a method, a superclass method of the same name is called by
saying method#superclass. The left operand of "#" must be the method
name.
This error is misleading as the left operand is obj and not SubDemo.
The error message should have indicated that the construction function name SubDemoo is not the same as the class name SubDemo.

Why null reference exception in SetMolePublicInstance?

I get a "null reference" exception in the following line:
MoleRuntime.SetMolePublicInstance(stub, receiverType, objReceiver, name, null);
The program builds and compiles correctly. There are no complaints about any of the parameters to the method.
Here's the specification of SetMolePublicInstance, from the object browser:
SetMolePublicInstance(System.Delegate _stub, System.Type receiverType, object _receiver, string name, params System.Type[] parameterTypes)
Here are the parameter values for "Locals":
+ stub {Method = {System.String <StaticMethodUnitTestWithDeq>b__0()}} System.Func<string>
+ receiverType {Name = "OrigValue" FullName = "OrigValueP.OrigValue"} System.Type {System.RuntimeType}
objReceiver {OrigValueP.OrigValue} object {OrigValueP.OrigValue}
name "TestString" string
parameterTypes null object[]
I know that TestString() takes no parameters and returns string, so as a starter to try to get things working, I specified "null" for the final parameter to SetMolePublicInstance. As already mentioned, this compiles OK.
Here's the stack trace:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ExtendedReflection.Collections.Indexable.ConvertAllToArray[TInput,TOutput](TInput[] array, Converter`2 converter)
at Microsoft.Moles.Framework.Moles.MoleRuntime.SetMole(Delegate _stub, Type receiverType, Object _receiver, String name, MoleBindingFlags flags, Type[] parameterTypes)
at Microsoft.Moles.Framework.Moles.MoleRuntime.SetMolePublicInstance(Delegate _stub, Type receiverType, Object _receiver, String name, Type[] parameterTypes)
at DeqP.Deq.Replace[T](Func`1 stub, Type receiverType, Object objReceiver, String name) in C:\0VisProjects\DecP_04\DecP\DeqC.cs:line 38
at DeqPTest.DecCTest.StaticMethodUnitTestWithDeq() in C:\0VisProjects\DecP_04\DecPTest\DeqCTest.cs:line 28
at Starter.Start.Main(String[] args) in C:\0VisProjects\DecP_04\Starter\Starter.cs:line 14
Press any key to continue . . .
To avoid the null parameter, I changed the final "null" to "parameterTypes" as in the following line:
MoleRuntime.SetMolePublicInstance(stub, receiverType, objReceiver, name, parameterTypes);
I inserted the line:
Type [] parameterTypes = new Type[0];
Using moles.runner.exe produces the desired results :)
The compiler can not check for NullReferenceException; because, it is a runtime exception. This exception means one of the objects passed to the arguments is null, when it is expected to point to an instance.
Place a breakpoint on that line of the test project. Running the test in debug mode will break on that line, allowing you to see which of the arguments is null.