Is all data stored in computers stored as machine code?

I know that the most basic (and least abstract) code for programming is machine code (with binary of 0s and 1s being the typical machine code).

I also know that computers can save data even if they are turned off, by different types of computer memory (storage device memory, RAM and other computer system devices which can "remember" some data).

Is all data stored in computers ("all data remembered in a given computer memory") stored as machine code?
Is what’s saved in a computer’s "memory" (and becoming actually effective by electrical current correctly distributed to the computer system) just binary machine code in the sense that if I could read and understand that data directly without an operating system interfacing it for me it should appear in my mind as machine code, or rather, is it something else?

Is this Bracers of Stored Health magic item balanced?

I was thinking about the similarities between a character I was making and one from the Mistborn series by Brandon Sanderson, when the idea to make a magic item that replicated the effects of one of the powers in that series, Gold Feruchemy, which allows the user to store their health in pieces of gold, becoming sickly while storing, in order to be able to draw on the stored health later to heal faster. So I made this:

Bracers of Stored Health

Wondrous item, rare(requires attunement)

These ornate golden bracers can store the wearer’s health for later use. While wearing the bracers, you can use an action to take one of the following actions:

Store. You store 1 hit die into the bracers. After taking this action, you have disadvantage on Constitution saves for 2 rounds, and take 1 extra damage for each die rolled to deal damage to you in the same time frame. This effect stacks with consecutive uses of this action. A long rest will not restore any hit die stored up to an hour before starting the rest.

Tap. You can roll up to 5 stored hit die, healing for that amount. Alternatively, you can spend 1 hit die to cancel the debuff from 1 use of the Store action, or 3 hit die to cure yourself of 1 disease or condition that is affecting you. The condition can be blinded, deafened, paralyzed, or poisoned.

Some potential balancing options that I thought of are:

-If the Store action is too underpowered, making the Store action a bonus action instead.

-If the Store action is too overpowered, change it so that you instead store over a short or long rest, storing as many hit die as you want. Hit die stored during a long rest are not restored by it. The debuff would last for 10 minutes x the number of hit die stored, starting after the rest ends.

-Increasing/reducing the maximum number of hit die that can be used when taking the Tap action.

-Making it so that the Tap action can’t be taken on two consecutive turns

Does this seem balanced as it is, or does it need changes, either from the list I made or something I didn’t think of?

Virus / malware stored inside database

I have a small network of several Windows 10 machines (all protected by BitDefender 2020 Total Security), one of which acts as server with Firebird database.

For some time the database is deteriorating – in some random records some fields have altered values. I completly changed the server machine for a brand new with fresh Windows 10 installation and antivirus, on which the database was recreated from GBK archive. The primary machine was carefully check for RAM errors (with MemTest86) and SSD errors (CrystalDiskInfo and ADATA SSD ToolBox) – everything was in 100% fine.

I don’t have no suspicions other than that the server was hacked, but it looks like an alleged malware / virus must move inside database (even packed GBK archive), because only GBK file was moved to new machine (on verified pendrive).

Is it even possible that the virus is stored inside the database (e.g. in the form of stored procedures, etc.) and it transfers with GBK archive? If so, how to detect and remove it from database?

(Firebird database is stored in the form of single FDB file, which was scanned by BitDefender without any results)

C++ STL: How does the distance() method work for a set/ multiset (stored internally as a self balancing tree)?

I’m working on the problem: Count smaller elements on right side using Set in C++ STL

The solution is to add each element to the set and then to count the elements on the left, the distance function is called.

This is the algo:

1. Traverse the array element from i=len-1 to 0 and insert every element in a set. 2. Find the first element that is lower than A[i] using lower_bound function. 3. Find the distance between above found element and the beginning of the set using distance function. 4. Store the distance in another array Lets say CountSmaller. 4. Print that array 

I’m having a hard time to visualize or understand how can distance function be used with a set like structure since internally, the set data is stored as a self balanced tree (Red Black Tree). Whats the concept of distance for a self balancing tree and how does calling distance() give us the count of smaller elements on the right side?

