Snippets Collections
// Reviewer DL

def cfName = getFieldByName("Reviewer DL")
cfName.clearError()
String cfNameValue = cfName.getValue()
if (cfNameValue.endsWith("-rev")) return
if ((cfNameValue.endsWith(".rev@email.com")))return
if (cfNameValue.length() > 1)
    cfName.setError("should end with .rev@email.com or -rev without @email.com")
// DMP Tools Form

def cfName = getFieldByName("Communication Email")
cfName.clearError()
String cfNameValue = cfName.getValue()

// Only proceed if the field has a non-empty value
if (cfNameValue && cfNameValue instanceof String && cfNameValue.trim()) {
    // Check if the value ends with the required domains
    if (cfNameValue.endsWith("@acme.com") || cfNameValue.endsWith("@acmeTeam.com")) {
        return // No error if the value matches the required domains
    } else {
        // Set error if the conditions are not met
        cfName.setError("The email should end with @acme.com or @acmeTeam.com")
    }
}
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.ApplicationUser

// Define the issue keys you want to search for
def issueKeys = ["KEY-123", "KEY-124", "KEY-125"]
 
// change keys as needed

IssueManager issueManager = ComponentAccessor.getIssueManager()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def userManager = ComponentAccessor.getUserManager()

// Replace 'CustomFieldName' with the name of your custom field
CustomField customField = customFieldManager.getCustomFieldObjectsByName("Product Owner")[0]

issueKeys.each { key ->
    Issue issue = issueManager.getIssueByCurrentKey(key)
    
    if (issue) {
        ApplicationUser user = userManager.getUserByName("john_Doe") // Replace 'caselc' with the username of the user you want to set

        if (user) {
            issue.setCustomFieldValue(customField, user)
            issueManager.updateIssue(
                ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), 
                issue, 
                com.atlassian.jira.event.type.EventDispatchOption.DO_NOT_DISPATCH, 
                false
            )
        } else {
            println "User not found for key $key"
        }
    } else {
        println "Issue not found for key $key"
    }
}
//Add labels in bulk witth issue key

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.label.Label
import com.atlassian.jira.issue.label.LabelManager

// Define the issue keys you want to search for
def issueKeys = [key-xxxx, key-xxx2]



IssueManager issueManager = ComponentAccessor.getIssueManager()
LabelManager labelManager = ComponentAccessor.getComponent(LabelManager.class)

issueKeys.each { key ->
    Issue issue = issueManager.getIssueByCurrentKey(key)

    if (issue) {
        Set<Label> existingLabels = issue.getLabels()
        boolean hasDevLabel = existingLabels.find { it.getLabel().equalsIgnoreCase("DEV") }

        // Add 'DEV' label if it doesn't already exist
        if (!hasDevLabel) {
            labelManager.addLabel(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(), issue.getId(), "DEV", false)
        }
    }
}
import apexMethodName from '@salesforce/apex/Namespace.Classname.apexMethodReference';
@wire(apexMethodName, { apexMethodParams })
propertyOrFunction;
import Id from '@salesforce/user/Id';
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.Permissions

def projectManager = ComponentAccessor.getProjectManager()
def permissionManager = ComponentAccessor.getPermissionManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def projects = projectManager.getProjectObjects().findAll { project ->
    permissionManager.hasPermission(Permissions.BROWSE, project, user)
}

log.info("Number of accessible projects: ${projects.size()}")

projects.each { project ->
    def projectLead = project.getProjectLead()
    log.info("Project Key: ${project.getKey()}, Project Name: ${project.getName()}, Project Lead: ${projectLead?.getDisplayName() ?: 'No Lead Assigned'}")
}
import com.atlassian.jira.component.ComponentAccessor

def projectManager = ComponentAccessor.getProjectManager()
def userManager = ComponentAccessor.getUserManager()

def projects = projectManager.getProjectObjects()

log.info("Number of projects: ${projects.size()}")

projects.each { project ->
    def projectLead = project.getProjectLead()
    log.info("Project Key: ${project.getKey()}, Project Name: ${project.getName()}, Project Lead: ${projectLead?.getDisplayName() ?: 'No Lead Assigned'}")
}
#include <iostream>

using namespace std;

// here basically i am just storing the last element in a temporary variable and looping from last element to 2nd element and assigning last 2nd element to last element and finally when loop is over i am just assigning back the temp variable to 1st element

void rotateby1(int arr[], int n){
	int temp = arr[n-1];
    
    for(int i = n-1; i>0; i--){
    	arr[i] = arr[i-1];
    }
    arr[0] = temp;
}

// here i took two pointers to 1st and last element, and swapping the 1st with last element but last element is freezed and only the 1st element is being incremented.

void rotatetwopointer(int arr[], int n){
	int l = 0;
    int r = n-1;
    
    for(int i=0; i<n-1; i++){
    	swap(arr[i], arr[r]);
    }
}

//here I am rotating the 1st n-k element and then rotating the whole array

