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
1
vote
1 answer

How to hardcode a MP4 stream file with iOS VideoToolbox and FFMPEG?

Guys! I have found a demo in github that is :-VideoToolboxDemo. And I also found a question in stackoverflow how-to-use-videotoolbox-to-decompress-h-264-video-stream which someone has implemented in github:https:/ /github.com/lileilei1119/VTDemo But…
Kim Jin
  • 180
  • 1
  • 8
1
vote
3 answers

Requesting item from Factory without hard-coding every case

I have an interface called Command: public interface Command { // irrelevant code } And about 15 classes that implement this interface: public class Comm_A implements Command { // irrelevant code } public class Comm_B implements Command…
Antti Degl
  • 69
  • 8
1
vote
2 answers

Creating an Android Trial app that expires after a certain number of actions

I've searched for trial application expiry methods and I've found good answers regarding Trial periods for apps but they're time-based. How can I create a Trial app version that expires after clicking a button 3 times? based on this link Creating…
zuspence
  • 78
  • 5
1
vote
0 answers

logstash csv map columns not hardcoded

i am trying to Generically map a csv file, so that the order of the columns wont matter. i know how to do this: input { file { path => "/opt/tradertools/omer/omer.csv" type => "csv" } filter { if [type] == "csv" { csv{ …
mike
  • 767
  • 2
  • 10
  • 18
1
vote
2 answers

Is this hardcoding? How can I avoid it?

I'm creating a parser for a specific XML structure and I'm facing a possible hardcoding issue. Here: private function filterDefaultParams($param){ #FIXME Hardcoding? return array_key_exists('default',$param); } The literal 'default' is a…
1
vote
3 answers

Is String culture info important for comparison if the user will never modify those strings

When comparing hard-coded Strings that the User will see but not modify/change, is the culture info important. I would assume not, but I just want to be safe. Example: static void Main() { string hardString = "IAMHardCodei"; string…
JackBarn
  • 635
  • 1
  • 6
  • 18
1
vote
2 answers

How can I save a double in values folder on android

I don't want to hardcode a double, so I wanted to put it in the values folder, either in a new XML or in the strings.xml I know it exists: my string true
RedDeath
  • 283
  • 4
  • 17
1
vote
3 answers

Detect beacon without hardcode

I was wondering : When we enter a shop, using the app shop, we receive for example a notification. But what if the beacon is down, and it's replaced with another beacon, with a different UUID etc .. ? Are the UUID/Major/Minor value of a beacon not…
user4203923
1
vote
3 answers

Hard-coding HTML into VB6 code

Background: we have an application that generates reports from HTML (that may or may not have inline scripting). The HTML source is normally stored as a blob in the database. There is now the need to hard-code a particular report into the…
jpoh
  • 4,536
  • 4
  • 35
  • 60
1
vote
5 answers

What does it mean the something is Hardcoded ?

I'm following an MVC tutorial of MoviesMVC here , and the author says the following thing : public string Index() { return "This is my default action..."; } Currently the Index method returns a string with a message that is …
JAN
  • 21,236
  • 66
  • 181
  • 318
1
vote
2 answers

Is there a way to write the same try-except for multiple lines of code without hardcoding? python

I have multiple functions that might return None: do_something(), do_something2(), do_something3(), etc. And to overcome the None Type Errors, from another part of the code I have to hardcode the try-except as such: try: x =…
alvas
  • 115,346
  • 109
  • 446
  • 738
1
vote
2 answers

MS Access query multiple criteria

I am trying to build an access query with multiple criteria. The table to be queried is "tblVendor" which has information about vendor shipment data as shown below: The second table is "tblSchedule" which has the schedule for each Vendor cutoff…
1
vote
4 answers

How to minus one on multiple variable? python

I have a key two sets of identical int variables from two different objects, but one starts its the first element of with 0 and the other with 1 a = 0, b = 5, c = 7 # var_abc x = 1, y = 6, d = 6 # var_xyz In order to do other processes, i must…
alvas
  • 115,346
  • 109
  • 446
  • 738
1
vote
3 answers

What is the difference between "hard-coding" and passing in arguments in regard to memory?

So the title is my question. In memory, arguments can be located on the stack or heap depending on how they are initialized, but how is hard-coded information dealt with? As an example, I will use the constructor for ifstream What is the difference…
Sean Sen Wang
  • 193
  • 1
  • 1
  • 12
1
vote
2 answers

Avoiding database calls by hardcoding data into script

I've got approximately 1000 rows (4 fields) in a MySQL database. I know for a fact that the data in the database is not going to change very often (they are GPS coordinates). Is it better for me to call this information from the database every time…
Lars
  • 7,908
  • 11
  • 52
  • 70