After upgrade to SQL Server 2019 some stored procedures fail

We just upgraded from SQL Server 2008 R2 to SQL Server 2019(Compability lvl 150).

We have two different stored procedures that started failing after the upgrade, with error messages like this:

Msg 8632, Level 17, State 2, Procedure BuildSelfSaleStats, Line 14 [Batch Start Line 4] Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them. 

Whats really strange is that this particular stored procedure doesnt take any arguments, and when we simply execute the body of the SQL code in SSMS, it works fine(!?).

What might cause some SQL code that works fine when executed in SSMS, to suddenly start failing when its wrapped in a stored procedure?

Security concern on locally stored authentication token

It is a common method on mobile applications to allow users to bypass authentication process by verifying a locally stored token (previously authenticated) on device.

This is to strike a balance between usability (avoiding authentication every time) and security.

  1. Are there any security holes in this process?
  2. What are measures to be taken to strengthen this method?

Value of the Included Column is stored in Leaf Node?

There is SQL- script, which generated the Nonclustered Index with Included Column:

CREATE TABLE users    (       id        INT,       firstname VARCHAR(50),       surname   VARCHAR(50)    );   CREATE CLUSTERED INDEX ix_users_id    ON users (id);   CREATE NONCLUSTERED INDEX ix_users_firstname    ON users (firstname)    include (surname);   SELECT firstname,         surname  FROM   users  WHERE  firstname = 'John'; 

If I correctly understood, most of the time, Engine of my SQL Server 2019 will seek Nonclustered Index for the above SELECT query, without touching the Clustered Index. Does that mean the value of surname column is stored in Leaf Node of the Nonclustered Index? Also, that means the value of surname is duplicated because it also stored in Clustered Index.

Am I right?

MySQL trigger calling stored procedure always get null value for out parameter of stored procedure

My stored procedure OUT parameter, always return a null value.

Here is sample Table, Trigger and Procedure code.

Table: test

  • id - Int
  • status - enum(‘pass’, ‘fail’)

    • status - enum(‘pass’, ‘fail’) (null is allowed)

Values in a table:

id  |  status 1   |  null 


create trigger BEFORE_UPDATE_TEST before update on `test` for each row begin      call Test_BEFORE_UPDATE_TEST(, @updatedStatus);         ## I always get @updatedStatus null/nil      if (@updatedStatus is not null and @updatedStatus <> new.status) then         set new.status = @updatedStatus;     end if;  end; 


create procedure Test_BEFORE_UPDATE_TEST (   IN id int(5),   OUT status enum(‘pass’, ‘fail’) ) begin    @status = ‘pass’;  END; 

What is wrong with this code, as I get unexpected result as null in the value @updatedStatus, which should be 'pass'.

I looked around following QAs on dba.stackexchange but could’t find solution.

I use MySQLWorkbench in MacOS Catalina and version of MySQL is 8.0.19.

The maximum decimal integer that can be stored in memory of 8-bit word processor computer?

Actually i am preparing for an exam and in the last year exam this que. was been asked. i.e

The maximum decimal integer number that can be stored in memory of 8-bit word processor computer ?

a) (128)10
b) (127)10
c) (129)10
d) (255)10

Answer of this que. as given in the answer key is (b). And I have no idea how they arrived at this result.

Acc. to my understanding, we have 8-bits, which is 28 = 256 so 255 should be the maximum integer which we can store.

Compress JSON String Stored in PostgreSQL, such as MessagePack?

JSON strings are currently being stored in a PostgreSQL 11 table in a text field. For example, a row can have the text field asks containing the string:


Question: Is it possible to store it in a format that consumes lesser space? Using some CPU cycles to serialize/deserialize the JSON string is acceptable as a compromise for using lesser storage space. The JSON data does not need to be searchable. The JSON object keys are almost always different in different rows.

I am particularly interested in using JSON encoding/compression algorithms like MessagePack with zlib, but how can we use this when inserting the record into the PostgreSQL table?

Note: Also using Node.js with Knex.js to communicate with PostgreSQL. Currently converting JSON objects to strings using Node’s JSON.stringify function.