void rotatereverse(int arr[], int n, int k){
	
    for(int i=0, j=n-k-1; i<j; i++, j-- ){
    	int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
    
    for(int i=0, j=n-1; i<j; i++, j--){
    	int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
}

int main() {
	int arr[] = {1, 2, 3, 4, 5};
    int n = sizeof(arr)/sizeof(arr[0]);
  	
    rotatereverse(arr,n,1);
    for(int i=0; i<n; i++){
    	cout<<arr[i];
    }
  return 0;
}
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options');
function mycustom_mainwp_child_branding_init_options( $opts ) {
if (is_array($opts) && isset($opts['hide'])) {
      $opts['hide'] = '';
}
return $opts;
}
OA1586918418	22B81A05R7	ABHI	AAGANTHAM
OA1586918419	22B81A05R8	ABHINAV	DANTHALA
OA1586918420	22B81A05R9	ABHINAY	ALLAM
OA1586918421	22B81A05S0	ABHISHEK	ALLI
OA1586918422	22B81A05S1	AKHILESH	CHIKATLA
OA1586918423	22B81A05S2	AKSHITHA	ELMELA
OA1586918424	22B81A05S3	AKSHITHA	MAMIDI
OA1586918425	22B81A05S4	ALEKHYA	KADEMAMI
OA1586918426	22B81A05S5	ALOK	GUNDE
OA1586918427	22B81A05S6	BARATHCHANDRA	PONUGOTI
OA1586918454	22B81A05S7	RANKAWAT	CHETHNA
OA1586918455	22B81A05S8	DEVENDHAR SAI	POLISHETTI OA1905313655
OA1586918475	22B81A05S9	DINESH REDDY	PISATI
OA1586918476	22B81A05T0	ESHA	THALLAPUREDDY
OA1586918477	22B81A05T1	GAYATHRI	GARINE
OA1586918504	22B81A05T2	GUNASAI SUDHEERTHI	BANGARU
OA1586918505	22B81A05T3	HARDHIK	RACHURI
OA1586918532	22B81A05T4	HARI	NARAPONGU
OA1586918533	22B81A05T5	GARI HARSHITH RAO	KAULAMMA
OA1586918534	22B81A05T6	CHERUKURI	HASHITHA
OA1586918535	22B81A05T7	JAIDEEP	KURNI
OA1586918536	22B81A05T8	KUMARA SATYA SAI	CHINNALA
OA1586918537	22B81A05T9	LAKSHMI MEGHANA	ARASADA
OA1586918538	22B81A05U0	MAHESH KUMAR	MUTHYALA
OA1586918539	22B81A05U1	NAREN	GOWRU
OA1586918540	22B81A05U2	NEHAL SOHEL	MOHAMMAD
OA1586918541	22B81A05U3	PRANEETH REDDY	BOOTHPUR
OA1586918542	22B81A05U4	PRAVEEN KUMAR	GANGARAM
OA1586918543	22B81A05U5	PUZAA	NIZAMPATNAM
OA1586918544	22B81A05U6	RAGHU HARAN GOUD	NIMMAGUDEM
OA1586918572	22B81A05U7	RAKESH	KASTHURI
OA1586918573	22B81A05U8	RASHMITHA	MANCHI
OA1586918574	22B81A05U9	RISHITHA REDDY	RAMIDI
OA1586918627	22B81A05V0	RISHITHA REDDY	RAMIDI
OA1586918628	22B81A05V1	SAI CHANDHU	GADDAM
OA1586918629	22B81A05V2	SAI KEERTHAN REDDY	CHINNINTI
OA1586918630	22B81A05V3	SAI MANISH	PANDIRI
OA1586918708	22B81A05V4	SAI SUHAS REDDY	PANNALA
OA1586918709	22B81A05V5	SAI VARSHITH	VEMULA
OA1586918710	22B81A05V6	SANA	SHAIK
OA1586918711	22B81A05V7	SANJINI	VEMULA
OA1586918712	22B81A05V8	SANTHOSH	PATHULOTHU
OA1586918731	22B81A05V9	SHERI
OA1586918758	22B81A05W0	SHIVA SHANKAR	GADAGOJU
OA1586918785	22B81A05W1	SHREYA	TIRUNAGARI
OA1586918786	22B81A05W2	SIRI	DEVOJU
OA1586918787	22B81A05W3	MOHAMMED SOHAIB	SHAIK
OA1586918788	22B81A05W4	SRI PAVANI	RACHAKONDA
OA1586918789	22B81A05W5	SRINITH	TAPPA
OA1586918790	22B81A05W6	SWAPNA	KORRA
OA1586918791	22B81A05W7	SWETHA SRI	PERAMALLA
OA1586918792	22B81A05W8	TEJA	G M
OA1586918793	22B81A05W9	TEJAA KARTHIKEYA GOUD	TALLA
OA1586918794	22B81A05X0	TEJASHWINI	GONDLE
OA1586918795	22B81A05X1	THANMAI	REPAKULA
OA1586918796	22B81A05X2	TWISHA REDDY	KAYITI
OA1586918797	22B81A05X3	VAMSHI	SHANIGALA
OA1586918798	22B81A05X4	VAMSHI KRISHNA	PRATHAPAGIRI
OA1586918799	22B81A05X5	VAMSHI REDDY	BARDA
OA1586918800	22B81A05X6	VENKATA SRIKARAN JYOTHIRADITHYA	DAMARAJU
OA1586918845	22B81A05X7	VENKATESHWAR REDDY	MALLYALA
OA1586918846	22B81A05X8	VIBHAVESH	ARAVA
OA1586918847	22B81A05X9	VIJAYA LAKSHMI	JAYASURYA
Have dataset single , and one column should represent the data or identifier of both the columns in single column .And that column would be used to represent the segmentation in graph.
//////// BFS IN GRAPHS /////////////

/// breadth first = tranverse technique to printing by edges connected 
 // APPROACH = track the vidited node , queue data structure willl be used ,  

#include <iostream>
#include <unordered_map>
#include <list>
#include <queue> // Include for using the queue data structure
using namespace std; // Allows us to use standard library names without the std:: prefix

// Class to represent a graph
class Graph {
public:
    // Adjacency list representation of the graph using an unordered_map
    unordered_map<int, list<int>> adj;

    // Function to add an edge to the graph
    void addEdge(int u, int v) {
        // Add an edge from vertex u to vertex v
        adj[u].push_back(v);
        // For undirected graph, add an edge from vertex v to vertex u
        adj[v].push_back(u);
    }

    // Function to perform BFS traversal from a given starting node
    void bfs(int start) {
        // Create a queue to help with the BFS traversal
        queue<int> q;
        // Create a map to keep track of visited nodes
        unordered_map<int, bool> visited;

        // Start by marking the starting node as visited and enqueue it
        visited[start] = true; // Mark the starting node as visited
        q.push(start); // Enqueue the starting node

        // Continue the BFS until the queue is empty
        while (!q.empty()) {
            // Dequeue a vertex from the queue and print it
            int node = q.front(); // Get the front node of the queue
            cout << node << " "; // Print the current node
            q.pop(); // Remove the node from the queue

            // Iterate through all the adjacent vertices of the dequeued vertex
            for (int neighbor : adj[node]) {
                // If the neighbor hasn't been visited yet
                if (!visited[neighbor]) {
                    // Mark it as visited and enqueue it
                    visited[neighbor] = true; // Mark the neighbor as visited
                    q.push(neighbor); // Enqueue the neighbor
                }
            }
        }
    }
};

int main() {
    Graph g; // Create a graph object

    // Adding edges to the graph
    g.addEdge(0, 1); // Add edge between vertex 0 and vertex 1
    g.addEdge(0, 2); // Add edge between vertex 0 and vertex 2
    g.addEdge(1, 2); // Add edge between vertex 1 and vertex 2
    g.addEdge(1, 3); // Add edge between vertex 1 and vertex 3
    g.addEdge(2, 4); // Add edge between vertex 2 and vertex 4
    g.addEdge(3, 4); // Add edge between vertex 3 and vertex 4

    // Perform BFS starting from vertex 0
    cout << "BFS traversal starting from vertex 0: ";
    g.bfs(0); // Call the BFS function
    cout << endl; // Print a newline for better formatting

    return 0; // Indicate that the program ended successfully
}
import React, { useState, useEffect } from "react";
import { FaMedal } from "react-icons/fa";
import axios from "axios";
import Apis from "../../APIs";
import { useAuth } from "../Auth/AuthContext";
import { useNavigate } from "react-router-dom";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

const Assessment = () => {
  const { user, setUser } = useAuth();
  const navigate = useNavigate();
  const [questions, setQuestions] = useState([]);
  const [answers, setAnswers] = useState([]);
  const [score, setScore] = useState(0);
  const [result, setResult] = useState(false);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);
  const [assessmentRecordId, setAssessmentRecordId] = useState(null);
  const [redirectPage, setRedirectPage] = useState(null);

  const optionLabels = ["A", "B", "C", "D"];

  useEffect(() => {
    const fetchQuestions = async () => {
      try {
        const response = await axios.get(Apis.QUESTION_API);
        const fetchedQuestions = response.data;
        setQuestions(fetchedQuestions);
        setAnswers(fetchedQuestions.map(() => Array(4).fill(null)));
        setLoading(false);
      } catch (err) {
        console.error("Error fetching questions:", err);
        setError("Failed to load questions. Please try again later.");
        setLoading(false);
      }
    };

    fetchQuestions();
  }, []);

  const handleRatingSelect = (qIndex, oIndex, rating) => {
    const newAnswers = [...answers];

    if (newAnswers[qIndex][oIndex] === rating) {
      newAnswers[qIndex][oIndex] = null;
    } else {
      const isRatingUsed = newAnswers[qIndex].some(
        (selectedRating, index) => selectedRating === rating && index !== oIndex
      );

      if (isRatingUsed) {
        toast.error(
          `You have already used rating ${rating} for another option in this question.`
        );
        return;
      }

      newAnswers[qIndex][oIndex] = rating;
    }

    setAnswers(newAnswers);
  };

  const handleSubmit = async () => {
    const incompleteQuestions = questions.some((question, qIndex) =>
      answers[qIndex].some((rating) => rating === null)
    );
  
    if (incompleteQuestions) {
      toast.error("Please Complete all the Assessments");
      return;
    }
  
    setResult(true);
  
    const formattedResponses = questions.map((question, qIndex) => ({
      questionId: question._id,
      ratings: answers[qIndex].map((rating) => ({ rating })),
    }));
  
    const userId = user._id;
  
    const payload = {
      userId: userId,
      responses: formattedResponses,
    };
  
    try {
      const response = await axios.post(Apis.ASSESSMENT_API, payload);
      setAssessmentRecordId(response.data._id);
      fetchAssessmentRecord(response.data._id);
      
     if (user.feedbackStatus === "newUser") {
      const updatedUserData = { feedbackStatus: "feedbackPending" };

      await axios.put(`${Apis.USER_API}/${user._id}`, updatedUserData);
      setUser({ ...user, feedbackStatus: "feedbackPending" });
    }
  } catch (error) {
    console.error("Error submitting assessment:", error);
  }
};
  

  const fetchAssessmentRecord = async (recordId) => {
    try {
      const response = await axios.get(
        `${Apis.ASSESSMENT_API}/getAssessmentRecord/${recordId}`
      );
      const optionStats = response.data.optionStats;
      determineRedirect(optionStats);
    } catch (error) {
      console.error("Error fetching assessment record:", error);
    }
  };
  

  const determineRedirect = (optionStats) => {
    const maxOption = Object.entries(optionStats).reduce(
      (acc, [key, value]) => {
        if (value[1] > acc.count) {
          return { key, count: value[1] };
        }
        return acc;
      },
      { key: null, count: 0 }
    );

    switch (maxOption.key) {
      case 'option1':
        setRedirectPage("/PdfD"); 
        break;
      case 'option2':
        setRedirectPage("/PdfG");
        break;
      case 'option3':
        setRedirectPage("/PdfC");
        break;
      case 'option4':
        setRedirectPage("/PdfS");
        break;
      default:
        setRedirectPage("/dashboard"); 
    }
  };

  const handleOkClick = async () => {
    const fetchUserData = async () => {
      try {
        const response = await axios.get(`${Apis.USER_API}/${user._id}`, {
          headers: {
            Authorization: `Bearer ${localStorage.getItem("token")}`,
          },
        });
        const updatedUserData = response.data;
        setUser(updatedUserData);
      } catch (error) {
        console.error("Error refreshing user data:", error);
      }
    };
  
    const updatePdfAccess = async () => {
      try {
        const pdfName = redirectPage.replace("/", "");
  
        await axios.put(
          `${Apis.USER_API}/${user._id}`,
          { pdfAccess: [...user.pdfAccess, pdfName] },
          {
            headers: {
              Authorization: `Bearer ${localStorage.getItem("token")}`,
            },
          }
        );
  
        await fetchUserData();
      } catch (error) {
        console.error("Error updating pdfAccess:", error);
        toast.error("Failed to update PDF access. Please try again later.");
      }
    };
  
    await updatePdfAccess();
    navigate(redirectPage);
  };
  

  if (loading) {
    return (
      <div className="min-h-screen w-full flex items-center justify-center bg-primary-gradient">
        <l-infinity
          size="200"
          stroke="4"
          stroke-length="0.15"
          bg-opacity="0.1"
          speed="1.3"
          color="white"
        ></l-infinity>
      </div>
    );
  }

  if (error) {
    return (
      <section className="min-h-screen w-full bg-primary-gradient flex items-center justify-center">
        <div className="text-white text-2xl">{error}</div>
      </section>
    );
  }

  return (
    <>
      <section className="min-h-screen w-full bg-primary-gradient flex flex-col items-center justify-center p-5">
        {result ? (
          <div className="min-h-[400px] w-80 md:w-[400px] rounded-lg bg-secondary p-5 flex items-center justify-center flex-col gap-5">
            <h2 className="text-3xl text-center">
              Thank you for giving the assessment
            </h2>
            <h2 className="text-3xl text-center">
              To See Your Result Click Ok
            </h2>
            <FaMedal className="text-4xl text-yellow-400" />
            <button
              onClick={handleOkClick}
              className="h-10 w-full rounded-lg bg-green-500 text-white hover:bg-green-700"
            >
              Ok
            </button>
          </div>
        ) : (
          <>

          <div className=" w-screen max-w-[90%] md:max-w-[900px] rounded-lg bg-secondary p-5">
            <h2 className="font-bold text-xl mb-5">
              Know Your Competency (KYC) - Assessment on DGCS Leadership Style :
              -{" "}
            </h2>
            <h2 className="font-semibold text-base mb-5">
              Please choose your rating based on your preference. Rank 1 - Most
              Agreed; 2 - Agreed; 3 - Lesser agreed; 4 - Least Agreed. -{" "}
            </h2>
            <h2 className="font-semibold text-base mb-5">
              only one option should be given for each rank for each questions.
              For the question one - if you give rank 4 for 1st option, the same
              rank 4 cannot be given for the other 3 options : -{" "}
            </h2>
            </div>

            <div className=" w-screen max-w-[90%] md:max-w-[900px] rounded-lg bg-secondary p-5 mt-10">
            {questions.map((q, qIndex) => (
              <div key={q._id} className="mb-6">
                <h3 className="font-semibold text-lg mb-3">
                  {qIndex + 1}. {q.mainQuestion}
                </h3>
                <div className="flex flex-col gap-3">
                  {q.options.map((option, oIndex) => (
                    <div
                      key={option._id}
                      className="items-start justify-start flex flex-col md:flex-row md:items-center md:justify-between "
                    >
                      <span>{`(${optionLabels[oIndex]}) ${option.option}`}</span>
                      <div className="flex gap-10">
                        {[1, 2, 3, 4].map((rating) => {
                          const isRatingUsed = answers[qIndex].some(
                            (selectedRating, index) =>
                              selectedRating === rating && index !== oIndex
                          );

                          return (
                            <button
                              key={rating}
                              onClick={() =>
                                handleRatingSelect(qIndex, oIndex, rating)
                              }
                              className={`w-8 h-8  rounded-full border-2 flex items-center justify-center ${
                                answers[qIndex][oIndex] === rating
                                  ? "bg-green-500 text-white"
                                  : isRatingUsed
                                  ? "bg-gray-300 text-white" 
                                  : "border-gray-300 hover:bg-green-400"
                              }`}
                              disabled={isRatingUsed} 
                            >
                              {rating}
                            </button>
                          );
                        })}
                      </div>
                    </div>
                  ))}
                </div>
              </div>
            ))}
            <div className="mt-5 flex justify-end">
              <button
                onClick={handleSubmit}
                className="h-10 w-32 rounded-lg bg-green-500 text-white hover:bg-green-700"
              >
                Submit
              </button>
            </div>
          </div>
          </>

        )}
      </section>
      <ToastContainer />
    </>
  );
};

export default Assessment;
sudo groupadd groupname
article:first-child {
//code
}

article:last-child {
//code
}

article:nth-child([index of element]) {
//code
}
[#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

//i gave an array as reference and two pointers for left right index of array, set a base condition that is left index is greater than right then return else swap value at left and right and I am using this funtion recirsively ustil the base condition meets by increasing and decreasing left and right index

void reverserecursive(vector<int>&arr, int l, int r){
	while(l>=r) {
    return;
    }
    swap(arr[l],arr[r]);
    reverserecursive(arr, l+1, r-1);
}

//here i just iterated first half and swapped with corresponding elements from the end.

void reverseusingswap(vector<int>&arr){
	int n = arr.size();
    for(int x=0; x<n/2; x++){
    swap(arr[x],arr[n-x-1]);
    }
}

//here i took two pointers for left and right index and used swap to swap the left and right index value by increasing and decreasing the index elements

void reversetwopointer(vector<int>&arr, int l, int r){
    
    while(l<=r){
    swap(arr[l], arr[r]);
    l++;
    r--;
    }
}

// here I used an inbuilt method reverse and reversed the elements for this algorithm header should be added

void reverseinbuiltmethod(vector<int>&arr){
	reverse(arr.begin(), arr.end());
}


int main() {
	vector<int>arr = {1,2,3,4,5};
 
	
    reverseinbuiltmethod(arr);
 	for(int i = 0; i< arr.size(); i++){
    cout<<arr[i];
    }
    
  return 0;
}]
param = Map();
param.put("accept_retainer",true);
param.put("retainer_percentage":"100");
approve_quote = invokeurl
[
  url :"https://www.zohoapis.com/books/v3/estimates/" + quote_id + "/status/accepted?organization_id=" + organization_id
  type :POST
  parameters:param
  connection:"zoho_apps_connection"
];
case Contact.MailingStateCode
    when 'DE' then 'Mid-Atlantic'
    when 'NJ' then 'Mid-Atlantic'
    when 'NY' then 'Mid-Atlantic'
    when 'PA' then 'Mid-Atlantic'
    when 'MD' then 'Mid-Atlantic'
    when 'DC' then 'Mid-Atlantic'
    when 'VA' then 'Mid-Atlantic'
    when 'IA' then 'Midwest'
    when 'IL' then 'Midwest'
    when 'IN' then 'Midwest'
    when 'KS' then 'Midwest'
    when 'MI' then 'Midwest'
    when 'MN' then 'Midwest'
    when 'MO' then 'Midwest'
    when 'NE' then 'Midwest'
    when 'OK' then 'Midwest'
    when 'WI' then 'Midwest'
    when 'OH' then 'Midwest'
    when 'WV' then 'Midwest'
    when 'CT' then 'New England'
    when 'RI' then 'New England'
    when 'VT' then 'New England'
    when 'MA' then 'New England'
    when 'NH' then 'New England'
    when 'ME' then 'New England'
    when 'AR' then 'South'
    when 'FL' then 'South'
    when 'GA' then 'South'
    when 'LA' then 'South'
    when 'NC' then 'South'
    when 'SC' then 'South'
    when 'TN' then 'South'
    when 'TX' then 'South'
    when 'KY' then 'South'
    when 'MS' then 'South'
    when 'AL' then 'South'
    when 'AK' then 'West'
    when 'AZ' then 'West'
    when 'CA' then 'West'
    when 'CO' then 'West'
    when 'HI' then 'West'
    when 'ID' then 'West'
    when 'MT' then 'West'
    when 'NM' then 'West'
    when 'NV' then 'West'
    when 'OR' then 'West'
    when 'SD' then 'West'
    when 'ND' then 'West'
    when 'UT' then 'West'
    when 'WA' then 'West'
    when 'WY' then 'West'
    when 'PR' then 'Territories of the U.S.'
    when 'VI' then 'Territories of the U.S.'
    when 'GU' then 'Territories of the U.S.'
    when 'AS' then 'Territories of the U.S.'
    when 'MP' then 'Territories of the U.S.'
    when 'AA' then 'Armed Forces'
    when 'AE' then 'Armed Forces'
    when 'AP' then 'Armed Forces'
    else 'Unknown'
end
internal final class NW_NumToTxtHelper
{
    static TempStr numeralsToTxt_AR(real _num)
    {
        real    numOfPennies = decround(frac(_num), 2);
        real    test         = _num - frac(_num);
        str     zero;
        str     comma;
        str     and;
        str     cent;
        int     numOfTenths;
        str 20  ones[19], tenths[9], hundreds, thousands, millions, billions, trillions;
 
        int64   temp;
        str 200  returntxt;
 
        real modOperator(real a1, real a2)
        {
            int     tmpi;
            real    tmp1, tmp2;
            tmp1 = a1 / a2;
            tmpi = real2int(tmp1);
            tmp2 = tmpi;
            return (tmp1 - tmp2)*a2;
        }
 
        str doubleDigit2ARTxt(real doubledigit,boolean _pennies = false)
        {
            str     txt;
            int     firstDigit;
            real    tempdigit;
 
            if(_pennies)
            {
                firstDigit = doubledigit * 10;
                doubledigit = doubledigit * 100;
                if(!firstDigit)
                {
                    doubledigit = doubledigit mod 10;
                    //txt = zero + " " + ones[doubledigit];
                    txt = ones[doubledigit];
                    return txt;
                }
            }
            tempdigit = doubledigit;
            if (tempdigit >= 20)
            {
                tempdigit = tempdigit div 10;
                txt = tenths[tempdigit];
                doubledigit = doubledigit mod 10;
            }
            if (doubledigit >= 1)
            {
                txt = txt ?  (ones[doubledigit] + and + txt) : ones[doubledigit];
            }
 
            return txt;
        }
 
        real checkPower(real  _test,int64 _power)
        {
            int64   numOfPower;
 
            if (_test >= _power)
            {
                numOfPower = _test div _power;
                if (numOfPower >= 100)
                {
                    temp = numOfPower div 100;
 
                    if(temp > 9)// The validation was previously on 2
                    {
                        returntxt = returntxt ? (returntxt + and + ones[temp] + ' ' + hundreds) :(returntxt + ' ' + ones[temp] + ' ' + hundreds);
                    }
 
                    else
                    {
                        switch(temp)
                        {
 
                            Case 1:
                                returntxt = returntxt ? (returntxt + and + hundreds) : (returntxt + ' ' + hundreds);
                                break;
                            Case 2:
                                // TO DO need to insert a label for two hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "مائتين") :   returntxt + ' ' + "مائتين";
                                break;
                            Case 3:
                                // TO DO need to insert a label for three hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "ثلاثمائة") :   returntxt + ' ' + 'ثلاثمائة';
                                break;
                            Case 4:
                                // TO DO need to insert a label for four hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "اربعمائة") :   returntxt + ' ' + "اربعمائة";
                                break;
                            Case 5:
                                // TO DO need to insert a label for five hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "خمسمائة") :   returntxt + ' ' + "خمسمائة";
                                break;
                            Case 6:
                                // TO DO need to insert a label for six hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "ستمائة") :   returntxt + ' ' + "ستمائة";
                                break;
                            Case 7:
                                // TO DO need to insert a label for seven hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "سبعمائة") :   returntxt + ' ' + "سبعمائة";
                                break;
                            Case 8:
                                // TO DO need to insert a label for eight hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "ثمانمائة") :   returntxt + ' ' + "ثمانمائة";
                                break;
                            Case 9:
                                // TO DO need to insert a label for nine hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "تسعمائة") :   returntxt + ' ' + "تسعمائة";
                                break;
 
                        }
                    }
                    numOfPower = numOfPower mod 100;
                }
                if(numOfPower > 2 && _power > 100)
                {
                    returntxt = returntxt ?  (returntxt + and + doubleDigit2ARTxt(real2int(numOfPower))) : (returntxt  + ' ' + doubleDigit2ARTxt(real2int(numOfPower)));
                }
                else
                {
                    if(returntxt && numOfPower)
                    {
                        returntxt = returntxt + and + ' ';
                    }
                }
                switch(_power)
                {
                    case 1000000000000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two trillions in Arabic
                                returntxt = returntxt + "تريليونين ";
                            }
                            else
                            {
                                returntxt = numOfPower > 10 ||  numOfPower == 1 || numOfPower == 0 ? (returntxt + ' ' + trillions) : (returntxt + ' ' + "تريليونات");
                            }
                            _test = modOperator(_test, 1000000000000.00);
                            break;
                        }
                    case 1000000000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two billions in Arabic
                                returntxt = returntxt + "مليارين";
                            }
                            else
                            {
                                returntxt = numOfPower > 10 ||  numOfPower == 1 || numOfPower == 0 ? (returntxt + ' ' + billions) : (returntxt + ' ' + "مليارات");
                            }
                            _test = modOperator(_test, 1000000000);
                            break;
                        }
                    case 1000000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two Millions in Arabic
                                returntxt = returntxt + "مليونين";
                            }
                            else
                            {
 
                                returntxt = numOfPower > 10 || numOfPower == 1 || numOfPower == 0 ? (returntxt + ' ' + millions) : (returntxt + ' ' + "ملايين");
 
                            }
                            _test = modOperator(_test, 1000000);
                            break;
                        }
                    case 1000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two Thousands' in Arabic
                                returntxt = returntxt + "ألفين";
                            }
                            else
                            {
                                returntxt = numOfPower > 10 ||  numOfPower == 1 || numOfPower == 0  ? (returntxt + ' ' + thousands) : (returntxt + ' ' + "الاف");
                            }
                            _test = modOperator(_test, 1000);
                            break;
                        }
                    case 100 :
                        {
                            switch (numOfPower)
                            {
                                case 2:
                                    returntxt = returntxt + "مائتين";
                                    break;
 
                                case 3:
                                    returntxt = returntxt +"ثلاثمائة";
                                    break;
 
                                case 4:
                                    returntxt = returntxt + "اربعمائة";
                                    break;
 
                                case 5:
                                    returntxt = returntxt + "خمسمائة";
                                    break;
 
                                case 6:
                                    returntxt = returntxt + "ستمائة";
                                    break;
 
                                case 7:
                                    returntxt = returntxt + "سبعمائة";
                                    break;
 
                                case 8:
                                    returntxt = returntxt + "ثمانمائة";
                                    break;
 
                                case 9:
                                    returntxt = returntxt + "تسعمائة";
                                    break;
 
                                default:
                                    returntxt = returntxt + ' ' + hundreds;
                            }
 
                            _test = modOperator(_test, 100);
                            break;
                        }
                }
 
            }
            return _test;
 
        }
 
        infolog.language("AR");
        and     = ' ' + "@SYS5534" + ' ';
        //and     = ' ' + "و" + ' ';
        comma   = "ريـال";
        //comma = "@SYS80142";
        zero    = "@SYS2068";
        cent    = "هللــه";
 
        ones[1] = "@SYS26620";
        ones[2] = "@SYS26621";
        ones[3] = "@SYS26622";
        ones[4] = "@SYS26626";
        ones[5] = "@SYS26627";
        ones[6] = "@SYS26628";
        ones[7] = "@SYS26629";
        ones[8] = "@SYS26630";
        ones[9] = "@SYS26631";
        ones[10] = "@SYS26632";
        ones[11] = "@SYS26633";
        ones[12] = "@SYS26634";
        ones[13] = "@SYS26635";
        ones[14] = "@SYS26636";
        ones[15] = "@SYS26637";
        ones[16] = "@SYS26638";
        ones[17] = "@SYS26639";
        ones[18] = "@SYS26640";
        ones[19] = "@SYS26641";
 
        tenths[1] = 'Not used';
        tenths[2] = "@SYS26643";
        tenths[3] = "@SYS26644";
        tenths[4] = "@SYS26645";
        tenths[5] = "@SYS26646";
        tenths[6] = "@SYS26647";
        tenths[7] = "@SYS26648";
        tenths[8] = "@SYS26649";
        tenths[9] = "@SYS26650";
 
        hundreds    = "@SYS26651";
        thousands   = "@SYS26652";
        millions    = "@SYS26653";
        billions    = "@SYS26654";
        trillions   = "@SYS101697";
 
        if(test == 0)
        {
            returntxt = zero;
        }
        else
        {
            test = checkPower(test, 1000000000000);
            test = checkPower(test, 1000000000);
            test = checkPower(test, 1000000);
            test = checkPower(test, 1000);
            test = checkPower(test, 100);
        }
        if(returntxt && test)
        {
            returntxt = returntxt + and + doubleDigit2ARTxt(real2int(test));
        }
        else
        {
            returntxt = returntxt + ' ' + doubleDigit2ARTxt(real2int(test));
        }
        if(numOfPennies)
        {
            //Removing the stars and addin the pound and cent wording to fullfil the Egyptian requierment
            returntxt = ' فقط ' + returntxt + ' ' + comma + ' ' + and + doubleDigit2ARTxt(numOfPennies,true) + ' ' + cent + ' لاغير ';
            //returntxt = '***' + returntxt + ' ' + comma + ' ' + doubleDigit2ARTxt(numOfPennies,true);
        }
        else
        {
            //Removing the stars and the zeros if no cents to fullfil the Egyptian requierment
            returntxt = ' فقط ' + returntxt + ' ' + comma + ' لاغير ';
            //returntxt = '***' + returntxt + ' ' + comma + ' ' + zero + ' ' + zero;
        }
        return returntxt;
    }
 
    public static Description numToTxt_En(real _amount, str currency)
    {
        real decimals, WordReal;
        int intNum;
        str 250 word, decWord, wholeWord;
        int repPos, repPos1, repPoswhole;
 
        word = Global::numeralsToTxt_EN(_amount);
        repPos = strscan(word, ' and', 1, strlen(word));
        intNum = _amount;
        decimals = _amount - intNum;
        WordReal = _amount - decimals;
        str Curr, cent;
        if(currency =='EURO')
        {
            Curr = "Euro";
            cent = 'Cents';
        }
        else if(currency =='$' || currency=="USD")
        {
            Curr = "Dollars";
            cent = 'Cents';
        }
        else if(currency =='SAR')
        {
            Curr = "Saudi Riyals";
            cent = 'Halalah';
        }
        if (decimals == 0.00)
        {
            wholeWord = num2str(WordReal,0,0,0,0);
 
            wholeWord = Global::numeralsToTxt_EN(str2num(wholeWord));
            wholeWord = strdel(wholeWord, 1, 4);
            repPoswhole = strscan(wholeWord,' and', 1, strlen(wholeWord));
            wholeWord = substr(wholeWord, 1, repPoswhole-1);
            word = strfmt("%1 %2 only",wholeWord,Curr);
        }
        else
        {
            
            decWord = substr(num2str(decimals, 0, 2, 1, 1), 3, 2);
            // Info ("test str: " +(num2str(decimals, 0, 2, 1, 1)));
            wholeWord = num2str(WordReal,0,0,0,0);
            decWord = Global::numeralsToTxt_EN(str2num(decWord));
            wholeWord = Global::numeralsToTxt_EN(str2num(wholeWord));
            decWord = strdel(decWord, 1, 4);
            wholeWord = strdel(wholeWord, 1, 4);
            repPos1 = strscan(decWord, 'and', 1, strlen(decWord));
            repPoswhole = strscan(wholeWord, ' and', 1, strlen(wholeWord));
 
            decWord = substr(decWord, 1, repPos1-1);
            wholeWord = substr(wholeWord, 1, repPoswhole-1);
 
            word = strfmt("%1 %2 and %3 %4 only",wholeWord,Curr,decWord, cent);
        }
        return word;
    }
 
    public static TempStr numToTxt_AR(real _num,str _currency)
    {
        real    numOfPennies = decround(frac(_num), 2);
        real    test         = _num - frac(_num);
        str     zero;
        str     comma;
        str     and;
        str     cent;
        int     numOfTenths;
        str 20  ones[19], tenths[9], hundreds, thousands, millions, billions, trillions;
 
        int64   temp;
        str 200  returntxt;
 
        real modOperator(real a1, real a2)
        {
            int     tmpi;
            real    tmp1, tmp2;
            tmp1 = a1 / a2;
            tmpi = real2int(tmp1);
            tmp2 = tmpi;
            return (tmp1 - tmp2)*a2;
        }
 
        str doubleDigit2ARTxt(real doubledigit,boolean _pennies = false)
        {
            str     txt;
            int     firstDigit;
            real    tempdigit;
 
            if(_pennies)
            {
                firstDigit = doubledigit * 10;
                doubledigit = doubledigit * 100;
                if(!firstDigit)
                {
                    doubledigit = doubledigit mod 10;
                    //txt = zero + " " + ones[doubledigit];
                    txt = ones[doubledigit];
                    return txt;
                }
            }
            tempdigit = doubledigit;
            if (tempdigit >= 20)
            {
                tempdigit = tempdigit div 10;
                txt = tenths[tempdigit];
                doubledigit = doubledigit mod 10;
            }
            if (doubledigit >= 1)
            {
                txt = txt ?  (ones[doubledigit] + and + txt) : ones[doubledigit];
            }
 
            return txt;
        }
 
        real checkPower(real  _test,int64 _power)
        {
            int64   numOfPower;
 
            if (_test >= _power)
            {
                numOfPower = _test div _power;
                if (numOfPower >= 100)
                {
                    temp = numOfPower div 100;
 
                    if(temp > 9)// The validation was previously on 2
                    {
                        returntxt = returntxt ? (returntxt + and + ones[temp] + ' ' + hundreds) :(returntxt + ' ' + ones[temp] + ' ' + hundreds);
                    }
 
                    else
                    {
                        switch(temp)
                        {
 
                            Case 1:
                                returntxt = returntxt ? (returntxt + and + hundreds) : (returntxt + ' ' + hundreds);
                                break;
                            Case 2:
                                // TO DO need to insert a label for two hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "مائتين") :   returntxt + ' ' + "مائتين";
                                break;
                            Case 3:
                                // TO DO need to insert a label for three hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "ثلاثمائة") :   returntxt + ' ' + 'ثلاثمائة';
                                break;
                            Case 4:
                                // TO DO need to insert a label for four hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "اربعمائة") :   returntxt + ' ' + "اربعمائة";
                                break;
                            Case 5:
                                // TO DO need to insert a label for five hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "خمسمائة") :   returntxt + ' ' + "خمسمائة";
                                break;
                            Case 6:
                                // TO DO need to insert a label for six hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "ستمائة") :   returntxt + ' ' + "ستمائة";
                                break;
                            Case 7:
                                // TO DO need to insert a label for seven hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "سبعمائة") :   returntxt + ' ' + "سبعمائة";
                                break;
                            Case 8:
                                // TO DO need to insert a label for eight hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "ثمانمائة") :   returntxt + ' ' + "ثمانمائة";
                                break;
                            Case 9:
                                // TO DO need to insert a label for nine hundred in Arabic
                                returntxt = returntxt ? (returntxt + and + "تسعمائة") :   returntxt + ' ' + "تسعمائة";
                                break;
 
                        }
                    }
                    numOfPower = numOfPower mod 100;
                }
                if(numOfPower > 2 && _power > 100)
                {
                    returntxt = returntxt ?  (returntxt + and + doubleDigit2ARTxt(real2int(numOfPower))) : (returntxt  + ' ' + doubleDigit2ARTxt(real2int(numOfPower)));
                }
                else
                {
                    if(returntxt && numOfPower)
                    {
                        returntxt = returntxt + and + ' ';
                    }
                }
                switch(_power)
                {
                    case 1000000000000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two trillions in Arabic
                                returntxt = returntxt + "تريليونين ";
                            }
                            else
                            {
                                returntxt = numOfPower > 10 ||  numOfPower == 1 || numOfPower == 0 ? (returntxt + ' ' + trillions) : (returntxt + ' ' + "تريليونات");
                            }
                            _test = modOperator(_test, 1000000000000.00);
                            break;
                        }
                    case 1000000000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two billions in Arabic
                                returntxt = returntxt + "مليارين";
                            }
                            else
                            {
                                returntxt = numOfPower > 10 ||  numOfPower == 1 || numOfPower == 0 ? (returntxt + ' ' + billions) : (returntxt + ' ' + "مليارات");
                            }
                            _test = modOperator(_test, 1000000000);
                            break;
                        }
                    case 1000000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two Millions in Arabic
                                returntxt = returntxt + "مليونين";
                            }
                            else
                            {
 
                                returntxt = numOfPower > 10 || numOfPower == 1 || numOfPower == 0 ? (returntxt + ' ' + millions) : (returntxt + ' ' + "ملايين");
 
                            }
                            _test = modOperator(_test, 1000000);
                            break;
                        }
                    case 1000 :
                        {
                            if( numOfPower == 2)
                            {
                                // TO DO need to insert a label for two Thousands' in Arabic
                                returntxt = returntxt + "ألفين";
                            }
                            else
                            {
                                returntxt = numOfPower > 10 ||  numOfPower == 1 || numOfPower == 0  ? (returntxt + ' ' + thousands) : (returntxt + ' ' + "الاف");
                            }
                            _test = modOperator(_test, 1000);
                            break;
                        }
                    case 100 :
                        {
                            switch (numOfPower)
                            {
                                case 2:
                                    returntxt = returntxt + "مائتين";
                                    break;
 
                                case 3:
                                    returntxt = returntxt +"ثلاثمائة";
                                    break;
 
                                case 4:
                                    returntxt = returntxt + "اربعمائة";
                                    break;
 
                                case 5:
                                    returntxt = returntxt + "خمسمائة";
                                    break;
 
                                case 6:
                                    returntxt = returntxt + "ستمائة";
                                    break;
 
                                case 7:
                                    returntxt = returntxt + "سبعمائة";
                                    break;
 
                                case 8:
                                    returntxt = returntxt + "ثمانمائة";
                                    break;
 
                                case 9:
                                    returntxt = returntxt + "تسعمائة";
                                    break;
 
                                default:
                                    returntxt = returntxt + ' ' + hundreds;
                            }
 
                            _test = modOperator(_test, 100);
                            break;
                        }
                }
 
            }
            return _test;
 
        }
 
        infolog.language("AR");
        and     = ' ' + "@SYS5534" + ' ';
        if(_currency =='EURO')
        {
            comma = "يورو";
            cent = 'سنت';
        }
        else if(_currency =='USD')
        {
            comma = "دولار";
            cent = 'سنت';
        }
        else if(_currency =='KWD')
        {
            comma   = "دينار كويتي";
            cent    = "فلس";
        }
        else if(_currency =='BHD')
        {
            comma   = "دينار بحريني";
            cent    = "فلس";
        }
        else if(_currency =='SAR')
        {
            comma   = "ريـال";
            cent    = "هللــه";
        }
        zero    = "@SYS2068";
        ones[1] = "@SYS26620";
        ones[2] = "@SYS26621";
        ones[3] = "@SYS26622";
        ones[4] = "@SYS26626";
        ones[5] = "@SYS26627";
        ones[6] = "@SYS26628";
        ones[7] = "@SYS26629";
        ones[8] = "@SYS26630";
        ones[9] = "@SYS26631";
        ones[10] = "@SYS26632";
        ones[11] = "@SYS26633";
        ones[12] = "@SYS26634";
        ones[13] = "@SYS26635";
        ones[14] = "@SYS26636";
        ones[15] = "@SYS26637";
        ones[16] = "@SYS26638";
        ones[17] = "@SYS26639";
        ones[18] = "@SYS26640";
        ones[19] = "@SYS26641";
 
        tenths[1] = 'Not used';
        tenths[2] = "@SYS26643";
        tenths[3] = "@SYS26644";
        tenths[4] = "@SYS26645";
        tenths[5] = "@SYS26646";
        tenths[6] = "@SYS26647";
        tenths[7] = "@SYS26648";
        tenths[8] = "@SYS26649";
        tenths[9] = "@SYS26650";
 
        hundreds    = "@SYS26651";
        thousands   = "@SYS26652";
        millions    = "@SYS26653";
        billions    = "@SYS26654";
        trillions   = "@SYS101697";
 
        if(test == 0)
        {
            returntxt = zero;
        }
        else
        {
            test = checkPower(test, 1000000000000);
            test = checkPower(test, 1000000000);
            test = checkPower(test, 1000000);
            test = checkPower(test, 1000);
            test = checkPower(test, 100);
        }
 
        if(returntxt && test)
        {
            returntxt = returntxt + and + doubleDigit2ARTxt(real2int(test));
        }
        else
        {
            returntxt = returntxt + ' ' + doubleDigit2ARTxt(real2int(test));
        }
 
        if(numOfPennies)
        {
            //Removing the stars and addin the pound and cent wording to fullfil the Egyptian requierment
            returntxt = ' فقط ' + returntxt + ' ' + comma + ' ' + and + doubleDigit2ARTxt(numOfPennies,true) + ' ' + cent + ' لاغير ';
            //returntxt = '***' + returntxt + ' ' + comma + ' ' + doubleDigit2ARTxt(numOfPennies,true);
 
        }
        else
        {
            //Removing the stars and the zeros if no cents to fullfil the Egyptian requierment
            returntxt = ' فقط ' + returntxt + ' ' + comma + ' لاغير ';
 
            //returntxt = '***' + returntxt + ' ' + comma + ' ' + zero + ' ' + zero;
        }
 
 
 
        return returntxt;
    }
   
}
 
