powershell: how to write-host value from [ref] variable

You would have probably tried: write-host “the new value is $obj1.value” and got corresponding output of the new value is System.Management.Automation.PSReference.value I think you did not notice the .value in the end of the output. In strings you have to do something like this while accessing properties: write-host “the new value is $($obj1.value)” Or use … Read more

can’t use template ref on component in vue 3 composition api

I ran into this issue today. The problem is that, when using the <script setup> pattern, none of the declared variables are returned. When you get a ref to the component, it’s just an empty object. The way to get around this is by using defineExpose in the setup block. // Child.vue <template> <div ref=”wrapper”> … Read more

How to pass a C# struct by reference?

It sounds like you just want to use ref to pass the struct by reference: private static void Foo(ref s s1) { s1.a++; Console.WriteLine(“inner a = ” + s1.a); } And at the call site: Foo(ref s1); See my article on parameter passing in C# for more details. Note that other than for interop, I … Read more

Managed C++ ref class

Basically, a ref class is a CLR class. It’s the equivalent of class in C#. This creates a reference type managed by the CLR. If you want to make a class that’s usable from C#, you’d normally create a ref class. (ref struct, by the way, does exactly the same thing, but with C++’s standard … Read more

PL/SQL print out ref cursor returned by a stored procedure

Note: This code is untested Define a record for your refCursor return type, call it rec. For example: TYPE MyRec IS RECORD (col1 VARCHAR2(10), col2 VARCHAR2(20), …); –define the record rec MyRec; — instantiate the record Once you have the refcursor returned from your procedure, you can add the following code where your comments are … Read more

React hook form v7 Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()

So the issue is that I think that the {…register(“name”}} line actually includes a ref property. You could console.log that out to verify; this is what I found to be true when using {…field} with the ControlledComponent. A very quick fix to get rid of the console error is to just, after the line with … Read more

C# Cannot use ref or out parameter inside an anonymous method body

Okay, I’ve found that it actually is possible with pointers if in unsafe context: public static class IntEx { unsafe public static Action CreateIncrementer(int* reference) { return () => { *reference += 1; }; } } However, the garbage collector can wreak havoc with this by moving your reference during garbage collection, as the following … Read more

How to use Material UI Select with react-hook-form?

Using Select component from Material UI with react hook form need you to implement custom logic with a Controller https://react-hook-form.com/api#Controller Here is a reusable component that will hopefully simplify the code to use that Select component in your app: import React from “react”; import FormControl from “@material-ui/core/FormControl”; import InputLabel from “@material-ui/core/InputLabel”; import Select from “@material-ui/core/Select”; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)