Monday, 31 August 2020

SNS notification

 https://medium.com/@todd_10692/creating-push-notification-job-with-sns-lambda-and-node-js-3fcf3903e205 

Friday, 28 August 2020

Java ENUM ecxample

 // Java program to demonstrate how values can 

// be assigned to enums. 

enum TrafficSignal 

// This will call enum constructor with one 

// String argument 

RED(1,"STOP"), GREEN(2,"GO"), ORANGE(3,"SLOW DOWN"); 


// declaring private variable for getting values 

private String action; 

  private Integer code;


// getter method 

public String getAction() 

return this.action; 

      

  public Integer getCode(){

  return this.code;

  }


// enum constructor - cannot be public or protected 

private TrafficSignal(Integer code,String action) 

      System.out.println("code"+code+"action"+action);

this.action = action; 

      this.code=code;


// Driver code 

public class EnumConstructorExample 

public static void main(String args[]) 

// let's print name of each enum and there action 

// - Enum values() examples 

TrafficSignal[] signals = TrafficSignal.values(); 


for (TrafficSignal signal : signals) 

// use getter method to get the value 

System.out.println("name : " + signal.name() + 

" action: " + signal.getAction() +"code"+signal.getCode()); 


Wednesday, 26 August 2020

node js HTTP call

 var request = require("request");

const bodydata=JSON.stringify({"company_id":"","company_name":"postman1","company_slug":"postman1","logo_url":"","country_id":6,"state_id":0,"city":"","location_id":"","location_name":"HEADQUARTERS","tz_id":55,"industry":"","send_monthly_report":false,"is_ethnicity":false,"paywall_status":"inactive","paywall_start_date":"2020-08-27","account_type":"TRIAL","csr_name":"","csr_email":"","sdr_name":"","sdr_email":""});
var options = { method: 'POST',
url: 'https://xxx/api/rest/v1.6/company/add_company',
headers:
{ 'accept-language': 'en-US,en;q=0.9',
referer: '',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
origin: 'https://xxx.co',
'session-token': '',
'user-type': 'manager',
platform: 'admin',
'api-key': '',
accept: 'application/json, text/plain, */*',
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36',
locale: 'en',
'api-secret': '',
authority: 'dev' },
body:bodydata};

request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});

javascript tutorial

 https://www.geeksforgeeks.org/javascript-tutorial/

Convert array to array list and and get impact

 import java.util.ArrayList;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
class Main {
public static void main(String[] args) {
String[] array = {"a", "b", "c", "d", "e"};

//Method 1
// List<String> list = Arrays.asList(array);
// list.add("p");
List<String> list1 = new ArrayList<String>();
Collections.addAll(list1, array);
list1.add("p");
System.out.println(list1);
//System.out.println(list);
System.out.println("Hello world!");
}
}

Thursday, 13 August 2020

timezone wise get expired company list

 ----------------------------------------------------------------------------------------------------------

SELECT 

    sh_company.company_id,

    sh_timezone.tz_name,

    sh_timezone.tz_id,

    sh_timezone.tz_unit_hm,

    CONVERT_TZ(sh_company.paywall_end_date,

            sh_timezone.tz_name,

            sh_timezone.tz_name) AS time,

    CONVERT_TZ(sh_company.paywall_end_date,

            'utc',

            sh_timezone.tz_name) AS time1,

    sh_company.paywall_end_date

FROM

    sh_company

        LEFT JOIN

    sh_location ON sh_location.company_id = sh_company.company_id

        LEFT JOIN

    sh_timezone ON sh_timezone.tz_id = sh_location.tz_id

WHERE

    paywall_status = 'INACTIVE'

        AND CONVERT_TZ(paywall_end_date,

            sh_timezone.tz_name,

            sh_timezone.tz_name) <= CONVERT_TZ('2020-08-14 23:59:59',

            'utc',

            sh_timezone.tz_name)

        AND paywall_end_date != '0000-00-00 00:00:00'

        AND name != '1Huddle'

        AND sh_location.head_location = 1;

-------------------------------------------------------------------------------------------------------------