[ExtensionOf(classStr(SrsPrintDestinationTokensNone))] 
final class SrsPrintDestinationTokensNone_DC_Extension 
{ ///
	expandEmailToken(SrsPrintDestinationToken _token, SRSPrintDestinationSettings _settings) 
	{ 
	boolean mustSkipNext = true; 
	str tokenNotFoundMsg; 
// Skip the next by using the following trick with the try-catch block. 
//The base expandEmailToken() method generates a warning message that causes 
// problems if infolog contains some old warnings or error messages. 

	try 
	{ 
		if (mustSkipNext) 
		{ 
	// When an exception is thrown inside a ttsBegin-ttsCommit transaction block, no catch statement inside that transaction block can process the exception, 
	// unless it is a UpdateConflict or a DuplicateKeyException. We always want to be sure that the catch block is executed, 
	//so we use the UpdateConflict exception. 
	
		throw Exception::UpdateConflict; 
		} 
		tokenNotFoundMsg = next expandEmailToken(_token, _settings); 
	} 
	catch (Exception::UpdateConflict) 
	{ 
	// Don't expand the token, and don't show the error. Let Docentric report DSP class to deal with this. 
		tokenNotFoundMsg = DocConstantPlaceholder::PlaceholderStartSymbol + _token + DocConstantPlaceholder::PlaceholderEndSymbol; 
	} 
	return tokenNotFoundMsg; 
	} 
}
// Author : Khadiza Sultana 
#include<iostream>
 using namespace std;
  int binTodec(int binNum){
    int ans = 0, pow = 1;
    while(binNum > 0){
        int rem = binNum % 10; // accessing the last digit
        ans += rem * pow;
        binNum /= 10; // removing the last digit
        pow *= 2;
    }
    return ans;
  }

  int main(){
    int binNum;
    cin >> binNum;
    cout << binTodec(binNum) << endl;
    return 0;
  }
