## Locking – Why table lock escalation happens in my scenario

I have a Table1 table that is updated with the following query in small blocks:

``````update top (1000) Table1
set VarcharColumn1 = 'SomeValue'
from Table1
where ID in (select ID from Table2)
and VarcharColumn1 is NULL
``````

More details:

Table 2 contains 90000 rows, and the total number of rows that must be updated in Table1 is also 90000 (1: 1 relationship).

Even if table rows1 are updated, there is a trigger for tables1, which inserts rows into table Table1History as they were before the update
So, when I update 1000 rows in Table1, 1000 rows are inserted into Table1History

Question:

When I update top `100 rows`There is no escalation of the table lock

I oversee this `Extended Events "lock_escalation" event`and also in `Performance Monitor - SQLServer:Access Methods - Table Lock Escalations / sec`

When I refresh the first 1000 or 500 rows, the table lock escalation for Table1 occurs

``````So I wonder, what is the mechanism or formula that is used by SQL Server
to escalate locking to table level ?
``````

Google states that 5000 rows are the threshold, but in my case, 1000 or 500 rows are apparently sufficient to cause Table1 to escalate to Table1

## object-oriented – sequence diagram, main scenario of the use case "register company"

From the sequence diagram above, you judge the following points:

I. The internal actor is the "company" responsible for informing the business registration data.

II. As the initial interface the class "Register Company" is used. For the registration of companies, the objects "Branch of Activity" and "Zip Code" are already registered.

For each object represented, it can be seen that a "lifeline" has begun, and when the object begins to interact, the control focus is used whose messages are in a numbered and ordered manner.

IV. After the operations have been performed, the receiving object "company" sends a response to the "Form_Cadastrar Empresa" transmitter interface shown in the dashed line.

The right elements are:

## Should my sitemap and robots.txt have http or https URLs for the given scenario

#### Stack Exchange network

The Stack Exchange network consists of 175 Q & A communities, including Stack Overflow, the largest and most trusted online community where developers can learn, share, and build a career.

Visit Stack Exchange

## Now, the question arises, which of the following techniques is best for the above scenario and why?

For example, suppose you work for a software company with a limited memory system and have assigned a task. You use the recursive function to complete the task, but you find that you can use the tail recursion instead of the recursive function, and then find that this tail recursion can be converted to a loop. Now, the question arises, which of the following techniques is best for the above scenario and why? 1. Recursive function. 2. Tail recursion. 3rd loop

## Complexity Theory – The relationship between matrix inversion, the HHL algorithm, and the unlikely scenario \$ BQP = PSPACE \$

I examine the quantum computer algorithm presented in the thesis Quantum algorithm for linear systems of equations}.

Without going through all the details, the HHL algorithm can apply an inverted matrix to a normalized vector created in a quantum state in time complexity $$tilde {O} ( log (N) s ^ 2 kappa ^ 2 / epsilon)$$to solve $$A | x rangle = | B rangle$$it calculates an estimate $$| x rangle = A ^ {- 1} | B rangle$$ from where

$$N$$ is the dimension of the matrix

$$s$$ i the sparse nature of the matrix

$$kappa$$ is the condition number of the matrix

$$epsilon$$ the desired error is bound

In an argument for the optimality of the algorithm, the authors construct a reduction from a general quantum shift to a matrix inversion problem with a proof (page 4).

Here I am confused, the authors write:

The reduction from general quantum switching to a matrix inversion problem also implies that our algorithm (under standard assumptions) can not be significantly improved. If the runtime could be made in polylogarithmic $$kappa$$, then none
Problem solved on $$n$$ Qubits could be solved in poly (n) time (i.e. $$BQP = PSPACE$$), a highly unlikely possibility

Why does this imply this? $$BQP = PSPACE$$? All findings very much appreciated.

## Ruby on Rails – What is the RSpec test derived from a cucumber scenario and step?

Landscape cucumber:

``````Functionality: List all system users
As a system administrator
I want to see a list of all system users

Context:
Since I am system administrator by email "admin@admin.com" password "admin123"
And that I am on the back office side.

Scenario layout: List all users
And that there is a user named ""Naturally"", email"", Record""
When I click on the "All users" link,
So I should see a table with the data:
| Username |      |
| of course |        |
| Contact us |         |
| Registration |  |

Examples:
| Username | of course | Contact us | Registration |
| João | Computer Science | joao@gmail.com | test |
| Genesio | Software Development | genesio@gmail.com | 123123123 |
``````

Step cucumber:

``````Given ("I am System Administrator with email {string} and password {string}") of | string, string2 |
User.create (username: & # 39; admin & # 39 ;, email: string, password: string2,
Registration: "15015296", course: "CIC", is_admin: true
)
Visit new_user_session_path
fill_in: user_email, with: string
fill_in: user_password, with: string2
click_button "Log in"
The End

And ("I'm on the back office page")
visit (backoffice_path)
The End

So ("I should see a table with the data:") |
table.rows_hash.each | Field, value |
expect (page). to have_content (value)
The End
The End

