is it possible, to call a procedure within a IF Statement?
IF(1=1, call GetAllFemiFAUFCount(1005876054),'')
many thanks
is it possible, to call a procedure within a IF Statement?
IF(1=1, call GetAllFemiFAUFCount(1005876054),'')
many thanks
I want to know how If Else conditions are written in XML, can anyone please help me ? Below is the code.
<quer:projection alias="PF" xmlns:quer="http://www.taleo.com/ws/integration/query">
<quer:switchByCriterion>
<quer:cases>
<quer:case>
<quer:containsIgnoreCase>
<quer:field path="CurrentOffer,OfferLetter,TemplateName"/>
<quer:string>Offer Letter</quer:string>
</quer:containsIgnoreCase>
<IF>
<Condition>
<Condition PF>360000</Condition>
</Condition>
<Statements>
"HRA" = 600
</Statements>
</IF>
<ELSE>
<Statements></Statements>
</ELSE>
</quer:case>
</quer:cases>
</quer:switchByCriterion>
</quer:projection>
I want to write a logic something like If values in field PF which is defined as Alias in first line is 100 then create a new column/field in output by name of HRA and that value should be 200. The above query is not valid and I am not able to understand why ?
I am using this XML in Taleo. https://docs.oracle.com/cloud/18a/taleo/OTCCU/_advancedqueries.htm#OTCCUid08ATA0RF05Z
Please let me know how to proceeds, any help would be appreciated.
Thanks, Shivam
I have a script
$data = file_get_contents('http://my_example_link/data.xml');
and if http://my_example_link/data.xml is showing error
Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
I would like to create condition if the link is showing error above I will showing alert notification using bootstrap panel.
can I doing like that ?
try {
$results = $db->prepare("INSERT INTO Form_Data
(first_name, last_name, email, gender, comment)
VALUES
(?,?,?,?,?)
");
$results->bindParam(1,$fname,PDO::PARAM_STR);
$results->bindParam(2,$lname,PDO::PARAM_STR);
$results->bindParam(3,$email);
$results->bindParam(4,$gender);
$results->bindParam(5,$comment,PDO::PARAM_STR);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$results->execute();
}
} catch (Exceptions $e) {
echo "Unable to insert data";
exit;
}
Do I need to use the if($_SERVER["REQUEST_METHOD] == "POST") statement? Or can I just use $results->execute();? And why?
I have a business logic library with a method that is designed to run asynchronously, passing false to be used in an if statement. If run asynchronously, it's fine:
const permissions = new PermissionProvider(userId,appId);
if(await permissions.ifAllowed('invalid action', itemID)){
// This code is not reachable.
}
export class PermissionProvider {
...
public async ifAllowed(action: string, itemId?: string): Promise<boolean> {
return await db.query(params)
.then(() => { return false; }
}
However, I'm concerned someone may accidentally run the code synchronously:
if(permissions.ifAllowed('invalid action', itemID)){
// This code executes because asynchronous functions return a Promise,
// and objects evaluate to true.
}
Simply documenting that the API must be run with the async/await seems precarious. This is particularly bad because it may not be obvious that the end user will be allowed to do pretty much anything if the async keyword is omitted.
If I return a primitive boolean instead, the async code then returns undefined because it's coming from the database as a Promise.
Is there a good workaround to either enforcing async calls on the consumer of the API, or preventing the if statement from evaluating true?
I tried throwing an uncaught error, but it still executes the code because the error is thrown after the if statement is already executed.
I'm trying to store the 2nd argument passed in command line (i.e the argument after 'make') in a variable called NAME, and then use it to do stuff. If there is no 2nd argument then by default NAME = a .
Why doesn't it work ?
NAME = a
ifneq ($(strip $(NAME)),)
$(NAME) = $(shell $2)
endif
$(NAME): $(NAME).c
@$(CC) $(CFLAGS) $< -o $@ && ./$(NAME)
# ... and do other things with NAME
Here is a simple game code also known as TicTacToe. It goes to GUI and gives cells with X or O -s. What I want to do is to change each array element (or each tile/cell in GUI) to numbers from 1 to 9 (with different colours and so on, but that's nit the issue, I can handle later). There are only two options in the code - X and O (as it is TicTacToe). I guess I need to change/add something related to token, but how and what - have no idea, since I just started. Literally, few days. No kidding. So how to make numbered tiles instead and would it possible to make it without changing the approach in this example?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
/**
* JFrame to hold TicTacToe board.
*/
public class TicTacToeFrame extends JFrame
{
// Indicate whose turn it is
private char whoseTurn = 'X';
private boolean gameOver = false;
// Create cell grid
private Cell[][] cells = new Cell[3][3];
// Create a status label
JLabel jlblStatus = new JLabel("X's turn to play");
/**
* No-argument Constructor
*/
public TicTacToeFrame()
{
// Panel to hold cells
JPanel panel = new JPanel(new GridLayout(3, 3, 0, 0));
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
panel.add(cells[i][j] = new Cell());
panel.setBorder(new LineBorder(Color.red, 1));
jlblStatus.setBorder(new LineBorder(Color.yellow, 1));
add(panel, BorderLayout.CENTER);
add(jlblStatus, BorderLayout.SOUTH);
}
/**
* Determine if game board is full.
* @return True, if game board is full. Otherwise, false.
*/
public boolean isFull()
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
if (cells[i][j].getToken() == ' ')
return false;
return true;
}
/**
* Determines if a given token has won.
* @param token Token to test for winning
* @return True, if the token has won. Otherwise, false.
*/
public boolean isWon(char token)
{
// check rows
for (int i = 0; i < 3; i++)
if ((cells[i][0].getToken() == token)
&& (cells[i][1].getToken() == token)
&& (cells[i][2].getToken() == token))
{
return true;
}
// check columns
for (int j = 0; j < 3; j++)
if ((cells[0][j].getToken() == token)
&& (cells[1][j].getToken() == token)
&& (cells[2][j].getToken() == token))
{
return true;
}
// check diagonal
if ((cells[0][0].getToken() == token)
&& (cells[1][1].getToken() == token)
&& (cells[2][2].getToken() == token))
{
return true;
}
if ((cells[0][2].getToken() == token)
&& (cells[1][1].getToken() == token)
&& (cells[2][0].getToken() == token))
{
return true;
}
return false;
}
/**
* Defines a cell in a TicTacToe game board.
*/
public class Cell extends JPanel
{
// token of this cell
private char token = ' ';
/**
* Constructor
*/
public Cell()
{
setBorder(new LineBorder(Color.black, 1));
addMouseListener(new MyMouseListener());
}
/**
* Gets the token of the cell.
* @return The token value of the cell.
*/
public char getToken()
{
return token;
}
/**
* Sets the token of the cell.
* @param c Character to use as token value.
*/
public void setToken(char c)
{
token = c;
repaint();
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
if (token == 'X')
{
g.drawLine(10, 10, getWidth() - 10, getHeight() - 10);
g.drawLine(getWidth() - 10, 10, 10, getHeight() - 10);
}
else if (token == 'O')
{
g.drawOval(10, 10, getWidth() - 20, getHeight() - 20);
}
}
private class MyMouseListener extends MouseAdapter
{
@Override
public void mouseClicked(MouseEvent e)
{
if (gameOver)
return;
// if the cell is empty and the game is not over
if (token == ' ' && whoseTurn != ' ')
setToken(whoseTurn);
// Check game status
if (isWon(whoseTurn))
{
jlblStatus.setText(whoseTurn + " won! Game over!");
whoseTurn = ' ';
gameOver = true;
}
else if (isFull())
{
jlblStatus.setText("Tie game! Game over!");
whoseTurn = ' ';
gameOver = true;
}
else
{
whoseTurn = (whoseTurn == 'X') ? 'O' : 'X';
jlblStatus.setText(whoseTurn + "'s turn.");
}
}
} // end class MyMouseListener
} // end class Cell
} // end class TicTacToeFrame
Here is the MainClass
import javax.swing.JFrame;
public class TicTacToe
{
public static void main(String[] args)
{
JFrame ticTacToe = new TicTacToeFrame();
ticTacToe.setTitle(TicTacToe Game");
ticTacToe.setSize(600, 600);
ticTacToe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ticTacToe.setLocationRelativeTo(null);
ticTacToe.setVisible(true);
}
} // end class TicTacToe