https://paragchapre.com/how-to-get-workers-current-position-department-and-manger-in-x/

HcmWorkerRecId   hcmWorkerRecId =  HcmWorker::userId2Worker(curUserId());

HcmPositionRecId hcmPositionRecId = HcmWorkerHelper::getPrimaryPosition(hcmWorkerRecId);


The code to get current worker manager.

HcmWorker currentWorker = HcmWorker::find(HcmWorkerLookup::currentWorker());
HcmWorker currentWorkerManager = HcmWorkerHelper::getManagerForWorker(currentWorker.RecId);


The code to get current worker department.

HcmWorker currentWorker = HcmWorker::find(HcmWorkerLookup::currentWorker());
OMOperatingUnit department = HcmWorkerHelper::getPrimaryDepartment(currentWorker.RecId);


The code to get current worker legal entity.

HcmWorker currentWorker = HcmWorker::find(HcmWorkerLookup::currentWorker());
CompanyInfo legalEntity = HcmWorkerHelper::getLegalEntity(currentWorker.RecId);
/////////************** GRAPHS IN C++ **********////////////////

/// graphs are combination of nodes and edges 
// nodes = entity in which data is stored
// edges = connecting line which connect the nodes 
// degree = no of edges connected



////// types of graphs

// undirected graph = arrow will not be provided ... (v---u == u--v)

// directed graph = arrow will  be provided ... (v---u != u--v)

// they're two type of degree in directed 
// indegree = edges coming inside  my way  
// outdegree = edges coming out of  way  

// wieghted graph = theyre are wieghted writeen on edges(like numbers) default wieght is 1 

/// path = squence of nodes reaching (nodes written will not repeat)

// cyclic graph = when we create a path in which we reach the node which we written in previous order also. (like a-b-c-d and we d-a this cyclic graph)

/// TYPES OF REPRESENATATION 

/// i) adjacency matrix 
///  in this 2d matrix is made....
/// space complexity = O(n^2)

/// ii) adjacency list 
// in this we write the node connected with one and another in the form of list.



#include <iostream>
#include <unordered_map>
#include <list>
using namespace std;

class graph {
public:
    unordered_map<int, list<int>> adj; // here we mapping a number with another number 

