Why entire table is locked instead of a single row?

Laravel Version: 7.16

PHP Version: 7.4.6

Database Driver & Version: MariaDB 10.4.13 InnoDb engine

Below laravel(php) code is going to return array response Once action method called for id=1 it takes 20 sec to get committed. Meanwhile the same method called for id=2 response waits until the first transaction is getting finished. why row-level locking is not working.

protected function actions($  id)     {       DB::beginTransaction();       try {           if($  id==1)             sleep(20);            $  invoice = Invoice::lockForUpdate()->find($  id);           $  name = 'Approve';           if ($  invoice->approved) {              $  name = 'Disapprove';                   }          } catch (Exception $  e) {             DB::rollBack();           }       DB::commit();          return [             'name' => $  name,             'id' => 'menu-approve',             'data-status' => $  invoice->approved         ];     } 

A lockForUpdate() locks a specific row until it was committed successfully (Select * from invoices where id=1 FOR UPDATE). But select * from invoices where id=2 FOR UPDATE should not be wait until the first query get committed. Also without specifying a lock ( Select * from invoices) records are not drawn and it waits the first transaction to be committed. What could be the reason that entire table is locked instead of a single row?

Specify a force on the entire body (e.g. gravity)

In the thread Stress calculations using finite elements User21 showed an example how to define a force over the entire body during FEM calculation as boundary condition. See the screenshot below from the corresponding position in this thread.

enter image description here

In the description of the definition of the boundary condition – force on the entire bodyUser21 has defined the differential equation system as follows.

$ ps$ == {$ 0, -9.8$ }

Which unit has this power? Is the unit $ N/m^2$ ?

If $ N/m^2$ is the correct unit, then I can understand how to calculate the normalized body force from the density and volume of the body and insert it into the right side of the differential equation.

If $ N/m^2$ is not the right unit, then I have the following questions on you:

How is the density of the material or the mass considered here? Could you please show how to use this correctly in the equation?

In my case I have a centripetal acceleration due to rotation and the equation would look like this:

$ ps$ == {$ omega ^2 * x, omega ^2 * y$ }

Omega is the angular velocity of the body for which the deformations are to be calculated with FEM. And the expression

$ omega^2 * r$

is the centripetal acceleration, where $ r$ is the distance from the center of rotation.

However also here I have the problem, density resp. masses are not considered.

Does anybody have an answer to the question how to use the density and the mass correctly in the equation?

Many thanks in advance!

Can a PHP shell uploaded to a WordPress directory have access to an entire Linux machine?

I run a few WordPress instances. I had one new one that I had not configured and left sitting, so the installation was on the 1st step awaiting for the database name, username, password, and host. When I went to finish the install after letting it sit like that for a week, I had noticed that someone had found the site, and inputted their own database information, and “took the site over”. It was a blank slate, so not much to it.

I removed the wp-config.php file and re-ran the installation with my own values. I then looked around for anything suspicious in the WordPress directory. I had found a shell plugin they installed, labeled “UBH console”. I couldn’t get the console to run, I got a 404 error.

I assume this shell couldn’t get them access out into the machine past the www directory the website was installed in?

In the past, I’ve always set the WordPress directory permissions with the following command:

chown -R www-data:www-data directory/ 

Is this the right way to set these directories? Upon further research, a lot of people run this and stay like this, but I’ve heard to change your permissions after running the installation. Running Debian on my machine.

Entire network trojanned? UDP Port 6666 connections

While analyzing a Wireshark capture, I noticed that a large majority of hosts on my network were making MANY UDP connections to port 6666. After a quick Google search, I learned this port is commonly used as backdoor Trojan. Also, all connections on this port were to destination ip meaning the entire network. I’ve heard that port 6666 is a common IRC port, but no one on my network is using IRC. Any ideas?

How can I get all messages from a user without looping over the entire table?

I have a database with many Users and many many Messages, each with a single User sender and a single User recipient. I want to get all messages sent by John from my MySQL table with a low lagtime. He has only ever sent 20 messages, but the total messages sent by the database amount to a full 20,000,000. How can I quickly pull John’s sent messages?

I have tried:

SELECT * FROM Messages WHERE name = 'John'; 

which times out.

I am considering making Views for every username, so I can just SELECT * FROM JohnView;. This would presumably be satisfactory time-wise, but I don’t want to make unique views for all 500,000 users. Is there a way to pre-sort a table by name so I can binary search for all messages from any individual user?

Why after dd’ing ISO file to entire USB flash device, only the first partition match the ISO checksum?

I use dd to “burn” an ISO file to USB stick:

dd bs=4M if=/mnt/media/ISO/Fedora-Workstation-Live-x86_64-31-1.9.iso   of=/dev/sdd conv=fdatasync  status=progress 

Now I can see several partitions has been created:

sdd      8:48   1   1.9G  0 disk  ├─sdd1   8:49   1   1.8G  0 part /run/media/alex/Fedora-WS-Live-31-1-9 ├─sdd2   8:50   1  10.6M  0 part  └─sdd3   8:51   1  22.2M  0 part  

Why only sdd1 matches the ISO checksum, not an entire drive? I checked files on other partitions, they contain this ISO related files..

How can I get my entire game to scale based on screensize?

I’m currently building a 2d mobile game and I’m currently stuck trying to get my game to scale with screen sizes. Currently my background is scaled to 1920 X 1080. When I run the game on my Galaxy S10+, it scales to 1920 X 1080, but you can see blue space on the sides (See Image). How do I get that 1920 x 1080 background to fill the entire screen without using a UI canvas?

I want the game to fill the entire screen. If I set the resolution to the Galaxy resolution, it fills the entire screen. But won’t this look weird on other screens that don’t have the same resolution?

I’m not trying to scale any UI. Everything I find online is only talking about scaling UI. That’s not the issue. I’m trying to get the entire game to adjust based on screen sizes. 1920 x 1080 Scale

Could you anonymously upload a file on the internet if the threat model was the entire world trying to find your identity after you do so?

Thought experiment: You need to upload a file, and the threat model is the entire world trying to find out who you are after you do so.

I know this is absurd, but bear with me, it’s a thought experiment that I thought would be fun to have, where the scenario is the following:

You are a normal citizen, and you have a file (assume that you just have it, and the file doesn’t have metadata or information related to you) that is somehow so compromising that, if uploaded on the internet, the entire world would actively try to find out who you are. Everyone, military, every country’s agencies, civilians, that grandma going to the grocery store, yes, her too, to the best of her ability. People who run TOR relays too, everyone.

Your mission is to upload it on the internet without your identity being revealed. How would you go about it?

Update: File is in your pendrive, has a size of few MB, it’s ok if it just shows up eventually. No-one should really guess what country you might live in. We can think of the user as average-citizen, with average knowledge of technology, but can follow instructions (for example, setting up Tails). Assume that who had access to this information was not relevant, because no-one had access to this data before. We can invent an unrealistic scenario for this, for example, you have material that prove the existence of aliens or something.

Is it possible to encrypt portions of a file for upload so that one does not need to encrypt the entire file first?

Normally, to upload an encrypted file I would first encrypt the entire file, then upload the encrypted file. However, for large files this is not that easy as I need a external hard drive to hold the encrypted file. I am wondering if it is possible to perhaps encrypt a large file, say of 500 GB size, bit by bit, and to send the bit by bit encrypted information to an upload stream to say, Google Drive? Thanks.