Pager extention not working in dynamic database query

Question: I am trying to create a page which shows all the nodes created by the currently logged in user.  To do this I am using a dynamic query to fetch the relevant nodes.  However, for some reason the pager is not working.  Instead it lists all of the nodes.  I have not been able to work out why this is occurring as I have successfully used pagination previously with other less complex queries.  The following is from the page callback function:
function playground_page() {
  $build = array();

  $build['intro'] = array(
    '#markup' => 'This is a testing ground for Drupal concepts.',
  );

  // Example of table join. Display content created by current user.

  // Construct base query.
  global $user;
  $query = db_select('users', 'u');
  $node_table_alias = $query->join('node', 'n', 'n.uid = u.uid');
  $query
    ->fields($node_table_alias, array('nid'))
    ->condition('u.uid', $user->uid);

  // Add pager and node_access options.
  $query
    ->addTag('node_access')
    ->extend('PagerDefault')
    ->limit(5);

  $nids = $query->execute()->fetchCol();
  $nodes = node_load_multiple($nids);

  foreach ($nodes as $node) {
    $key = 'node_' . $node->nid;
    $build[$key] = node_view($node, 'teaser');
  }

  $pager_args = array('tags' => array('<<', '<', NULL, '>', '>>'));
  $build['pager'] = array(
    '#markup' => theme('pager', $pager_args),
  );

  return $build;
}

Answer: This issue is related to the use of extenders.  When using an extender it is important to note that $query is not altered in place. A new query object is returned from extend(), and if it is not saved to a variable it will be lost.  See Extenders documentation for more info.
To achieve this with the OP code, one would need to modify the following section:
  // Add pager and node_access options.
  $query = $query
    ->addTag('node_access')
    ->extend('PagerDefault')
    ->limit(5);

Full working code is as follows:
function playground_page() {
  $build = array();

  $build['intro'] = array(
    '#markup' => 'This is a testing ground for Drupal concepts.',
  );

  // Example of table join. Display content created by current user.

  // Construct base query.
  global $user;
  $query = db_select('users', 'u');
  $node_table_alias = $query->join('node', 'n', 'n.uid = u.uid');
  $query
    ->fields($node_table_alias, array('nid'))
    ->condition('u.uid', $user->uid);

  // Add pager and node_access options.
  $query = $query
    ->addTag('node_access')
    ->extend('PagerDefault')
    ->limit(5);

  $nids = $query->execute()->fetchCol();
  $nodes = node_load_multiple($nids);

  foreach ($nodes as $node) {
    $key = 'node_' . $node->nid;
    $build[$key] = node_view($node, 'teaser');
  }

  $pager_args = array('tags' => array('<<', '<', NULL, '>', '>>'));
  $build['pager'] = array(
    '#markup' => theme('pager', $pager_args),
  );

  return $build;
}


window in mobile not closing

Question: I have a website with PHP-pages that are opened and closed by Javascript.
In Internet Explorer on a desktop-computer everything works well: pages that are opened by Javascript can also be closed by Javascript.
On my smartphone with Android however this doesn't work: pages opened by Javascript are not closed by Javascript. So I get a whole accumulation of opened pages that block the Phone when the number is 15.
Can anyone help me?
Thanks in advance
Comment: what code are you using?
Comment: In the first file: . In the second file:
Comment: window.open("Thirdfile.php"); should be url address. like window.open("domain.com/Thirdfile.php");
Comment: Thank you, Flakerimi! It works well now!
Comment: Accept it please
Answer: Instead of calling a file
window.open("Thirdfile.php");

you should call url address. like
window.open("domain.com/Thirdfile.php");

window in mobile not closing


How to change the query value using hook_views_query_alter?

Question: I am having a problem trying to change the query output on my view.
I am using this code:
function zed_views_query_alter(&$view, &$query){
  if ($view->name == 'questions_home' && $view->current_display == 'rates_related') {
    $or = db_or();
    dpr($query->where[1]['conditions'][2]['field']->condition());
  }
}

I am trying to alter the word %california%. The output is the following one.
DatabaseCondition Object
(
    [conditions:protected] => Array
        (
            [#conjunction] => OR
            [0] => Array
                (
                    [field] => node.title
                    [value] => %california%
                    [operator] => LIKE
                )

            [1] => Array
                (
                    [field] =>
                    [value] =>
                    [operator] => IS NULL
                )

        )

    [arguments:protected] => Array
        (
        )

    [changed:protected] => 1
    [queryPlaceholderIdentifier:protected] =>
)

How can I go about changing the value %california%?
Answer: function zed_views_query_alter(&$view, &$query) {
  if ($view->name == 'questions_home' && $view->current_display == 'rates_related') {
    foreach($query->where[1]['conditions'] as $idx => $condition) {
      if (!is_object($condition['field']) && $condition['field'] == 'node.title') {
        $query->where[1]['conditions'][$idx]['value'] = '%whateveryoulike%';
        // or you can unset this condition and write down a new one
        // unset($query->where[1]['conditions'][$idx]);
        // $query->add_where_expression('1', "$field LIKE %" . db_like("california") . "% OR field LIKE %" . db_like("somethingelse") . "%");
      }
    }
    dpr($query->where[1]['conditions']);
  }
}

Answer: In Case of views query alter hooks we can use syntax similar below mentions
function hook_views_query_alter(&$view, &$query) {
  global $user;
  if ($view->name == "Alerts") {
     $query->where [0] ['conditions'] ['0'] ['value'] = '%' . $user->name . '%';
     $query->where [0] ['conditions'] ['0'] ['operator'] = "LIKE";
  }
}

Also you can change other $query->where positions data, This will impact in your query.
Answer: To change query values in Filter criteria, you can use hook_views_query_alter in the following way:
/**
 * Implements hook_views_query_alter().
 */
function MYMODULE_views_query_alter(&$view, &$query) {
  if ($view->name == 'my_view') {

    // Assign my values.
    $value1 = 'This is my value for filter 1.';
    $value2 = 'This is my value for filter 2.';
    $value3 = 'This is my value for filter 3.';

    // Programatically update the filter criteria of a view.
    array_walk_recursive($query->where, create_function('&$v, $k', '$v = str_replace("_MY_TOKEN1_", "'.$value1.'", $v);'));
    array_walk_recursive($query->where, create_function('&$v, $k', '$v = str_replace("_MY_TOKEN2_", "'.$value2.'", $v);'));
    array_walk_recursive($query->where, create_function('&$v, $k', '$v = str_replace("_MY_TOKEN3_", "'.$value3.'", $v);'));
  }
}

Just change your value in your view to some custom token (_MY_TOKEN1_) and the function automatically find the right array key and it'll alter its value.
If you're using YQL View, use hook_yql_views_query_query_alter() instead.
Answer: if($view->name == "SomeView_Name"){
       $query->where[1]['conditions'][0] = array('field'=>"node.title","value"=>'%california%',"operator"=>"LIKE");
}

I think this will help you.


Derivative of $y = x^{7 \sin(x)}$

Question: What is the derivative of $y = x^{7 \sin(x)}$?
Using the fact that the derivative of $x^a$ is $x^a \ln(a)$ and chain rule, I got $7x^{7 \sin(x)}\ln(7\sin(x))\cos(x)$ as the answer. However, the answer was $7x^{7\sin(x)}(\frac{\sin(x)}{x}+\ln(x)\cos(x))$ instead, where they found it by taking the logarithm of both sides. I get why that solution works but why is mine wrong?
Comment: First of all, the derivative of $x^a$ is not what you wrote. You confuse it with $a^x$. But anyway, you can't simply replace a constant $a$ by an expression that depends on $x$.
Comment: oops sorry, I meant $a^x$
Comment: Hint: write $y=e^{7\sin(x)log(x)}$.
Answer: I think you are confusing the derivative of $x^a$ with $a^x$. In this case use $\ln y = 7 \sin (x) \cdot \ln x$ and differentiating both sides with respect to $x$ get the desired
Answer: If $a$ is a constant then $\frac{d}{dx} x^a = ax^{a-1}= \frac{ax^a}{x}$ not $x^a \ln(a)$
Similarly if $b$ is a constant then $\frac{d}{dx} b^x = b^x \ln(b)$
and $\frac{d}{dx} b^{7\sin(x)} = b^{7\sin(x)}\ln(b)7\cos(x)$
so $\frac{d}{dx} x^{7\sin(x)} =   \frac{7\sin(x)x^{7\sin(x)} }{x} + x^{7\sin(x)}\ln(x)7\cos(x) $ $= 7x^{7\sin(x)}\left( \frac{\sin(x) }{x} + \ln(x)\cos(x)\right)$
Answer: The derivative of $x^a$ is $a x^{a-1}$ (for $a$ independent of $x$) , and the derivative of $a^x$ is $a^x \ln(a)$ (again , $a$ needs to be independent of $x$).
In your case you have $x^{7 \sin(x)}$. Neither the base nor the exponent are independent of $x$, so those rules don't apply.
To take the derivative properly, take the derivative wrt each occurrence of $x$ separately, pretending all the other occurrences are constants. Then add them (to prove this works, apply the multivariable chain rule to $f \circ \Delta$, where $f : \mathbb{R}^n \rightarrow \mathbb{R}$ is the desired function and $\Delta : \mathbb{R} \rightarrow \mathbb{R}^n$ is $x \rightarrow (x, ... x)$) .
$\frac{d}{dx} x^{7 sin(a)} = 7 \sin(a) x^{7 \sin(a)-1}$, and $\frac{d}{dx} a^{7 \sin(x)} =  a^{7 \sin(x)} \ln(a) 7 \cos(x)$.
Now add them, $7 \sin(x) x^{7 \sin(x) -1} + x^{7 \sin(x)} \ln(x) 7 \cos(x)$

Derivative of $y = x^{7 \sin(x)}$


pygame clock.tick() vs framerate in game main loop

Question: Every pygame has a game loop that looks like this:
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
    pygame.display.flip()
    print("tick " + str(pygame.time.get_ticks()))
    clock.tick(1)

According to the api forget_ticks():

Returns the number of millisconds since pygame.init() was called.
  Before pygame is initialized this will always be 0.

But clock.tick() :

This method should be called once per frame. It will compute how many . milliseconds have passed since the previous call.
If you pass the optional framerate argument the function will delay to keep the game running slower than the given ticks per second. This can be used to help limit the runtime speed of a game. By calling Clock.tick(40) once per frame, the program will never run at more than 40 frames per second.

I'm a bit confused, does it mean that clock.tick() directly affects how many milliseconds have passed since the start of the game?
So clock.tick(40) means I "issue" 40 frames per second and the while loop runs 40 times per second?
I don't see the relation between fps and ticks.
UPDATE:
I actually just tested it and get_ticks() still returns REAL time in mls no matter what fps you give to tick() - 0.1 or 30 or 60.
So it seems clock.tick() just sets up how fast game should run or how often while loop should update itself, run through itself.
However I m still a bit confused, other answers are welcome.
Answer: FPS, Frames Per Second, is the number of frames shown per unit of time.
1 / FPS is the amount of time should pass between each frame.
Tick is just a measure of time in PyGame.
clock.tick(40) means that for every second at most 40 frames should pass.
Comment: not only that! I wanted deeper explanation, but thanks! Basically clock.tick(3) tells to main loop: run through yourself at 3 frame per second, this does not affect actual real time of game.
Comment: Does clock.tick() basically function like sleep() or does it sleep for a dynamic amount of time? Does it block the code from running? If it does, does it block the whole iteration immediately or does it let the iteration to finish processing?
Answer: I set up high fps - clock.tick(30) or 60,
and game runs fast, and get_ticks() prints out elapsed time very fast however actual runtime from pygame.init() did not change!
I thought time runs faster because of high FPS! It does not, I tried clock.tick(0.1) - aka 1 frame per 10 seconds, and get_ticks() printed out its elapsed time only ONCE PER 10 seconds! Because the while loop was running through itself at fps = 0.1.
But if fps was higher, the update rate would be higher -not the total elapsed time
Now I figured it out.
Answer: I know it is already answered but I wanted to explain something I tried:
import pygame

pygame.init()

gameDisplay = pygame.display.set_mode((800,600))
clock = pygame.time.Clock()

crashed = False

counter = 1
while not crashed:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            crashed = True

    pygame.display.update()
    print(counter)
    counter += 1
    clock.tick(1) # will be 10 in the next run

So what we will do is make two runs — one where frame per second (fps) equals 1 and the other where fps equals 10. And we will run the code for 10 seconds. I used my phone stopwatch to do this.
So, mathematically 1 fps for 10sec is 10 right and 10 fps in 10sec is 100, clearly.
So, running the first run, 1 fps, the counter variable should be around 10, depending on your timing. For the second run, at the end of 10 seconds the counter variable in your console should be around 100.
So, in brief, we could say the loop is controlling your game display
and clock.tick() specifies how fast you want to change the game display or, in other words, how fast the loop runs.
Answer: I am a bit late, but I have an answer that I have come across based on my research. This is geared towards beginners like myself, please feel free to correct me if I am wrong.
Lets assume the following loop:
while True:
  # ... Some code which deals with the objects and surfaces
  pygame.display.flip() # displays all the changes we've made to the user
  pygame.clock.tick(60) # code that prevents our framerate from exceeding 60 fps

Ok, considering the code above, assume pygame.clock.tick measures the time elapsed from when it was last called
So lets say it is now the 2nd iteration of this loop, and the tick method has measured that 0.0157 seconds has elapsed since it was last called in the first iteration. If we calculate the FPS for this, it would be 1 frame/0.0157 seconds (if you are confused about why it is 1 frame, it is because we have only "updated" the user's screen once since the last calling of the tick method. 1/0.0157 = 63.69 frames per second. Dang it! Thats more than 60 frames per second. Thus, the method tick will automatically "slow" down your code, preventing it from "updating" again UNTIL enough time has elapsed such that the frame rate = 60 fps.
So how will it do that? Well, using basic math we can calculate that an FPS of 60 translates to 1 frame every 0.016 seconds. So, if we make the code wait an extra 0.0003 seconds, we will achieve a frame rate of 60! This is because 0.0157 seconds has already elapsed as described in the scenario above, so we need to wait an extra 0.0003 seconds on this frame to achieve our desired frame rate.
I hope this helps anyone who is confused on this subject.
Comment: Hi Julian, if possible try to use the markdown to make sure the code part of the answer stands out from the rest of the answer. This will help the reader find the solution faster and in turn, they will upvote your answers more.


how to pass by a reference in java

Question: public class SecureSystem {
    final int low = 0;
    final int high = 1;
    HashMap<String, int[]> subject;
    HashMap<String, int[]> object;

    public SecureSystem() {
    subject = new HashMap<String, int[]>();
    object = new HashMap<String, int[]>();
    }
    ReferenceMonitor rm = new ReferenceMonitor();
    rm.ReferenceMonitor(subject,object);

    System.out.println(this.subject.get("a")); // how to make it print [1,2]?
    System.out.println(this.object.get("b")); // how to make it print [3,4]?
}
class ReferenceMonitor{
    ReferenceMonior(HashMap<String, int[]> subject, HashMap<String, int[]> object) {
        SecureSystem ss = new SecureSystem();
        ss.subject.put("a", new int{1,2});
        ss.object.put("a", new int{3,4})
    }
}

how do I make it do that?
If I pass HashMaps to ReferenceMonitor class, and try to read contents, I get NullPointerError.
Thank you so much.
Comment: you never created objects for subject and "object".  They are not initialized.
Comment: You can't pass by reference in Java. The language doesn't support this mechanism. Everything in Java is passed by value.
Comment: @NullUserException: true, but that said, the value that is passed is a reference to the object. Which is why you can re-assign the variable, i.e. var = new Object, but after exiting the method and returning to the parent method your parameter will not be changed because basically all you did was change the value of the reference.
Comment: Where are you initializing `subject` and `object` ?
Comment: And even if you could pass something by reference, this code wouldn't work.
Comment: I actaully have them initialized, I posted only a chunk of my code. I am sorry.
Comment: You don't make an instance of the ReferenceMonitor class
Comment: Please don't think about other syntax errors, I've successfully compiled it. If anyone knows how to mimic the reference mechanism, please let me know.
Comment: You can create a container object to mimic c style pointers but in all my time with java I have never found it nessissary
Answer: You have not initialized the HashMaps. They are null because you have never created them.
HashMap<String, int[]> map = new HashMap<String, int[]>();
Comment: I actually do... it's just a simplified version of my code. The point of this post was to ask how to pass by a reference.
Answer: The problem is here:
class ReferenceMonitor{
    ReferenceMonior(HashMap<String, int[]> subject, HashMap<String, int[]> object) {
        //these three lines are the culprit
        SecureSystem ss = new SecureSystem();
        ss.subject.put("a", new int{1,2});
        ss.object.put("a", new int{3,4})
    }
}

You're putting the data in the subject and object maps inside the new SecureSystem ss local variable which will be unusable after the completion of the constructor call. You should put the data in the subject and object parameters so they're contents will be modified as well:
class ReferenceMonitor{
    ReferenceMonior(HashMap<String, int[]> subject, HashMap<String, int[]> object) {
        //code fixed
        //also, there's no need to create a new SecureSystem instance
        subject.put("a", new int[] {1,2});
        object.put("b", new int[] {3,4});
    }
}

This code can even be enhanced to pass the SecureSystem object reference instead:
class ReferenceMonitor{
    ReferenceMonior(SecureSystem secureSystem) {
        secureSystem.getSubject().put("a", new int[] {1,2});
        secureSystem.getObject().put("b", new int[] {3,4});
    }
}

Also, please note that Java is NOT pass by reference.
Answer: Did you in any place use a new() to initialize your Hashmaps? In case not. There is your answer.
What you intended was something like
class ReferenceMonitor{
    ReferenceMonior(HashMap<String, int[]> subject, HashMap<String, int[]> object) {
        SecureSystem ss = new SecureSystem();
        ss.subject=subject;
        ss.object=object;
        ss.subject.put("a", new int{1,2});
        ss.object.put("a", new int{3,4})
    }
}

Besides, that is awful code.
1) You should consider using patterns like builder pattern
2) Your use of public data-members is a violation of OOP's information hiding principle and is considered bad style. Please use setter methods.