    void addEdge(int u, int v, bool direction) { // u and v are edges and bool for undirected and directed graph 
        // direction = 0 -> undirected graph
        // direction = 1 -> directed graph

        // creating an edge from u to v 
        adj[u].push_back(v); // created 
        if (direction == 0) { // checking directed or undirected 
            adj[v].push_back(u); // corrected from push.back to push_back
        }
    }

    void printAdjList() { // Removed the duplicate declaration
        for (auto i : adj) {
            cout << i.first << " -> ";
            for (auto j : i.second) {
                cout << j << ", ";
            }
            cout << endl; // Move to the next line after printing the list for a node
        }
    }
};

int main() {
    int n;
    cout << "Enter the number of nodes: " << endl;
    cin >> n;

    int m;
    cout << "Enter the number of edges: " << endl;
    cin >> m;

    graph g;

    for (int i = 0; i < m; i++) {
        int u, v;
        cout << "Enter edge (u v): "; // Prompt for edge input
        cin >> u >> v;

        // Ask the user for the type of graph
        int direction;
        cout << "Is the graph directed (1) or undirected (0)? ";
        cin >> direction;

        // creation of graph based on user input
        g.addEdge(u, v, direction);
    }

    // printing graph 
    g.printAdjList();

    return 0;
}






#include <iostream>
#include <vector>

using namespace std; // Allows us to use standard library names without the std:: prefix

class Graph {
private:
    int V; // Number of vertices in the graph
    bool directed; // Indicates if the graph is directed
    vector<vector<int>> adjacencyMatrix; // 2D vector to store the adjacency matrix

public:
    // Constructor to initialize the graph
    Graph(int vertices, bool isDirected = false) : V(vertices), directed(isDirected) {
        // Resize the adjacency matrix to V x V and initialize all values to 0
        adjacencyMatrix.resize(V, vector<int>(V, 0));
    }

    // Method to add an edge from vertex u to vertex v with an optional weight
    void addEdge(int u, int v, int weight = 1) {
        adjacencyMatrix[u][v] = weight; // Set the weight for the edge from u to v
        if (!directed) {
            adjacencyMatrix[v][u] = weight; // For undirected graph, set the weight for the edge from v to u
        }
    }

    // Method to display the adjacency matrix
    void display() {
        // Iterate through each row of the adjacency matrix
        for (const auto& row : adjacencyMatrix) {
            // Print each value in the row
            for (int val : row) {
                cout << val << " ";
            }
            cout << endl; // Move to the next line after printing a row
        }
    }
};

int main() {
    // Create an undirected graph with 5 vertices
    Graph g(5, false);

    // Add edges to the undirected graph
    g.addEdge(0, 1);
    g.addEdge(0, 4);
    g.addEdge(1, 4);
    g.addEdge(1, 3);
    g.addEdge(3, 4);

    // Display the adjacency matrix for the undirected graph
    cout << "Adjacency Matrix for the Undirected Graph:" << endl;
    g.display();

    // Create a directed graph with 5 vertices
    Graph gDirected(5, true);

    // Add edges to the directed graph
    gDirected.addEdge(0, 1);
    gDirected.addEdge(1, 2);
    gDirected.addEdge(2, 0);
    gDirected.addEdge(3, 4);

    // Display the adjacency matrix for the directed graph
    cout << "\nAdjacency Matrix for the Directed Graph:" << endl;
    gDirected.display();

    return 0; // Indicate that the program ended successfully
}
// Author : Khadiza Sultana
#include<iostream>
using namespace std;

int decimalToBinary(int decNum){
    int ans = 0, pow = 1;
    while(decNum > 0){
        int rem = decNum % 2; // documenting the remainder for example for 3 % 2 = 1
        decNum /= 2; // determining the divisor 3 / 2 = 1
        ans += (rem * pow); // determining the position for the remainder as it goes from down to up
        pow *= 10; // updating the position of the digits
    }
    return ans;
}

int main(){
    int decNum = 50;  
    cout << decimalToBinary(decNum) << endl;
    return 0;
}
// Khadiza Sultana
#include<iostream>
using namespace std;
int primecheck(int n){
    bool isprime = true;
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0){
            isprime = false;
            return false;
        }
    }
    if(isprime)
       return true;
}
void printprime(int num){
    for(int i = 2; i <= num; i++){
        if(primecheck(i))
           cout << i << " ";
    }
}
int primecount(int num){
    int count = 0;
    for(int i = 2; i <= num; i++){
        if(primecheck(i))
           count++;
    }
    return count;
}
int main(){
    int num;
    cin >> num;
    printprime(num);
    cout << endl;
    cout << primecount(num) << endl;
    return 0;
}
CODE:

import numpy as np

import matplotlib.pyplot as plt

Generate synthetic data for linear regression (same as before)

np.random.seed (42)

X2 np.random.rand(100, 1) 100 random points for X y-4+3x np.random.randn(100, 1)y4+ 3x noise

Plot the generated data

plt.scatter (X, y)

plt.xlabel('X')

plt.ylabel('y')

plt.title('Synthetic Linear Data')

Adagrad Gradient Descent Function for Linear Regression

plt.show()

def adagrad_gradient descent (X, y, learning_rate=0.01, n_epochs-50,

epsilon-le-8):

mlen (X)

theta np.random.randn(2, 1) Random initialization of

parameters

Add bias term (column of ones) to X X_bnp.c_(np.ones((m, 1)), X)

Initialize accumulated squared gradients to 0

accumulated_gradients np.zeros((2, 1)) epoch in range (n epochs):

for gradients2/m X b.T.dot (X_b.dot (theta) y) # Compute

the gradients accumulated_gradients + gradients**2 Accumulate the squared

gradients adjusted_learning_rate learning_rate / (np.sqrt(accumulated gradients) epsilon) Adjust learning rate theta theta adjusted_learning_rate gradients Update

parameters (theta)

return theta

Apply AdaGrad to fit the model

