Questions tagged [hardcoded]

Parameters or variables in a program are considered as hard-coded, if they represent a constant value that can't be changed by configuration or via any kind of interface. The only way to change them is to modify the program itself.

120 questions
40
votes
4 answers

C hardcoded array as memcpy parameter

I want to pass in a hardcoded char array as the source parameter to memcpy ... Something like this: memcpy(dest, {0xE3,0x83,0xA2,0xA4,0xCB} ,5); This compiled with clang gives the following error: cccc.c:28:14: error: expected expression If i…
Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
9
votes
2 answers

Why aren't constants used for events in Node.js?

I'm new to node, but I come from an extensive background in programming. Everywhere I looked (both in tutorials and in production code I've seen around), people overwhelmingly use hard coded strings instead of constants to identify events. I picked…
Bogdan Stăncescu
  • 5,320
  • 3
  • 24
  • 25
8
votes
2 answers

How to suppress FindBugs warning (hard coded reference to an absolute pathname)?

i am just testing some things for the opensource software Geonetwork and now I want to export a shape file from my postGIS database to my computer but I cant test it cause I always get a findbugs warning : Hard coded reference to an absolute…
6
votes
1 answer

Detecting Hard Coded Passwords

I have been trying to detect hard coded passwords in source code files. Currently I am checking for variable assignments and comparison for identifiers with a sub-string matching with password,pswd. But it is leading to lots of false positives like…
Mrinal Ahlawat
  • 115
  • 1
  • 10
5
votes
3 answers

Java get valueOf for generic subclass of java.lang.Number or primitive

After reading through a lot of questions, I asked myself if it is possible to solve the dilemma of transforming a string into a generic number WITHOUT using a hardcoded approach. For example: I get from a method a parameter with the type Class With…
Georg Friedrich
  • 183
  • 2
  • 12
5
votes
1 answer

Reusing a character class in a regular expression

In order to keep a regular expression more brief, is there a shorthand way to refer to a character class that occurs earlier in the same regular expression? Example Is there a way to shorten the…
Joel Christophel
  • 2,604
  • 4
  • 30
  • 49
4
votes
2 answers

Best practice instead of hard-coded RFC destinations?

is there a good way to use not hardcoded RFC destinations? Right now our solution is to check which system is used and then assign the destination to a variable IF cl_role EQ 'P'. p_dest = 'ESW300'. ELSE. p_dest = 'EAW300'. …
Jen Mer
  • 101
  • 1
  • 3
  • 10
4
votes
2 answers

How can I ignore all hard coded strings inside Log in Android Studio?

I have been reading about ignoring hardcoded string from Log: Log.d(TAG, "onBindViewHolder: "); Even inside a Toast: Toast.makeText(context,"Hardcoded text",LENGTH_SHORT).show(); Sources: How can I find all RELEVANT hard coded strings in Android…
Deneb Chorny
  • 391
  • 3
  • 19
4
votes
2 answers

is it possible to use a hardcoded list of values instead of a range in range-formulas?

I was wondering if I could hardcode an array or "range" into a formula. So, for example, if I wanted to see if a month in B2 is March, April, June or July, I would like to compress this this: =COUNTIF(a1:a4,MONTH(B2))>0 where A1:a4 = 3,4,6,7 to…
cperlmutter
  • 308
  • 3
  • 9
4
votes
1 answer

Password Management : Hard coded password in html

Fortify lists outputs the following line as vulnerable to attack under the category - Password Management : Hard coded Password. Though I've not hard coded the password. Why is it showing that as a vulnerability, and how do I fix…
Shruthi HM
  • 55
  • 1
  • 2
  • 6
4
votes
2 answers

save php variables permanently without database

In the admin area of my site there is a form which is for the hostname, username and password for the mysql database that the site uses. Currently these values are hardcoded into a php class. But who can I link it so the form can edit the variables…
Jonathan.
  • 53,997
  • 54
  • 186
  • 290
4
votes
2 answers

How can I get automatic unique atomic counter binding points (no hard coded binding=)?

Many articles describe using atomic counters by specifying a fixed binding point: //Shader: layout(binding = 0, offset = 0) uniform atomic_uint myAtomicCounter; //App code glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, myBufferHandle); Here, the…
jozxyqk
  • 16,424
  • 12
  • 91
  • 180
4
votes
7 answers

C - alternative to #ifdef

I'm trying to streamline large chunk of legacy C code in which, even today, before doing the build guy who maintains it takes a source file(s) and manually modifies the following section before the compilation based on the various types of…
Bostone
  • 36,858
  • 39
  • 167
  • 227
4
votes
3 answers

Java: Is there a performance difference between using n variables or using hard coded array elements?

I'm making a program for myself and this question popped up. This program deals with graphics so I have to keep performance in mind. Is there a difference in performance if I use several variables or if I use an array with hard coded indexes? If…
GuiRitter
  • 697
  • 1
  • 11
  • 20
3
votes
2 answers

Why it is not suggested to pass hardcoded absolute path name to File object constructor File(String)

I am creating a File object in Java using File(String pathName), where pathName is the absolute path to the file. While this works perfectly fine from functionality point of view, but it frequently ends up as an static analysis defect. Is there any…
user3928919
1
2 3 4 5 6 7 8