vendredi 27 octobre 2017

How to Use Else If statement in the Script for matching Content

I would first like to tell you as what I am trying to accomplish from this script. I am not very familiar with writing scripts, however I have succesfully tested the below script but now when I try to do some changes in it, I get errors

I want to accomplish the following. 1. The Loop Should run for 100 Messages only. 2. The Data pointer is skipping Messages, and changing labels of much more than 100 Messages. 3. Label to remain as "Pending" where data is not Grabbed, and change to "Done" where it is grabbed.

function GrabFacebookLP() {

var ss = SpreadsheetApp.getActiveSheet();

var label = GmailApp.getUserLabelByName("Pending");
var threads = label.getThreads();
var label2 = GmailApp.createLabel("Done")
for (var i=0; i<100; i++) {

var tmp,
  message = threads[i].getMessages()[0],
  subject = message.getSubject(),
  content = message.getPlainBody(),
  date = message.getDate();


// Get the plain text body of the email message
// You may also use getRawContent() for parsing HTML

// Implement Parsing rules using regular expressions
if (content) {

  tmp = content.match(/Name :\s*([A-Za-z0-9\s]+)(\r?\n)/);
  var username = (tmp && tmp[1]) ? tmp[1].trim() : 'No username';

  tmp = content.match(/Email :\s*([A-Za-z0-9@._-]+)/);
  var email = (tmp && tmp[1]) ? tmp[1].trim() : 'No email';

  tmp = content.match(/Phone number :\s*([A-Za-z0-9\s]+)(\r?\n)/);
  var phone = (tmp && tmp[1]) ? tmp[1] : 'No phone';

  tmp = content.match(/Services :\s*([A-Za-z0-9\s]+)(\r?\n)/);
  var services = (tmp && tmp[1]) ? tmp[1].trim() : 'No Services Chosen/Mentioned';

  ss.appendRow([date, subject, username, email, phone, services]);

} // End if
threads[i].addLabel(label2);
threads[i].removeLabel(label);

} // End for loop

}

If/Else statement in Sass to alter css based on number of items in list

I have a list of items that I am stying with flex. They're stacked in one horizontal row.

I wondered whether it would be possible to write an if/else statement that basically does the following:

If there are 4 or less items in the list, use justify-content: space-between, but if there are 5 or more items, use justify-content: space-evenly.

I'm struggling to get my head around how I would write such a thing to test it and couldn't quite find anything in the Sass docs that covers such a scenario - is something like this possible?

Blogger Conditional Tag

Whats wrong with this Blogger conditional tag? The aim is to show the widget 'HTML6' only on the those posts which come under the label 'News' and not on other posts.

 <b:includable id='main'>     
 <b:if cond='data:post.labels any (label => label.name == "News")'>
 <style>#HTML6 { display: block; }</style>
 <b:if cond='data:title != &quot;&quot;'>
 <h2 class='title'><data:title/></h2>
 </b:if>     
 <b:else/>
 <style>#HTML6 { display: none; }</style>
 </b:if>
 </b:includable>

Got this from a discussion on blogger help forum, but unfortunately, it is not working.

jeudi 26 octobre 2017

'if' statement Error: Expected Declaration Swift

my touch ID code is not working due to the 'if' statement saying that there is an "Expected Declaration"

Please help!

screenshot of ViewController

VBA Code For copying and Pasting with If statement

I need to copy range A1:G200 from one workbook to current workbook (both workbooks active) but I need the code to only copy the rows that meet a certain criteria in column G. Column G only has values ranging from .000 to .999. I need the macro to copy range A1:G200 but only if they are between range .250 and .500 in column G.

I have already created the macro for copying and pasting, which works great but the problem is that I am not too familiar with If statements. Can anyone help me out? Here is what I have so far:

Sub test()

Dim masterWb As Workbook
Dim mySht As Worksheet
Set mySht = ThisWorkbook.ActiveSheet
Set masterWb = Workbooks("JME") 
With masterWb.Worksheets.Add
    .Range("A1:G200").Value = mySht.Range("A1:G200").Value
End With

End Sub

Error when running command inside variable with `if`

We've got a script running the last 2 commands. But it's failing..

$ if [ -d / ]; then echo a; else echo b; fi
a
$ bash -c 'if [ -d / ]; then echo a; else echo b; fi'
a
$ A="bash -c 'if [ -d / ]; then echo a; else echo b; fi'"
$ $A
[: -c: line 0: unexpected EOF while looking for matching `''
[: -c: line 1: syntax error: unexpected end of file

I really wonder why? Thanks!

angular 2 alert box on click event by referencing the value in textbox

hi i want to display an alert box on clicking a button. where the value should be taken from the input text box.

here is the code..

this is the file in app.component.html

`<table>
<tr>
  <td>
      <label>No of Units Used:</label>
  </td>
  <td>
    <input type="number" [(ngModel)]="electricity"> 
  </td>
</tr>
  <input type="checkbox"/>Home <br>
  <input type="checkbox"/>Commercial <br>
  <input type="button" value="Calculate" (click)="return calculate()">
</table>`

now the logic which i wrote in app.component.ts

 `import { Component } from '@angular/core';
  import {ViewChild} from '@angular/core';
  import { NgIf } from '@angular/common';

   @Component({
   selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
   })
   export class AppComponent {
    title = 'Electricity Bill Claculation';
    electricity: any;
     msg: any = 'please enter the units';
  calculate()
   {
    let electricity = this.electricity ? parseFloat(this.electricity):0;

   if (electricity!=null  ) {
    alert('hii');
   }else {
   alert ('you entered the value');
   }

   //return  this.electricity;

   }
    }  `

now i want to use the value of input box and display a alert box where the logic is written in a function in .ts file.

i tried all ways which i know and guys anyone do help me in solving this..

thanks in advance.. and i don't know what are directives to use and i do need to write the logic in .ts file rather than using ngif in enter code here html file.