So ("I should be on a page with a list containing the user
{string}, email {string}, course {string} and record {string} ")
String1, string2, string3, string4 |
expect (page) .to have_content (string1)
expect (page) .to have_content (string2)
expect (page) .to have_content (string3)
expect (page) .to have_content (string4)
The End
``````

I need a translation, let's say for a RSpec test, just an idea of ​​what RSpec would look like.

## Facebook – doomsday scenario

Facebook is a great communication platform.

But it has two basic disadvantages:
1. It is run by an arrogant and inefficient company
2. It is used by many evil people to do evil things.
I speak from personal experience.
To discover evil people and their robots, Facebook uses "intelligent" robotic computers. These confuse normal and good people with robots and evil people. That's why Facebook punishes these good people for Facebook's own mistake. Worse, they do not allow you to appeal, never respond to a complaint, or correct your mistakes.
So I searched the internet for advice. The most common advice is:
Since Facebook confuses people with robots, it's best to use an intelligent computer robot yourself that simulates people so effectively that even Facebook thinks they are human.
I have it?
Facebook has stupid computers that people think are robots. Users will have a smart computer that looks like humans.
I already see the DOOMSDAY SCENARIO: Computers are struggling with computers, no more people needed.

One more comment on Facebook:
I get sponsored posts from Facebook reporting on an interview with Roger Federer claiming to have found a foolproof method to get rich without risk and effort. As is clear from many comments, it is obviously false news and fraud. Me and many others have posted these posts to Facebook, which give the automatic response "Thanks for the message, we'll check this". Nevertheless, these fake messages continue to appear.
It seems that Facebook is not very good at removing scams when you pay them a lot of money.
So much for morality !!

## Authentication – Do you correct UX for the scenario in which a user forgets the answers to his security questions?

As a second factor, you effectively use security issues.

## Two-factor authentication

Two-factor authentication (2FA) authentication makes it more difficult for attackers to retrieve logon credentials. You may have seen them in great services like Amazon Two-Step Verification or Google. It makes perfect sense to use them when it comes to money.

For more information, see the Wikipedia article on multi-factor authentication.

## Security issues for 2FA

Better suited in another context, see 2-Factor Authentication vs. security questions

## Security questions for "forgot password"

Security questions are useful to prevent your users from being misused by the Forgot Password feature of other users. Here's a little user story on how it works:

Anna is on GitHub. Her username is her e-mail address, with which she also signs her commits and which she has publicly in her profile.

Anna starts a fight with Bob. Bob knows that Anna is on Github and wants to annoy her. That's why he triggers GitHub's Forgot Password feature every hour to distract Anna.

Say, GitHub allowed Anna to ask a security question (if she wants to). Then the story would look like this:

Anna is on GitHub. Her username is her e-mail address, with which she also signs her commits and which she has publicly in her profile. Having previously received some "forgotten password" emails, she sets her security question to "What is the second name of my spouse's mother?". A few people in her family know that, but it's not public information.

Bob knows that Anna is on Github and wants to annoy her. It triggers the function "password forgotten". He is asked, "What is the second name of my spouse's mother?". He googles afterwards, but can not find this information. Anna is not disturbed.

## Database – Can I reduce the suspension for this scenario using Hibernate and H2?

My Java application uses Hibernate and H2.

It processes music files in folders. Usually it reads the files in the folder for a folder and saves each file as a Song class in a database. Later, it adds extra data to these song objects.

The application is multithreaded so that multiple folders can be processed simultaneously and therefore multiple read / write requests can be made to the database.

I can not remember the exact DB terminology, but I assume that H2 gets a SHARE lock when querying the database and needs a WRITE lock to add new rows to the table. This is not possible as long as there is a SHARE lock on a table.

Profiling application has shown that quite a few threads can spend blocked waiting time on db.

But here's the thing, though it's the same thing that thread A never works on the same lines as thread B. For example, thread A will work on songs 1, 2, 3, and thread B on 4, 5, 6. Since I know this is all I can do to allow Thread A to write to the SONG database at the same time I read Thread B, Thread A is not in danger of changing records read by Thread B / written, and vice versa.

To simplify this somewhat, I use executors, and while FolderA is initially processed by Executor1, it can then be passed to Executor2 and Executor3. However, it still remains that two executors will never work on the same lines.

Executor1 mainly loads files and the change is moved to Executor2. Executor1 was originally multithreaded, but I've since switched to a single-threaded executor because multi-threads did not experience performance improvements and just blocked the threads. The other executors are multithreaded, as they not only have to do database work.

## Best scenario for using memory with ESXi and Linux VM

I'm looking forward to discussing my file server architecture. Today I have the following scenario: 1 Windows 2008R2 server as AD, 1 Windows 2012R2 server as a file server, and a 27 TB of storage connected via iSCSI in Windows 2012R2 (NTFS file system). Both Windows servers are VMs hosted on an ESXi 6.0U3. Today, this file server hosts about 12 TB of my company's daily files.

We are in the migration project of our infrastructure from Windows to Linux and this is a good time to rethink this architecture. Therefore, I have created two possible scenarios and I would like to share them with you and discuss the best performance-oriented architecture:

Scenario 1: Storage concatenated via iSCSI directly under Linux (the ESXi VM) and formatted with EXT4;

Scenario 2: Storage connected through iSCSI to ESXi and creating a 27TB VMTK (using VMFS-5) attached to the Linux VM.

In both cases, the contents of the memory are shared via SMB for more or less than 150 Windows stations.