how to pass by a reference in java


VPN Client connection drops when second user connects

Question: My customer is using a NETGEAR FVS338 for internet access and s2s-connectivity for his two locations, which works flawlessly.
He (and a couple of his employees) also use the ShrewSoft VPN software client to connect to the office while on the road.
The roadwarriors (and my customer in his homeoffice) use the VPN Client to connect to his company network and use a RDP session to a terminalserver in the office to work with our applications.
Today he reported the following problem:

Client-A (roadwarrior) establishes a VPN connection and RDP session to the server.
Connection is stable and works without issues
If Client-B (customer in homeoffice) connects to the VPN, the RDP session to CLIENT-A drops.

While I was having a look at the connected RDP users (roadwarrior is connected) my customer established a VPN connection. I could observe that the RDP session does not drop immediately but after a couple of minutes while the roadwarrior told us he lost the connection immediately after my customers connection was established.
Therefore I believe, that it isn't really the RDP session that is dropping but it is the VPN dying and the RDP session is timing out.
To mititgate this problem I made sure that both users are using discrete VPN policies with different Remote-ID values as seen by the router (resp. different Local-IDs when viewed from the VPN client).
The clients share the following settings (they actually don't share those because as I said before these are different policies, but have the same settings configured):
IKE Policy

Remote Endpoint - both connect to the same router
Remote ID for the router (which is the routers IP address)
Exchange Mode (Aggressive)
Encryption and Authentication Algorithm
DH-Group for Phase 1
SA-Lifetime

VPN Policy

The remote Subnet (as seen by the client which is the company network they are connecting to)
Local Traffic Selection (which is set to "Any" on the router so should allow anything the client sends)
Policy Type (Automatic Policy Generation)
Encryption and Integrity algorithm
PFS group
SA Lifetime

The only thing that I can think of being a problem is the Local Traffic selection so that somehow the Netgear Router cannot differentiate between both clients and drops one of the connections (or let it timeout).
Is this realistic? If so, could this be mitigated by setting two discrete IP adresses in the traffic selection of the router and configure the virtual adapter on the client accordingly?
Are there any other hints you could give me to troubleshoot this?
Comment: some companies might limit the number of concurrent vpn connections you can have. So you might want to make sure you should be able to use multiple connection in the first place. (I only did read somewhere about a premium package for some router which enabled more concurrent vpn connections)
Comment: are both clients logging in with the same credentials? Sometimes this will drop everyone else when you log in.
Comment: Thanks for your recommandations @Peter and Dennis. I already made sure both clients use different credentials and aren't even connecting from the same network - so I think this can be ruled out. There is also no upgrade/premium package available for this router and we are well within the limits of the supported VPN connections. I guess I'll try to reproduce this issue in a simple LAN setup and see if I can get two simultaneous connections up.
Comment: Just to clarify: When Client-B (homeoffice) connects to VPN, does Client-A (roadwarrior) immediately get disconnected? Or does the VPN connection persist and only the RDP session tanks? Or does starting the second RDP session coincide with the disconnect? Is there a "Client-C" and do the same issues occur? Is this a new issue or only recently reported? Have you tried the Netgear VPN Client (I think a 30 day trial is free) and does that have the same results? Can you provide a screen shot of your Mode Config Record and IKE Policy? (obviously, please obscure sensitive fields)
Comment: Are your VPN tunnels using XAuth for user authentication?
Answer: The other connection is dropping because I think you are using the same IP in both the VPN clients, so when both the VPN clients are connecting they are assigned the same IP address. This is like having two PCs with same IP address in a LAN.
To resolve this change the IP in VPN client for each client.
Comment: Yes, this is most likely to be the cause.
Answer: Swap the local and remote subnets round, in the VPN policy. if you are defining them on the FVS338.
I'd also double check the Mode Config screen to confirm that there are plenty of remote IPs available.
Answer: Shrew is IPSec VPN client, which is may be limited by NAT existence between client(s) and server. If same NAT is traversed by both clients, that could be a good reason for the first session to stop working


Configuring OpenVPN server (linux) and client(windows)

Question: I'm having a problem configuring OpenVPN server on Debian 5 32-bit and a client on Windows 7 64-bit.
I can connect from my windows client to the server successfully, but when I go to website that shows my IP address, I get my local IP address, and not my server's. What should I do to hide my local IP address?
Here is my server's config file:
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 172.17.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
user nobody
group users
persist-key
persist-tun
status openvpn-status.log
verb 3

and here's config of windows client (downloaded from here http://openvpn.net/index.php/open-source/downloads.html):
client
dev tun
proto udp
remote server.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert ferdo_key.crt
key ferdo_key.key
comp-lzo
verb 3

Answer: You need to do this:
http://openvpn.net/index.php/open-source/documentation/howto.html#redirect
The specific server directive is:
push "redirect-gateway def1"
Basically, the server needs to push routing configuration to the client.  This routing configuration will change the default route of the client, so that non-local traffic will go through the VPN tunnel rather than the LAN.
Note that you need to have OpenVPN client run with administrative privileges for this to work.  Otherwise, the client program will not be able to change the Windows machine's routing table.
Comment: Thanks, that's it ! I don't know how I've missed that :)


Are some instruments more tonal than others? How do you measure tonality?

Question: If I consider the range of musical instruments, one thing that seems to vary is tonality. For instance, a snare drum clearly doesn't produce a tonal sound whereas a piano does.
How does one measure the degree of tonality of an instrument? How can I tell if one instrument is more tonal than another besides just the obvious contrasts between a drum and piano?
Answer: In your question, you use the word "tonality", but I do not think it means what you think it means. Tonality refers to a certain harmonic vocabulary, especially involving the use of dominant-tonic chord relationships. You are asking about the tone quality, or timbre, of an instrument, and what could be refered to as its harmonicity. More frequently, we refer to the opposite concept: inharmonicity. To understand this concept, we have to take a detour into physics.
When an object produces a musical tone, it usually vibrates in various "modes". This means that the object produces numerous different frequencies at the same time, in varying strengths. This distribution of frequencies is known as a spectrum, and is what determines the timbre of an instrument. To illustrate, here are a few extreme cases of spectra:

A pure sine wave has a single peak at a single frequency.
White noise ("static") has no peaks, and has approximately equal amplitude across all spectra.

Most musical instruments, at least in western music, approximate a one-dimensional object: usually a length of string or a column of air. In an ideal one dimensional case, the object will resonate most strongly at frequencies that are integer multiples of some base fundamental frequency, and all other frequencies will dampen out. If the fundamental is f, the spectrum will peak strongly at f, 2f, 3f, 4f, etc..., and higher multiples of f will generally have smaller peaks. These peaks are called harmonics, and a spectrum that follows this pattern (or an instrument that produces such a spectrum) is said to be harmonic.
Two dimensional objects (such as drum heads) and three dimensional objects (such as bars, or bells) vibrate in more complex modes that don't necessarily produce a harmonic series. In the case of drum heads, there is only a vague sensation of relative pitch (e.g. kick vs. snare, or low toms vs. high toms). In metallophones and other similar pitched percussion, there is a perception of a distinct pitch, but the harmonics are still shifted of off their "ideal" harmonic locations, leading to a distinctive "clangy" sound. When created, such instruments are often designed in such a way to minimize this inharmonicity, by locating the mounting points at a place that dampens out certain inharmonic modes.
Even in string instruments, plucked and hammered stings (pizzicato, guitar, piano) will sound more inharmonic than bowed strings. In fact, over the course of a pianos range, this inharmonicity necessitates a technique known as "stretched tuning". The inharmonicity is worse in stiffer strings, and particularly affect the bass strings on an upright piano (which are shorter and stiffer than those on a grand piano), which explains why grand pianos are considered higher quality.
Answer: I'm not qualified to give an in depth answer, but to me the simple requirement is the mathematical relationship between harmonics.
Eg if you have a note and then a range of harmonics at multiples of the fundamental it will sound tonic. Snare and other percussion instruments have many frequencies that are not related mathematically. These sound atonal.
Comment: +1 hmm. Yes, that's a start to an answer. I think more depth is needed, but definitely helpful. Thanks! Also, is there a difference between the terms toneless and atonal?
Comment: Just to clarify, are you saying then a tone has to be comprised of integer multiples of the fundamental? I am a bit unclear about this.
Comment: No, but simple mathematical relationships are a key factor.
Comment: @StanShunpike  Dr. Mayhem is referring to the harmonics heard when a note is played on many instruments.  Consciously you hear the main note (fundamental), but on almost a subliminal level you hear other notes ringing out simultaneously at frequencies that are multiples of the frequency of the fundamental note.  Your brain hears what you perceive as the fundamental note.  But the fundamental note is made up of many notes blended together.  To see this you can play a harmonic on the 7th fret of a guitar and then lightly touch string at the 12 fret to cancel some of the harmonic frequencies.
Comment: @RockinCowboy *the fundamental note is made up of many notes blended together*...  it might be better to say that "a note is made of many partials blended together". It is possible to have an audible note with a given frequency with no energy in the partial *at* that frequency - i.e. with no fundamental at all!
Comment: @topomorto - good point sir.


Can a bowler change hands for different deliveries in the same over?

Question: Can a bowler, within the same over, bowl three balls with their right hand and three balls with their left hand?
Can they do this alternating sides or must they complete all deliveries with each hand consecutively before changing?
Answer: Bowlers must inform the Umpire, who in turn informs the batsmen of what side of the wicket they will bowl from and from which hand when they begin their spell. They need to inform the Umpire, who informs the batsmen if they want to change it but can do so as often as they like. That is all though, the style of bowling need not be declared, just the side of the wicket and hand. If he didn't inform it would be declared as a no-ball.
So a bowler a can switch hands, but with prior information to the standing umpire for the change.
Please see this link
Comment: This would be a great answer if you could add a reference to the Laws of the Game which specify this.
Comment: Additionally, umpiring practice would say that if the bowler had a consistent plan, such as I will bowl right arm over to bat a and left arm over to the Bat B, it would be normal to say it once and the umpire to tell the bats once.
Answer: The first part of your question:

Can a bowler, within the same over, bowl three balls with their right hand and three balls with their left hand?

Yes, so long as the bowler notifies the umpire (who will then notify the striker) before they change their mode of delivery - either from left hand to right hand or vice versa, or from over the wicket to round the wicket or vice versa. This is covered by Law 21.1.1:

The umpire shall ascertain whether the bowler intends to bowl right handed or left handed, over or round the wicket, and shall so inform the striker.
It is unfair if the bowler fails to notify the umpire of a change in his/her mode of delivery.  In this case the umpire shall call and signal No ball.

The second part:

Can they do this alternating sides or must they complete all deliveries with each hand consecutively before changing?

Yes, they can alternate sides so long as they notify the umpire before each ball; there is no restriction in Law 21 or elsewhere as to the number of times that a change of mode of delivery can be made during an over.
Answer: At the start of the over bowler notifies the umpire by

"Right arm over the wicket"

Whenever the bowler want to change its bowling side , one can change by notifying

"side change or Right arm over the wicket "

In the same way bowler can change its arm by simply notifying the field umpire.

"Left arm over the wickets".

But it is quiet tough for a regular bowler to throw a legal delivery by different hand.


Do multivariate integrals take account of orientation?

Question: Suppose a well-constructed function: are those integrals equivalents?
$$
\int_{-1}^{+1} \int_{-1}^{+1} f(x, y) \, dx \, dy \hspace{35pt} \int_{+1}^{-1} \int_{-1}^{+1} f(x, y) \, dx \, dy
$$
If they are not, then why?
Answer: You have to consider here that
$$g(y)=\int_{-1}^{+1}f(x,y)\ dx$$
thus
$$\int_{-1}^{+1}\int_{-1}^{+1}f(x,y)\ dx\ dy=\int_{-1}^{+1}g(y)\ dy$$
And OTOH you should know that
$$\int_{-1}^{+1}g(y)\ dy=-\int_{+1}^{-1}g(y)\ dy$$
Therefore
$$\int_{-1}^{+1}\int_{-1}^{+1}f(x,y)\ dx\ dy=-\int_{-1}^{+1}\int_{+1}^{-1}f(x,y)\ dx\ dy=\\=-\int_{+1}^{-1}\int_{-1}^{+1}f(x,y)\ dx\ dy=\int_{+1}^{-1}\int_{+1}^{-1}f(x,y)\ dx\ dy$$
--- rk
Answer: Suppose,
$$
\frac{d F(x,y)}{dy} = f(x,y).
$$
Then,
\begin{align*}
\int_{-1}^{+1} \int_{-1}^{+1} f(x, y) \, dx \, dy  &= \int_{-1}^{+1} \big[ F(x,1) - F(x,-1) \big] \, dx \\[10pt]
  &= -\int_{+1}^{-1} [F(x,1) - F(x,-1)] \, dx \\[10pt]
  &= -\int_{+1}^{-1} \int_{-1}^{+1} f(x, y) \, dx \, dy. \\[10pt]
\end{align*}


Show relative date or time, not both on iOS?

Question: I'm currently doing this:
NSDateFormater *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateStyle:NSDateFormatterMediumStyle];
[dateFormat setTimeStyle:NSDateFormatterShortStyle];
[dateFormat setDoesRelativeDateFormatting:YES];

