17,665 questions
0
votes
0
answers
41
views
How to keep an add on Python debugger function to stay in scope
After trying Lavi Kumar's example it seems the package import pdbext.debug in ~/.pdbrc goes out of scope when another source file is called.
~/.pdbrc:
!import pdbext.debug
alias pl !pdbext.debug....
0
votes
1
answer
65
views
Which scope does the {$I-} directive have in Pascal?
I disable I/O checking inside a procedure:
procedure RewriteText(
FileName: string;
var TextFile: text;
var ErrMsg: string
);
begin
{$I-}
assign(TextFile, FileName);
rewrite(...
7
votes
6
answers
2k
views
C program: Use an array outside the scope it was defined in
I have some code in which an array of strings is defined in a conditional statement. The array is out of scope where I need it. So I defined another pointer in the outer scope. In the conditional ...
2
votes
2
answers
103
views
how is the ref-safe-context determined in c# when ref assigning to local variables
I am a beginner in C# trying to figure out how ref-safe-context is defined in C#. I declared a function Foo which didn't work since it tries to ref assign a variable with declaration-block to a ref ...
1
vote
1
answer
86
views
In Ansible YAML, how do I pass different variables to an include_tasks to make it reusable?
I have a workflow where I download a file, do some stuff to it, upload it, and then download it again to verify that the changes took place. I want my download logic to be in a reusable YAML file that ...
-3
votes
1
answer
68
views
How to "unset" colors when customizing an overly-specific Sublime Text Color Scheme?
What is being customized
When creating a color scheme for Sublime Text, to find the scope that defines the color for a portion of code, we can press Cmd Opt P (Mac) or Shift Ctrl Alt P (Win), to bring ...
3
votes
3
answers
121
views
Dynamically create .NET buttons, with button pressed return its name, or other unique identifier
I am trying to dynamically add buttons to a list, and have $Button (or another variable) be set to whatever is clicked (No OK/Cancel button needed).
The below code creates the buttons, and resizes the ...
-1
votes
1
answer
154
views
Variable scope when System.IO.FileSystemWatcher event is triggered
variables $relativePath and $x lose their values in the function $createdChanged, however $session retains its value. what am i missing about scope or otherwise with these variables?
windows 11, ...
-5
votes
1
answer
118
views
Python 3 changes variable even after if condition fails [closed]
I have a kaggle notebook(link here). The notebook iterates over a list of number(candidate_max_leaf_nodes) and then gets a mae for each number by massing it as a parameter(ignore the other parameters) ...
3
votes
1
answer
99
views
Can i use the using: scope modifier for a script block executed in a module function
If a have Powershell function, like
function invoke-sb1 ([scriptBlock] $sb) {
invoke-command -computerName abc -credential (get-cred.ps1) -scriptBlock $sb
}
and then invoke the function from ...
2
votes
1
answer
100
views
Pass borrowed ref cell value into function trait
I'm working on an ECS system, but in order to iterate across pairs of queries, I need to be able to fetch components only for a limited scope when executing a system. To do this, I'm trying to make a ...
1
vote
2
answers
95
views
Question about Rust bracket operator plus ampersand
The following snippet is from the (Brown University ver.) Rust book
fn largest<T>(list: &[T]) -> &T {
let mut largest = &list[0];
for item in list {
if item > ...
0
votes
0
answers
56
views
Can Facebook Webhooks notify follower count changes on a Page?
Limite de débit de l’application
We would like to monitor in real time the changes in the number of followers (subscribers) of a Facebook Page.
Is there a Webhook field that allows receiving a ...
0
votes
2
answers
90
views
How to define a new scope?
Currently, I am considering these three methods to define a new scope.
if (1) {
def a = 1
}
({
def a = 1
})()
any {
def a = 1
}
Is there anyone better? It seems the official style guide ...
0
votes
1
answer
82
views
Avalonia UI style scope propagation
I'm having some issues in defining styles of my items. Or actually in the scope of the styles I set. My question is how do I make sure, that a style I'm setting is not propagated for the elements of ...
0
votes
0
answers
109
views
Lost name reference when setting extra attribute
I have shot myself in the foot a fair number of times with declare until I started to differentiate its switches that are not all equal. Some set variable attributes, but some just affect scope. So ...
0
votes
1
answer
108
views
Having issues with function scoping and generally how the browser JavaScript engine executes JavaScript code [duplicate]
First I linked two JavaScript files to my HTML
<script src="script.js"></script>
<script src="main.js"></script>
On the first file ( the "script.js&...
3
votes
1
answer
169
views
C++: dynamic array unexpectedly working and on the scope of variables
I'm super duper new to coding and I'm just learning this as a hobby. I'm following a course and this is the code I wrote (user input to a dynamically created array):
#include <iostream>
using ...
1
vote
0
answers
56
views
plibsys data structures give incorrect results
I am trying to put together some code to find duplicated files between two or more directories, for this
I am using C libs like tinydir, and plibsys, the idea is traverse dirs get the hash of every ...
4
votes
3
answers
244
views
does calling a function means leaving the scope of an object declared prior to that call in C?
In the C17's final draft N2176 document, the 7th paragraph of 6.2.4 section says
For such an object that does have a variable length array type, its lifetime extends from the declaration of the ...
4
votes
2
answers
160
views
What is the difference between an enumeration constant and an enumerator?
In C17's final draft N2176,
in the 1st paragraph of 6.2.1 it says
member of an enumeration is called an enumeration constant.
in the 7th paragraph 6.2.1 it says
Each enumeration constant has scope ...
7
votes
2
answers
143
views
strictly speaking, where does the scope of a label name starts and ends in C?
In C17's final draft N2176 document,
at 1st paragraph of 6.2.1, it defines a label name as a type of identifier,
at 3rd paragraph of 6.2.1, it says
A label name is the only kind of identifier that ...
0
votes
0
answers
102
views
Trying to act on objects from a separate view SwiftUI SceneKit macOS 'cannot find ** in scope'
I have an app using SceneKit in a SwiftUI framework, and I am trying to properly organise my views by defining a separate view for the interface panel as an ZStack overlay.
I have moved the buttons (...
3
votes
3
answers
177
views
How does the block scope work?How does the standard explain this?
For example, we have such code:
#include <stdio.h>
int main(void)
{
int n = 4;
{
n++;
}
printf("%d\n",n);
return 0;
}
How does the inner block see the ...
1
vote
1
answer
98
views
Why does Import-Module import into the calling module's scope, while New-PSDrive creates a drive in the scope which called the module?
Per Import-Module's -Scope parameter documentation:
By default, when Import-Module cmdlet is called from the command prompt, script file, or scriptblock, all the commands are imported into the global ...
0
votes
1
answer
57
views
block scope, associating bindings to Declarative records
//global code: GC
const x=20; //BD_GC_X
{
//block code: BC
console.log(x); //BC_X
const x=10; //BD_BC_X
}
my understanding:
binding for x at BD_GC_X is associated by Global Execution ...
2
votes
1
answer
87
views
How do I fix a Powershell problem with button selection?
I used ChatGPT to generate the code to understand how to do it myself, and it mostly works. The script is to check my TV & Movie folders for missing files to make Plex work better (folder.jpg, ...
2
votes
1
answer
149
views
PowerShell - how to import module in a script without polluting the global scope?
Inside a script, I import a module, for example
Import-Module -Name Test -Scope Local
I execute the script at the command prompt
test.ps1
Then, after the script finishes, I run Get-Module and the ...
1
vote
1
answer
63
views
Attaching inner functions that use the same random number to related button click events js
I'm working on a game that will take a random object, and use that same random object for a series of questions/functions. I'm having trouble getting the next piece of code to run after clicking the &...
1
vote
2
answers
431
views
Bluesky social oauth scope "Bad token scope"
I'm trying to build an app that integrates with bsky's OAuth and API. Using the below the document using the "Browser App" option.
https://docs.bsky.app/docs/advanced-guides/oauth-client
I'm ...
-2
votes
1
answer
56
views
Is there a way to use a function which references an object that in turn references that function? [closed]
I'm working on a practice game that uses an array of objects (plants) that will be chosen randomly. Questions are asked about light and water requirements, winning or losing the plant and moving onto ...
3
votes
2
answers
170
views
Where does the C++ standard allow an identifier with name space of a structure in a primary expression?
Where the C++ standard allows an identifier with name space of a structure (a "non-ordinary" identifier in C) in a primary expression?
Consider the following code (which is a valid C++, but ...
0
votes
0
answers
69
views
Flutter web app requesting Google Calendar scope, and Google Cloud verified, but still shows unverified in web
I have a Flutter web and android app using google calendar api, create/edit/delete a calendar for the app's own use. I use googleapis package, and chose "calendarScope" to access google ...
0
votes
2
answers
105
views
Why is my variable not working when passed as an argument?
For the person who is missing it, I am trying to add the year of death by using the reduce method for an array of objects.
For example:
{
name: "Carly",
yearOfBirth: 2018,
},
{
name: 'Carly'...
-2
votes
1
answer
129
views
How to make script-level variables private to the script [duplicate]
Is it possible to declare a global variable that is invisible to the importing script?
For example, in script a.py I have a variable var_a that is accessible to any function in a.py. However, in ...
3
votes
2
answers
165
views
The scope for `my` var in the non C-style for loop
While recently trying to get one algorithm for "Getting indices of matching parentheses". I can get what that algorithm means although with some problems with perl language.
The perl syntax ...
3
votes
2
answers
160
views
Shadowing an iterator inside a for loop has undefined (?) behaviour in C
When shadowing i inside the for loop, the following code
#include <stdio.h>
int main()
{
for (int i = 1; i < 5; i++) {
printf("%d", i);
int i = i;
...
12
votes
3
answers
1k
views
What is the scope of `fesetround()`?
I learned that fesetround can be used to control FP rounding rule.
I wonder what is scope of the function? say, is it local to the very source file? or translation unit? how about thread?
Any insight ...
2
votes
0
answers
62
views
Why does Rust scope include the else of an if conditional as well? [duplicate]
I have the below min repro application which is meant to build a graph (tree) from a vec (split string). (It is meant to be part of a larger loop that would modify the graph/tree multiple times.)
The ...
2
votes
1
answer
118
views
What is a declaration outside the template-parameter-list?
In the [basic.scope.temp] section of the C++ standard, it is mentioned:
6.4.9 Template parameter scope
Each template template-parameter introduces a template parameter scope that includes the ...
0
votes
0
answers
43
views
CMake variable CMAKE_C_COMPILER_VERSION set but later value lost
So I have a number of CMake files - and I am trying to refactor many common things across multiple projects.
One example is we turn on features due to the compiler version (GCC)
I am having problems ...
0
votes
3
answers
97
views
how to access objects generated within other objects from outside
I wrote some container type which keep objects. I want to ensure that objects will be deleted if they are not longer needed.
I am able to generate objects inside my class and I can access these ...
0
votes
1
answer
182
views
Problem with method visibility in a trait in Rust [closed]
I'm working on a Rust project and have a trait called Auth with an asynchronous method auth_login. The issue I'm facing is that when I try to make the method accessible from other modules using pub, I ...
-1
votes
1
answer
120
views
Does the garbage collector know to dispose variables located in a lambda-captured scope?
In this C# example, will the garbage collector dispose of hugeString after TestClass is instantiated?
Furthermore, would uncommenting the line hugeString = null help garbage collection at all?
public ...
0
votes
0
answers
23
views
Why can't I access the property of an object from a function located in an array of functions [duplicate]
shouldn't it be able to access the object "something"?
var problem = {
something: {thing:23},
somethingElse: [function(){return this.something.thing}]
};
console.log(...
0
votes
1
answer
95
views
Why is a field of a struct defined in main.rs accessible within the main function without declaring it as pub?
In Rust, items defined in the same module (siblings) can access each other, so we can access Config within main(). However, given that struct fields are private by default, why can they still be ...
0
votes
0
answers
27
views
Using won't work but direct reference will
A website I built 10+ years ago for a fishing club needs a few changes. I haven't changed the site for 5+ years and am immediately getting build errors when it compiled fine under VS 2017 - but won't ...
1
vote
0
answers
19
views
Rust scopes and borrowing in CSV tutorial [duplicate]
In the Rust csv module tutorial, under the Reading Headers section (about a third of the way down the page), there is a code example as follows:
//tutorial-read-headers-02.rs
fn run() -> Result<(...
0
votes
0
answers
115
views
How to remove 'with' from this method
Here is the function in question:
/**
* @el [Element] Target HTML Element
* @attr [String] attribute to bind
* @match [Object] Result from regex.exec
*/
const bindValue = (el, attr, match) => {
...
0
votes
0
answers
38
views
Why is "self" not defined for evals in Python comprehensions [duplicate]
To increase visibility into my application, I'm monkey-patching certain methods on an object to add logging statements before the method call:
class Foo:
def bar(self, f):
print(f"bar {f}&...