Questions tagged [hardcode]

It is the development practice of writing data considered as configuration or input directly in source code.

Hardcoding is considered a bad practice, source code must be changed every time programmer want to change the hardcoded data. It is commonly used when writing programs that should accept user's input, to avoid complexity the programmer should prefer hardcode the input data in the source code instead handle real input.

153 questions
0
votes
2 answers

is it possible to generate hardcode array according to data of another hardcode array automatically?

for example, I have a pair array (which is a static variable) a[] which represents coordinates of points A,B,C: pair MyClass::a[]={{0,0},{320,568},{640,0}}; and I want another array b[] which stores the length of AB and BC: float…
ggrr
  • 7,737
  • 5
  • 31
  • 53
0
votes
4 answers

String Resource in laravel programming?

is there any way that instead of hard coding strings in the blade you use something like a string resource(or string table) so if you change a string every blade will be changed . For example instead of hoard coding "product" in the blade I use a…
M.Shahrokhi
  • 385
  • 1
  • 7
  • 19
0
votes
3 answers

Confused about many different ways of doing the same things

I am currently working on the Ruby course in Codecademy and on the 'hashes and symbols' section. Here is the code I am working with: strings = ["HTML", "CSS", "JavaScript", "Python", "Ruby"] symbols = [] strings.each do |x| if x =='s' …
user6092327
0
votes
2 answers

Should integers be included in the strings.xml file?

If I have a button with an attribute of android:text="+1" should it be included in the @string file or is it fine to be hardcoded in the activity_main?
KalebB
  • 11
  • 4
0
votes
1 answer

Using Table with Python

I need to incorporate a table into my python program so when I run my program it can read the information from the table as it is needed. What is the best way to incorporate the table into my program so that it is familiar with it when the program…
Rataiczak24
  • 1,032
  • 18
  • 53
0
votes
1 answer

How can I hardcode specific server names in powershell script

I want to reboot specific servers, I am using findstr to find specific servers in the list of 1000's of servers, however, is there any way I can hardcode servernames in a script so the script only run on a particular set of remote servers? Also, how…
Mickey
  • 25
  • 9
0
votes
1 answer

Do calculated fields allow hardcoding dates?

I'm trying to create a calculated field to determine the duration between a date field and another hardcoded date, like this: DIFFINDAYS(test_datefield, "19-Dec-16"), but it won't work. Is it possible in CRM 2015 or 2016?
0
votes
1 answer

Avoid hardcoding strings html

How should I go about avoiding hardcoding Strings in HTML code? e.g:

Website name

So that they can be easily changed globally across the site from one location.
0
votes
3 answers

Rails user authentication: can you hardcode a user?

I have a working rails application with user authentication. I want to automatically have my account coded because I will have the admin role and no one else will. Is there a way to do this? By the way, my db/migrate table looks like this: class…
salipshitz
  • 67
  • 13
0
votes
0 answers

What is the best way to refactor a long array of hard-coded references?

I am currently trying to rework some code on our server that is super non-pretty Java hard-coded mess. The server receives a byte opcode from the user, and then some variable amount of size. The server will then process this information by reading…
Will Sherwood
  • 1,484
  • 3
  • 14
  • 27
0
votes
2 answers

Java hardcoded repeating process

I am making a basic hardcoded game that has 2 users that will fight each other. All my methods are set and work as expected. I am now trying to figure out a way after looping through the main hardcode, to give the option to fight again and…
TheDetailer
  • 289
  • 5
  • 16
0
votes
0 answers

VB.NET hardcoding with obfuscation trouble

I need to hardcode a string in my source code and make an "if clause check" to see if the user entered input is the same or not. I am also using EAZfuscator.net for obfuscating the code. However, when ı use the obfuscator, I think it changes my…
0
votes
1 answer

Search query in two tables and ID

I have a system that stores author name in one table: author_id | author_name 1 | J.K.Rowling 2 | Ryan Quinn 3 | Stephen King and another table that stores books and uses author_id from above: book_id | book_name | book_desc…
0
votes
2 answers

Risks of hard coding username and passwords to log into websites

I am working on a small project of my own and am using Selenium to log into a website and currently I have my username and password hardcoded in the .py file. What kind of risks do I face? I am the only one who has access to this file and it will…
jlcv
  • 1,688
  • 5
  • 21
  • 50
0
votes
2 answers

Hard Code Image into class file

I have in the past downloaded a tool that will take an image file as input and output a source file extending the Image class that can be used for graphics. I now have a practical application for this tool, but I no longer have a copy. I have…
nimsson
  • 930
  • 1
  • 14
  • 27