Showing Syntax error, unexpected variable “$buyValue” - laravel

Showing Syntax error, unexpected variable “$buyValue”
I don't know where I mistake on livewire controller, anyone please help to findout where I mistake here.
$marketData = \Http::get('https://api.binance.com/api/v3/ticker/24hr?symbol='.$lists->pair.'USDT')->json()
$buyValue = $lists->size * $lists->entry_price;
$currentvalue = $lists->size*$marketData['lastPrice'];
$profitloss = $currentvalue - $buyValue;
if($price > $lists->entry_price){
if($lists->order_type == "buy") {
$lists->profit_loss = $profitloss;
}else{
$lists->profit_loss = '-'.$profitloss;
}else{
if($lists->order_type == "buy") {
$profit_loss = $profitloss;
}else{
$profit_loss = substr($profitloss, 1);
}
}
`
Please help

you have missed semicolon ( ; ) at the end of very first line in script you posted.
$marketData = \Http::get('https://api.binance.com/api/v3/ticker/24hr?symbol='.$lists->pair.'USDT')->json()
to
$marketData = \Http::get('https://api.binance.com/api/v3/ticker/24hr?symbol='.$lists->pair.'USDT')->json();

Related

DXL in DOORs to check specific outlink and return the number of occurrences for a certain word

Thanks for any help.
I am currently trying to get a DXL script to return all occurrences for a certain word in the module in the outlink. The outlink "test" will need to be a wild card, if possible, to find all other outlnks that have the word "test" unsure on if that's possible. The attribute in the outlink will be "Compliance". Maybe need a while loop?
Link outlnk
string tmn = ""
string Status = ""
int Count = 0
for outlnk in obj-> "*" do
{
tmn = fullName source(outlnk)
Object tgt = source(outlnk)
if(matches("Test", tmn))
{
Status = tgt."Compliance"
if (Status == "Compliant"){
Count++
}
}
}
display Count""
I tried to get the above code to work with the below while loop. But can not figure out the correct syntax.
Regexp Check = regexp2 "Compliant"
while (!null Status && Check Status)
{ Status = Status[end 0 + 1:]
Count++
}

Oracle Hyperion planning function #Return not working as should

I am trying to use function #RETURN in the calculation script in Oracle planning. It should return error message "Please check this again" if "SGAseason" is 1, otherwise should give value 100 to "SGAseasonvalid". By now it returns error message in BOTH cases. Anyone know what is the issue / how to go around?
FIX("FY18" AND "Mar")
"SGAseasonvalid" (
IF("SGAseason" == 1 )
#RETURN("Please check this again", ERROR);
ELSEIF("SGAseason" <> 1 )
100;
ENDIF)
ENDFIX
You can use groovy for returning error messages:
boolean flag = false;
def mbUs = messageBundle( ["validation.forceNegetive": errorMessage
]);
def mbl = messageBundleLoader(["en" : mbUs]);
if(flag == true){
throwVetoException(mbl, "validation.forceNegetive");
}

explode comma from an array value in codeigniter

I want to explode coma from an array value.
My code is.
$to_ids_string = "";
$to_id = $this->input->post('to');
for ($r = 0; $r < count($this->input->post('to')); $r++) {
if ($to_ids_string != "") {
$to_ids_string = $to_ids_string . "," . $to_id[$r];
} else {
$to_ids_string = $to_id[$r];
}
}
echo $to_ids_string;
$a = explode(',', $to_ids_string);
foreach ($a as $item) {
echo("<li>$item</li>");
exit;
}
when i echo $to_ids_string it will return 2,3 but when i loop in foreach it only return 2 not show 3.
Because of your exit, if you use exit like that, then it is the end of your program and it doesn't echo anymore.
You forget to remove exit; from foreach loop. When you write exit, execution of your code stops. Hence you are not getting desired output.
Happens due to exit.
Please remove exit from your code.

Making a game with 4 possible answer buttons

I am new to ActionScript-3 and I am attempting to make a game to learn more.
For every picture that is displayed I want there to be 4 choices (buttons) and only one of them to be the correct one. But how can I make it so that the text from the buttons will be random.
As you can see I've made it so the 4th button is always the correct answer. I don't want to make all this thing for every picture that is displayed...to much pointless code.
Can anybody help me? If you need extra information I will gladly provide it.
var k:int;
for(k=1;k<=3;k++)
{
GAME.variante.buttonMode=true;
GAME.variante.addEventListener(MouseEvent.MOUSE_OVER,mouse_over_variante);
GAME.variante.addEventListener(MouseEvent.MOUSE_OUT,mouse_out_variante);
GAME.variante.varianta_corecta.addEventListener(MouseEvent.CLICK,variante);
GAME.variante.varianta_gresita1.addEventListener(MouseEvent.CLICK,variante_gresiteunu);
GAME.variante.varianta_gresita2.addEventListener(MouseEvent.CLICK,variante_gresitedoi);
GAME.variante.varianta_gresita3.addEventListener(MouseEvent.CLICK,variante_gresitetrei);
GAME.varianta1.text = "Cameleon";
GAME.varianta2.text = "Snake";
GAME.varianta3.text = "Frog";
GAME.varianta4.text = "Snail";
function variante_gresiteunu(e:MouseEvent){
if (varianta_gresita_apasata1 == 1){
totalScore -= score_variante_gresite;
GAME.text1.text = totalScore;
varianta_gresita_apasata1 = 2;
}
}
function variante_gresitedoi(e:MouseEvent){
if (varianta_gresita_apasata2 == 1){
totalScore -= score_variante_gresite;
GAME.text1.text = totalScore;
varianta_gresita_apasata2 = 2;
}
}
function variante_gresitetrei(e:MouseEvent){
if (varianta_gresita_apasata3 == 1){
totalScore -= score_variante_gresite;
GAME.text1.text = totalScore;
varianta_gresita_apasata3 = 2;
}
}
}
GAME.extra_points.visible = false;
function variante (e:MouseEvent) {
if (GAME.stichere.sticker1.currentFrame == (1)){
GAME.extra_points.visible = true;
GAME.extra_points.plus_ten1.gotoAndPlay(1);
}
//go to great job screen
GAME.greatJob.stars.gotoAndPlay(1);
GAME.greatJob.visible = true;
}
function mouse_over_variante (e:MouseEvent) {
trace(e.target.name);
e.target.gotoAndPlay(1);
}
function mouse_out_variante (e:MouseEvent) {
e.target.gotoAndStop(1);
}
You like to have 4 images and they will be tested right?
The text below the images will be randomness. I saw your code and I
confess I was confused. I made a different one.
I undestand that this code is a little diferent of what you ask, but i think it will > give you some new ideas and help you on your app...
//start button added on the sceen named f3toc. I give a function name for him f3roll.
f3toc.addEventListener(MouseEvent.CLICK,f3roll);
function f3roll(e:MouseEvent):void{
//creating variables for the picture.
var bola:Number
var quadrado:Number
var pentagono:Number
//Here is just a randomization code, you can change it to the what you want to use after the =
bola = Math.ceil(Math.random() * 10);
pentagono = Math.ceil(Math.random() * 10);
f3res1_txt.text = String (bola + 8 + 8);
f3res2_txt.text = String(bola - 1 + bola);
f3res3_txt.text = String (pentagono + 10 - bola);
//converting number to string so we can put tem into the text fields.
var pentagonotring:String = pentagono.toString();
var bolastring:String = bola.toString();
//function to check wen the name is correct. each wrong do nothing and every correct add 1 to a variable, in the end wen this variable reach 3 it does something.
f3check_bnt.addEventListener (MouseEvent.CLICK, f3check);
function f3check (e:MouseEvent):void{
if (f3inp2_txt.text == pentagonotring){
f3ver_ext2.text = "Correct"
} else {f3ver_ext2.text = "Wrong";}
if (f3inp1_txt.text == bolastring){
f3ver_ext1.text = "Correct"
}else {f3ver_ext1.text = "Wrong";}
// function to check wen the variable pass reach 3
pass = 0;
if (f3ver_ext1.text == "Correct"){
pass++
}
if (f3ver_ext2.text == "Correct"){
pass++
if (pass == 3){
nextFrame();
}}}}

String: replacing spaces by a number

I would like to replace every blank spaces in a string by a fixnum (which is the number of blank spaces).
Let me give an example:
s = "hello, how are you ?"
omg(s) # => "hello,3how10are2you1?"
Do you see a way (sexy if possible) to update a string like this?
Thank you Rubists :)
gsub can be fed a block for the "replace with" param, the result of the block is inserted into place where the match was found. The argument to the block is the matched string. So to implement this we capture as much whitespace as we can ( /\s+/ ) and feed that into the block each time a section is found, returning that string's length, which gets put back where the whitespace was originally found.
Code:
s = "hello, how are you ?"
res = s.gsub(/\s+/) { |m| m.length }
puts res
# => hello,3how10are2you1?
it is possible to do this via an array split : Javascript example
var s = "hello, how are you ?";
function omg( str ) {
var strArr = str.split('');
var count = 0;
var finalStr = '';
for( var i = 0; i < strArr.length; i++ ) {
if( strArr[i] == ' ' ) {
count++;
}
else
{
if( count > 0 ) {
finalStr += '' + count;
count = 0;
}
finalStr += strArr[i];
}
}
return finalStr
}
alert( omg( s ) ); //"hello,3how10are2you1?"
Lol, this seems the best it can be for javascript

Resources