...

label.text = [dateFormat stringFromDate:thedate];

And this is producing:
Today, 1:00 PM
Yesterday, 1:00 PM
Oct 5, 2012, 1:00 PM
Oct 5, 2013, 1:00 PM

What I want is this:
1:00 PM
Yesterday
Oct 5
Oct 5 2013

Showing current year is OK (3rd line). At the very least the time should show only if it's today. On the iPhone the recent calls list does this. I need to do this because I have very little space for the date.
(Something like isEqualToString@"Today" will not work - This only works for English)
What's the easiest way to do this?
Answer: You'll have to write your own formatters to deal with this.
Have a look at https://github.com/mattt/FormatterKit to see how you could go about it.


Como pegar os valores dentro de múltiplas tags

Question: Olá,
Tenho a seguinte página em HTML:
<!DOCTYPE html>

    <title>Exemplo</title>

Valor 1

Valor 2

Valor 3

Estou usando a seguinte função em PHP para pegar o texto entre uma tag:
function capturar($string, $start, $end) {
    $str = explode($start, $string);
    $str = explode($end, $str[1]);
    return $str[0];
}

Exemplo de uso:
<?php
$url = file_get_contents('http://localhost/exemplo.html');
$valor = capturar($url, '
', '
');
echo $valor;

Porem, quando tem mais de uma tag idêntica com o texto entre elas diferente, ela só pega o texto entre a primeira tag, oque eu faria para para pegar todos textos entre essa tag (
,
) e adicionar eles entre uma array?
Obrigado desde já.
Comment: Olha `id` é um identificador único, não podem se repetir na mesma página
Answer: O ideal é usar o preg_match_all.
function capturar($string, $start, $end) {

    $start = str_replace('/', '\/', $start);
    $end = str_replace('/', '\/', $end);
    preg_match_all('/'.$start.'(.*?)'.$end.'/', $string, $matches);
    if(isset($matches[1]))
        return $matches[1];
    else return false;
}

Pode não estar perfeito, pois poderá ser preciso fazer "escape" a outros caracteres. Agora só faz ao /
Answer: Existem várias formas de buscar elementos em um documento HTML.
Primeiro você deve notar que o seu HTML está inválido, pois o atributo id deve ser único em todo o documento.
Você pode utilizar consultas XPath para resolver o seu problema:
$html = <<<'HTML'
<!DOCTYPE html>

    <title>Exemplo</title>

Valor 1

Valor 2

Valor 3

HTML;

$crawler = new DomDocument();
$crawler->loadHTML($html);
$xpath = new DOMXPath($crawler);

$elementos = $xpath->query("//div[@id='text']");

echo '
';
foreach($elementos as $objeto) {
    var_dump($objeto->nodeValue);
}

Uma outra forma um pouco mais fácil e que lhe propricia mais recursos é através de bibliotecas de terceiros. Uma biblioteca bem poderosa e útil a DomCrawler.
Para instalar usando composer:
composer require symfony/dom-crawler

A mesma solução de antes, utilizando DomCrawler:
require __DIR__ . '/vendor/autoload.php';

use Symfony\Component\DomCrawler\Crawler;

$html = <<<'HTML'
<!DOCTYPE html>

    <title>Exemplo</title>

Valor 1

Valor 2

Valor 3

HTML;

$crawler = new Crawler($html);

$elementos = $crawler->filterXPath("//div[@id='text']")->extract(['_text']);

echo '
';
foreach($elementos as $elemento) {
   var_dump($elemento);
}

Note que alem deste exemplo, a documentação oficial ainda indica que é possível utilizar seletores CSS, incluindo a dependência symfony/css-selector.


Web-Worker with GWT

Question: What's the simplest way of getting a Web-Worker thread loaded with a GWT module?
I am not referring to getting support for Web-Worker in GWT (there are libraries for that) but rather how would generate a GWT module for loading into a web-worker?
I suspect I need a special Linker - is there one available somewhere?
Answer: Have a look at http://code.google.com/p/speedtracer/source/browse/trunk/src/client/ui/src/com/google/gwt/webworker/
I didn't dig deep but it seems to be that "special linker" you're looking for (the linker is then used for the "hintlet engine" and "breaky" modules of SpeedTracer)
Answer: There is a library called gwt-ns which includes web worker.
Following link is the example using it.
http://extremelysatisfactorytotalitarianism.com/blog/?p=645
UPDATE
The author of gwt-ns posted a note that he stopped development since 2010, so it's not compatible with recent GWT (like 2.6.1 or later)

NOTE (04 February 2014): gwt-ns hasn't been touched since June 2010
  and my understanding is that the Web Worker support does not work in
  any recent versions of GWT. This is somewhat expected, as it had to
  reach fairly far into the GWT compiler to work and would have had to
  make changes as the compiler design changed.
       The other modules are also likely out of date since permutation selection for these features would need to be adjusted as browsers add
  support or move support from prefixed to full. Some things might still
  accidentally work.
       Feel free to use the code as you please, but be forewarned. I no longer do any GWT development, so if you'd like to get workers working
  again with gwt-ns as a base, you'll need to fork the code and start a
  new project (luckily the Apache 2.0 license makes this easy for you).
Comment: Unfortunately, gwt-ns project was only compatible with GWT 2.0-2.2
Answer: You can try my gwtwwlinker project published on GitHub: https://github.com/tomekziel/gwtwwlinker
It allows you to compile separate module as web worker, dedicated linker eliminates usual $wnd and $doc dependencies.
Answer: Manfred Tremmel has taken the core code from the Google Speedtest application and put it in a separate repository gwt-webworker. I've added a very simple example code at SimpleWebWorker. This code works with the latest 2.8.1 version of GWT.

Web-Worker with GWT


Não consigo iniciar o Xampp

Question: Ao tentar iniciar o MySQL no xampp como sempre de costume, ocorreu este erro:
Error: MySQL shutdown unexpectedly.
14:04:23  [mysql]   This may be due to a blocked port, missing dependencies,
14:04:23  [mysql]   improper privileges, a crash, or a shutdown by another method.
14:04:23  [mysql]   Press the Logs button to view error logs and check
14:04:23  [mysql]   the Windows Event Viewer for more clues
14:04:23  [mysql]   If you need more help, copy and post this
14:04:23  [mysql]   entire log window on the forums

Já olhei em alguns lugares para tentar resolver, mas nenhum desses métodos resolveu:

Abrir o gerenciador de tarefas e encerrar o precesso mysqld (Ele não aparece no meu gerenciador).
Ir para C:\xampp\mysql\data e apagar os arquivos aria_log, ib_buffer, ib_logfile, ibdata1, multi-master, mysql_error e etc (Ao apagar e tentar iniciar o MySQL, eles são criados novamente).
Alterar uma porta do Skype, mas não tenho ele instalado.

Se desinstalar e instalar vou perder meus bancos de dados, estou meio preocupado com essa situação kkk, agradeço desde já.
Comment: Provavelmente tem dois mysqls instalados na sua máquina, a porta do skype não tem nada haver com isto, só quando é o apache que estiver com erro, o teu caso é o mysql que esta com problema.
Answer: Utilize no CMD o comando: netstat -a -n -o | findstr porta do mysql, caso ela esteja em uso, mate-a e tente novamente: Taskkill /PID pid /F (alterar pid pelo número que o netstat forneceu).
Comment: Infelizmente ela não está em uso, pior que não posso desinstalar porquê se não vou perder todos bds.
Comment: e se fizer uma cópia da pasta e instalar outra versão por cima?
Comment: Tentei fazer isso, mas algumas tabelas acabaram sendo corrompidas, mas vou tentar criar elas igual a antes, vai ser difícil pois eram muitas, você não imagina minha raiva kkkk, mas obrigado.

Não consigo iniciar o Xampp


Can pandas.to_datetime() format unix time to local timezone?

Question: I am trying to get pandas.to_datetime to give me the correct time relevant to my timezone and I can't find anything about how to do that.
This is the code I made:
def _new_values_list(arg1=list()):
    import time
    keys = arg1[1]
    sym = arg1[0]
    """
    ==========================================================================
    :param: values returned by the seperate_key_value() in the form of a
    variable. Probably something like candle_data, candleD, etc.
    ==========================================================================
    :returns: a sorted pandas DataFrame with columns for the open, high, low
    close, volume and datetime as index. It also, includes a row with the
    epoch time for easier time series calculations.
    ==========================================================================
    """

    o = []
    for vals in keys: o.append(vals['open'])

    h = []
    for vals in keys: h.append(vals['high'])

    l = []
    for vals in keys: l.append(vals['low'])

    c = []
    for vals in keys: c.append(vals['close'])

    etime = []
#     for vals in keys: etime.append((vals['datetime'])/10000)
    for vals in keys: etime.append(vals['datetime'])

    time = []
    for vals in keys:
        vals = pd.to_datetime(vals['datetime'], unit='ms')
        time.append(vals)

    vol = []
    for vals in keys: vol.append(vals['volume'])

    df = pd.DataFrame({'unix_time':etime, 'datetime': time, 'open': o, 'high': h, 'low': l, 'close': c,'volume': vol})

    return df

Then this is the output:

          unix_time            datetime    open      high       low    close  \
0     1637332200000 2021-11-19 14:30:00  342.71  343.0700  342.2000  342.810
1     1637332260000 2021-11-19 14:31:00  342.73  343.2000  342.7100  342.710
2     1637332320000 2021-11-19 14:32:00  342.76  342.8900  342.3101  342.875
3     1637332380000 2021-11-19 14:33:00  342.80  342.9965  342.6800  342.810
4     1637332440000 2021-11-19 14:34:00  342.86  343.1100  342.8600  343.080
...             ...                 ...     ...       ...       ...      ...
3815  1638564900000 2021-12-03 20:55:00  321.68  322.4000  321.6100  322.320
3816  1638564960000 2021-12-03 20:56:00  322.30  322.7000  322.1600  322.450
3817  1638565020000 2021-12-03 20:57:00  322.42  323.0800  322.1100  323.050
3818  1638565080000 2021-12-03 20:58:00  323.05  323.0773  322.8500  322.950
3819  1638565140000 2021-12-03 20:59:00  322.96  323.4500  322.7300  323.180

       volume       std    volume_std
0     1813225  0.242681  76462.813531
1       77239  0.242681  76462.813531
2       66437  0.242681  76462.813531
3       42748  0.242681  76462.813531
4       52295  0.242681  76462.813531

datetime should be showing up as 08:30:00 but it isn't.

Can I change that? and if so how?

I tried to do new_data['datetime'].tz_convert('US/Central')
and I received this error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-93-1843a60046f9> in <module>
      3 data = _values_list(rdata)
      4 new_data = _new_values_list(rdata)
----> 5 new_data['datetime'].tz_convert('US/Central')
      6 new_data['std'] = new_data['close'] - new_data['open']
      7 new_data['std'] = new_data['std'].std()

~\anaconda3\lib\site-packages\pandas\core\generic.py in tz_convert(self, tz, axis, level, copy)
   9773             if level not in (None, 0, ax.name):
   9774                 raise ValueError(f"The level {level} is not valid")
-> 9775             ax = _tz_convert(ax, tz)
   9776
   9777         result = self.copy(deep=copy)

~\anaconda3\lib\site-packages\pandas\core\generic.py in _tz_convert(ax, tz)
   9755                 if len(ax) > 0:
   9756                     ax_name = self._get_axis_name(axis)
-> 9757                     raise TypeError(
   9758                         f"{ax_name} is not a valid DatetimeIndex or PeriodIndex"
   9759                     )

TypeError: index is not a valid DatetimeIndex or PeriodIndex

Answer: There is a method for that:
df['datetime'].dt.tz_convert('US/Central')

To get your time zone use:
import time
time.tzname[time.localtime().tm_isdst]

You may need to first set the original timezone to convert from:
df['datetime'].dt.tz_localize('US/Central').dt.tz_convert('Israel')

You won't need to do that if your timestamps already belong to a timezone:
df = pd.DataFrame({'datetime': pd.to_datetime(['2020-1-1 19:43'], utc=True)})

Comment: I just tried that and it didn't work, I will edit the question to show you what that returned.
Comment: `df['datetime'].dt.tz_localize('US/Central')` is wrong if `df['datetime']` is naive datetime that was converted from Unix time. Note that pandas (in contrast to native Python) does not have local time as the default. Instead, it will be UTC by default, check e.g. conversion from Unix time with `utc=True` vs. `utc=False`.
Comment: correct would be e.g. `pd.to_datetime([1637332200000], unit='ms', utc=True).dt.tz_convert(time.tzname[time.localtime().tm_isdst])`
Comment: Yeah that's what I've got - I just broke it down so that each step is clear on its own, thanks for the `utc=True` suggestion :)


