Questions tagged [variable-names]

256 questions
1
vote
4 answers

How to dynamically create objects containing files with similar names in same path?

I'm very new to Python and not a programmer. I have this: y1990=open('Documents/python/google-python-exercises/babynames/baby1990.html', 'r', encoding='utf8') y1992=open('Documents/python/google-python-exercises/babynames/baby1992.html', 'r',…
xv70
  • 922
  • 1
  • 12
  • 27
1
vote
1 answer

Batch-rename variables in R without For loop

I have a table of survey questions: ques <- data.frame(stringsAsFactors=F, question_id=c("q1","q2"), question_nm=c("computer_hrs","exercise_hrs"), question_txt=c("How many hours did you spend last week on a computer?", …
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
1
vote
5 answers

Is there a convention, when using Java RMI, to use the dollar sign $ in a variable name?

I realize that it is a valid part of a variable name, but I've never seen variable names actually use the symbol $ before. The Java tutorial says this: Additionally, the dollar sign character, by convention, is never used at all. You may find some…
Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
1
vote
3 answers

How to create a generic id reference with jQuery

I have about 6 div elements with the same class. When I mouseover any one of them I want to show a nother div next to them. I am thinking of giving them all an id of the form id="mydiv-divname" where mydiv- will always be constant. How would I…
Ankur
  • 50,282
  • 110
  • 242
  • 312
1
vote
2 answers

TSQL: Declare variables with a counter in the name

How do I create/declare variables with a counter in the name on a MS SQL Server? I have a "for-like" loop with CURSOR and WHILE @@FETCH_STATUS = 0 BUT: the number of those values is changing continuously. So i want to write every value in an own…
Agen T Smith
  • 49
  • 1
  • 6
1
vote
2 answers

Convert array values to array of vars PHP

FROM array with no key: $array = array('apple','bee','carrot','dragon','elephant') To $newarray = ($apple,$bee,$carrot,$dragon,$elephant) Why: I want to create flexible function to get fields from a mysql db, like this:
Leo
  • 580
  • 7
  • 22
1
vote
3 answers

How do I search for variable names in the editor?

In functions, the MATLAB editor displays a warning when a defined variable is not subsequently used before the function ends or before the variable is overwritten. This obviously tells me that the editor has a way of searching for occurrences of…
andreasdr
  • 3,804
  • 4
  • 28
  • 32
0
votes
2 answers

Syntax for iterating the comparison of one array to many other systematically named arrays

I have a question about proper syntax in iterative functions. I want to compare one master array to a large set (180+) of other arrays. The large set of arrays to be compared are systematically named (scorespec1, scorespec2, scorespec3...). Each…
WyoBuckeye
  • 187
  • 2
  • 13
0
votes
3 answers

Javascript: dynamic var names with php?

Probably a dead simple and idiotic question (I'm totally new to javascript): I have this code that loads a new post by clicking on a "next" or "back"-link. The clicks variable is used to scroll up and down in the sql-limit-statement (using the…
quartier
  • 3
  • 2
0
votes
0 answers

Create a variable wita another variable in the (variable) name, and have a dynamic variable

naam$var='value' doesn't work Need to use it in a loop : naam$var=$(sed -n $var"p" namefile.txt) Dynamic variable names in Bash doesn't do the trick for me. Maybe i didn't understand it inuff, but I already spend time on this. For me it just…
0
votes
1 answer

Angular Validator requiredFalse

I want to add a validator to my FormControl that validates the form if a boolean is false. There is requiredTrue but I need the opposite. Is there a validator for…
0
votes
1 answer

Naming variables which represent json

I am naming a variable JsonArray versionsJA = jsonObject.get("versions").getAsJsonArray() Is there any proper naming convention that can be done here? I mean something better than the name versionsJA? Is it a good idea to include the type of…
nick
  • 107
  • 6
0
votes
1 answer

Create Dictionary with name and value of list of variables

I have a list of variables in python. And I want to create a dictionary whose key will be the name of the variable and the value will be the content. a,b,c = 1,2,3 list = [a,b,c] dic = {f'{item=}'.split('=')[0]:item for item in list} If I run the…
arodrisa
  • 300
  • 4
  • 17
0
votes
0 answers

Issues with naming empty dictionaries on Python

I was attempting to make an empty dictionary and use set default to allow duplicates. For some reason, the only variable name that would work is “d1”. Is there a reason why? I had another friend with way more experience in Python programming tell me…
0
votes
1 answer

Naming conventions. Method or variable names containing numbers as a words

I can't find even couple of words about containing numbers in names of variables or on methods. Does anyone have any authoritative information about such cases: string2map its4me etc... Exactly using number as a word but not number as a number. Is…