Hot answers tagged

145 votes
Accepted

Should temporary files be saved to /tmp or the current working directory?

Temporary files have to be stored into the operating system temporary directory for several reasons: The operating system makes it very easy to create those files while ensuring that their names ...
user avatar
138 votes
Accepted

Does storing plain text data take up less space than storing the equivalent message in binary?

Plaintext is binary. When you write an H to a hard drive, the write head doesn't carve two vertical lines and a horizontal line into the platter, it magnetically encodes the bits 010010001 into the ...
user avatar
  • 5,632
124 votes
Accepted

Are data type declarators like "int" and "char" stored in RAM when a C program executes?

To address the question you've posted in several comments(which I think you should edit into your post): What I don't understand is how does the computer know lets when it reads a variable's value ...
user avatar
  • 2,594
105 votes
Accepted

Would having 4 states per "bit" rather than 2 mean twice the storage space?

The word you are looking for is not "bit" but "symbol." "Symbol" is the word used to describe the process of mapping hardware signals (such as voltages or magnetic patterns) into logical bits. If a ...
user avatar
  • 10.5k
58 votes
Accepted

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

What you describe, "smoothing by fives", is a finite impulse response (FIR) digital filter. Such filters are implemented with circular buffers. You keep only the last N values, you keep an index ...
user avatar
54 votes

Modeling first and lastname separately

First name and last name are not useful concepts. Names work differently in different countries. In most Asian countries, the family name is written first, but it is still used for sorting—so you may ...
user avatar
  • 18.2k
43 votes

Are data type declarators like "int" and "char" stored in RAM when a C program executes?

I think your main question seems to be: "If the type is erased at compile-time and not retained at runtime, then how does the computer know whether to execute code wich interprets it as an int or to ...
user avatar
33 votes

Should temporary files be saved to /tmp or the current working directory?

Should I insist saving to /tmp is the right approach and defend for any failure as "working as intended" (ie. ask your admin for proper permission access)? There are standards for this, and the best ...
user avatar
  • 19.9k
32 votes

Modeling first and lastname separately

The only argument that matters is what are the requirements of your system? Do you need to deal with just one culture? If so, conform to that culture. Otherwise plan for internationalization (as ...
user avatar
  • 4,795
24 votes

If C++ is generally faster than java, why most data analysis / ETL tools are developed in java?

Assuming for a moment that the general performance difference is true... Java has more mature data manipulation libraries. Java has mildly sane string manipulation. Java has a wider userbase. Java ...
user avatar
  • 107k
21 votes

How should I store readonly data to deploy with my application?

If the data never changes and is read only, then just put it in a code file as a list of constants. public readonly string AppStartUpData = "MyAppNeedsThis"; If this data is different per deployment,...
user avatar
  • 10.7k
21 votes

Would having 4 states per "bit" rather than 2 mean twice the storage space?

One quarternary memory cell can store exactly as much information as 2 binary memory cells: Quaternary Binary 0 00 1 01 2 10 3 11 So if you have same number of ...
user avatar
  • 3,704
19 votes

Does storing plain text data take up less space than storing the equivalent message in binary?

I find this a great fun thing to think about. Binary is not 1s and 0s in the way you talk about it. Imagine there is a quantity, I can tell you what quantity it is in many different ways: Nine in ...
user avatar
17 votes
Accepted

Why do binary files load quicker than alphanumeric text files?

Using fscanf() in itself probably explains most of it. fscanf() has to interpret the passed-in format string, and then has to scan the input stream from the file, trying to match the specified pattern....
user avatar
17 votes
Accepted

File storage microservice design

A goal of a service in SOA is to perform some logic which, otherwise, would have to be duplicated among other services. That logic is, in turn, the reason for the service to exist. In your case, you ...
user avatar
16 votes
Accepted

Microservices - sharing data through distributed in-memory cache?

Just like using a single database for multiple services, the approach you describe causes a strong coupling between the services. For example, you can not change the data model of one service without ...
user avatar
15 votes

How should I store readonly data to deploy with my application?

You can always add a file into your project and set its build type to Embedded Resource so that it is embedded directly into the application itself. Alternatively a file that is encrypted and placed ...
user avatar
15 votes

If C++ is generally faster than java, why most data analysis / ETL tools are developed in java?

I think there's more to this than simply that the workflow for ETL is typically I/O bound, not CPU bound; that's just the justification. The real issue here is development cost. C++ applications of ...
user avatar
  • 314
15 votes
Accepted

Is there any use case for using 'L' letter after a number literal in C?

In the C language expressions are typed inside-out: literals have types. E.g. 123 is an int, and 123U is an unsigned int, 123L is a long int and so on. The type of an expression depends on the types ...
user avatar
  • 125k
14 votes
Accepted

How should I store readonly data to deploy with my application?

A binary file would be the obvious answer, but it depends on how you are loading it - you might as well make life easy for yourself if you can. XML might be a good choice as there are built in ...
user avatar
14 votes
Accepted

How does Microdata rdfa compare to JSON-LD?

Microdata is not dead. While Microdata will not become a W3C standard¹, it’s still part of WHATWG’s HTML Living Standard. Differences between JSON-LD, Microdata, and RDFa (in the context of HTML ...
user avatar
  • 1,032
14 votes

Does storing plain text data take up less space than storing the equivalent message in binary?

Does storing plain text data take up less space than storing the equivalent message in binary? No, never. Your computer already stores the plain text data in the equivalent binary representation. ...
user avatar
  • 107k
13 votes
Accepted

How to deal with constructors in large data classes

You are looking for the builder pattern. Essentially it's an object with setters where you can set the parameters for construction and a createResult() method that will create the object you are ...
user avatar
13 votes

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

Every problem can be solved by adding an additional level of indirection. So do that. You can't delete part of an array in C++. But you can create a new array holding just the data you want to keep, ...
user avatar
  • 11.6k
12 votes

Are data type declarators like "int" and "char" stored in RAM when a C program executes?

The computer doesn't "know" what addresses are what, but the knowledge of what's what is baked into the instructions of your program. When you write a C program that writes and reads a char variable,...
user avatar
  • 27.2k
12 votes
Accepted

Binary data formats, how to make ensure you can read different format versions?

It seems to me that the simplest solution is to make your version header unambiguous and make sure that the old format can never look like it has a format header, you simply look for it. If it's not ...
user avatar
  • 22.1k
12 votes

Which layer should have responsibility for rounding numbers?

Monetary values in general do not use floating point (always approximation errors!), but fixed point, as BigDecimal in java, DECIMAL in SQL. For currencies you then have a defined precision (2 ...
user avatar
  • 1,680

Only top scored, non community-wiki answers of a minimum length are eligible