Unable to install node ZeroMQ through npm in windows

Question: We are trying to install  zeromq through npm on windows8 64 bit
*we install visual studio 2010 and python
but still we are getting the error as follows:
<code>D:\Projects\changi\node_modules\zmq>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-g
yp.js" rebuild )  else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: spawn C:\Python27 ENOENT
gyp ERR! stack     at exports._errnoException (util.js:849:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
gyp ERR! stack     at onErrorNT (internal/child_process.js:344:16)
gyp ERR! stack     at doNTCallback2 (node.js:430:9)
gyp ERR! stack     at process._tickCallback (node.js:344:17)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\changi\node_modules\zmq
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "zmq"
npm ERR! node v4.1.2
npm ERR! npm  v2.7.4
npm ERR! code ELIFECYCLE

npm ERR! email@example.com install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the firstname.lastname@example.com install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the zmq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls zmq
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Projects\changi\npm-debug.log
</code>
Could you please tell us what we are missing or point us to some document which will help us to do this thanks for ur time
Comment: Have you installed zeromq?
Comment: it is installed according to this documentation http://zeromq.org/distro:microsoft-windows
Answer: Set PYTHON Enviorment Variable.
Comment: after setting the python environmental variable i am getting the error has in the edited post please check
Comment: Check installation guide here : https://github.com/nodejs/node-gyp   and check you have all things in place or not
Answer: <code>* Install python. Make sure Python 2.7.x with the steps provided below
    http://www.howtogeek.com/197947/how-to-install-python-on-windows/
    And confirm by running below commands:
    $ python -V
    Python 2.7.9
*installed node-gyp manually:
        $ npm install -g node-gyp
*installed 'Visual Studio 2012 Express for Windows Desktop'
*install 'Windows7 SDK'
  *And do  npm install zmq
and it worked!
</code>


MySql crashes randomly Out of memory: Kill process 24978 (mysqld) score 99 or sacrifice child

Question: I am running a LEMP server. 2Core Processor, 4GB RAM on Hetzner Cloud.
Ubuntu 18.04, PHP7.4, MySql 5.7, Nginx 1.16
But my MySql server randomly gets crashed even when traffic is negligible. It happens 2-3 times in a month.
How to prevent this issue in future?
Here is log from journalctl -xe
See the first line, it says:
Nov 23 03:48:49 ubuntu-server-18 kernel: php-fpm7.4 invoked oom-killer: gfp_mask=0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=0
Is the problem caused by php-fpm ?
=============
Nov 23 03:48:49 ubuntu-server-18 kernel: php-fpm7.4 invoked oom-killer: gfp_mask=0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=0
Nov 23 03:48:50 ubuntu-server-18 kernel: php-fpm7.4 cpuset=/ mems_allowed=0
Nov 23 03:48:50 ubuntu-server-18 kernel: CPU: 0 PID: 24811 Comm: php-fpm7.4 Not tainted 4.15.0-64-generic #73-Ubuntu
Nov 23 03:48:50 ubuntu-server-18 kernel: Hardware name: Hetzner vServer, BIOS 20171111 11/11/2017
Nov 23 03:48:50 ubuntu-server-18 kernel: Call Trace:
Nov 23 03:48:50 ubuntu-server-18 kernel:  dump_stack+0x63/0x8b
Nov 23 03:48:50 ubuntu-server-18 kernel:  dump_header+0x71/0x285
Nov 23 03:48:50 ubuntu-server-18 kernel:  ? security_capable_noaudit+0x4b/0x70
Nov 23 03:48:50 ubuntu-server-18 kernel:  oom_kill_process+0x21f/0x420
Nov 23 03:48:50 ubuntu-server-18 kernel:  out_of_memory+0x2b6/0x4d0
Nov 23 03:48:50 ubuntu-server-18 kernel:  __alloc_pages_slowpath+0xa53/0xe00
Nov 23 03:48:50 ubuntu-server-18 kernel:  __alloc_pages_nodemask+0x29a/0x2c0
Nov 23 03:48:50 ubuntu-server-18 kernel:  alloc_pages_current+0x6a/0xe0
Nov 23 03:48:50 ubuntu-server-18 kernel:  __page_cache_alloc+0x81/0xa0
Nov 23 03:48:50 ubuntu-server-18 kernel:  filemap_fault+0x3ea/0x6f0
Nov 23 03:48:50 ubuntu-server-18 kernel:  ? page_add_file_rmap+0x134/0x180
Nov 23 03:48:50 ubuntu-server-18 kernel:  ? filemap_map_pages+0x22c/0x390
Nov 23 03:48:50 ubuntu-server-18 kernel:  ext4_filemap_fault+0x31/0x44
Nov 23 03:48:50 ubuntu-server-18 kernel:  __do_fault+0x5b/0x115
Nov 23 03:48:50 ubuntu-server-18 kernel:  __handle_mm_fault+0xdef/0x1290
Nov 23 03:48:50 ubuntu-server-18 kernel:  handle_mm_fault+0xb1/0x210
Nov 23 03:48:50 ubuntu-server-18 kernel:  __do_page_fault+0x281/0x4b0
Nov 23 03:48:50 ubuntu-server-18 kernel:  do_page_fault+0x2e/0xe0
Nov 23 03:48:50 ubuntu-server-18 kernel:  ? async_page_fault+0x2f/0x50
Nov 23 03:48:50 ubuntu-server-18 kernel:  do_async_page_fault+0x51/0x80
Nov 23 03:48:50 ubuntu-server-18 kernel:  async_page_fault+0x45/0x50
Nov 23 03:48:50 ubuntu-server-18 kernel: RIP: 0033:0x7f3be729d140
Nov 23 03:48:50 ubuntu-server-18 kernel: RSP: 002b:00007fff1d94b888 EFLAGS: 00010206
Nov 23 03:48:50 ubuntu-server-18 kernel: RAX: 0000000000000042 RBX: 0000000000000043 RCX: 0000000000000000
Nov 23 03:48:50 ubuntu-server-18 kernel: RDX: 00007f3bcdd5c400 RSI: 0000000036393034 RDI: 0000000000000043
Nov 23 03:48:50 ubuntu-server-18 kernel: RBP: 00007f3bcdd5c400 R08: 00007fff1d94b820 R09: 0000000000000036
Nov 23 03:48:50 ubuntu-server-18 kernel: R10: 0000000000000000 R11: 0000000000000000 R12: 000055f7b0be96a0
Nov 23 03:48:50 ubuntu-server-18 kernel: R13: 0000000000000200 R14: 0000000000000001 R15: 00007f3bcdd5c400
Nov 23 03:48:50 ubuntu-server-18 kernel: Mem-Info:
Nov 23 03:48:50 ubuntu-server-18 kernel: active_anon:915548 inactive_anon:1944 isolated_anon:0
                                          active_file:97 inactive_file:107 isolated_file:1
                                          unevictable:0 dirty:5 writeback:0 unstable:0
                                          slab_reclaimable:7073 slab_unreclaimable:18771
                                          mapped:37449 shmem:47203 pagetables:11749 bounce:0
                                          free:21461 free_pcp:471 free_cma:0
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 active_anon:3662192kB inactive_anon:7776kB active_file:388kB inactive_file:428kB unevictable:0kB isolated(anon):0kB isolated(file):4kB mapped:149796kB dirty:20kB writeback:0kB shmem:188812kB
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 DMA free:15472kB min:272kB low:340kB high:408kB active_anon:380kB inactive_anon:0kB active_file:4kB inactive_file:8kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked
Nov 23 03:48:50 ubuntu-server-18 kernel: lowmem_reserve[]: 0 2968 3803 3803 3803
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 DMA32 free:55640kB min:52528kB low:65660kB high:78792kB active_anon:2931328kB inactive_anon:448kB active_file:732kB inactive_file:696kB unevictable:0kB writepending:0kB present:3129204kB man
Nov 23 03:48:50 ubuntu-server-18 kernel: lowmem_reserve[]: 0 0 835 835 835
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 Normal free:14732kB min:14776kB low:18468kB high:22160kB active_anon:729848kB inactive_anon:7328kB active_file:564kB inactive_file:28kB unevictable:0kB writepending:136kB present:950272kB ma
Nov 23 03:48:50 ubuntu-server-18 kernel: lowmem_reserve[]: 0 0 0 0 0
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 DMA: 3*4kB (UM) 1*8kB (U) 2*16kB (UM) 0*32kB 3*64kB (UM) 1*128kB (U) 1*256kB (U) 1*512kB (M) 2*1024kB (UM) 0*2048kB 3*4096kB (ME) = 15476kB
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 DMA32: 436*4kB (UEH) 565*8kB (EH) 582*16kB (UEH) 386*32kB (EH) 191*64kB (UME) 63*128kB (UMEH) 15*256kB (ME) 1*512kB (M) 1*1024kB (U) 1*2048kB (U) 0*4096kB = 55640kB
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 Normal: 529*4kB (UMEH) 217*8kB (UMEH) 123*16kB (UEH) 96*32kB (UMEH) 23*64kB (UEH) 6*128kB (UMH) 6*256kB (MH) 1*512kB (M) 2*1024kB (MH) 0*2048kB 0*4096kB = 15228kB
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Nov 23 03:48:50 ubuntu-server-18 kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Nov 23 03:48:50 ubuntu-server-18 kernel: 47438 total pagecache pages
Nov 23 03:48:50 ubuntu-server-18 kernel: 0 pages in swap cache
Nov 23 03:48:50 ubuntu-server-18 kernel: Swap cache stats: add 0, delete 0, find 0/0
Nov 23 03:48:50 ubuntu-server-18 kernel: Free swap  = 0kB
Nov 23 03:48:50 ubuntu-server-18 kernel: Total swap = 0kB
Nov 23 03:48:50 ubuntu-server-18 kernel: 1023867 pages RAM
Nov 23 03:48:50 ubuntu-server-18 kernel: 0 pages HighMem/MovableOnly
Nov 23 03:48:50 ubuntu-server-18 kernel: 38546 pages reserved
Nov 23 03:48:50 ubuntu-server-18 kernel: 0 pages cma reserved
Nov 23 03:48:50 ubuntu-server-18 kernel: 0 pages hwpoisoned
Nov 23 03:48:50 ubuntu-server-18 kernel: [ pid ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Nov 23 03:48:50 ubuntu-server-18 kernel: [  448]     0   448    26475       46    94208        0             0 lvmetad
Nov 23 03:48:50 ubuntu-server-18 kernel: [  846]     0   846     6499      317    86016        0             0 dhclient
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1080]     0  1080   206132      332   163840        0             0 lxcfs
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1082]   102  1082    65759      366   167936        0             0 rsyslogd
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1084]     0  1084    17682      222   180224        0             0 systemd-logind
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1086]     0  1086     7506       72   106496        0             0 cron
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1087]     0  1087    27619       89   122880        0             0 irqbalance
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1088]     0  1088    42284     1945   221184        0             0 networkd-dispat
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1105]   103  1105    12574      230   139264        0          -900 dbus-daemon
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1126]     0  1126     7082       53    98304        0             0 atd
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1132]     0  1132    18075      187   188416        0         -1000 sshd
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1142]     0  1142    72220      230   200704        0             0 polkitd
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1143]     0  1143     3666       35    69632        0             0 agetty
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1145]     0  1145     3722       32    73728        0             0 agetty
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1158]     0  1158    46486     1977   262144        0             0 unattended-upgr
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1159]     0  1159     5764       56    86016        0             0 qemu-ga
Nov 23 03:48:50 ubuntu-server-18 kernel: [ 1228]     0  1228    43539     3614   237568        0             0 nginx
Nov 23 03:48:50 ubuntu-server-18 kernel: [25966]   101 25966    17730      228   180224        0             0 systemd-resolve
Nov 23 03:48:50 ubuntu-server-18 kernel: [25996] 62583 25996    35489      151   176128        0             0 systemd-timesyn
Nov 23 03:48:50 ubuntu-server-18 kernel: [26018]     0 26018    30318      708   249856        0             0 systemd-journal
Nov 23 03:48:50 ubuntu-server-18 kernel: [16675]     0 16675    10731      184   118784        0         -1000 systemd-udevd
Nov 23 03:48:50 ubuntu-server-18 kernel: [19523]     0 19523    71587      280   188416        0             0 accounts-daemon
Nov 23 03:48:50 ubuntu-server-18 kernel: [30852]     0 30852   235988     4258   274432        0          -900 snapd
Nov 23 03:48:50 ubuntu-server-18 kernel: [14252]     0 14252    72771     2616   425984        0             0 php-fpm5.6
Nov 23 03:48:50 ubuntu-server-18 kernel: [14272]    33 14272    73345     1286   405504        0             0 php-fpm5.6
Nov 23 03:48:50 ubuntu-server-18 kernel: [14274]    33 14274    73345     1286   405504        0             0 php-fpm5.6
Nov 23 03:48:50 ubuntu-server-18 kernel: [14319]     0 14319   112080     1758   581632        0             0 php-fpm7.2
Nov 23 03:48:50 ubuntu-server-18 kernel: [14341]    33 14341   112654     1367   552960        0             0 php-fpm7.2
Nov 23 03:48:50 ubuntu-server-18 kernel: [14345]    33 14345   112654     1367   552960        0             0 php-fpm7.2
Nov 23 03:48:50 ubuntu-server-18 kernel: [31607]     0 31607   112112     1912   577536        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [12292]    33 12292    60815    32497   466944        0             0 nginx
Nov 23 03:48:50 ubuntu-server-18 kernel: [12293]    33 12293    61214    32910   471040        0             0 nginx
Nov 23 03:48:50 ubuntu-server-18 kernel: [12294]    33 12294    44113     4358   233472        0             0 nginx
Nov 23 03:48:50 ubuntu-server-18 kernel: [23744]    33 23744   152297    42951   978944        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24231]    33 24231   149576    40587   954368        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24245]    33 24245   160604    50698  1024000        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24247]    33 24247   150409    34720   888832        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24251]    33 24251   149541    39766   929792        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24253]    33 24253   149987    33909   880640        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24255]    33 24255   149565    33360   872448        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24261]    33 24261   149283    34006   892928        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24270]    33 24270   151926    35619   905216        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24272]    33 24272   151055    34804   901120        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24280]    33 24280   149279    33033   872448        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24474]    33 24474   149977    41005   942080        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24480]    33 24480   160875    44150   958464        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24481]    33 24481   155125    39199   929792        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24494]    33 24494   130327    32679   851968        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24501]    33 24501   149217    32395   872448        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24711]    33 24711   167027    43212   954368        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24716]    33 24716   130119    30374   839680        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24728]    33 24728   129974    30180   839680        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24729]    33 24729   129980    30295   835584        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24730]    33 24730   130061    30360   835584        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24731]    33 24731   129492    31333   839680        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24732]    33 24732   129987    30500   839680        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24733]    33 24733   129785    31073   839680        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24735]    33 24735   114592    14326   716800        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24736]    33 24736   148728    30660   851968        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24737]    33 24737   130017    30366   839680        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24739]    33 24739   119261    19469   741376        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24740]    33 24740   140396    21720   778240        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24742]    33 24742   151672    34753   892928        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24777]    33 24777   129731    29546   811008        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24779]    33 24779   129731    29562   811008        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24780]    33 24780   129731    29537   811008        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24783]    33 24783   129731    29554   811008        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24784]    33 24784   129731    29554   811008        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24785]    33 24785   114039    14515   704512        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24786]    33 24786   115559    13569   679936        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24791]    33 24791   120167    18244   716800        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24792]    33 24792   120679    18849   720896        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24793]    33 24793   120679    18729   720896        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24794]    33 24794   120679    18793   720896        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24795]    33 24795   119143    16921   708608        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24797]    33 24797   120167    18172   716800        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24798]    33 24798   119143    16921   708608        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24807]    33 24807   116039    12175   667648        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24808]    33 24808   116039    12945   671744        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24809]    33 24809   117607    14883   696320        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24810]    33 24810   117607    15484   696320        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24811]    33 24811   117575    15597   696320        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24942]    33 24942   113151     5722   630784        0             0 php-fpm7.4
Nov 23 03:48:50 ubuntu-server-18 kernel: [24978]   111 24978   415917    97861  1253376        0             0 mysqld
Nov 23 03:48:50 ubuntu-server-18 kernel: Out of memory: Kill process 24978 (mysqld) score 99 or sacrifice child
Nov 23 03:48:50 ubuntu-server-18 kernel: Killed process 24978 (mysqld) total-vm:1663668kB, anon-rss:391444kB, file-rss:0kB, shmem-rss:0kB
Nov 23 03:48:50 ubuntu-server-18 kernel: oom_reaper: reaped process 24978 (mysqld), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Nov 23 03:48:50 ubuntu-server-18 systemd[1]: mysql.service: Main process exited, code=killed, status=9/KILL
Nov 23 03:48:50 ubuntu-server-18 systemd[1]: mysql.service: Failed with result 'signal'.
Nov 23 03:48:50 ubuntu-server-18 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 23 03:48:50 ubuntu-server-18 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 3.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd

