Near identical MySQL deployments behaving very different – High CPU Usage problem

So I have five identical websites, running on five machines provisioned in the same way. The only thing that differs between these installations are the language files and the languages of the text stored in MySQL tables.

Four of them have no problems what so ever. One is struggling a LOT under the same or somewhat less load than the other four.

I cannot understand why this is.

Things I’ve done so far:

  1. Checked slow queries. All queries uses indexes and are in the realm of 0.0008 Sec execution time i.e. very fast
  2. I’ve noticed that the thing that causes most trouble for this MySQL instance is UPDATE and INSERT, so much so, I’ve turned off the UPDATE’s that were there, for this instance. Bear in mind that these UPDATE’s doesn’t cause a blip on the other servers.
  3. Tried to eliminate external factors i.e. noisy neighbours (moved host) etc.

Worth noticing is that the machines are deployed the same i.e. a vanilla Debian 10 installation with a LEMP stack, nothing out of the ordinary at all.

Still, the problem persists. I can see the load of the machine struggling to keep under 1.00. The other machines are in the 0.10 – 0.20 range all the time.

Looking at CPU for the MySQL process on this machine (with 2 CPU cores as the other machines have as well) it is quite often above 100%. The other machines are never – EVER – over 60% for the MySQL process.

So, any help is much appreciated.

Please do let me know if you need me to run a command that you need to see the output from in order to help.

Thanks.

EDIT Spelling and clarifications

code in functions.php not restricting or behaving as it should be

I have written the below script to restrict users to access bbpress forums or topics. Here are the conditions:

  1. If user in not logged in will be redirected to “Join” page.
  2. If user is logged in but doesn’t have “pmpro_role_1” role, he will be redirected to “Product Page”.
  3. If a user is the administrator, he can view the page.

The problem here is for topics in forum it is working except the latest created topic. And it is taking user to “Join” page even if the user is logged in and have the “pmpro_role_1”. What is happening here?

Please help.

    add_action ('template_redirect', 'forum_security');          function forum_security(){         $  roles = wp_get_current_user()-> roles;         if(is_singular( array( 'forum', 'topic' ) )){             if(!is_user_logged_in()){                 wp_redirect('/join');                 exit;             }else{                 if(current_user_can('administrator')){                     return;                 }elseif(!in_array('pmpro_role_1', $  roles)){                     wp_redirect('/product/channel-mcgilchrist');                     exit;                 }             }                      }     } 

Mod function is behaving wieredly

