How do I write validation statement to require a day of the week?

I have a field in a custom list called "WeekOf". I have a default statement that populates the date as the following Monday, but some people are entering for future weeks and then add a start date other than a Monday.

What statement should I put in the column validation to require a Monday?

I’d just figure it out myself, but the client wants it fixed asap.

functions – PHP calling MYSQL statement and getting output

I am trying to call via php an MySQL Statement and have that output the values. Below is what I have tried. Could someone please help enlighten me as to what I am doing wrong?

<?php
$sql = "SELECT DAYNAME(wp_cbxrbooking_log_manager.`booking_date`) as 'weekday',  n"

    . "              wp_cbxrbooking_log_manager.`party_size` as 'Party Size',n"

    . "              wp_cbxrbooking_log_manager.`booking_time` as 'Time',n"

    . "              wp_cbxrbooking_log_manager.`mattiscool` as '# of Reservations'n"

    . "FROM wp_cbxrbooking_log_managern"

    . "n"

    . "WHERE `booking_date` >= DATE(NOW()) - INTERVAL 7 DAY  n"

    . "ORDER BY `Time`  ASC";
?>

go – What is the best practice to use multi different statement in Golang

After reading some of this book Building Maintainable Software
I am curious about how can I use a multi different statement like this to be more maintainable.

    if UserNotActive(){
        // do job 1
    }else if UserCanWriteSomeThing(){
        // do job 2
    }else if UserMessageIsSomeMessage(){
        // do job 3
    }else if TheTimeIsMidNight(){
        // do job 4
    }// and whatever

method names are fake, but my code is something like this and maybe they statements are more than 10 or 15

What is the best syntax for this code? Can I use Switch?

solution verification – How to proof this statement. “There are not odd integers x,y,z according to $(x-z)^2$ + $(y-z)^2$ = $(x+y)^2$.”

I did try to proof this by contradiction(I guess it works). So I suppose this statement is false but I have confused about the meaning of it.

If this statment is false it means “There are odd integers x,y,z according to $(x-z)^2$ + $(y-z)^2$ = $(x+y)^2$.” or “There are odd integers x,y,z according to $(x-z)^2$ + $(y-z)^2$ $neq$ $(x+y)^2$.” or…..

Is proof by contradiction a good method? and Could you help me how to do next from the statement that suppose to be false?

Thank you very much.

Is Monzo bank statement acceptable for tier 4 visa application

Please i would like to know if UKVI (UK Visa and Immigration) accept Monzo Bank statement for tier 4 visa application. I appreciate your response in advance. Thank you

sql server – Need some advise on Query tuning a statement within an SP

I am looking for some guidance on tuning below query as part of stored proc which takes a unique personid every time as parameter. This SP executes on avg 5K/min and some time part of below statement in that SP is showing taking 20-30 secs as major run time.

Declare @OldDateKey INT
        @Today DATETIME,
        @Yesterday DATETIME,
        @twodaysago DATETIME,

SET @Today= Getdate();
SET @Yesterday = DATEADD( dd,-1,@Today)
SET @twodaysago = DATEADD( dd,-1,@Yesterday)


SELECT TOP 1 @OldDateKey = d.datekey from sometable (NOLOCK) d

WHERE d.datekey IN(
(DATEPART(Year,@Today) % 2) * 366 + DATEPART (dy, @Today),
(DATEPART(Year,@Yesterday) % 2) * 366 + DATEPART (dy, @Yesterday),
(DATEPART(Year,@twodaysago) % 2) * 366 + DATEPART (dy, @twodaysago)
)
AND personid = @personid

sometable is partitioned on partition key called datekey which is the PK Clustered index for the table.

We also have a NC index on personid as leading key but still above part of select statement takes 20-30 secs. the table is around 500 GB and approx 2 billion rows.

Is there a way we can make above run faster because application sends over 20 threads at a time to execute that SP everytime.

Can I declare a variable in an “if statement”? (for c++)

I am writing a “vending machine” code for c++ and I need to have 5 items where 3 items cost an integer amount and the other 2 cost a decimal amount.

I am only using if statements in this code but there is an error with my “cost” variable. Can someone help me with my error?

Thanks in advanced!

Code below:

```
#include <iostream>
using namespace std;

int main() {

  cout << "Vending Machine" << endl;
  cout << "----Items------" << endl;
  cout << "1. Popcorn: $2" << endl;
  cout << "2. Coconut Clusters: $3" << endl;
  cout << "3. Granola Bar: $2.50" << endl;
  cout << "4. Trail Mix: $1.50" << endl;
  cout << "5. Chocolate: $1" << endl;

  cout << "Enter you selection: " << flush;
  int input;
  cin >> input;


  if (input == 1) {
    cout << "You added Popcorn to your cart." << endl;
    float cost = 2;
    cout << "Your total is $" << cost << endl;
  }
  
  if (input == 2) {
    cout << "You added Coconut Clusters to your cart." << endl;
    float cost = 3;
    cout << "Your total is $" << cost << endl;
  }
  
  if (input == 3) {
    cout << "You added Granola Bar to your cart." << endl;
    float cost = 2.50;
    cout << "Your total is $" << cost << endl;
  }

  if (input == 4) {
    cout << "You added Trail Mix to your cart." << endl;
    float cost = 1.50;
    cout << "Your total is $" << cost << endl;
  }

  if (input == 5) {
    cout << "You added Chocolate to your cart." << endl;
    float cost = 1;
    cout << "Your total is $" << cost << endl;
  } 

  

  cout << "Pay amount: " << flush;
  float money;
  cin >> money;

  if (money > cost) {
    float change = money-cost;
    cout << "Thank you! You have $" << change << " change." << endl;
  }

  if (money == cost) {
    cout << "Thank you! Have a nice day!." << endl;
  }

  if (money < cost) {
    float amountOwed = cost-money;
    cout << "Please insert another $" << amountOwed << endl;

    cout << "Enter amount: " << flush;
    float payment;
    cin >> payment;

    if (payment > amountOwed) {
    float change2 = payment-cost;
    cout << "Thank you! You have $" << change2 << " change." << endl;
    }

    if (payment == amountOwed) {
      cout << "Thank you! Have a nice day!." << endl;
    }

    if (payment < amountOwed) {
      cout << "Sorry, you did not enter enough money. Your cart has emptied." << endl;
    }

  }
  return 0;
}

 

Can I proof this statement "Suppose $x in mathbb{R}$ If $x^3-x>0$ then $x>-1$" like this?

Proof by contrapositive

We want to prove "If $x<=-1$ then $x^3-x<=0$"

Suppose $x<=-1$ Then $x^3<=-1^3=-1$ Thus $x^3-x<=0$ Therefore $x^3-x<=0$ #

Nested IF Statement in SP List Calculated Column

I need to create a Nested If statement based on several columns.

Column 1. CurrentDate (Date)
Column 2. DteofCQ (Date)
Column 3. CQTitle (Text)
Column 4. ComplianceStatus (Calculated)

There are 8 positions in the organization; 4 general positions (with various names), and Driver, Clerk, Cashier, Manager. The general positions have no recurring training. The others have differing sunset dates on their training; from 365 days (every year) to 1095 days (every three years).

What I need –

  1. If the CQTitle column contains any of the general positions the Compliance Status should contain ‘Certified’, regardless of the contents of the DteofCQ

  2. If the CQTitle column contains Driver, Clerk, Cashier, or Manager positions and the DteofCQ is blank Compliance Status should contain ‘Noncompliant’

  3. If the CQTitle column contains Driver, or Manager and the DteofCQ has a date the formula shall compare the contents of DteofCQ to the CurrentDate. Where the difference is greater the 365 days (it has been one year of more since last training) the Compliance Status should contain ‘Noncompliant’, else ‘Compliant’

          - If CQTitle contains Cashier = 720 days
          - If CQTitle contains Manager = 1095 days
    

Can all of the above be contained within one Nested IF statement?

I gotten this far with the calculated ComplianceStatus column –

=IF(ISBLANK(DteofCQ),”Noncompliant”,IF(CQTitle=”Driver”,”Certified”,IF(CurrentDate-DteofCQ<=365,”Compliant”,”Noncompliant”)))

Thank you!

SQL Server 2019 UPDATE Statement SET to function does not execute the function again for each row

I suspect this is because of a new SQL 2019 feature, scalar UDF inlining:

With this new feature, scalar UDFs are automatically transformed into scalar expressions or scalar subqueries that are substituted in the calling query in place of the UDF operator. These expressions and subqueries are then optimized. As a result, the query plan will no longer have a user-defined function operator, but its effects will be observed in the plan, like views or inline TVFs.

This can be a performance benefit, but in your case it appears to be processing the function only once, then applying the same result to every row.

The bottom of the linked article describes several ways to disable scalar UDF inlining.

You can disable it database by database:

ALTER DATABASE SCOPED CONFIGURATION SET TSQL_SCALAR_UDF_INLINING = OFF;

Or force this option query-by-query, using a hint:

OPTION (USE HINT('DISABLE_TSQL_SCALAR_UDF_INLINING'));

Or you can disable it by altering the UDF itself:

WITH INLINE = OFF