----- UPDATE (Server Configs) -----
Here is my PHP settings
pm.max_children = 50
pm.start_servers = 22
pm.min_spare_servers = 15
pm.max_spare_servers = 30
pm.max_requests = 300

MySql Settings
/etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address        = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size     = 16M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options  = BACKUP
#max_connections        = 100
#table_open_cache       = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit   = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log     = 1
#slow_query_log_file    = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#log_bin            = /var/log/mysql/mysql-bin.log
expire_logs_days    = 10
max_binlog_size   = 100M
#binlog_do_db       = include_database_name
#binlog_ignore_db   = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

Where should I define innodb_buffer_pool and max_connections ?
See the Hetzner Graph. I see something strange when MySql was killed.
Comment: Find out what is using the memory and allocate it better.  Probably less to MySQL.
Comment: You have max_connections in your config - disabled with the leading #.  Remove the leading # and your max_connections will drop from 151 to 100.
innodb_buffer_pool_size=100M - to be added before * Security in your config will reduce size from default of 128M to 100M.  Stop/Start instance for changes to take effect.
Comment: Additional information request.
Any SSD or NVME devices on MySQL Host server?
Post on pastebin.com and share the links.
From your SSH login root, Text results of:
B) SHOW GLOBAL STATUS;    after minimum 24 hours UPTIME
C) SHOW GLOBAL VARIABLES;
D) SHOW FULL PROCESSLIST;
E) complete MySQLTuner report
AND Optional very helpful information, if available includes -
htop OR top  for most active apps,
ulimit -a       for a Linux/Unix list of limits,
iostat -xm 5 3 for IOPS by device and core/cpu count,
for server workload tuning analysis to provide suggestions.
Comment: @Future-King   You may have to ask Hetzner to post this information for you.  We can assist after Hetzner posts the links so we can see your data.
Answer: 4GB is a rather small machine.

Decrease the number of PHP children nginx is allowed to spawn -- perhaps down to only 20.
Decrease MySQL's innodb_buffer_pool some.
Decrease MySQL's max_connections some.
Comment: I have increased the RAM to 8GB. Will it prevent the issue in future?
Comment: Can you suggest me some program which can store history of CPU and RAM usage over period of time and display the data in graph?
Comment: @FutureKing - I can't promise that the issue is now solved -- there was no clear evidence that you were running out of RAM.  Usually, Cloud operators provide such; I don't know about Hetzner.  Is there any swap space?
Comment: Hetzner does not provides data about RAM usage. SWAP space is not present.
During high traffic hours RAM usages goes to maximum 2.5GB It never reaches to 3GB.
Mysql was killed during minimum traffic hour. Thats why it looks very strange.
Comment: Where should I enter innodb_buffer_pool and max_connections  ???
Comment: I have added a Graph report from Hetzner. It shows something unusual.
Comment: Can you tell whether the spikes are just before the crash?  Or just after?  I would expect an I/O spike afterward while it reloads lots of stuff.
Comment: Does Hertzner have a way of modifying the configuration?  (They probably don't allow you access to the file system, where `my.cnf` is.)


Find confidence interval via pivotal quantity?

Question: Suppose $X_1, X_2, ..., X_n$ is a random sample from a population with pdf
$$f(x|\theta) = \dfrac{1}{2\theta}e^{-|x|/\theta},x\in \mathbb{R}$$
The pivotal quantity is $\frac{2}{\theta}\sum_{i=1}^n |X_i|$. How to derive it? How to find pivotal in general?
Update:
Is $\frac{2}{\theta}\sum_{i=1}^n |X_i|$ a chi-square distribution?
P.S. this problem is from our previous comprehensive exam. We have no answer for it.
Comment: That's right--because $|X_i|$ is Exponential, sums of iid Exponentials are Gamma, and the $\chi^2$ distribution is a special form of the Gamma. BTW, one way to answer questions about finding pivotal quantities is explained and illustrated (with a closely related distribution) in the answer at http://stats.stackexchange.com/a/10849/919.
Comment: Could you please show how you arrive at it being chi-square?
Comment: $\frac{1}{2} e^{-|x-0|} \sim Laplace(0,1)$, then $\frac{1}{2\theta} e^{-|x-0|/\theta}\sim Laplace(0, 1/\theta)$. According to the link, $\frac{2}{\theta}\sum_{i=1}^n |X_i|\sim \chi (2n)$.
Comment: Hint: $X_i / \theta$ is distributed Laplace (another name for this distribution) with scale equal to one.
Comment: Either way I can give some hints: You're trying to estimate $\theta$, which is a scale parameter in the density. Consider, specifically, what happens to $|X|$ when $\theta$ increases or decreases (indeed, consider the distribution of $|X|$ explicitly if that helps). Then consider the definition of a pivotal quantity.
Comment: @Glen_b check this [link](https://en.wikipedia.org/wiki/Laplace_distribution#Related_distributions)
Comment: @Jason I already derived it myself when I first saw the question (it's obvious enough if you've done a couple of that sort of question). The point of my question about how you arrived at that result was to try to see whether you were able to make an argument for it being chi-square.
Answer: An outline of one way to approach it.
Step 1: show that $|X_i|/\theta$~Exponential(1)
Step 2: Hence explain how $\frac{2}{\theta}|X_i|\sim\chi^2_2$
Step 3: Hence give the distribution of $\frac{2}{\theta}\sum_i|X_i|$


Proof about complex holomorphic function

Question: I have $f(z)$ which is holomorphic in $G$ open set, and there exist $g(z)$ such that is holomorphic in $G$ and $e^{g(z)}=f(z)$ then for every $n>1$ there exist $h(z)$ s.t. $h^n=f$.
I tried this:
I put $h(z)=e^{g(z)/n}$ then I have to proof that this sequence of function is holomorphic in $G$ but its obvious since $g(z)$ is holomorphic and its a composition over the exponential function, and the sequence $h_n(z)$ converges to $0$ as $n$ goes to $\infty$.
Should I define the $h$ as the limit of this sequence?
Comment: If you stopped just before "and the sequence $h_n(z)$ converges to 0 as n goes to infiny", the solution would be complete. Why consider the limit when $n\to\infty$ at all? The last sentence "Should I define the h as the limit of this sequence?" is a mystery as well.
Comment: Ah okey so fixed n natural number not for the sequence of functions. But is it everything? So easy exercise? I  Because the exercise is in a sheet of complex integrals and application of Cauchy's theorem and Deformation theorem.
Comment: Are you looking for the inverse which is also true? That is, *If for every $n$, there exists a holomorphic nowhere vanishing $h$, such that $h^n=f$, then there exists a $g$, such that $e^g=f$.*
Answer: No. For each $n\in\mathbb N$, you just define $h_n(z)=e^{g(z)/n}$. That's all. It is clear that $h_n$ is holomorphic and that $(\forall z\in G):{h_n(z)}^n=f(z)$. What else could you possibly want?


Como efetuar uma busca desconsiderando caracteres especiais FireBird na Clausula WHERE

Question: Estou fazendo uma View e na clausula WHERE ele não aceita um filtro deste 'Temporário' somente se retirar o acento Ex: 'Temporario'.
CREATE VIEW VWORDEMPRODUCAO (
CODEMPRESA
)
AS
SELECT
F002 AS CODEMPRESA
FROM MFT05O020
WHERE F020 <> 'Temporário'

Obrigado e fico no aguardo.
Comment: Dá algum erro? Se sim, qual?
Answer: Não conheço bem o FireBird, por isso não sei se essa solução será viável, mas valide:
CREATE VIEW VWORDEMPRODUCAO (CODEMPRESA)
AS
    SELECT  F002 AS CODEMPRESA
    FROM    MFT05O020
    WHERE   (CAST(F020 AS VARCHAR(MAX)) COLLATE SQL_Latin1_General_Cp1251_CS_AS) <> ('Temporário' COLLATE SQL_Latin1_General_Cp1251_CS_AS)

A Collation SQL_Latin1_General_Cp1251_CS_AS remove todos os caracteres acentuados, permitindo assim fazer a comparação sem eles.


Filtered View gives duplicates

Question: I'm creating a View that creates a page based on filters.
Filters are:

Published AND
Content: Type (= Student Resources) AND
Content: Resources Tag (Both or Prospective)

In the end, this should retrieve "Student Resources" that are Published and that have been tagged as either "Prospective" or "Both".  It does this without problem.  However, what it also does is show the output multiple times:

Only one of each of these content exist, but each is showing up 6 times.
Please help me troubleshoot.  What other information can I give you?
Comment: Which format setting are you using under views UI? Grid?
Comment: Yes, Format: Grid.
Answer: You can refer this article Remove Duplicate Views Results. Yo can use second option from that article.
Generally, it is done by the Enabling Aggregation: Yes under Views UI. This all has been mentioned at that link. Hope it will help.
Comment: I tried this (Aggregation, yes; count-distinct=1), and all results then disappear as soon as I turn Aggregation on.
Answer: I was able to fix this by installing the Views Distinct Module.
Once installed, I added Content: Resources Tag (Both or Prospective) to my fields in the view of interest.  Then clicked on that field and under Views Distinct Settings, chose Filter Repeats.
I got this from this video: How To Remove Views Duplicates (Drupal Tutorial)
Answer: In my case, the solutions in this article don't work : Remove Duplicate Views Results.
The duplicate was due to an image field. I found this solution : set Exclude from display for the fields and set REWRITE RESULTS / Override the output of this field with custom text and use the token for the field {{ field_my_image }}
I don't know exactly why it has solved the issue but there is no more duplicate.

Filtered View gives duplicates


Conditions that a function is analytic in the complex plane of its independent variable?

Question: I have no a mathematic undergraduate background, so I am very sorry if this question is too naive.
Consider a simple example: $f(x)=\vert x \vert^3$ and $g(x)=x^3$ where $x\in \mathbb{C}$. Why $f(x)$ is not analytic in the complex $x$ plane and $g(x)$ is a analytic function in the extire complex plane of $x$? or what is the conditions that a function is analytic in the complex plane of its independent variable?
Please explain as detail as possible but please not use too much jargon. Thank you very much.
Answer: Start with the definition of analytic.  The function of a complex variable $z$ is analytic at $z \in \mathbb C$ if it is differentiable at $z$, which means
$$\begin{align} \frac{f(z+h) - f(z)}{h} \tag 1 \end{align}$$
has a unique limit as $\lvert h \rvert \to 0$, denoted $f'(z)$.  The limit has to exist regardless of how and in which direction $h$ approaches zero.
This is a strong requirement and requires $f(z)$ to satisfy the Cauchy Riemann equations.
These are obtained as follows:  write $z=x+iy$ and $f(z) = u(x,y)+iv(x,y)$ and consider the complex derivative when $h = \delta x$ and $h = i\delta y$ for real $\delta x,\delta y$.  If $f$ is required to be analytic at $z$ then both are must be the same, so we obtain,
$$\frac{\partial f}{\partial x} = f'(z) = -i \frac{\partial f}{\partial y}.$$
Now write this in terms of $u,v$ to obtain the Cauchy-Riemann equations,
$$ \begin{align}
\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}, \quad
\frac{\partial v}{\partial x} = -\frac{\partial u}{\partial y}. \tag 2
\end{align}$$
When applied to $\lvert z \rvert^3$ these break down.  We have $u(x,y) = (x^2+y^2)^{3/2} $ and $v(x,y) = 0$.  It is not difficult to see then that $(2)$ will only be satisfied by exception, when $x = y = 0$.  Thus $\lvert z \rvert^3$ cannot be analytic except at the single point $z = 0$.
I hope this is useful.
Comment: Thank you. Do you mean (1) should have a unique limit as $\vert h\vert \to0$ because it seems that $h\in \mathbb{C}$?
Comment: Exactly so.  It is not unusual to say $h \to 0 $ and $|h| \to 0 $ interchangeably.  I'll amend the answer.


VBA copying cell value from one sheet to another

Question: does anyone has a clue how I can solve the following. I have a table in sheet 1 which I want to copy to sheet 2. However, copying will only take place for those cells in sheet1 for which column 3 row 11 to 32 are not empty.
If say C11 is not empty, C11 will be copied together E11,F11,H11,I11 and J11. Then the code checks if C12 is filled and does the same and so on.
The copied cells are placed in sheet2 starting row and column 15. I have the following code which works very well. However it copies the formulas which obviously make no sense in sheet2, hence, values are nonsense:
Private Sub CommandButton1_Click()
Dim i As Integer
Dim a As Integer
a = 15
For i = 11 To 32
If Worksheets(1).Cells(i, 3) <> "" Then
Worksheets(1).Cells(i, 3).Copy Worksheets(2).Cells(a, 15)
Worksheets(1).Cells(i, 5).Copy Worksheets(2).Cells(a, 17)
Worksheets(1).Cells(i, 6).Copy Worksheets(2).Cells(a, 18)
Worksheets(1).Cells(i, 7).Copy Worksheets(2).Cells(a, 19)
Worksheets(1).Cells(i, 8).Copy Worksheets(2).Cells(a, 20)
Worksheets(1).Cells(i, 9).Copy Worksheets(2).Cells(a, 21)
a = a + 1
End If
Next i

How can I adjust the code in order to copy only the values?
Thank you very much for any support.
Comment: `.Cells(y, x)` represents a `Range` in VBA, and `Range` has a `.PasteSpecial` method. (Here's an MSDN link: http://msdn.microsoft.com/en-us/library/office/ff839476(v=office.15).aspx.) The option you're probably looking for here is `xlPasteValues`
Comment: This question appears to be off-topic because it could be answered using the macro recorder and copy/paste values only option.
Answer:     Dim i As Integer
    Dim rw As Range, rwD as Range

    Set rwD = Worksheets(2).Rows(15)

    For i = 11 To 32
        Set rw = Worksheets(1).Rows(i)
        If rw.Cells(3) <> "" Then

        rwD.Cells(15).Value = rw.Cells(3).Value
        rwD.Cells(17).Value = rw.Cells(5).Value
        rwD.Cells(18).Value = rw.Cells(6).Value
        rwD.Cells(19).Value = rw.Cells(7).Value
        rwD.Cells(20).Value = rw.Cells(8).Value
        rwD.Cells(21).Value = rw.Cells(9).Value

        Set rwD = rwD.Offset(1, 0)
        End If

    Next i

Answer: So, the way to do this with minimal changes to your code would be:
Private Sub CommandButton1_Click()
Dim i As Integer
Dim a As Integer
a = 15
For i = 11 To 32
If Worksheets(1).Cells(i, 3) <> "" Then
Worksheets(2).Cells(a, 15) = Worksheets(1).Cells(i, 3).Value
Worksheets(2).Cells(a, 17) = Worksheets(1).Cells(i, 5).Value
Worksheets(2).Cells(a, 18) = Worksheets(1).Cells(i, 6).Value
Worksheets(2).Cells(a, 19) = Worksheets(1).Cells(i, 7).Value
Worksheets(2).Cells(a, 20) = Worksheets(1).Cells(i, 8).Value
Worksheets(2).Cells(a, 21) = Worksheets(1).Cells(i, 9).Value
a = a + 1
End If
Next i

Comment: @user3849959 try recording a macro first. These questions can easily be answered with a little trial-and-error on your part...
Comment: Wow. thanks for the quick reply. It works! Just another short question. This is obvioulsy linked to a button. How can I amend the code so whenever I press the button it first deletes everything in the respective columns and rows in sheet2 and then filles the values.
Comment: For guys working with VBA continuously this "easily" might apply for beginners not. So please if you can help I'll appreciate if not just let others reply. Thanks!
Comment: @user3849959 I am in agreement with David that the proper commands for deletion can fairly easily be gotten from the Macro Recorder. If you are unaware of how to use the macro recorder. There are many resources available on the internet. It will help answer many basic how-to questions in VBA.

".ClearContents" is the command for deletion. To clear values, you would use that in place of " = Worksheets....Value" in the code which I have shown.
Comment: Do you know how to amend the code above so that in addition to the value when these are bold the copied values are bold as well?


Two-variable limit via change of variables

Question: It often happens that by considering polar coordinates we can transform a limit of the form
$$\lim_{(x,y) \to (0,0)} f(x,y) \quad \quad \quad (1)$$
into one of the form
$$\lim_{(r,\theta),\, r \to 0} F(r)G(\theta). \quad \quad (2)$$
I am assuming that $f(x,y)$ is continuous in a punctured ball centered at the origin of $\mathbb{R}^{2}$.
I have two questions regarding this process:
a) Given that $x^{2}+y^{2} = r^{2}$ and $(x,y) \to (0,0)$ iff $r \to 0$, is it OK to omit the $\theta$ in $(2)$?
b) In case $F(r)\to 0$ as $r \to 0$ and $G$ is a bounded function, it does follow that $\lim_{(x,y) \to (0,0)} f(x,y)=0$, right?
Can you recommend a calculus text wherein an "observation" similar to the one in b is stated and proved in detail?
Thanks in advance for you replies...
Comment: Generally, no, you shouldn't ignore the presence of $\theta$. You may end up with a limand that depends only on $\theta$, in which case the value of the limit may be different for different values of $\theta\in[0,2\pi)$. For instance, $\frac yx$ transforms to $\tan\theta$, so the limit at the origin does not exist.
Comment: Thanks... If I understand correctly, this implies that the answer to the first question is "no".... What about the second question?
Comment: @user170231  "I am assuming that f(x,y) is continuous in a punctured ball centered at the origin of R2." $\frac{y}{x}$ does not exist for $x=0$, hence it's not conti in a ball, and thus the example does not match the hypo.
Comment: @Jamai-Con Does my answer solves your problem?
Comment: Acc-lab: It does...
Answer: Recall
We write a function $f(x,y) = F(r)G(\theta)$ with $r=\sqrt{x^2+y^2}$ and $\theta = \bar{\text{atan}}(x,y)$, where $$\bar{\text{atan}}(x,y) = \begin{cases}
\arctan(\frac{y}{x})&\text{if } x\neq0\\
\frac{\pi}{2}&\text{if }x=0 \land y>0\\
\frac{3\pi}{2}&\text{if }x=0 \land y<0\\
\text{undefined}&\text{if }x=0 \land y=0\\
\end{cases}$$
(You can change the definition above as long as the $\theta$ is discussable.)
Then we can easily prove (by the $\epsilon-\delta$ definition) that
$$ \lim_{(x,y)\to(0,0)} f(x,y) = L$$
implies
$$ \lim_{r\to0} F(r)G(\theta) = L, \; \forall \theta$$
For $f(x,y)$ whose limit does not exist, the polor coordinates expression of the limit might not exists itself or depends on the value $\theta$. Nothing further is guaranteed.
Noted that the converse statement normally does not hold. The polar coordinate one limit exists and equals to $L$ for all $\theta$ does not imply the original limit exist. See b. for further discussion.
The Questions

