Hot answers tagged

165 votes
Accepted

Why do most log files use plain text rather than a binary format?

systemd famously stores its log files in binary format. The main issues I have heard with it are: if the log gets corrupted it's hard to recover as it needs specialist tooling they are not human ...
  • 3,852
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 ...
  • 5,630
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 ...
  • 10.7k
91 votes
Accepted

Is a memory of all possible permutations of a kilobyte block and pointers possible?

There are 28192 possible different 1K blocks. Storing them all would take 28202 bits of storage. Since the universe contains only about 1080 (or ~2266) particles, it's a safe bet that it isn't ...
90 votes

Why do most log files use plain text rather than a binary format?

Why do most log files use plain text rather than a binary format? Search for the word "text" in the Unix philosophy Wikipedia article, for example you'll find statements like: McIlroy, then ...
  • 3,367
54 votes
Accepted

What is the size of the number 65535 in bytes?

TL;DR The key takeaway here is that there is a world of difference between the number 65535 and a piece of text which represents the digits '6', '5', '5', '3' and '5'. It may look the same to you when ...
  • 38.7k
49 votes

Why do most log files use plain text rather than a binary format?

There are a lot of debatable presumptions here. Logging has been an integral part of (almost) every job I've had. It is essential if you want any sort of visibility on the health of your ...
41 votes
Accepted

PHP: when to use arrays, and when to use objects for mostly-data-storing code constructs?

The way I see this, it depends on what you intend to do with the data afterwards. Based on a few simple checks you can determine which of the two data structures is better for you: Does this data ...
  • 1,217
36 votes

Why do most log files use plain text rather than a binary format?

Log files are a critical part of any serious application: if the logging in the app is any good, then they let you see which key events have happened and when; what errors have occurred; and general ...
  • 1,035
30 votes

Why were punch cards used for programming

Time-sharing, multi-user, systems were invented in the late fifties, but they were comparatively rare through all through the 60s. Most computers ran in batch mode, running a single program at a time, ...
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 ...
  • 3,714
20 votes

Is a memory of all possible permutations of a kilobyte block and pointers possible?

As others have already pointed out, you have 2^8192 possibilities for a 1k block. This means you would need 8192 bits to encode the address of a block if all blocks addresses are encoded with the same ...
20 votes
Accepted

How are variables stored in a language compiler or interpreter?

Interpreter An intepreter will work about the way you guessed. In a simple model, it will maintain one dictionary with the variable names as dictionary keys and the variable values as dictionary ...
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 ...
18 votes

Why were punch cards used for programming

[W]hy did programmers ever write their programs on punch cards? Didn't computer screens and keyboards already exist by the time programmers used them? We use whatever i/o mechanism our computers have. ...
  • 3,156
15 votes

Why were punch cards used for programming

Punched cards served not only as an input/output medium, but also as a long-term storage device. You could run a program more than once by reloading the card deck for that program. There were no hard ...
  • 449
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. ...
  • 108k
14 votes

Is it ineffecient to store data as json in plain text?

Is it less efficient to store a small bit of data like your example encoded in a string than as binary? Yes. How much less? Not enough to care. Is it less efficient to store thousands of such records ...
12 votes

Why were punch cards used for programming

The weight of history... Lets go back to the Jacquard loom, a mechanical loom invented over 200 years ago. The loom was controlled by a "chain of cards", a number of punched cards, laced together ...
  • 52.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 ...
  • 22.9k
11 votes
Accepted

Hard Coded File Paths - Solution?

Both options are over-engineered, involving the database is inappropriate here, and the directory structure is too deep. Instead, for administrator-friendly software, I see the following patterns ...
  • 1,414
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, ...
  • 1,277
11 votes
Accepted

Why shouldn't I be using SQLITE instead of the INI format in all cases?

I think the problem is your definition of application settings. I think most people would designate your "partial and full downloads" as application state rather than application settings, ...
  • 65.5k
10 votes

Why do filesystems read and write in blocks?

Read speed and caching is an important factor, but it's not the only factor, and perhaps not even the primary factor in selecting a filesystem's block size. Every block on your filesystem has ...
10 votes

How are variables stored in a language compiler or interpreter?

It depends on the implementation. For example, a C compiler might maintain a symbol table during compilation. This is a rich data structure that allows pushing and popping of scopes, since each ...
  • 32.4k
9 votes
Accepted

Should I store images in my database or file system in this application?

Why not do both? Database is the backing, ultimate store for the image. The public side can be a simple read from db but you can easily extend that into a read-through disk cache and also take ...
9 votes

Storing great amounts of data

The most generalized term for this is "distributed index", and it is indeed a quite complex topic where a lot of active research is done. The first step is a dedicated index server, i.e. one that ...
9 votes

Why do most log files use plain text rather than a binary format?

An example of a somewhat binary log is wide-spread: the Windows event log. On the pro side, this allows log messages to be quite wordy (and thus hopefully helpful) at virtually no cost, possibly ...
9 votes

Should MySQL database tables only have a single unit of information per row?

Your coworker is actually right about this. If you're taking measurements from all your sensors at the same interval, and the set of sensors you're recording from remains constant or mostly constant, ...

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