Hot answers tagged

146 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 ...
Arseni Mourzenko's 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 ...
8bittree's user avatar
  • 5,656
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 ...
Cort Ammon's user avatar
  • 10.9k
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 ...
John R. Strohm's user avatar
55 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 ...
Jan Hudec's user avatar
  • 18.3k
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 ...
Blrfl's user avatar
  • 20.3k
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 ...
Becuzz's user avatar
  • 4,845
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 ...
Telastyn's user avatar
  • 109k
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,...
Jon Raynor's user avatar
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 ...
hyde's user avatar
  • 3,744
19 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 ...
unor's user avatar
  • 1,102
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 ...
TessellatingHeckler's user avatar
19 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 ...
Arseni Mourzenko's user avatar
17 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 ...
Michał Kosmulski's 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 ...
TheLethalCoder's 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 ...
Doug's 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 ...
amon's user avatar
  • 134k
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 ...
Matt Wilko's user avatar
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. ...
Telastyn's user avatar
  • 109k
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 ...
ratchet freak's user avatar
13 votes
Accepted

"Reactive programming is programming with asynchronous data streams." is this true?

The most common example of Reactive programming that I've heard about is a spreadsheet program that has computed values. Personally, I would think about a spreadsheet more as a hybrid between ...
Jörg W Mittag's 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, ...
Nicol Bolas's user avatar
  • 11.9k
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 ...
JimmyJames's user avatar
  • 25.9k
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 ...
Joop Eggen's user avatar
  • 2,021
11 votes
Accepted

How to test data based on SQL queries?

Been there, done that. First let's make something clear: That's not unit testing. Unit testing is about code. You are not runnning the tests after a code change to test if code alterations ...
Tulains Córdova's user avatar
11 votes
Accepted

Why is it considered a good practice to isolate data management in a microservice?

A big advantage that a Microservices architecture has is that each service can be safely developed, tested and deployed independently. Having services share a database undermines this as it allows ...
Justin's user avatar
  • 1,728
11 votes

Is it anti-pattern to have inheritence in a dto?

Update: Rewrote code in Java since this question is tagged java but this applies to any object oriented language. If using inheritance is a means of reducing code duplication, I'm a little reluctant ...
Greg Burghardt's user avatar
11 votes

Why do or should programmers save data in text based formats like JSON or XML instead of binary?

JSON and XML are less efficient than pure binary, but what you aren't considering is that they (JSON/XML, and some other formats like YAML) are standardised, while binary isn't - different systems, ...
AIWalker's user avatar
  • 1,287
11 votes

Prevent analytics from crashing the production database

I will start with the simplest solution, per amon's comment - create a read replica - if you are hosting your database in a cloud provider, this is typically just a few clicks or a few changes to your ...
DavidT's user avatar
  • 2,386
10 votes

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

The previous answers, although correct, aren't valid for most large scale computer clusters. Computer clusters not always follow the standard conventions for machines, usually for good reasons, and ...
Davidmh's user avatar
  • 240

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