a. Given that $r^2={x^2+y^2}$ and $(x,y)→(0,0)$ iff $r→0$, is it OK to omit the $θ$ in (2)?

By "omit", you might think $\theta$ does not affect the limit. Since nothing further is guaranteed in your statement(e.g. the original limit exists), I'd say No-the second limit might depends on $\theta$.
For instance
$$ f(x,y) = \bar{\text{atan}}(x,y)$$
with
$$ F(r)=1, G(\theta)=\theta$$
Beside that, how will you replace $G(\theta)$ if you omit the $\theta$ generally? You may still find ways to omit $\theta$ with more restrictions(for example, the restriction in b.), but generally it is a No.

b. In case $F(r)→0$ as $r→0$ and $G$ is a bounded function, it does follow that $\lim_{(x,y) \to (0,0)}{f(x,y)=0}$, right?

The answer is Yes. Here's a proof.
We know that since $G$ is bounded, we may let $G(\theta) < M$, and $F(r) \to 0$ as $r \to 0$. Then given $\epsilon$ there exists $\delta$ such that for all $r<\delta$ and $\theta$
$$ |F(r)G(\theta)| < M|F(r)| < \epsilon \;$$
Noted that $\delta$ is only revelant to $\epsilon$, and is irrevelant to $\theta$.
Now for $(x,y)$, we may write $\lim\limits_{(x,y) \to (0,0)}{f(x,y)}$
$$=\lim_{(x,y) \to (0,0)}{F(\sqrt{x^2+y^2})G(\bar{\text{atan}}(x,y))}$$
Let $r=\sqrt{x^2+y^2}$ and take $\delta$ in the above statement. Then for all   $|(x,y)|<\delta \to r<\delta$
$$|F(\sqrt{x^2+y^2})G(\bar{\text{atan}}(x,y))|<\epsilon$$
The choice of $\delta$ does not rely $\theta$, which, is $\bar{\text{atan}}(x,y)$ in this case. And hence proved.
Note
Noted that even if this statement is correct, you should still carefully use polar coordinate to prove an existence of multi-variable limits. Here is an example of mis-using polar coordinates to examine the limit. Similar proof for that example does not work because $\delta$ is revelant to $\theta$, unlike question b. Which cause there does not exist a common $\delta$ for different angle. That is why $G(\theta)$ being bounded is neccessary here.
tl;dr
Without further restrictions, you should not omit $\theta$ in the second limit. The hypo in b. does imply the original limit exist, but carefully use this theorem- especially be sure that $G(\theta)$ is bounded.
Answer: Well since r is defined as $\sqrt(x^2+y^2)$
As x --> 0 and y -->0, it becomes apparent that r --> 0.
Which is why we can use this. However this doesn't mean we can omit the $\theta$. As it is an independent variable.