theta_adagradadagrad_gradient_descent (X, y, learning_rate=0.1,

n_epochs-100) Display the resulting parameters (theta) print (f"AdaGrad estimated parameters

: Intercept (theta) = (theta_adagrad [0] [0]:.4f), Slope (thetal) (theta_adagrad [1][0]:.4f)") #Plot the fitted line

X new np.array([[0], [2]]) New data to plot the line

X new b np.c (np.ones((2, 1)), X_new] Add bias term to new data

y predict X_new_b.dot (theta_adagrad) Predict y based on new X plt.plot (X_new, y_predict, "r-", linewidth=2, label="Predictions")

plt.plot (X, y, "b.")

plt.xlabel('X')

plt.title('Linear Regression with AdaGrad')

plt.legend (

plt.ylabel('y')

)plt.show()
internal final class NW_AutoApproveWF
{
    public UserId GetSetpUser(Common Table)
    {
        WorkflowTrackingStatusTable WorkflowTrackingStatusTable;
        WorkflowTrackingTable       WorkflowTrackingTable;

        select firstonly WorkflowTrackingStatusTable
            join WorkflowTrackingTable
            order by WorkflowTrackingTable.CreatedDateTime desc
            where WorkflowTrackingTable.WorkflowTrackingStatusTable == WorkflowTrackingStatusTable.RecId
            && WorkflowTrackingStatusTable.ContextTableId == Table.TableId
            && WorkflowTrackingStatusTable.ContextRecId == Table.RecId
            && WorkflowTrackingTable.TrackingContext   == WorkflowTrackingContext::WorkItem;

        return WorkflowTrackingTable.User;
    }

    public void AutoApprove(Common Table, str Comment, str menuItem)
    {
        WorkflowWorkItemTable       WorkflowWorkItemTable;
        ;
        select WorkflowWorkItemTable
            where WorkflowWorkItemTable.Type == WorkflowWorkItemType::WorkItem
            && WorkflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending
            && WorkflowWorkItemTable.RefTableId == Table.TableId
            && WorkflowWorkItemTable.RefRecId == Table.RecId;

        WorkflowWorkItemActionManager::dispatchWorkItemAction(
            WorkflowWorkItemTable,
            Comment,
            this.GetSetpUser(Table),
            WorkflowWorkItemActionType::Complete,
            menuItem);
    }

}
#include <iostream>
#include <queue>

using namespace std;

class heap {
public:
    int arr[100];
    int size;

    heap() {
        arr[0] = -1;
        size = 0;
    }

    void insert(int val) {
        size = size + 1;
        int index = size;
        arr[index] = val;
        while (index > 1) {
            int parent = index / 2;

            if (arr[parent] < arr[index]) {
                swap(arr[parent], arr[index]);
                index = parent;
            } else {
                return;
            }
        }
    }

    void print() {
        for (int i = 1; i <= size; i++) {
            cout << arr[i] << " ";
        }
        cout << endl;
    }

    void deletefromHeap() {
        if (size == 0) {
            cout << "nothing to delete " << endl;
            return;
        }

        // Step 1: Replace root with last element
        arr[1] = arr[size];
        size--;

        // Step 2: Take root to its correct position
        int i = 1;
        while (i <= size) {
            int leftIndex = 2 * i;
            int rightIndex = 2 * i + 1;
            int largest = i;

            // Check if left child exists and is greater
            if (leftIndex <= size && arr[largest] < arr[leftIndex]) {
                largest = leftIndex;
            }

            // Check if right child exists and is greater
            if (rightIndex <= size && arr[largest] < arr[rightIndex]) {
                largest = rightIndex;
            }

            // If largest is still the parent node, break the loop
            if (largest == i) {
                break;
            }

            // Swap with the largest child and continue down the heap
            swap(arr[i], arr[largest]);
            i = largest;
        }
    }
};

// Heapify function to maintain max heap property
void heapify(int arr[], int n, int i) {
    int largest = i;
    int left = 2 * i;
    int right = 2 * i + 1;

    if (left <= n && arr[largest] < arr[left]) {
        largest = left;
    }
    if (right <= n && arr[largest] < arr[right]) {
        largest = right;
    }

    // If the largest element is not the parent node
    if (largest != i) {
        swap(arr[largest], arr[i]);
        heapify(arr, n, largest);
    }
}

// Heap Sort function to sort the array
void heapSort(int arr[], int n) {
    int size = n;

    // While the heap size is greater than 1
    while (size > 1) { // removed semicolon here
        // Step 1: Swap the last element with the root
        swap(arr[size], arr[1]);
        
        // Step 2: Reduce heap size by 1
        size--;

        // Call heapify on the reduced heap
        heapify(arr, size, 1);
    }
}

int main() {
    heap h;
    h.insert(6);
    h.insert(54);
    h.insert(57);
    h.insert(59);
    h.insert(58);
    h.print();

    // Delete the root of the heap
    h.deletefromHeap();
    cout << "After deleting root: ";
    h.print();

    // Example array to demonstrate heapify and heap sort
    int arr[6] = {-1, 54, 53, 55, 52, 50};
    int n = 5;

    // Build the heap
    for (int i = n / 2; i > 0; i--) {
        heapify(arr, n, i);
    }
    cout << "PRINTING THE ARRAY AFTER HEAPIFY" << endl;
    for (int i = 1; i <= n; i++) {
        cout << arr[i] << " ";
    }
    cout << endl;

    // Perform heap sort
    heapSort(arr, n);
    cout << "Array after heap sort: ";
    for (int i = 1; i <= n; i++) {
        cout << arr[i] << " ";
    }
    cout << endl;
    
    cout << "priority queueu"<< endl;
    
    // max heap 
    priority_queue<int> pq;
    pq.push(6);
    pq.push(10);
    pq.push(57);
    pq.push(5);
    
    cout << "element at top "<<pq.top() << endl;
    pq.pop();
    cout << "element at top "<<pq.top() << endl;
    cout << "size of  "<<pq.size() << endl;
    if(pq.empty()){
        cout << "empty" << endl;
    }
    else{
        cout << "not empty" << endl;
    }
     
    // Min heap using priority_queue with greater comparator
    priority_queue<int, vector<int>, greater<int>> minheap;

    // Adding elements to the min heap
    minheap.push(10);
    minheap.push(33);
    minheap.push(43);
    minheap.push(67);
    minheap.push(75);
    
    // Displaying the top element in the min heap
    cout << "Element at top: " << minheap.top() << endl;

    // Removing the top element
    minheap.pop();

    // Displaying the new top element
    cout << "Element at top after pop: " << minheap.top() << endl;

    // Displaying the size of the min heap
    cout << "Size of minheap: " << minheap.size() << endl;

    // Checking if the min heap is empty
    if (minheap.empty()) {
        cout << "Minheap is empty" << endl;
    } else {
        cout << "Minheap is not empty" << endl;
    }
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":star: Xero Boost Days! :star:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Canberra! Please see below for what's on this week! "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-13: Wednesday, 14th November",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:Lunch: *Lunch*: Provided in our suite from *12pm*."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0?cid=Y19jYzU3YWJkZTE4ZTE0YzVlYTYxMGU4OThjZjRhYWQ0MTNhYmIzMDBjZjBkMzVlNDg0M2M5NDQ4NDk3NDAyYjkyQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20|*Canberra Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
{
	"blocks": [
		{
			"type": "section",
			"block_id": "heading",
			"text": {
				"type": "mrkdwn",
				"text": "*🌟 Boost Days Extended 🌟*"
			}
		},
		{
			"type": "section",
			"block_id": "intro",
			"text": {
				"type": "mrkdwn",
				"text": "Hey Brisbane!\n\nThanks to your incredible feedback, we’re thrilled to announce that our Boost Days program is extended through March 2025! With your input, we’ve refined Boost Days to focus on the experiences that bring our Xeros the most enjoyment. To maximise what you love, we’re saying farewell to Afternoon Tea and Wellbeing activities. But don't worry - our awesome Wellbeing team and Wellbeing Champions in each region will continue to offer and promote these initiatives.\n\n*Here’s what’s changing—and what’s here to stay:*"
			}
		},
		{
			"type": "section",
			"block_id": "meals",
			"text": {
				"type": "mrkdwn",
				"text": "*🍽️ More Meals, More Connections*\nWe’re adding more deliciousness to the menu!\nGet ready for both a breakfast and a light lunch each week.\nNow you'll have two opportunities to come together and refuel with your fellow Xeros."
			}
		},
		{
			"type": "section",
			"block_id": "social-events",
			"text": {
				"type": "mrkdwn",
				"text": "*🎉 Social Happy Hour*\nHappening every two weeks with a rebranded style. Enjoy drinks and tasty nibbles - this regular schedule makes it easier than ever to connect and have some fun!"
			}
		},
		{
			"type": "section",
			"block_id": "cafe-partnership",
			"text": {
				"type": "mrkdwn",
				"text": "*☕ Café Partnership*\nContinue to enjoy your favourite café-style beverages from _Edwards_. Whether it's a latte, tea or a hot chocolate, it's the perfect pick-me-up through your Boost day!"
			}
		},
		{
			"type": "section",
			"block_id": "closing",
			"text": {
				"type": "mrkdwn",
				"text": "Boost Days have always been about giving you time to recharge and reconnect, and we’re so excited to bring you an even better experience with these updates.\n\nSee you at the next Boost Day! 🌟\n\nWith love,\nThe WX Team :party-wx:"
			}
		}
	]
}
{
	"blocks": [
		{
			"type": "section",
			"block_id": "heading",
			"text": {
				"type": "mrkdwn",
				"text": "*🌟 Boost Days Extended 🌟*"
			}
		},
		{
			"type": "section",
			"block_id": "intro",
			"text": {
				"type": "mrkdwn",
				"text": "Hey Sydney!\n\nThanks to your incredible feedback, we’re thrilled to announce that our Boost Days program is extended through March 2025! With your input, we’ve refined Boost Days to focus on the experiences that bring our Xeros the most enjoyment. To maximise what you love, we’re saying farewell to Afternoon Tea and Wellbeing activities. But don't worry - our awesome Wellbeing team and Wellbeing Champions in each region will continue to offer and promote these initiatives.\n\n*Here’s what’s changing—and what’s here to stay:*"
			}
		},
		{
			"type": "section",
			"block_id": "meals",
			"text": {
				"type": "mrkdwn",
				"text": "*🍽️ More Meals, More Connections*\nWe’re adding more deliciousness to the menu!\nGet ready for both a breakfast and a light lunch each week.\nNow you'll have two opportunities to come together and refuel with your fellow Xeros."
			}
		},
		{
			"type": "section",
			"block_id": "social-events",
			"text": {
				"type": "mrkdwn",
				"text": "*🎉 Social Happy Hour*\nHappening every two weeks with a rebranded style. Enjoy drinks and tasty nibbles - this regular schedule makes it easier than ever to connect and have some fun!"
			}
		},
		{
			"type": "section",
			"block_id": "cafe-partnership",
			"text": {
				"type": "mrkdwn",
				"text": "*☕ Café Partnership*\nContinue to enjoy your favourite café-style beverages from _Elixir_. Whether it's a latte, tea or a hot chocolate, it's the perfect pick-me-up through your Boost day!"
			}
		},
		{
			"type": "section",
			"block_id": "closing",
			"text": {
				"type": "mrkdwn",
				"text": "Boost Days have always been about giving you time to recharge and reconnect, and we’re so excited to bring you an even better experience with these updates.\n\nSee you at the next Boost Day! 🌟\n\nWith love,\nThe WX Team :party-wx:"
			}
		}
	]
}
{
	"blocks": [
		{
			"type": "section",
			"block_id": "boost_days_heading",
			"text": {
				"type": "mrkdwn",
				"text": "*🌟 Introducing Boost Days🌟*"
			}
		},
		{
			"type": "section",
			"block_id": "boost_days_intro",
			"text": {
				"type": "mrkdwn",
				"text": "Hey Orange County! \n\nWe’re excited to launch Boost Days, starting on the [INSERT DATE] through March 2025! \nThese days are designed to give you the chance to recharge and connect with your fellow Xeros."
			}
		},
		{
			"type": "section",
			"block_id": "whats_staying",
			"text": {
				"type": "mrkdwn",
				"text": "*Starting the week of November 25th, here's what to expect:*\n\n🍽️ *Weekly Meals*: Join us each week on a [INSERT DAY] for a light lunch - a perfect time to gather over delicious food and even better company."
			}
		},
		{
			"type": "section",
			"block_id": "boost_days_impact",
			"text": {
				"type": "mrkdwn",
				"text": "Boost Days are all about creating moments to recharge and reconnect, and we can't wait for you to experience it!"
			}
		},
		{
			"type": "section",
			"block_id": "closing_message",
			"text": {
				"type": "mrkdwn",
				"text": "See you at the next Boost Day! 🌟\n\nWith love,\nThe WX Team :party-wx:"
			}
		}
	]
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ProBet - Live Sports Odds</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            padding: 2rem;
            background-color: #f4f4f9;
        }
        h1 {
            color: #333;
            text-align: center;
        }
        .widgets-container {
            display: flex;
            gap: 2rem;
            margin-top: 2rem;
            flex-wrap: wrap;
        }
        .widget {
            border: 1px solid #ddd;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body>

    <h1>Welcome to ProBet - Live Sports Odds</h1>
    <p>Get real-time NFL and NBA odds from FanDuel, updated instantly.</p>

    <div class="widgets-container">
        <!-- NFL Odds Widget -->
        <div class="widget">
            <iframe
                title="NFL Odds Widget"
                style="width: 300px; height: 400px; border: none;"
                src="https://widget.the-odds-api.com/v1/sports/americanfootball_nfl/events/?accessKey=wk_e4d976ec6efe552a3fee4d580e7cd480&bookmakerKeys=fanduel&oddsFormat=american&markets=totals&marketNames=h2h%3AMoneyline%2Cspreads%3ASpreads%2Ctotals%3AOver%2FUnder">
            </iframe>
        </div>

        <!-- NBA Odds Widget -->
        <div class="widget">
            <iframe
                title="NBA Odds Widget"
                style="width: 300px; height: 400px; border: none;"
                src="https://widget.the-odds-api.com/v1/sports/basketball_nba/events/?accessKey=wk_e4d976ec6efe552a3fee4d580e7cd480&bookmakerKeys=fanduel&oddsFormat=american&markets=totals&marketNames=h2h%3AMoneyline%2Cspreads%3ASpreads%2Ctotals%3AOver%2FUnder">
            </iframe>
        </div>
    </div>

</body>
</html>
class NW_ZatcaSendInvoice
{
    public static void main(Args _args)
    {
        int ICVSequence;
        str PIH,ICV,UUID;
        NW_InvoiceICVSequence InvoiceICVSequence;
        CustInvoiceJour _CustInvoiceJour,CustInvoiceJour1;
        ProjInvoiceJour _ProjInvoiceJour,ProjInvoiceJour;
        NW_EInvoice EInvoice;
        CustTable CustTable;
        NW_ZatcaApiType ZatcaApiType;
        CustInvoiceTable CustInvoiceTable;
        NW_CertificateAPI CertificateAPI;

        NW_EInvoicesView EInvoicesView = _args.record();
        CertificateAPI = NW_CertificateAPI::Find();
        ZatcaApiType = _args.parmEnum();
      

        update_recordset EInvoice setting
            Latest = NoYes::No
            where EInvoice.InvoiceId == EInvoicesView.InvoiceId;

       

        UUID = strrem(guid2str(newguid()), '{}'); //Winapi::createGUID();
        ICVSequence = CertificateAPI.ICVSequence +1;
        ICV = int2Str(ICVSequence);

        if(!CertificateAPI.PIH)
        {
            PIH ="NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==";

        }
        else
        {
            PIH =   CertificateAPI.PIH;
        }


        update_recordset CertificateAPI setting
                PIH = PIH,
                ICVSequence = ICVSequence,
               UUID = UUID;
             
       

       


        if(EInvoicesView.Table_Id == any2Str(tableNum(ProjInvoiceJour)))
        {

            NW_EInvoice::newProjInvoice(EInvoicesView,true, NW_EInvoiceStatus::CreatedFailed,ICV,PIH,UUID);
            new MenuFunction(menuItemActionStr(NW_EInvoiceProcessorCreateXMLUpdate), MenuItemType::Action).run(_args);

            NW_ZatcaSendInvoice::ClearenceAPI(EInvoicesView.InvoiceRecId,ICV,ICVSequence,any2Int(EInvoicesView.Table_Id));

        }

        else
        {

            NW_EInvoice::newCustInvoice(EInvoicesView,true, NW_EInvoiceStatus::CreatedFailed,ICV,PIH,UUID);

            new MenuFunction(menuItemActionStr(NW_EInvoiceProcessorCreateXMLUpdate), MenuItemType::Action).run(_args);

       
        NW_ZatcaSendInvoice::ClearenceAPI(EInvoicesView.InvoiceRecId,ICV,ICVSequence,any2Int(EInvoicesView.Table_Id));
          
        

        }
       


    }

    public static void ClearenceAPI(RecId InvoiceRecId,str ICV,int ICVSequence,tableid _TableId)
    {
        RetailWebRequest    webRequest;
        RetailWebResponse   response;
        str                 rawResponse, ref;
        Map                 responseData;
        RetailCommonWebAPI webApi;
        str UUID,xmlInvoice;
        System.IO.Stream streamstr,responsestr;
        System.IO.StreamReader reader;
        NW_EInvoice EInvoice,_EInvoice;
        CustInvoiceJour CustInvoiceJour;
        ProjInvoiceJour ProjInvoiceJour;
        Map responseMap;
        MapEnumerator       mapEnumerator;
        str HashInvoice,clearedInvoice;
        NW_CertificateAPI CertificateAPI;
        XmlDocument doc = new XmlDocument();
        XmlNodeList nodeList;
       


        ;

        select * from EInvoice where EInvoice.CustInvoiceJourRecId == InvoiceRecId && EInvoice.ICV == ICV
            && EInvoice.Latest == NoYes::Yes;

       
        select * from CertificateAPI;

        UUID = EInvoice.UUID;
        xmlInvoice = System.Convert::ToBase64String(System.Text.Encoding::UTF8.GetBytes(EInvoice.XMLOutgoing));

        str json = "{\"uuid\": \"" + UUID + "\" , \"xmlInvoice\": \"" + xmlInvoice + "\"}";


        webApi = RetailCommonWebAPI::construct();

        // str authHeader = @'SecretToken: '+"h!YZWFP!b2L6YyjZjjUhEK=A5WnqJ_9E";
        str authHeader = @'SecretToken: '+CertificateAPI.SecretToken;


        // response =  webApi.makePostRequest("https://zatca.netways1.com/api/Zatca/InvoiceClearance",json,authHeader,"application/json");
        response =  webApi.makePostRequest(CertificateAPI.ClearenceAPIURL,json,authHeader,"application/json");

        update_recordset _EInvoice setting
            ResponseAPI = response.parmData(),
            InvoiceBase64 = xmlInvoice
            where _EInvoice.RecId == EInvoice.RecId;


       // info(response.parmData());

        if(response.parmHttpStatus() == 200)
        {
           
            responseMap = RetailCommonWebAPI::getMapFromJsonString(response.parmData());
            mapEnumerator = responseMap.getEnumerator();

            while (mapEnumerator.moveNext())
            {
                if(mapEnumerator.currentKey() == "invoiceHash")
                {
                    HashInvoice = strRem(mapEnumerator.currentValue(),"]");
                    HashInvoice = strRem(mapEnumerator.currentValue(),"[");
                }

                if(mapEnumerator.currentKey() == "clearedInvoice")
                {
                    clearedInvoice = strRem(mapEnumerator.currentValue(),"]");
                    clearedInvoice = strRem(mapEnumerator.currentValue(),"[");



                    doc.loadXml(System.Text.Encoding::UTF8.GetString(System.Convert::FromBase64String(clearedInvoice)));

                    nodeList = doc.getElementsByTagName('cac:AdditionalDocumentReference');
                }

            }

           
            if(_TableId == (tableNum(ProjInvoiceJour)))
            {
                update_recordset ProjInvoiceJour setting
                NW_ZatcaStatus = NW_ZatcaStatus::Cleared,
                QRCode_SA = nodeList.item(2).childNodes().item(1).innerText(),
                ZatcaClearedInvoice = clearedInvoice,
                ZatcaClearedInvoiceDate = systemDateGet()
            where ProjInvoiceJour.RecId == EInvoice.CustInvoiceJourRecId;
            }
            else

            {

            update_recordset CustInvoiceJour setting
                NW_ZatcaStatus = NW_ZatcaStatus::Cleared,
                QRCode_SA = nodeList.item(2).childNodes().item(1).innerText()
            where CustInvoiceJour.RecId == EInvoice.CustInvoiceJourRecId;
            }



           
            CertificateAPI.clear();
            update_recordset CertificateAPI setting
                PIH = HashInvoice,
                ICVSequence = ICVSequence;
            

            
           
            
        }


        

        else
        {
            NW_EInvoiceResponse EInvoiceResponse;
            NW_ValidationResultsResponse  ValidationResultsResponse;
            NW_ErrorMessagesResponse      ErrorMessagesResponse ;
            NW_WarningMessagesResponse    WarningMessagesResponse;
            List ErrorMessagesList,WarningMessagesList = new List(Types::Class);
            ListEnumerator ErrorMessagesListEnumerator,WarningMessagesListEnumerator;


            ValidationResultsResponse= FormJsonSerializer::deserializeObject(classNum(NW_ValidationResultsResponse),response.parmData());

            ErrorMessagesList= ValidationResultsResponse.parmerrorMessages();
            ErrorMessagesListEnumerator = ErrorMessagesList.getEnumerator();

            while (ErrorMessagesListEnumerator.moveNext())
            {
                ErrorMessagesResponse= ErrorMessagesListEnumerator.current();
                // Info(ErrorMessagesResponse.parmmessage());

                EInvoiceResponse.EInvoiceRecId = EInvoice.RecId;
                EInvoiceResponse.Massage = ErrorMessagesResponse.parmmessage();
                EInvoiceResponse.Type = "Error";
                EInvoiceResponse.insert();

            }

            WarningMessagesList = ValidationResultsResponse.parmwarningMessages();
            WarningMessagesListEnumerator = WarningMessagesList.getEnumerator();

            while (WarningMessagesListEnumerator.moveNext())
            {
                WarningMessagesResponse= WarningMessagesListEnumerator.current();
                // Info(WarningMessagesResponse.parmmessage());EInvoiceResponse.EInvoiceRecId = EInvoice.RecId;

                EInvoiceResponse.Massage = WarningMessagesResponse.parmmessage();
                EInvoiceResponse.Type = "Warning";
                EInvoiceResponse.insert();

            }



        }

      




    }

    public static void ReportingAPI(RecId InvoiceRecId,str ICV,int ICVSequence,TableId _TableId )
    {
        RetailWebRequest    webRequest;
        RetailWebResponse   response;
        str                 rawResponse, ref;
        Map                 responseData;
        RetailCommonWebAPI webApi;
        str UUID,xmlInvoice;
        System.IO.Stream streamstr,responsestr;
        System.IO.StreamReader reader;
        NW_EInvoice EInvoice,_EInvoice;
        CustInvoiceJour CustInvoiceJour;
        ProjInvoiceJour ProjInvoiceJour;
        Map responseMap;
        MapEnumerator       mapEnumerator;
        str HashInvoice,SignedInvoice;
        NW_CertificateAPI CertificateAPI;
        XmlDocument doc = new XmlDocument();
        XmlNodeList nodeList;


        ;

        select * from EInvoice where EInvoice.CustInvoiceJourRecId == InvoiceRecId && EInvoice.ICV == ICV
            && EInvoice.Latest == NoYes::Yes;

        select * from CertificateAPI;

        UUID = EInvoice.UUID;
        xmlInvoice = System.Convert::ToBase64String(System.Text.Encoding::UTF8.GetBytes(EInvoice.XMLOutgoing));

        str json = "{\"uuid\": \"" + UUID + "\" , \"xmlInvoice\": \"" + xmlInvoice + "\"}";


        webApi = RetailCommonWebAPI::construct();

        str authHeader = @'SecretToken: '+CertificateAPI.SecretToken;

        

        //  response =  webApi.makePostRequest("https://zatca.netways1.com/api/Zatca/InvoiceReporting",json,authHeader,"application/json");
        response =  webApi.makePostRequest(CertificateAPI.ReportingAPIURL,json,authHeader,"application/json");

       
        update_recordset _EInvoice setting
            ResponseAPI = response.parmData(),
            InvoiceBase64 = xmlInvoice
            where _EInvoice.RecId == EInvoice.RecId;

        if(response.parmHttpStatus() == 200)
        {
           
            
            responseMap = RetailCommonWebAPI::getMapFromJsonString(response.parmData());

            mapEnumerator = responseMap.getEnumerator();

            while (mapEnumerator.moveNext())
            {
                if(mapEnumerator.currentKey() == "invoiceHash")
                {
                    HashInvoice = strRem(mapEnumerator.currentValue(),"]");
                    HashInvoice = strRem(mapEnumerator.currentValue(),"[");
                }

                if(mapEnumerator.currentKey() == "SignedInvoice")
                {
                    SignedInvoice = strRem(mapEnumerator.currentValue(),"]");
                    SignedInvoice = strRem(mapEnumerator.currentValue(),"[");

                    doc.loadXml(System.Text.Encoding::UTF8.GetString(System.Convert::FromBase64String(SignedInvoice)));

                    nodeList = doc.getElementsByTagName('cac:AdditionalDocumentReference');
                }

            }
            CertificateAPI.clear();

            update_recordset CertificateAPI setting
            PIH = HashInvoice,
            ICVSequence = ICVSequence;

            //if(ProjInvoiceJour::findRecId(InvoiceRecId))
            if(_TableId == (tableNum(ProjInvoiceJour)))
            {

                update_recordset ProjInvoiceJour setting
                NW_ZatcaStatus = NW_ZatcaStatus::Reported,
                QRCode_SA = nodeList.item(2).childNodes().item(1).innerText(),
                ZatcaSignedInvoice = SignedInvoice,
                ZatcaSignedInvoiceDate = systemDateGet()
            where ProjInvoiceJour.RecId == EInvoice.CustInvoiceJourRecId;
            }

            else
            {
                update_recordset CustInvoiceJour setting
                NW_ZatcaStatus = NW_ZatcaStatus::Reported,
                 QRCode_SA = nodeList.item(2).childNodes().item(1).innerText()
            where CustInvoiceJour.RecId == EInvoice.CustInvoiceJourRecId;
            }

           

           
        }

       
        else
        {
            NW_EInvoiceResponse EInvoiceResponse;
            NW_ValidationResultsResponse  ValidationResultsResponse;
            NW_ErrorMessagesResponse      ErrorMessagesResponse ;
            NW_WarningMessagesResponse    WarningMessagesResponse;
            List ErrorMessagesList,WarningMessagesList = new List(Types::Class);
            ListEnumerator ErrorMessagesListEnumerator,WarningMessagesListEnumerator;


            ValidationResultsResponse= FormJsonSerializer::deserializeObject(classNum(NW_ValidationResultsResponse),response.parmData());

            ErrorMessagesList= ValidationResultsResponse.parmerrorMessages();
            ErrorMessagesListEnumerator = ErrorMessagesList.getEnumerator();

            while (ErrorMessagesListEnumerator.moveNext())
            {
                ErrorMessagesResponse= ErrorMessagesListEnumerator.current();
                // Info(ErrorMessagesResponse.parmmessage());

                EInvoiceResponse.EInvoiceRecId = EInvoice.RecId;
                EInvoiceResponse.Massage = ErrorMessagesResponse.parmmessage();
                EInvoiceResponse.Type = "Error";
                EInvoiceResponse.insert();

            }

            WarningMessagesList = ValidationResultsResponse.parmwarningMessages();
            WarningMessagesListEnumerator = WarningMessagesList.getEnumerator();

            while (WarningMessagesListEnumerator.moveNext())
            {
                WarningMessagesResponse= WarningMessagesListEnumerator.current();
                // Info(WarningMessagesResponse.parmmessage());EInvoiceResponse.EInvoiceRecId = EInvoice.RecId;

                EInvoiceResponse.Massage = WarningMessagesResponse.parmmessage();
                EInvoiceResponse.Type = "Warning";
                EInvoiceResponse.insert();

            }



        }


        


    }

    public static void ValidateAPI(RecId CustInvoiceJourRecId,str ICV)
    {
        RetailWebRequest    webRequest;
        RetailWebResponse   response;
        str                 rawResponse, ref;
        Map                 responseData;
        RetailCommonWebAPI webApi;
        str UUID,xmlInvoice;
        System.IO.Stream streamstr,responsestr;
        System.IO.StreamReader reader;
        NW_EInvoice EInvoice,_EInvoice;
        CustInvoiceJour CustInvoiceJour;


        ;

        select * from EInvoice where EInvoice.CustInvoiceJourRecId == CustInvoiceJourRecId && EInvoice.ICV == ICV
            && EInvoice.Latest == NoYes::Yes;

           

        UUID = EInvoice.UUID;
        xmlInvoice = System.Convert::ToBase64String(System.Text.Encoding::UTF8.GetBytes(EInvoice.XMLOutgoing));

        str json = "{\"uuid\": \"" + UUID + "\" , \"xmlInvoice\": \"" + xmlInvoice + "\"}";


        webApi = RetailCommonWebAPI::construct();

        str authHeader = @'SecretToken: '+"h!YZWFP!b2L6YyjZjjUhEK=A5WnqJ_9E";

        response =  webApi.makePostRequest("https://zatca.netways1.com/api/Zatca/InvoiceCompliance",json,authHeader,"application/json");

            update_recordset _EInvoice setting
            ResponseAPI = response.parmData()
            where _EInvoice.RecId == EInvoice.RecId;

       


    }

}
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

//Initialize the pins
int moisture = A0;
int manual = A2;
int relay = 8;

//Setup
void setup() {
  pinMode(relay, OUTPUT);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(2, 0);
  lcd.print("Initializing");
  lcd.setCursor(0, 1);
  lcd.print("STYRERIUM MODULE");
  Serial.begin(9600);
  delay(10000);

}
void loop() {
  lcd.clear();
  //Convert to percentage
  int moistureValue = analogRead(moisture);
  int moisturePercent = map(moistureValue, 0, 1023, 100, 0);
  int manualValue = analogRead(manual);
  int manualPercent = map(manualValue, 0, 1023, 0, 100);
  //Relay control
  if (moisturePercent < 13 || moisturePercent < manualPercent) {
    digitalWrite(relay, HIGH);
  } else {  //Turn off relay
    digitalWrite(relay, LOW);
  }
  //Displaying the stats
  lcd.setCursor(0, 0);
  lcd.print("Moisture: ");
  lcd.setCursor(12, 0);
  lcd.print(moisturePercent);
  lcd.print("%");
  //Manual watering display
  lcd.setCursor(0, 1);
  lcd.print("Manual: ");
  lcd.setCursor(12, 1);
  lcd.print(manualPercent);
  lcd.print("%");
  delay(100);
}
#include <Wire.h>
#include "DHT.h"
#include <LiquidCrystal_I2C.h>
//Define DHT pin and type
#define DHTPIN 9
#define DHTTYPE DHT11
//Initialize the sensor and LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
DHT dht(DHTPIN, DHTTYPE);

const int pumpPin = 8;
const int soilMoisturePin = A0;
const int potentiometerPin = A2;
unsigned long pumpStartTime = 0;  // unsigned: only >=0
bool pumpRunning = false;

void setup() {
  lcd.init();
  lcd.backlight();
  dht.begin();

  pinMode(pumpPin, OUTPUT);
  pinMode(soilMoisturePin, INPUT);
  pinMode(potentiometerPin, INPUT);
  lcd.setCursor(2, 0);
  lcd.print("Initializing");
  lcd.setCursor(0, 1);
  delay(2000);
  lcd.clear();
}

void loop() {
  int moistureValue = analogRead(soilMoisturePin);        // Read current soil moisture level
  int potentiometerValue = analogRead(potentiometerPin);  // Read potentiometer value
  int targetMoisturePercent;
  // Map values to percentage
  int moisturePercent = map(moistureValue, 1023, 0, 0, 100);
  int potentiometerPercent = map(potentiometerValue, 0, 1023, 0, 100);
  if (potentiometerPercent >= 40) {
  targetMoisturePercent = potentiometerPercent;
  } else {
    targetMoisturePercent = 40;
  }
  // Check if pump should be running
  if (pumpRunning) {
    unsigned long elapsedTime = millis() - pumpStartTime;

    // If pump has been running for 20 seconds and soil moisture hasn't increased
    if (elapsedTime >= 20000 && moisturePercent <= 30) {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Low water! Pump");
      lcd.setCursor(0, 1);
      lcd.print("stopped.");

      // Stop the pump
      digitalWrite(pumpPin, LOW);
      pumpRunning = false;
      delay(20000);
      lcd.clear();
    }
    // Stop the pump if desired soil moisture level is reached
    else if (moisturePercent >= targetMoisturePercent) {
      digitalWrite(pumpPin, LOW);  // Stop the pump
      pumpRunning = false;

      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Plants watered!");
      lcd.setCursor(7, 1);
      lcd.print(":)");
      delay(2000);  // Display message for 2 seconds
      lcd.clear();
    } else {
      lcd.setCursor(0, 0);
      lcd.print("Pump running...");
      lcd.setCursor(0, 1);
      lcd.print("Soil: ");
      lcd.print(moisturePercent);
      lcd.print("% Man: ");
      lcd.print(potentiometerPercent);
      lcd.print("%");
    }
  } else {
    float h = dht.readHumidity();
    // Read temperature as Celsius (the default)
    float t = dht.readTemperature();
    if (isnan(h) || isnan(t)) {
      Serial.println(F("Failed to read from DHT sensor!"));
    }
    // If pump has stopped, continuously display moisture and potentiometer levels
    lcd.setCursor(0, 0);
    lcd.print("Mst:");
    lcd.print(moisturePercent);
    lcd.print("%  ");

    lcd.setCursor(8, 0);
    lcd.print("Tmp:");

    if (!isnan(t)) {
      lcd.print(t);
      lcd.print("oC ");
    }
    lcd.setCursor(8, 1);
    lcd.print("Hum:");
    if (!isnan(h)) {
      lcd.print(h);
      lcd.print("% ");
    }

    lcd.setCursor(0, 1);
    lcd.print("Man:");
    lcd.print(potentiometerPercent);
    lcd.print("% ");


    // Start the pump if potentiometerPercent is above 50% and soil is below target
    if (moisturePercent < targetMoisturePercent) {
      digitalWrite(pumpPin, HIGH);
      pumpStartTime = millis();
      pumpRunning = true;

      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Pump running...");
    }
  }

  delay(2000);  // Adjust delay as needed to update readings
}
LedgerJournalTrans  LedgerJournalTrans;
LedgerJournalTable  LedgerJournalTable;
TmpLedgerBase tmpLedgerBase;
originalDocuments originalDocuments;
VendInvoiceJour VendInvoiceJour;
VendTrans   VendTrans;
select VendTrans where VendTrans.RecId == 68719573210;
Info(strFmt("%1", VendTrans.Invoice));
originalDocuments = new Originaldocuments(VendTrans);
originaldocuments.findRelations();
tmpLedgerBase.setTmpData(originalDocuments.relations());
while select tmpLedgerBase
{
    Info(strFmt("%1", tmpLedgerBase.OriginalDocument));
    if(tmpLedgerBase.OriginalDocument == OriginalDocument::Purchase)
        Info(strFmt("%1", tmpLedgerBase.id));

}
select LedgerJournalTrans where LedgerJournalTrans.VendTransId == 68719573210;
//originalDocuments = new Originaldocuments(LedgerJournalTrans);
//originaldocuments.findRelations();
//tmpLedgerBase.setTmpData(originalDocuments.relations());
//while select tmpLedgerBase
//{
//    Info(strFmt("%1", tmpLedgerBase.id));
//}
select VendInvoiceJour
    where VendInvoiceJour.ledgerVoucher == VendTrans.Voucher
    && VendInvoiceJour.InvoiceAccount == VendTrans.AccountNum
    && VendInvoiceJour.InvoiceDate == VendTrans.TransDate;
Info(strFmt("%1", VendInvoiceJour.PurchId));
/////////// ********HEAPIFY ALGO**********////////////

// no of leaf nodes = [(n/2+1)th index to (n)th index] 
// n = is equal to the number of index  
//CONCLUSION -> we need to check only from 0 to n/2 because lower than it will be the binary tree as well beacuse of leaf node property 

// heapify function = the function which convert the tree into the heap by interchanging it ....(in this process we will not process the leaf nodes )

#include <iostream>
using namespace std;
 
class heap
{
    public:
    int arr[100];
    int size;
    
    heap()
    {
        arr[0] = -1;
        size = 0;
    }
    
    void insert(int val){
        
        size = size + 1 ;
        int index = size;
        arr[index] = val ;
        while(index > 1){
            int parent = index/2;
            
            if(arr[parent] < arr[index]){
                swap(arr[parent],arr[index]);
                index = parent;
            }
            else{
                return;
            }
        }
    }
    
    void print(){
        for(int i = 1 ; i<=size; i++){
            cout << arr[i] << " ";
        }cout<< endl;
    }
 
    void deletefromHeap()
    {
        if(size == 0){
            cout << "nothing to delete "<< endl;
            return;
        }
        
        // Step 1: Replace root with last element
        arr[1] = arr[size];
        size--;
        
        // Step 2: Take root to its correct position
        int i = 1;
        while(i <= size) // Fix: changed condition to `<= size` to avoid out of bounds
        {
            int leftIndex = 2 * i;
            int rightIndex = 2 * i + 1;
            int largest = i;
        
            // Check if left child exists and is greater
            if(leftIndex <= size && arr[largest] < arr[leftIndex])
            {
                largest = leftIndex;
            }
 
            // Check if right child exists and is greater
            if(rightIndex <= size && arr[largest] < arr[rightIndex])
            {
                largest = rightIndex;
            }
 
            // If largest is still the parent node, break the loop
            if(largest == i) {
                break;
            }
 
            // Swap with the largest child and continue down the heap
            swap(arr[i], arr[largest]);
            i = largest;
        }
    }
};
void heapify(int arr[], int n , int i ){
    int largest = i ;
    int left = 2*i;
    int right = 2*i + 1;
    
    if(left < n && arr[largest] < arr[left]){
        largest = left;
    }
    if(right < n && arr[largest] < arr[right]){
        largest = right;
    }
    if(largest != 1){
        swap(arr[largest],arr[i]);
        heapify(arr, n , largest);
    }
    
}
 
int main()
{
    heap h;
    h.insert(6);
    h.insert(54);
    h.insert(57);
    h.insert(59);
    h.insert(58);
    h.print();
    
    // Delete the root of the heap
    h.deletefromHeap();
    cout << "After deleting root: ";
    h.print();
    
    int arr[6] = {-1 , 54, 53 ,55, 52, 50 };
    int n = 5;
    for(int i = n/2 ; i>0 ; i--){
        heapify(arr , n , i);
    }
    cout << "PRINTING THE ARRAY IN NOW" << endl;
    for(int i = 1; i<n ;i++){
        cout << arr[i]<< endl;
    }
    cout << endl;
    
    return 0;
}
star

Wed Nov 13 2024 17:46:33 GMT+0000 (Coordinated Universal Time)

@belleJar

star

Wed Nov 13 2024 17:44:11 GMT+0000 (Coordinated Universal Time)

@belleJar

star

Wed Nov 13 2024 17:36:16 GMT+0000 (Coordinated Universal Time)

@belleJar

star

Wed Nov 13 2024 17:33:18 GMT+0000 (Coordinated Universal Time)

@belleJar

star

Wed Nov 13 2024 17:25:46 GMT+0000 (Coordinated Universal Time)

@redflashcode #apex #wire

star

Wed Nov 13 2024 17:24:25 GMT+0000 (Coordinated Universal Time)

@redflashcode

star

Wed Nov 13 2024 17:21:47 GMT+0000 (Coordinated Universal Time)

@belleJar

star

Wed Nov 13 2024 17:18:58 GMT+0000 (Coordinated Universal Time)

@belleJar

star

Wed Nov 13 2024 16:31:04 GMT+0000 (Coordinated Universal Time)

@Pavan_05

star

Wed Nov 13 2024 13:18:03 GMT+0000 (Coordinated Universal Time) https://mainwpcs.com/kb/white-label-master-reset

@Y@sir

star

Wed Nov 13 2024 11:33:36 GMT+0000 (Coordinated Universal Time)

@login123

star

Wed Nov 13 2024 10:21:40 GMT+0000 (Coordinated Universal Time)

@mdfaizi

star

Wed Nov 13 2024 10:19:58 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Wed Nov 13 2024 10:07:37 GMT+0000 (Coordinated Universal Time)

@Rishi1808

star

Wed Nov 13 2024 08:45:50 GMT+0000 (Coordinated Universal Time) https://tryhackme.com/r/room/nmap01

@hepzz03

star

Tue Nov 12 2024 23:31:19 GMT+0000 (Coordinated Universal Time)

@Tennie

star

Tue Nov 12 2024 21:34:09 GMT+0000 (Coordinated Universal Time)

@gbritgs

star

Tue Nov 12 2024 20:01:14 GMT+0000 (Coordinated Universal Time) https://builder.zety.com/letter/finalize?docid

@hagarmaher

star

Tue Nov 12 2024 18:19:54 GMT+0000 (Coordinated Universal Time)

@Pavan_05

star

Tue Nov 12 2024 14:40:23 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024 #deluge

star

Tue Nov 12 2024 14:13:05 GMT+0000 (Coordinated Universal Time)

@mdfaizi

star

Tue Nov 12 2024 13:08:51 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Tue Nov 12 2024 12:36:15 GMT+0000 (Coordinated Universal Time) https://myassignmenthelp.com/uk/mathematics-assignment-help.html

@thomasjack9654

star

Tue Nov 12 2024 11:18:45 GMT+0000 (Coordinated Universal Time) https://creatiosoft.com/online-poker-software-providers

@Rishabh #poker #pokersoftware #pokerprovider

star

Tue Nov 12 2024 08:24:29 GMT+0000 (Coordinated Universal Time) https://ax.docentric.com/how-to-skip-next-in-coc-of-a-method-in-xpp/

@Manjunath

star

Tue Nov 12 2024 06:28:39 GMT+0000 (Coordinated Universal Time) https://www.acadecraft.com/learning-solutions/scorm-compliant-solutions/

@dhimanharshal9 #scormcompliant learning solutions #scormcompliant content #scormcompliant e learning

star

Tue Nov 12 2024 03:11:26 GMT+0000 (Coordinated Universal Time)

@khadizasultana #c++ #function #loop

star

Mon Nov 11 2024 21:15:34 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Mon Nov 11 2024 16:48:24 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Mon Nov 11 2024 16:24:18 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Mon Nov 11 2024 16:09:30 GMT+0000 (Coordinated Universal Time)

@khadizasultana #c++ #function #loop

star

Mon Nov 11 2024 15:58:45 GMT+0000 (Coordinated Universal Time)

@khadizasultana #loop #c++

star

Mon Nov 11 2024 15:03:56 GMT+0000 (Coordinated Universal Time) https://e-school.obr.lenreg.ru/app/school/studentdiary/

@1

star

Mon Nov 11 2024 12:49:30 GMT+0000 (Coordinated Universal Time)

@Rithish

star

Mon Nov 11 2024 11:52:51 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Mon Nov 11 2024 10:09:59 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Mon Nov 11 2024 08:13:19 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1213430/how-can-i-fully-delete-a-git-repository-created-with-init

@SubhamSahoo

star

Mon Nov 11 2024 06:33:44 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/community-centric-nft-marketplace-development/

@LilianAnderson #communitycentricnft #nftmarketplacedevelopment #decentralizednftplatform #daoinblockchain #smartcontracts

star

Mon Nov 11 2024 04:07:18 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Mon Nov 11 2024 04:06:33 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Mon Nov 11 2024 04:05:38 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Mon Nov 11 2024 03:40:51 GMT+0000 (Coordinated Universal Time) https://www.pw.live/community/forum/65e70a59e7882b73e9fe1570

@saurav_ghunawat #code #of

star

Sun Nov 10 2024 23:23:32 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun Nov 10 2024 19:36:35 GMT+0000 (Coordinated Universal Time)

@tylermejorado

star

Sun Nov 10 2024 07:33:26 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Sat Nov 09 2024 16:19:31 GMT+0000 (Coordinated Universal Time)

@SPSTVMCR #c++

star

Sat Nov 09 2024 16:11:00 GMT+0000 (Coordinated Universal Time)

@SPSTVMCR #c++

star

Sat Nov 09 2024 14:55:40 GMT+0000 (Coordinated Universal Time) https://apps.weld.gov/sheriff/DailyArrests/index.cfm?fname={fName}&lastname={lName}&date_booked

@GIJohn71184

star

Sat Nov 09 2024 13:49:38 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Sat Nov 09 2024 10:27:27 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension