Questions tagged [reference]
A reference is a value that enables a program to indirectly access a particular datum, such as a variable or a record, in the computer's memory or in some other storage device.
17,154
questions
1
vote
1
answer
29
views
JOLT transformation for references
I'm looking for a JOLT transformation for replacing a reference by it's entity:
My input is as follows:
{
"users": [
{
"id": 1,
"firstname": "Max&...
0
votes
0
answers
36
views
How to get reference from a element that is not in the same tree of nodes of the element that hold the state?
I am using framer-motion, and i have three main components: NavBar (which is multiple), main(outlet), and footer:
I got a listener in the NavBar tracking the scroll behavior, to change the header. ALL ...
0
votes
3
answers
82
views
`let y = x` vs `let &y = &x`
What is the difference between the following two assignments?
let mut x = 1;
let mut y = x; // (1)
let &mut mut y = &mut x; // (2)
It appears they behave the same. Does #2 give ...
0
votes
1
answer
67
views
Change const refernece after initilization
I was advised to use const references instead of superfluous getter functions, i.e.
class Test {
private:
std::vector<int> _x;
public:
const std::vector<int> & x = _x;
}
...
0
votes
0
answers
10
views
_mysql_connector.MySQLInterfaceError: Duplicate key name 'locationid_index'
Referring the two foreign keys with same primary key in different table causes error in accessing
# Create the 'rides' table if it doesn't exist
cursor.execute('''
CREATE TABLE IF NOT ...
2
votes
2
answers
78
views
The range reference in the formula changes in one case but doesn't in other
The 3 in A3:A or B$3:B doesn't change when we move the 3rd row to any other row, but it changes when we move any other row to 3rd row position, or when insert a new row (Insert below in 2nd row or ...
1
vote
1
answer
59
views
Can I modify an &'a str on a struct instance in rust so that it has the same &'a str lifetime after modification?
struct test<'a> {
name: &'a str
}
impl<'a> test<'a> {
fn modify_name(&'a mut self) {
let new_name = self.name.replacen("az", "", 1);
...
1
vote
0
answers
38
views
How to get reference to the function or variable with the same name in Kotlin?
The problem is when I try to get the reference to testVar variable in Kotlin, ambiguity occurs if I have a function with the same name as the variable. Is there a solution for this?
class ...
0
votes
1
answer
57
views
fast reference in Microsoft Word with VBA
I have written two modules in the MS Word that can boost the speed of creat hyperlink for two words that they reference to each other:
This is useful specially when we want to reference many words. ...
-1
votes
0
answers
60
views
Difference between == and .equals() [duplicate]
Can some one explain the difference between == and .equals() when used to compare objects in Java?
I attempted to perform comparisons on Java objects using both the == operator and the .equals() ...
0
votes
0
answers
5
views
In VB6, how can I fix the "can't find library" error?
I'm using MSoft (msc.dll) in my VB6 project. When I tried to edit and compile the same project on a different PC, I encountered an error saying "Can't find the project or library". How can I ...
0
votes
1
answer
30
views
Referencing Environment with Global Python Variables
In the following program, there is a global variable, a, that I want to check the number of references to at each of the points 1, 2, 3, and 4.
import sys
a = 'my-string'
print(sys.getrefcount(a))
b ...
2
votes
1
answer
35
views
Python Read from csv1 and reference csv2 to write to csv3
I have two csv files, csv1 is the working file that changes, csv2 is static and used as a reference set.
csv1 - input.csv
Name
Type
Owner
Status
Date
Group
bananas
fruit
Joe
In Stock
1/1/23
apples
...
0
votes
1
answer
114
views
VB.NET and CATIA COM libraries
I try to make form app (Windows 11) in Visual Studio 2022 to work with opened CATIA products. I added project references...
And run this simple test:
Imports INFITF
Imports MECMOD
Public Class Form1
...
2
votes
1
answer
60
views
Unresolved reference 'turtle'
I was trying to import Turtle and Screen from turtle using the below code:
from turtle import Turtle, Screen
nora = turtle.Turtle()
screen = turtle.Screen()
but the editor(pycharm) shows-->
&...
0
votes
0
answers
26
views
How can I hide mismatched appendix StyleRefs in the footer?
I want to reference the appendix and the subsection of that appendix in my footer.
I'm currently using 4 StyleRef fields, referencing Appendix 1 and Appendix 2 data, but I encounter an issue with the ...
0
votes
1
answer
24
views
PackageReference and PackageReference to same project
Let's assume I have a library project (ProjA) and a second project (projB) that uses projA.
ProjA is published as a nuget package. Both projects have their own git repositories
In projB I have a ...
1
vote
1
answer
110
views
c++ undefined behavior of a reference to a base class
Please see my code. I have a base class "System" and a derived class "AdvancedSystem". When accessing the base class reference the output is undefined and random, and i have no ...
0
votes
0
answers
11
views
LaTex function \renewbibmacro*{} does not output APA 7th edition citations and bibliographies
I have the following LaTex code for citations with APA 7th edition style:
\usepackage[style=apa,natbib=true,backend=biber, citestyle=bwl-FU]{biblatex}
\appto{\bibsetup}{\sloppy}%to fit the ...
-2
votes
0
answers
51
views
Why isn't my vector, declared on the heap in main(), being instantiated in my function call? [duplicate]
Often, I use a reference to a data structure (such as a vector) in functions which add to/change that data structure.
For a change, I tried using a pointer instead of a reference. I did not see the ...
-1
votes
0
answers
30
views
Is JavaScript's "reference type" variables just pointers in C? [duplicate]
I've taken only CS50x for CS and don't have much knowledge about languages, so this question could look dumb or just completely wrong.
In C, a pointer is a variable storing an address, right?
I'm ...
2
votes
1
answer
128
views
Is it possible to write a class that can store lvalue references or objects exlusively?
I'm sick of passing all my objects by value and then moving, or overloading on lvalues and rvalues. I'm trying to write a class that can either store an lvalue reference or a normal object if an ...
1
vote
0
answers
67
views
Why can I add "const" to value parameters but not to reference parameters on member definition? [duplicate]
Look at this code:
struct A{
void f(int);
void g(int&);
};
// this works, defines A::f(int);
void A::f(const int){// no compiler error here despite additional const
};
// why does this ...
20
votes
1
answer
1k
views
Is int &ref = ref; well formed
I have learned that evaluating an uninitialized variable is undefined behavior. In particular, int i = i; is undefined behavior. I have read What's the behavior of an uninitialized variable used ...
0
votes
0
answers
16
views
Why does a Unit Test project need to install NuGet packages for classes it is testing
I have a project (ProjectA) that uses Microsoft.Graph and other things related to that package. I have another project (ProjectB) that Unit Tests methods in ProjectA. When I create an object from ...
-1
votes
0
answers
30
views
Two PHP application not working at same time on single server [duplicate]
I have 3 PHP application running on single server i.e IIS.
But problem is when I try to login to the first application it works but not for 2nd and 3rd PHP application. In order to login to 2nd or 3rd ...
0
votes
0
answers
21
views
Creating references between schemas in MongoDB and queries to get the data from the same
Here are the two schemas I am using:
UserSchema
import mongoose from "mongoose";
const UserSchema = new mongoose.Schema(
{
_id: {
type: Schema.Types.ObjectId,
},
name: {
...
12
votes
3
answers
198
views
Integer parameter calls float overload and float parameter calls integer overload? [duplicate]
Today i ran into roughly the following code:
#include <iostream>
void f(float&& f) { std::cout << f << "f "; }
void f(int&& i) { std::cout << i <&...
0
votes
0
answers
31
views
Library install with success in TwinCAT but not updated in my project
I'm using my own library in TwinCAT. So in my solution in VS, I have 2 project, one for my PLC the other one for my library. Like that if I have to change something in the library I can do it directly....
0
votes
1
answer
68
views
C# Found conflicts... circular reference?
In my solution consisting of ~20 projects, one project gives this build warning:
9>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion....
-1
votes
1
answer
97
views
Could not load file or assembly with identical setup of Visual Studio solution
VS 2019.
The issue I’m having is properly getting a build running of the current version (2.4) of a Solution.
I keep running into the error of
System.IO.FileNotFoundException: 'Could not load file or ...
0
votes
0
answers
18
views
Find all references to method and references to references in Java [duplicate]
I have a method in my Java application and I need to get all ways this method invoked from root of the first call inside of my application. In Eclipse I can find a nearest caller to the method but I ...
1
vote
1
answer
50
views
Zero-copy reference a slice of bytes by a step
I have a large Vec<u8> representing the raw pixel values of a gray image. Since the pixel format is actually 16-bit width, two u8 makes one pixel.
Now I'd like to use the image as if it was 8-...
0
votes
1
answer
52
views
Passing Primitive Types Behind a Struct Reference by Value in Rust -or- When is My Variable Bound?
Apologies for the code-bomb, however this question is best illustrated via a minimal example. Consider the following two implementations (new_1 and new_2) of passing data from behind a struct ...
0
votes
1
answer
94
views
How does Rust detect a reference to a local variable without the function being used?
Assume a function returns a dangling reference to a local variable:
fn foo<'a>() -> &'a i32 {
let i = 2;
&i
}
fn main() { }
Rust notices this and raises an error.
Adding ...
0
votes
0
answers
11
views
Third party dependency not loaded for class library I created and being referenced by a WPF project
I have a class library that has dependencies to a lot of packages from NuGet. Examples include Microsoft.Identity.Client, System.Diagnostics.DiagnosticSource, and System.Text.Json.
I reference this ...
2
votes
1
answer
68
views
I can't understand the Rust "scope" definition (Rust Programming Language, 2nd Ed. Klabnik & Nichols)
I'm having a hard time with how Rust defines "scope". Or perhaps it's with the definition of "scope" in the No Starch Press book (I actually bought the book).
On the top of pg. 62:...
0
votes
1
answer
21
views
Pomegranate unresolved reference in Pycharm
I have installed a Package named Pomegranate on my project. I use Pycharm.
I then import at the beginning of my file with the command :
import pomegranate, time, seaborn, numpy
from pomegranate import ...
0
votes
0
answers
11
views
How does self attention help in deciding references
Consider the two sentences: "The animal did not cross the road because it was too tired" and "The animal did not cross the road because it was too crowded". How does the self ...
0
votes
0
answers
71
views
What is the actual value of a reference variable in java? [duplicate]
I read a lot of articles regarding this subject and I really want to understand what is the value that it's stored inside a reference variable in java. There are just too many opinions for such a ...
0
votes
1
answer
32
views
copy a formula down , but change the row number by adding 12
I am converting a column in a sheet to multiple rows in another sheet. once I have populated the first row by referencing the addresses of the first 11 fields from the source sheet , I want to copy ...
1
vote
2
answers
81
views
Check C++ reference setter value
I have a question about the much-commented-about C++ reference getter-setter in C++. This is the base code:
class Foo
{
X x_;
public:
X & x() { return x_; }
const X & ...
-1
votes
0
answers
33
views
C++ program error: undefined reference to one of my functions [duplicate]
I have a async_test cpp file that is going to test my async.cpp implementation, but after compiling, I am unable to use my async_read function to test. I get the following error below:
async.cpp:88: ...
0
votes
0
answers
20
views
The Concept of Mutable and Immutable in case of Primitive and Reference data types in JS [duplicate]
When we say in JS that primitive values are immutable and reference data type values are mutable. What does it means?
Does it mean that when i write var x=10 an entry containing 10 is created on top ...
-1
votes
1
answer
136
views
Accessing members of a struct reference in C++
I have passed a reference of a struct to my function and need to access one of the members and pass it by reference to another function but it doesn't work. I am quite new to C++ so am not so familiar ...
1
vote
1
answer
57
views
References vs Rc's to values in Context for tokenization
I am creating an algebraic tokenizer/parser where implementations of individual token prototypes (such as operators, functions, constants, ...) are contained in a Context struct so that I don't have ...
-3
votes
0
answers
31
views
Undefined reference to classes included in header files, and multiple definitions of main [duplicate]
I have a main.cpp that references classes from model_class.h and model_component_classes.h, where model_class.h references model_component_classes.h (and their associated .cpp files).
When I try to ...
0
votes
2
answers
82
views
Call a function that uses `&mut self.0` in a loop (E0499)
I'm looking for a way around the lack-of-polonius problem in this specific circumstance. The other answers seem inapplicable, as far as I can understand at the moment.
I have two structures, ...
0
votes
0
answers
27
views
Permutation generation code in Go using a shared 'temp' slice exhibits unexpected behavior with input sizes less than 3
func permute(nums []int) [][]int {
return gen(nums, [][]int{}, []int{}, make([]bool, len(nums)));
}
func gen(nums []int, res [][]int, temp []int, used []bool) [][]int {
if len(nums) == len(...
1
vote
1
answer
78
views
Why use of references prevent decay of arrays in C++? [duplicate]
#include <iostream>
using namespace std;
int main()
{
int arr[3][3]
= { { 3, 2, 7 }, { 2, 6, 8 }, { 5, 1, 9 } };
for (auto& y : arr) {
for (int x : y) {
...