How to avoid invisible breakpoints in QtCreator?

Question: QtCreator is my favorite C++ IDE. Now I use " QtCreator + VC141 (vs2017) + WinDebug" to develop my x64 software on windows.
It works perfectly at first. But then at a time, it often encounter invisible breakpoints  when I start debugging.
The screen show following picture.

I use QtCreator in this situation for a long time, but when I finally need to implement software itnerface, I found it is impossible to used QtCreator for debugging. Because UI needs evevent loop, QtCreator always triggered invisible breakpoint.
By the way, I found that QtCreator usually (not every time) encounters invisible breakpoints when threads changes.
Does anyone have encoutered this problem?
Answer: I found the solution.
Under "tools->Options->Debugger"
disable

"Breakpoints->Thread creation"
"Breakpoints->Thread exit"
"Various->When CrtDbgReport() called"

The problem doesnot shown any more.
But debuggers will no stop at "assert()" in code.
So Turn on "1/2", if you need "assert()".


About continuous extensions and retractions

Question: I'm trying to prove the following: Let $X$ a topological space and $Z\subseteq X$ $\text{For every topological space } Y, \text{ and for every continuous function } f:Z\rightarrow Y  \text{ exists } g:X\rightarrow Y$ continuous such that $g|_Z:Z\rightarrow Y$ is equal to $f$ if and only if exists $r:X\rightarrow Z$ continuous such that $r|_Z(x)=Id_Z(x)$ i.e., $\forall x\in Z: r(x)=x$.
My question is about my proof. Notice that the implication $\Leftarrow$] is easy because $g(x)=f(r(x))$ is the function we want.
The implication [$\Rightarrow$ is my problem. I have two ideas:
1.- If $\delta(Z)=\emptyset$, the proof is finished. Otherwise, We have that $\overline{Z}\cup \overline{X\setminus Z}$ is a closed finite cover of $X$. If I can make $r_1:\overline{Z}\rightarrow Z$ and $r_2: \overline{X\setminus Z}\rightarrow Z$ continuous functions such that are equal to the identity in $Z$, then, the proof is complete.
2.-Since $Z$ is a topological space itself (the topology of $X$ restricted to $z$), we define $r:Z\rightarrow Z$ as $r(x)=x$ for all $x\in Z$. By hypothesis, there exists a continuous extension $g:X\rightarrow Z$ such that $g|_Z(z)=r(z)=z$. So, the proof is complete.
I have some problems accepting my second proof. Is right?. The first idea I can't finish it.
NOTATION: $\delta(A)$ denotes the boundary of a set and $\overline{A}$ the closure of a set.
Answer: Hint:  Apply the hypothesis to $Y=Z$, $f=\mathrm{id}$.  You got it from here?
Comment: Yes, I follow your argument. The idea is extend to f. for a second, I was thinking that argument is wrong; but now, I think is right.


Euclid's proof of proposition 2

Question: In proposition 2 Euclid introduces points $E$ and $F$. But how do we know how to put them geometrically(without drawing)? (I thought Euclid used only shapes for proofs, but now I only wonder)
link to the proposition
Even if we knew how to continue a line, we don't know how long that line should be. Which means the line should be infinite, that is it should be a ray.
Where am I wrong?
Is Euclid's proof valid? If so, why?
Answer: I do not think Euclid defines a "ray" in the same way we do, as an object that already extends infinitely far in a given direction. I think Euclid only had the ability to extend a line segment as far as you please in the direction past one end of the segment, but not to complete the extension to all points in that direction.
If Euclid had postulated the ability to construct a complete ray, he might very well have written Proposition 2 differently.
Instead of producing point $F$, he could say to construct the ray $\overrightarrow{DB}$ starting at $D$ and passing through $B$. Then $G$ is the point at which the circle with center $B$ and radius $BC$ intersects the ray $\overrightarrow{DB}$.
Likewise, $L$ is the point at which the circle with center $D$ and radius $DG$ intersects the ray $\overrightarrow{DA}$.
Since Euclid does not have the concept of a ray, but he does have the concept that you can reach any of the points you would have included in your ray,
instead of constructing an infinitely long object for the circle around $B$ to intersect he constructs a large enough part of that object.
It does not matter exactly how much of the object he constructs, as long as the far end of it (at $E$ or $F$) will be outside the circle.
And indeed this is not "proof-like" if you are accustomed to a more modern style of proof. Euclid's idea of a rigorous proof was different from Hilbert's.
Answer: $F$ and $E$ are named points only so that Euclid can name the lines through $DA$ and $DB$. They could be any point on those lines, but I think he wanted  points "far away" so they would lie outside the larger circle. Once you've chosen those points, $G$ and $L$ can be determined.
Comment: Sorry, I was looking at proposition 1. But my comment is still mostly valid; I've edited it above.
Comment: '"Once you've chosen those points" That's the point of the question. How in the world you can "choose" them? It's not very proof-like
Comment: Draw $DA$ extended past $A$. Pick any point on the extended ray and name it $E$. Similarly for $DB$ and $F$. Does that make sense? If not, we must be talking past each other and I guess you'll need to tell me in more detail what confuses you.
Comment: It's just as I tried to figure out what was the set of allowed operations, I came to think that  Euclid worked with shapes and their positions only(would that be beautiful !). Thus, I couldn't think of a way to extend a line. But now I'm not sure what to think. And also Euclid first(!) picks the points and only then describes the big circle, when it would be more logical to do it the other way around.
Answer: Straight lines in Euclid are what we call now segments.
This is not a proof, it's a basic construction. It is equivalent to the use of a compass to transport segments from a point to another.
$BC$ and $A$ are given. Build the equilateral triangle $ABD$. Draw the  circle with centre $B$ and radius $BC$. Draw the circle with centre $D$ and radius $DG$. Extend $DA$ to intersect the circle in $L$. $AL$ is the desired segment because it is $AL=DL-DA$ and $BC=DG-DB$ so $AL=BC$.
Don't know, to be honest, the reason why he doesn't use the compass to transport  segment $BC$ directly from $B$ to $A$.
Maybe it is because he has not yet proved that circles with equal radii are equal.
Comment: Classical constructions use a so-called "collapsing compass." It can draw a circle with a given point as center, passing through a second given point, but it cannot copy the radius anywhere else. It is called "collapsing" because we imagine that as soon as you pick the compass up to move it to a new center, it "collapses" to zero distance between the ends of the compass.
Comment: @DavidK After constructing this we can use non collapsing compass, tho
Comment: Effectively yes.

Euclid's proof of proposition 2