I am trying to use the Mode function as follows.

    Table[Nest[Mod[2 #, 1] &, FractionalPart[Pi], n], {n, 100}] // N 

Giving the following result

{0.283185,0.566371,0.132741,0.265482,0.530965,0.0619298,0.12386,0.247719,0.495439,0.990877,0.981755,0.963509,0.927018,0.854036,0.708073,0.416146,0.832291,0.664583,0.329165,0.658331,0.316661,0.633322,0.266645,0.533289,0.0665783,0.133157,0.266313,0.532626,0.0652523,0.130505,0.261009,0.522018,0.0440369,0.0880737,0.176147,0.352295,0.70459,0.40918,0.818359,0.636719,0.273438,0.546875,0.09375,0.1875,0.375,0.75,0.5,0.,0.,0.,0.,0.,-1.,-2.,-4.,-8.,-17.,-35.,-70.,-141.,-282.,-564.,-1129.,-2259.,-4518.,-9036.,-18072.,-36145.,-72290.,-144580.,-289161.,-578323.,-1.15665*10^6,-2.31329*10^6,-4.62658*10^6,-9.25317*10^6,-1.85063*10^7,-3.70127*10^7,-7.40254*10^7,-1.48051*10^8,-2.96101*10^8,-5.92203*10^8,-1.18441*10^9,-2.36881*10^9,-4.73762*10^9,-9.47525*10^9,-1.89505*10^10,-3.7901*10^10,-7.5802*10^10,-1.51604*10^11,-3.03208*10^11,-6.06416*10^11,-1.21283*10^12,-2.42566*10^12,-4.85133*10^12,-9.70265*10^12,-1.94053*10^13,-3.88106*10^13,-7.76212*10^13,-1.55242*10^14} 

Now when I do the following

 Hold[Table[    Nest[Mod[2. #1, 1.] &, FractionalPart[3.14159], n], {n, 100.}]]] 

I get the following

{0.283185,0.566371,0.132741,0.265482,0.530965,0.0619298,0.12386,0.247719,0.495439,0.990877,0.981755,0.963509,0.927018,0.854036,0.708073,0.416146,0.832291,0.664583,0.329165,0.658331,0.316661,0.633322,0.266645,0.533289,0.0665783,0.133157,0.266313,0.532626,0.0652523,0.130505,0.261009,0.522018,0.0440369,0.0880737,0.176147,0.352295,0.70459,0.40918,0.818359,0.636719,0.273438,0.546875,0.09375,0.1875,0.375,0.75,0.5,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}

Clearly something to do with working precision. But could you explain why this discrepancy ?

ctx.ListData.Row not behaving as expected in SharePoint 2016

I will first start out with saying that this solution was originally implemented as CSR/JSLink, but then a requirement came that all the functionality had to work in any personal views the users might create. I tried for quite some time to find a way to apply the jslink to personal views, but was never successful.

So, here I am instead trying to make the same functionality work from an _spBodyOnLoadFunctionNames.push within some custom js that is included in our master page.

The basic issue is that if the list contains multiple pages of items, and you navigate to any of the pages past the first page, ctx.ListData.Row only contains the rows from the FIRST page if the user happens to refresh (F5) the page. Due to that the code does not work as expected as it only sees the rows from Page 1.

Below is the function I have been using (called from _spBodyOnLoadFunctionNames as mentioned above), and as mentioned to replicate this issue make sure you have a list that has more then one page of rows, navigate to the next page, and then refresh the page.

function setProtectedIcon(){  if (ctx == undefined || ctx.ListData == undefined){      return; }  var listRows = ctx.ListData.Row; var includedContentTypes = ["Project Documents",                             "Excel Project Documents",                             "Comment Response Sheet",                             "General Document",                             "Meeting Minutes",                             "Presentation 4x3 standard",                             "Presentation 16x9 wide screen",                             "Task Deliverable",                             "Transmittal"];  for (var i = 0; i < listRows.length; i++){      //we only need to perform the check for certain content types     if (includedContentTypes.includes(listRows[i].ContentType)){          //check to make sure this view shows the three fields we require         var field1 = listRows[i].Field1;         var field2= listRows[i].Field2;         var field3 = listRows[i].Field3;         var firstColumn = jQuery("table.ms-listviewtable tbody tr:nth-child(" + (i+1) + ") td:first-child");          if (field1!= undefined && field2!= undefined && field3!= undefined){                      //in some cases this code will actually run before the DOM has finished loading the required elements             //we will just set a delay to try again until the elements are available on the page             if (firstColumn.length == 0){                 setTimeout(setProtectedIcon, 200);                 return;             }              if (field1.Label != undefined && field1.Label != "0 - No Controls"){                  firstColumn.prepend('<i class="fas fa-key xxx-protected" title="This document contains protected content"></i>');             }             else if (field2.Label != undefined && field2.Label != "U - Unclassified"){                  firstColumn.prepend('<i class="fas fa-key xxx-protected" title="This document contains protected content"></i>');             }             else if (field3.length > 0){                  //field3 is the only one that allows multiple values so we need to loop through them                 for (var j = 0; j < field3.length; j++){                      if (field3[j] != undefined && field3[j].Label != "0 - No Controls"){                          firstColumn.prepend('<i class="fas fa-key xxx-protected" title="This document contains protected content"></i>');                         break;                     }                 }             }         }         else{              firstColumn.prepend('<i class="fas fa-exclamation-triangle xxx-protected-unknown" title="Not enough info to determine if document contains protected content"></i>');         }     } } 

}

I changed some of the field names and values to protect the innocent, so please excuse any typos as I assure you this code runs without issue when there is only one page of results.

** I have a bit of an update here. It seems that after the page has fully finished loading the results the ctx.ListData.Row has the correct objects in it. It seems that just while the page is loading, all of the list items go through the ctx.ListData object one page at a time (which is very strange to me, but whatever…).

I guess the real question here, is how can I reliably detect when the list is fully rendered so I can run the function above? I know if it put a setTimeout of 900 before the function is called it works as I expect so this entire issue is just a timing issue. I don’t want to have to leave this as a setTimeout solution though as it will never be 100% reliable

Mega download links are behaving strange

I have the problem, that, if i try to download something from mega upload (as a zip file) often the file is broken. I use the google chrome mega upload extension. How can that be? As far as i know The files on the mega download server are not in a zip-file, so mega download creates the zip-file which i then try to download for me, but as i said, they are often broken. When i try to open the zip-file some parts are missing…see the picture. …there are 7 folders…they exist, they are on…

Mega download links are behaving strange

Neural network written in Python 3.6 (WinPython) behaving improperly

So I am using the Sequential model of Python 3.6 (WinPython) to design a deep neural network. My code looks like this:

`model = Sequential() model.add(Dense(newshape[1]+1, activation='relu', input_shape=(newshape[1],))) model.add(Dense(500, activation='relu')) model.add(Dense(250, activation='relu')) model.add(Dense(90, activation='relu')) model.add(Dense(2, activation='sigmoid')) model.compile(loss='binary_crossentropy',           optimizer='adam',           metrics=['accuracy']) model.fit(X_train, y_train, epochs=1000, batch_size=25, verbose=0) ANN = model.predict(featurevector) print(ANN)` 

The variable featurevector contains the entire set of features of the samples I need prediction for. I have 2 sample set, A and B for prediction purpose, set A contains samples from class 1 while set B contains samples from class 2. Now when I switched on my computer, for the first run, I am getting the correct output for set A and set B. But as soon as I try to get the result after I have already tried to get a prediction for set B, Set A is being predicted to belong to the same class as set B. I am getting correct output for set B always. But such is not the case for set A. It like this:

Switch on computer…

Predict set A: correct output

Predict set B: correct output

Predict set A again: incorrect output

Predict set B again: correct output

Predict set A again: incorrect output

Predict set A again: incorrect output

… and so on

Image column not behaving in SharePoint Online List with Custom Format

I am trying to allow users to include a thumbnail in a list. Since most users will not have general upload permissions anywhere on the site, this will be done through two fields: Attachments, and a picture column named “Thumb Image” (It’s actually a “Hypertext or Picture” column with “Format URL as” set to “Picture”). They will upload the attachment, then get the link, and add it in as the URL in “Thumb Image”. I then want the image to show up in the list view using the JSON “Format Current View” feature. If there is nothing in the “Thumb Image” column, I will display an icon instead.

The Problem:

The if() I’m using always returns false, as length([$ ThumbImage] always seems to return 0. And when I try to just display the image anyways by removing the if(), the src in the image tag ends up being (unknown)

Here’s the view-formatting JSON. My actual format rules are much bigger and more complex, but I’ve created this view in order to rule out any problems from that complexity, and the problem still exists:

{     "$  schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",     "rowFormatter": {         "elmType": "div",         "attributes": {             "class": "ms-bgColor-themePrimary ms-borderColor-black"         },         "style": {             "margin": "10px"         },         "children": [             {                 "elmType": "div",                 "attributes": {                     "iconName": "HomeVerify",                     "class": "ms-fontSize-su ms-fontWeight-regular  ms-fontColor-white",                     "title": "[$  Category]"                 },                 "style": {                      "display": "=if(length([$  ThumbImage]) == 0, 'block', 'none')"                 }             },             {                 "elmType": "img",                 "attributes": {                     "src": "[$  ThumbImage]",                     "title": "[$  Category]"                 },                 "style": {                     "max-height": "68px",                     "display": "=if(length([$  ThumbImage]) > 0, 'block', 'none')"                 }             }         ]     } } 

In place of [$ ThumbImage], I’ve tried using [$ ThumbImage.Url] and [$ ThumbImage.desc] but it always messes up. When I look it up in PowerShell, $ item["ThumbImage"] works, so it doesn’t seem like my identifier is wrong.

One really weird thing:

With this setup, if I edit an item and add or change the “Thumb Image” field (either the URL or Display Text), then the image shows up as expected. But as soon as I refresh the page, or view from a different browser, the image is gone again. Even selecting the row and opening and closing the details pane a few times makes the image show up!

After editing the thumb image or toggling the details pane a few times:

enter image description here

<img style="max-height:68px;display:block;" src="/sites/MembersHub/Lists/Classifieds/Attachments/21/Burnsville%20house%20ad%20for%20non%20CMA_Page_1.jpg?web=1" title="Hospitality">

Then, after refreshing the page:

enter image description here

<img style="max-height:68px;display:none;" src="" title="Hospitality">

This is just too weird, and the methods I usually use to debug things like this in PHP (like var_dump()) don’t seem to have equivalents in this limited JSON-based context.

Any help you can offer would be great!

FBS (pyqt) application is behaving strangely

I have a PyQt (FBS) desktop application. When I open it everything first works fine but as soon as I do an action like clicking a button. The action that is supposed to happen does not appear on the screen.enter image description here

After pressing next the application looks still the same.

But even though the application doesn’t indicate the change in the background it actually does what it is supposed to do. (e.g. in some case disables the next or back button). What I find especially weired is that if I change my screen and then go back to the application everything looks like it is supposed to be. enter image description here Why is that? and what can I do to fix this?

Alarm behaving very strangely

There is already another question like this (Alarm is disabled when device is switched off) but my question is slightly different from those.

In my new phone with Android 7.0 Nougat, I found something strange.
Suppose, I have set an alarm at 7:00 AM and at that time, the phone is switched off. I found that the alarm works absolutely fine – the screen turns on and the ringtone is played.
But, if the screen is not touched within about 15 seconds, such as, snoozing or dismissing the alarm, the screen turns off permanently, means that even if I hold down the power button, it doesn’t turns on. But the ringtone continues to play.
Then I need to pull out the battery, reinsert it and again restart the phone.

Now I have somehow coped up with this issue by setting the Automatic power on time to two minutes before the alarm, that is, at 6:58 AM. But, that is not the solution, because I may sometimes set the alarm to before the power on time and I may forget to change the power on time. I am really fed up with this problem.

Why does this happens and how can I solve this issue?

How do you troubleshoot an app that is not behaving as expected?

first post here so not sure if this is the correct group, so please excuse me if not 🙂 So my question is I downloaded an app named “world history” from app store on my iphone X with the latest firmware, however whenever I open the app it just open for less than a second and it closes the app immediately. The one thing I can do is to report to the app store , referring to the developers(if I found them) however, would like to know if you use some other methods of troubleshooting ?