vendredi 3 décembre 2021

Java boolean "Unexpected return value"

I'm new to Java and I can't understand why the IDE says that "Unexpected return value" inside the forEach where I declared that the boolean is true or false by an If statement. My goal is to check that there is an object inside the "States" HashMap which already uses the name that I want to set to a new state. (The HashMap's key is a String which is called IdentifierOfState and the value is my State object which contains variables like its name.) Thank you for your help in advance!

public boolean isStateNameClaimed(String NameOfState)
{
    States.forEach((IdentifierOfState, ValueOfState) ->
    {
        if (ValueOfState.getNameOfState().equalsIgnoreCase(NameOfState)) {return true;}
        else {return false;}
    });
    return false;
}

Renew list for every iteration

I want to renew the "namelist" for each iteration and use "if" to compare "name" against "namelist". The first iteration will always replace the content of "namelist" because the "namelist" at the first iteration is empty. For iteration number x, I therefore want "name" to be compared with the list's content from the previous iteration, ie x - 1. I do not want to append "name" to "namelist" but replace the entire content so the comparison is always between "name" and the latest version of "namelist". The "#-line" in the code shows where I think the operator should be.

def loop():
    namelist = []
    a = 1
    while a < 5:
        name = input("enter your name")
        if name != namelist:
            # operator that replaces the contents of "name list" with "name"
        else:
            continue
        a += 1

loop()

Excel IF AND Statement 3 Conditions and 1 Outcome but formula populated Unwanted Results

Hello Everyone this is my first post asking for Excel help.

Please be patient with me.

Currently I am creating a spreadsheet tracking hours.

Maybe I am using the wrong formula?

=IF(AND([@[Date]]>=DATEVALUE("05/01/2021"),[@[Date]]<=DATEVALUE("05/31/2021"),[@[Present OR Absent]]="Absent"),"May Absent","May Present")

What I want to do for this Column is to show if for the Month of May if someone is physically at that location.

The Date column ranges from January 2021 - October 2021. My formula catches the May month both May Present and May Absent correctly....... BUT

For Row items outside of May, unwanted results populated for months outside of May ie in 06/01/2021 Row I will see "May Present"

Is there another formula better fitting for what I am looking for? If so what is it?

Secondly how can I eliminate "May Present" for months outside of May? I just want a blank cell maybe ""?

The date Column is the First Column (A). Present or Absent Column (H) is to the Right of the Date Column and the Month Absent/Present Indicator Column (M) is to the right of the

Thank you for reading this far.

how do i return variables in c# if [closed]

I have code like this and i want to use numbersB var in other if, how can i return it?

if ((n2 > 0 && n2 <= 10) && (m2 > 0 && m2 <= 10))
{
    for (int i = 0; i < (n2 * m2); i++)
    {
        var lineB = Console.ReadLine().Split(' ');
        var numbersB = Array.ConvertAll<string, int>(lineB, int.Parse);
        return numbersB;
    }
}

u-boot how to call command via "if" or "echo"

Problem description:

When I'm reading a register of my device via i2c all is fine and is showing status as expected:

*HOSTMCU> i2c md 0x52 0x32 1
0032: 10    .
STM32MP>* 

My target is to use this information in if statement, but I'm not able to do it. I tried to construct this statement in different ways by without success:

*HOSTMCU> if test i2c md 0x52 0x32 1 = 31; then; echo "TRUE"; else echo "FALSE"; fi; 
TRUE

HOSTMCU> if test `i2c md 0x52 0x32 1` = 31; then; echo "TRUE"; else echo "FALSE"; fi; 
TRUE

HOSTMCU> if test `i2c md 0x52 0x32 1` == 31; then; echo "TRUE"; else echo "FALSE"; fi; 
TRUE

HOSTMCU> if test i2c md 0x52 0x32 1 == 31; then; echo "TRUE"; else echo "FALSE"; fi;   
TRUE

HOSTMCU> if test 'i2c md 0x52 0x32 1' == 31; then; echo "TRUE"; else echo "FALSE"; fi; 
TRUE

HOSTMCU> if 'i2c md 0x52 0x32 1' == 31; then; echo "TRUE"; else echo "FALSE"; fi;

Unknown command 'i2c md 0x52 0x32 1' - try 'help'
FALSE

HOSTMCU> if 'i2c md 0x52 0x32 1' == 31; then; echo "TRUE"; else echo "FALSE"; fi; 

Unknown command 'i2c md 0x52 0x32 1' - try 'help'
FALSE

HOSTMCU> if i2c md 0x52 0x32 1 == 31; then; echo "TRUE"; else echo "FALSE"; fi;   
0037: 10    .
TRUE

HOSTMCU> if 'i2c md 0x52 0x32 1' == 31; then; echo "TRUE"; else echo "FALSE"; fi; 
Unknown command 'i2c md 0x52 0x32 1' - try 'help'
FALSE

HOSTMCU> if `i2c md 0x52 0x32 1` == 31; then; echo "TRUE"; else echo "FALSE"; fi; 
Unknown command '`i2c' - try 'help'
FALSE

HOSTMCU> if $(i2c md 0x52 0x32 1) == 31; then; echo "TRUE"; else echo "FALSE"; fi; 
Unknown command '$(i2c' - try 'help'
FALSE

HOSTMCU> if $(i2c md 0x52 0x32 1) == 10; then; echo "TRUE"; else echo "FALSE"; fi; 
Unknown command '$(i2c' - try 'help'
FALSE

HOSTMCU> if $(i2c md 0x52 0x32 1) -eq 10; then; echo "TRUE"; else echo "FALSE"; fi; 
Unknown command '$(i2c' - try 'help'
FALSE

HOSTMCU> if i2c md 0x52 0x32 1 -eq 10; then; echo "TRUE"; else echo "FALSE"; fi;    
0037: 10    .
TRUE

HOSTMCU> if i2c md 0x52 0x32 1 -eq 1e; then; echo "TRUE"; else echo "FALSE"; fi; 
0037: 10    .
TRUE

HOSTMCU> if i2c md 0x52 0x32 1 -eq 13; then; echo "TRUE"; else echo "FALSE"; fi; 
0037: 10    .
TRUE

HOSTMCU> if $(i2c md 0x52 0x32 1) -eq 13; then; echo "TRUE"; else echo "FALSE"; fi; 
Unknown command '$(i2c' - try 'help'
FALSE

HOSTMCU>*

Question: As I mentioned above, my target is to compare this read value from i2c register with the second value. What I'm doing wrong in this IF statement?

Repeat Dates and Roles using Column Dates from (E to I)

I have some Data where, there are 8 columns. I want to keep Column, B,E,F,G,H and I.

In Column B I have Some positions and in other columns E,F,G,H and I i have dates. I want to convert the dates as 1 to count the Roles, to know that how many times the date is repeated in "Headers" for the "Roles".

I would really appreciate the help if it can be achieved using formula.

DATA

enter image description here

RESULT

enter image description here

Google Sheets Link

Inserting If/Else statement [closed]

How can I get my code to work using an If/Else statement, instead of on click like I currently have? While also displaying it in the IFrame?

My Current Code

    <html>
        <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <h1> Final Project</h1> 
        <p> Click Radio Button to Display 1 of 3 Maps!</p>
    
    </head>
    
    
    <div class="iframe_container">
        <form>
            <input type="radio" name="iframe" value="type" onClick= "go('https://storymaps.arcgis.com/stories/e7219a51b6a4411aace9ea68fb9c9cf2')"/>Story Map<br>
            <input type="radio" name="iframe" value="type" onClick = "go('https://acgis.maps.arcgis.com/apps/webappviewer/index.html?id=4a1566b7f7fb49ae8c9c470a6f371a78')"/> Web APP <br>
            <input type="radio" name="iframe" value="type" onClick = "go('API_File.html')"/> Web APP API
        </form>
    </div>
    
    <body>
       
       <script>
        function go(loc){
        console.log(loc);
            document.getElementById('iframe').src = loc;
                        }
       </script>
    
    <div class="logins_details_container">
    
        <iframe id="iframe" src="https://storymaps.arcgis.com/stories/e7219a51b6a4411aace9ea68fb9c9cf2" width="100%" height="60%"></iframe>
    
    </div>
    
    </body>
    </html>