dimanche 27 décembre 2015

if variable == ' some value' is not working properly

[1]:-the code i entered in python 3.5 (new file-not idle) [2]:-this is what i get when i run module and type 2. When i click run module and type 2, it prints what i have kept for else : .... etc. check it out in [2]. Please help me out with my problem.But when i exchanged if input == 2 with if input != 2 , and type 2 , it shows what i have written for if info != 2. how's that possible? [1]http://ift.tt/1OmHo33 [2]http://ift.tt/1PqxYsw

I can't solvebasic code form in php

I am new in Php world. This is my first question ever in any form. Please tell me what errors in my page. When i submit form no result came out. Please give me any solution.

I try to follow this video. https://www.youtube.com/watch?v=15Ucddc2ksM

enter code here

<!Doctype html>
<html>
<head>
    <title> My page </title>``
</head>
<body>

    <p style="font-weight:bold">hello1 world</p>
    <?php

    // Restaruant open at 8
    // Restaruant from 8-11
    // Lunch from 11-4
    // closes at 4
    $launch_menu = "Nashta <br /> 
    halwa <br /> gosher <br /> ";

    $breakfast_menu = "Launch <br />
    sugar <br /> meat <br /> ";

    if(isset($_post['time'])) {
        $time = $_post['time'];

        if($time < 8 or $time >= 16 ) {
            echo "sorry, we are closed <br />" ;
        }
        else{
            echo "Hi, what would you like order <br /> ";
            if($time < 11){
                echo $breakfast_menu;
            }
            else if ($time < 16)
            {
                echo $launch_menu;
            }
        }
    }

    ?>
    <form action='index.php' method='post'>
    What time is it? <input type='text' name='time' /> <br />
    <input type='submit' value='Submit'>
    </form>
</body>
</html>

samedi 26 décembre 2015

Return with a for loop

The code i am using is below. As far as i am aware the logic of the code is fine but when the return is after the print for the char B then the i within the for loop wont increment. If i remove the return statement then the for loop will increment as i wanted it too, however i need the method to end if the B/W is printed so i need the return to be present. Any help is greatly appreciated i've been trying to work out whats wrong for hours now.

if(currentCodeString.contains("" + currentGuessChar)) {
        for (int i = 0; i < codeLength; i++) {
            System.out.println("" + i);
            //System.out.println(currentGuess[i] + " - " + currentCode[i]);
            if(checkPins(currentGuess[i], currentCode[i])) {
                System.out.print("B");
                return;
            }
        }
        System.out.print("W");
        return;
    }

How to check if element is greater than another by certain %

I need to put a check in a C program to check if value[1] > value[2] by a certain % (in this case 15%) . But am struggling to come up with the simplest method?

Thanks,

'if statement' not firing on mobile?

This works fine on everything except for mobile. Is there a reason for this? How do I get around it?

$(document).ready(function()
  var my_var = 10;
  if(! my_var =="") {
    //do my code
  }
});

if statement to indicate whether a market has gone up or down

I have a dataset from library(ISLR) and I would like to make my own up and down, but my if statement always fail, any help would be appreciated:

library(ISLR)
attach(Smarket)

for (i in 1:nrow(Smarket)){
Smarket$myown = ()
if (Smarket[i, "Today"]>0) { Smarket$myown = "Up"
} else { Smarket$myown = "Down"
}}

Please note that if I use the statement ifelse then the issue is solved, but I want your help to MODIFY the above code, so I may learn

 Smarket$myown = ifelse(Smarket[, "Today"]> 0, "Up", "Down")  

How can I insert a if function in an array

I have an array

$data_array =

array
    (
        "limit" => $limit,
        "page_number" => $page,
        "books" => $books
    );

I want that if $books is set then the array should be

array
    (
        "limit" => $limit,
        "page_number" => $page,
        "books" => $books
    );

and if the variable $books is not set the array should be

array
(
    "limit" => $limit,
    "page_number" => $page
);

please can anybody help me.