conditions – errors in the condition, if PHP

I make the condition that if the field $ location1 is complete, a function is executed, and if the field $ location2 is complete, a similar function will be performed in the same field.
Can not find the error in the condition, can you help me?
Thank you very much

    add_filter ('bps_hidden_filters', 'directory_filters');
    function directory_filters ($filters)
    {
        $user = bp_loggedin_user_id ();
        if (empty ($user))  return $filters;

        $filters('bps_directory') = bps_current_page ();

    $location1 = xprofile_get_field_data (46, $user ); 
    $location2 = xprofile_get_field_data (52, $user ); 


   if (!empty ($location1)){
$filters('field_62') = empty ($_REQUEST('field_62'))? addslashes ($location1): $_REQUEST('field_62');} else  {
 $filters('field_62') = empty ($_REQUEST('field_62'))? addslashes ($location2): $_REQUEST('field_62');}
}

The Catalina USB drive can not be started under the new conditions of Macbook Pro and Internet Recovery

I will try to keep it as short as possible. I own a new 16 "Macbook Pro, whose drive was completely erased after I made some stupid decisions to downgrade to Mojave (note: do not waste your time, it's not possible) .I realized this possible After living with Catalina, I created a bootable USB device to reinstall the operating system using my old Macbook.

For some reason, my internet has been extremely cluttered lately (which has nothing to do with the laptops in question), so I could not make successful internet recovery on the new Macbook. I tried to hold down the Option key to start my Catalina USB drive, but since I do not have a recovery partition, by default the computer is set to Internet Recovery. Once that is loaded, I choose "Reinstall MacOS" from the menu and the download process starts and seems to work until "2 minutes left" is reached. Then the process is aborted and I get the error "PKDownload 8" I read that my internet connection was interrupted or interrupted.

The scaly internet should be a temporary problem (I intend to call the ISP). What I really want to know is how to load my Catalina USB installer from the Internet Recovery screen or how to start an offline recovery. I can see that the USB stick is recognized when I enter "diskutils list", but am not sure how to run it.

Any help is grateful, that drives me crazy.

mathematical optimization – Find the maximum of x for a set of conditions

Trying to find a maximum of x, provided that & # 39; & # 39; # 0 <= x <= 3 & # 39; & # 39; & # 39; and some other things. This works well:

Clear[x, y]
FindMaximum[{x, 0<=x<=3}, x]

But it does not:

Clear[x, y]
FindMaximum[{x, 0<=x<=3 && y==1}, x]

How can I get the maximum x from the second list of constraints?

Google Sheets: Counting query based on multiple conditions?

I have a table that I use for my World of Warcraft guild, and I stumbled against a wall when I tried to add new features to it.

For reference, when our guild goes through dungeons, we distribute objects that are dropped based on a plus counting system. That is, everyone starts at 0 and can roll against other 0 to try to win an item. If someone wins something, they receive +1 and can only roll against other +1s. So a person does not win everything just because they have more luck.

So we have a hand that records every single item that drops, who won it, where it was won, and if it counts to the + 1 system (there are some items that are not worth counting). Next to the item log is a query that automatically displays the number of items. This query looks like this:

Loot Tracker
--------------
Name     Count
--------------
Jim      2
Bob      1
Liam     1
Dave     1
Luke     1

The actual query for this is currently:

= INQUIRY (A: I, "Select D, count (E), where C = Vic Victrix und and G = true and A> = Date #" & TEXT (IF (WEEKDAY (J1, 1) = 3, J1, J1-WEEKDAY (J1 + 4)), "YYYY-MM-DD") & "and A <= date" & TEXT (J1 + 8-WEEKDAY (J1 + 5), "YYYY-" MM-DD ") &" to D order by number (E) descending, D designation D # name; #, number (E) # "#"

We've come to a point where people roll not just for their own character, but for their other specializations (something they do not use right now, but no one else needs it for their main character, so they roll for what's called " Off-Spec ") and this must also be tracked on the Loot Tracker.

Suppose I have this record:

 |  A         B              C      D
----------------------------------------------
1|  Name      Item           +1     Spec
----------------------------------------------
2|  Jim       Lorem          (✓)    MS
3|  Bob       Ipsum          (✓)    MS
4|  Jim       Dolor          (✓)    OS
5|  Liam      Sit            (✓)    MS
6|  Dave      Amet           (✓)    MS
7|  Luke      Consectetur    (✓)    OS

I somehow need a query or a single formula to work with the Loot Tracker:

Loot Tracker
-------------------
Name     MS+   OS+
-------------------
Jim      1     1
Bob      1     0
Liam     1     0
Dave     1     0
Luke     0     1

I hope that makes no sense, I have no idea how I would do it. I tried separate query formulas here in the third column, but they were not sorted correctly and matched the names. It must first be ordered by MS and then by OS.

Design Pattern – & # 39; n & # 39; Variables with & # 39; m & # 39; Conditions – how are the paths generated?

I have & # 39; n & # 39; Variables. Each of these variables can take values ​​from X to Y. This & # 39; n & # 39; Variables can also contain conditions that involve the other variables. For e.g. n1> n2; If n3 = 0, then n5 must be 15, and so on.

I'm looking forward to creating a function that uses these n variables and the m conditions and suggests the different scenarios.

I am sure that this is not a new problem and has already been addressed, but I am sure it will appreciate hints and techniques on how to tackle it. I try to solve this in C #.

python – Include multiple columns in one location based on two conditions in other columns

I have to rewrite a code that I already have. Columns are inserted in which a column "Standard Deviation" is missing. For this purpose, it is checked whether the previous column is a "variable" column and whether there is already a "standard deviation" column behind it.

Right now, I'm using a while loop that goes through the column check df.iloc(1,x) and df.iloc(1,x+1),

i = 7
j = len(df.columns)-1

while i < j:
    if df.loc(1,i) != 'Standard Deviation' and df.loc(1,i) != 'Replicates' and df.loc(1,i) != 'Method':
        if df.loc(1,i+1) != 'Standard Deviation':
            df.insert(i+1,'Standard Deviation',np.nan)
            df.columns = pd.RangeIndex(df.columns.size)
            df.loc(1,i+1)='Standard Deviation'
    i+=1
    j = len(df.columns)-1

df.insert(len(df.columns),'Standard Deviation',np.nan)
df.columns = pd.RangeIndex(df.columns.size)
df.loc(1,len(df.columns)-1)='Standard Deviation'

Detail of a data frame (difficult to understand):

50  51  52  53  54  55  56  57  58
0   Pour Point (°C) Pour Point (°C) Pour Point (°C) Pour Point (°C) Boiling Point Distribution- Temperature (°C)    Boiling Point Distribution- Temperature (°C)    Boiling Point Distribution- Temperature (°C)    Boiling Point Distribution- Temperature (°C)    Boiling Point Distribution- Temperature (°C)
1   Pour point  Standard Deviation  Replicates  Method  Initial Boiling Point   5%  10% 15% 20%
2   NaN NaN NaN NaN NaN NaN NaN NaN NaN
3   < -25   NaN NaN ASTM D97    NaN 35  52  70  88
4   < -25   NaN NaN ASTM D97    NaN 56  84  104 135
5   -6  NaN NaN ASTM D97    NaN 115 166 224 259
6   24  NaN NaN ASTM D97    NaN 279 303 322 339

At the moment the code works and gives the expected result. I just want to rewrite it more efficiently and elegantly.

I do not know how to do it without going through the columns to set the check df.iloc(1,i) and df.iloc(1,i+1)

Algorithms – Minimize the difference under certain conditions

given $ M $ For each array, select an element so that the difference between the maximum and minimum of the resulting array is as small as possible. Provide an efficient algorithm for finding such a minimal difference.

restrictions:

The total number of elements in $ M $ Arrays <=$ 10 ^ 5 $

$ M $<=$ 10 ^ 5 $

Time limit: 1sec

Example:
To let $ M $ Be arrays, ( $ M = 3 $ hereinafter)

$ 10.16,21 $

$ 15.28 $

$ 18.30 $

The optimal method of selecting elements is 16 from the first sentence, 15 from the second sentence, and 18 from the third sentence. Here's the answer $ 18-15 = $ 3

jquery – Display tabs and input fields under certain conditions with javascript

I'm working with jquery on some tabs when the user clicks on a specific tab.
I enter the text of the clicked tab and conditionally display some input fields.
Basically, when clicking on a tab, the inputs should be displayed when another tab is clicked
The previous entry should be hidden and the next one displayed, depending on the if condition.
When I click on a tab, some input fields are displayed, but others are not displayed if a
It will click on another tab

~ Please help?

markup

 

Conditional inputs








logic

let selected = false;
$(".columns").click(function () {
    if (!selected) {
        var subject = $(this).text();
        //alert(subject);
        if(subject.trim() == "Mathematics"){
            //Show Maths Inputs
            $('.mathInput').fadeIn(2000);
        }
        else if(subject == "English"){
            //Show English Inputs
            $('.engInput').fadeIn(2000);
        }
        else{
            $('.mathInput').css('display', 'none');
            $('.engInput').css('display', 'none');
        }
    }
});