Snippets Collections
{
    "_id" : ObjectId("682ae3ab51f919e432c3b2d1"),
    "fv" : 2000,
    "pc" : "toi",
    "pfm" : "aos",
    "lid" : 0,
    "enable" : true,
    "deleted" : false,
    "value" : {
        "lang" : 1,
        "defaultSelectedSectionId" : "Home-01",
        "isToRetainUserSelection" : false,
        "bottomBarSections" : [ 
            {
                "uid" : "Home-01",
                "name" : "Home",
                "engName" : "Home",
                "defaulturl" : "https://nprelease.indiatimes.com/aufs/config/navigation/section?client=toi&pc=toi&pfm=aos&path=toi/home",
                "actionBarTitleName" : "Home",
                "tn" : "Home",
                "icons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/120897786.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/120996271.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/120959876.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/120897787.cms"
                },
                "primeIcons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/113323285.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/113323312.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/113323305.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/113323296.cms"
                }
            }, 
            {
                "uid" : "ETimes-01",
                "name" : "ETimes",
                "engName" : "ETimes",
                "defaulturl" : "https://nprelease.indiatimes.com/aufs/config/navigation/section?path=toi/home/entertainment&pc=toi&fv=<fv>&pfm=aos&client=toi",
                "actionBarTitleName" : "ETimes",
                "tn" : "pagerSection",
                "icons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/120897789.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/120996275.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/120959881.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/120897791.cms"
                },
                "primeIcons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/113323293.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/113323319.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/113323310.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/113323302.cms"
                },
                "primeSection" : {
                    "uid" : "Yoga-01",
                    "name" : "Yoga",
                    "engName" : "Yoga",
                    "defaulturl" : "https://timeshealthplus.com/TH/plans?acqSource=healthplus_bottomtab&acqSubSource=bottomtab_Icon_iOS&utm_source=Apps&utm_medium=bottomtab_IOS",
                    "actionBarTitleName" : "Yoga",
                    "tn" : "yoga",
                    "icons" : {
                        "darkDeselected" : "https://static.toiimg.com/photo.cms?photoid=121166141",
                        "lightSelected" : "https://static.toiimg.com/photo.cms?photoid=121166142",
                        "lightDeselect" : "https://static.toiimg.com/photo.cms?photoid=121185245",
                        "darkSelected" : "https://static.toiimg.com/photo.cms?photoid=121166140"
                    },
                    "primeIcons" : {
                        "darkDeselected" : "https://static.toiimg.com/photo.cms?photoid=121166141",
                        "lightSelected" : "https://static.toiimg.com/photo.cms?photoid=121166142",
                        "lightDeselect" : "https://static.toiimg.com/photo.cms?photoid=121185245",
                        "darkSelected" : "https://static.toiimg.com/photo.cms?photoid=121166140"
                    },
                    "hideBottomNav" : true,
                    "enableGenericAppWebBridge" : false,
                    "deeplink" : "toiapp://open-$|$-id=Yoga-01-$|$-lang=1-$|$-displayName=Yoga-$|$-url=https://timeshealthplus.com/TH/plans?acqSource=healthplus_bottomtab&acqSubSource=bottomtab_Icon_iOS&utm_source=Apps&utm_medium=bottomtab-$|$-type=htmlview-$|$-pubId-100"
                },
                "myTimes" : {
                    "uid" : "myTimes-01",
                    "name" : "myTimes",
                    "engName" : "myTimes",
                    "defaulturl" : "",
                    "actionBarTitleName" : "myTimes",
                    "tn" : "customtab",
                    "icons" : {
                        "darkDeselected" : "https://static.toiimg.com/photo.cms?photoid=121166141",
                        "lightSelected" : "https://static.toiimg.com/photo.cms?photoid=121166142",
                        "lightDeselect" : "https://static.toiimg.com/photo.cms?photoid=121185245",
                        "darkSelected" : "https://static.toiimg.com/photo.cms?photoid=121166140"
                    },
                    "primeIcons" : {
                        "darkDeselected" : "https://static.toiimg.com/photo.cms?photoid=121166141",
                        "lightSelected" : "https://static.toiimg.com/photo.cms?photoid=121166142",
                        "lightDeselect" : "https://static.toiimg.com/photo.cms?photoid=121185245",
                        "darkSelected" : "https://static.toiimg.com/photo.cms?photoid=121166140"
                    },
                    "hideBottomNav" : true,
                    "enableGenericAppWebBridge" : false
                }
            }, 
            {
                "uid" : "TOIPlus-01",
                "name" : " TOI+",
                "engName" : "TOI+",
                "defaulturl" : "https://nprelease.indiatimes.com/aufs/config/navigation/section?pc=toi&pfm=aos&path=toi/toiplushome&client=toi&fv=<fv>",
                "actionBarTitleName" : "TOI+",
                "tn" : "prSections",
                "icons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/120897782.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/120996269.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/120959873.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/120897784.cms"
                },
                "primeIcons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/113088482.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/113088482.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/113088482.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/112376793.cms"
                }
            }, 
            {
                "uid" : "Print-Edition-01",
                "name" : "ePaper",
                "engName" : "ePaper",
                "defaulturl" : "https://epaper.indiatimes.com/timesepaper/publication-the-times-of-india,city-delhi.cms",
                "actionBarTitleName" : "ePaper",
                "tn" : "ePaperView",
                "primeIcons" : {
                    "darkDeselected" : "https://timesofindia.indiatimes.com/photo/113088465.cms",
                    "lightSelected" : "https://timesofindia.indiatimes.com/photo/120996279.cms",
                    "lightDeselect" : "https://timesofindia.indiatimes.com/photo/120959884.cms",
                    "darkSelected" : "https://timesofindia.indiatimes.com/photo/113323299.cms"
                },
                "icons" : {
                    "darkDeselected" : "https://static.toiimg.com/photo/120897794.cms",
                    "lightSelected" : "https://static.toiimg.com/photo/120766267.cms",
                    "lightDeselect" : "https://static.toiimg.com/photo/120766270.cms",
                    "darkSelected" : "https://static.toiimg.com/photo/120897797.cms"
                },
                "enableGenericAppWebBridge" : true
            }, 
            {
                "secPos" : 4,
                "uid" : "Game-01",
                "name" : "Games",
                "engName" : "Games",
                "defaulturl" : "https://nprelease.indiatimes.com/ufs-utility/toi-games/fetch/game/config?pc=<pc>&pfm=<pfm>&fv=<fv>&lang=<lang>",
                "actionBarTitleName" : "Games",
                "tn" : "games",
                "overrideSelected" : "true",
                "icons" : {
                    "darkDeselected" : "https://opt.toiimg.com/images/app/bottom/icon/v1/gamesbottomnavicon_unselected_darktheme.png",
                    "lightSelected" : "https://static.toiimg.com/photo/120895359.cms",
                    "lightDeselect" : "https://static.toiimg.com/photo/120959879.cms",
                    "darkSelected" : "https://static.toiimg.com/photo/120766263.cms"
                },
                "primeIcons" : {
                    "darkDeselected" : "https://opt.toiimg.com/images/app/bottom/icon/v1/gamesbottomnavicon_unselected_darktheme.png",
                    "lightSelected" : "https://static.toiimg.com/photo/114589843.cms",
                    "lightDeselect" : "https://opt.toiimg.com/images/app/bottom/icon/v1/gamesbottomnavicon_unselected_lighttheme.png",
                    "darkSelected" : "https://static.toiimg.com/photo/114589840.cms"
                },
                "animateConfig" : {
                    "animateIconLight" : "https://static.toiimg.com/photo/114427341.cms",
                    "animateIconDark" : "https://static.toiimg.com/photo/114427337.cms",
                    "primeAnimateIconLight" : "https://static.toiimg.com/photo/114427341.cms",
                    "primeAnimateIconDark" : "https://static.toiimg.com/photo/114427337.cms",
                    "startTimeOfDay" : {
                        "hr" : 1,
                        "min" : 30
                    },
                    "endTimeOfDay" : {
                        "hr" : 23,
                        "min" : 30
                    },
                    "secondsStartAfter" : 5,
                    "animationDuration" : 2
                }
            }
        ],
        "cityFallbackSection" : {
            "uid" : "Photos-01",
            "name" : "Photos",
            "engName" : "Photos",
            "defaulturl" : "https://plus.timesofindia.com/toi-feed/client/toia/navigation/section?lang=1&uid=Photos-01&category=Photo-01&fv=1130&isPager=true",
            "actionBarTitleName" : "Photos",
            "tn" : "pagerSection",
            "icons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/photos_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/photos_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/photos_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/photos_selected_dark.png"
            },
            "primeIcons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/photos_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/photos_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/photos_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/photos_selected_dark.png"
            }
        },
        "shortsSection" : {
            "uid" : "Shorts-01",
            "name" : "Shorts",
            "engName" : "Shorts",
            "defaulturl" : "https://plus.timesofindia.com/toi-feed/briefs/v1/toia/listing?lang=1&fv=1130",
            "actionBarTitleName" : "Shorts",
            "tn" : "shorts",
            "icons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/brieds_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/briefs_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_dark.png"
            },
            "primeIcons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/brieds_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/briefs_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_dark.png"
            },
            "IsPinned" : true
        },
        "outSideIndiaSection" : {
            "uid" : "VideoTB-01",
            "name" : "Videos",
            "engName" : "Videos",
            "defaulturl" : "https://plus.timesofindia.com/toi-feed/client/feed/list/toia/home-sections-news?lang=1&uid=VideoTB-01&puid=Home-01&category=VideoTB-01&adtag=homevideo&asset=ad,xwd,bn&fv=1130&swadTag=secWid",
            "actionBarTitleName" : "Videos",
            "tn" : "mixedList",
            "icons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/video_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/video_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/video_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/video_selected_dark.png"
            },
            "primeIcons" : {
                "darkDeselected" : "https://timesofindia.indiatimes.com/photo/113398330.cms",
                "lightSelected" : "https://timesofindia.indiatimes.com/photo/113398327.cms",
                "lightDeselect" : "https://timesofindia.indiatimes.com/photo/113398326.cms",
                "darkSelected" : "https://timesofindia.indiatimes.com/photo/113398328.cms"
            }
        },
        "briefETimesSection" : {
            "uid" : "Briefs-01",
            "name" : "Briefs",
            "engName" : "Brief",
            "defaulturl" : "https://plus.timesofindia.com/toi-feed/brief/toia/listing?lang=1&fv=1015&secuid=BriefsEntertainment-01&isincountry==true",
            "actionBarTitleName" : "Brief",
            "tn" : "briefList",
            "icons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/brieds_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/briefs_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_dark.png"
            },
            "primeIcons" : {
                "darkDeselected" : "https://opt.toiimg.com/images/Test/QC/brieds_deselected_dark.png",
                "lightSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_light.png",
                "lightDeselect" : "https://opt.toiimg.com/images/Test/QC/briefs_deselected_light.png",
                "darkSelected" : "https://opt.toiimg.com/images/Test/QC/briefs_selected_dark.png"
            }
        }
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class TurnManager : MonoBehaviour
{
    [SerializeField] private Character[] characters;
    [SerializeField] private float nextTurnDelay = 1.0f;

    private int curCharacterIndex = -1;
    public Character CurrentCharacter;

    public event UnityAction<Character> OnBeginTurn;
    public event UnityAction<Character> OnEndTurn;

    // Singleton
    public static TurnManager Instance;

    void Awake ()
    {
        if(Instance != null && Instance != this)
            Destroy(gameObject);
        else
            Instance = this;
    }

    void OnEnable ()
    {
        Character.OnDie += OnCharacterDie;
    }

    void OnDisable ()
    {
        Character.OnDie -= OnCharacterDie;
    }

    void Start ()
    {
        BeginNextTurn();
    }

    // Called when a new player is ready for their turn.
    public void BeginNextTurn ()
    {
        curCharacterIndex++;

        if(curCharacterIndex == characters.Length)
            curCharacterIndex = 0;

        CurrentCharacter = characters[curCharacterIndex];
        OnBeginTurn?.Invoke(CurrentCharacter);
    }

    // Called after the current character has casted their combat action.
    public void EndTurn ()
    {
        OnEndTurn?.Invoke(CurrentCharacter);
        Invoke(nameof(BeginNextTurn), nextTurnDelay);
    }

    // Called when a character dies.
    void OnCharacterDie (Character character)
    {
        if(character.IsPlayer)
            Debug.Log("You lost!");
        else
            Debug.Log("You win!");
    }
}
-- - REJECTION RATE 
DROP TABLE team_kingkong.offus_rej_rate_monthly ;
 
-- CREATE TABLE team_kingkong.offus_rej_rate_monthly AS
INSERT INTO team_kingkong.offus_rej_rate_monthly
WITH offus_base as 
(select DISTINCT a.*, case when edc_mid is not null then 'EDC' else 'QR' end as mid_type from
    (SELECT DISTINCT pg_mid from cdo.total_offline_merchant_base_snapshot_v3) f
INNER join
    (select distinct actionrecommended
    , json_extract_scalar(actionrecommendedrulestatus, '$[0].status') as rule_status
    , json_extract_scalar(actionrecommendedrulestatus, '$[0].versionedRule.ruleName') as rule_name
    , transactionid
    , cast(IF(eventamount = '', '0', eventamount) as double)/100 as txn_amount
    , paytmmerchantid
    , substr(cast(dl_last_updated as varchar(30)), 1, 7) AS yearMonth
    , date(dl_last_updated) as txn_date
    from cdp_risk_transform.maquette_flattened_offus_snapshot_v3
    where dl_last_updated BETWEEN date '2025-07-31' AND DATE'2025-08-03'
    AND DATE(dateinserted) BETWEEN date '2025-07-31' AND DATE'2025-08-03') a
on a.paytmmerchantid = f.pg_mid
LEFT JOIN
    (SELECT DISTINCT mid AS edc_mid FROM paytmpgdb.entity_edc_info_snapshot_v3
    WHERE terminal_status = 'ACTIVE' AND dl_last_updated >= DATE '2010-01-01') b 
ON a.paytmmerchantid = b.edc_mid)
 
SELECT A.*, B.attempted_txn, B.attempted_gmv FROM
    (SELECT txn_date, yearMonth, rule_name, mid_type
    , COUNT(transactionid) as rejected_txn
    , SUM(txn_amount) as rejected_gmv
    FROM offus_base
    WHERE actionrecommended = 'BLOCK' AND rule_status = 'LIVE'
    GROUP BY 1,2,3,4)A
INNER JOIN
    (SELECT txn_date, yearMonth, mid_type
    , COUNT(transactionid) as attempted_txn
    , SUM(txn_amount) as attempted_gmv
    FROM offus_base
    GROUP BY 1,2,3)B
ON A.yearMonth = B.yearMonth AND A.mid_type = B.mid_type AND A.txn_date = B.txn_date;


-- Rule X Monthly Breach rate
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'MID_CCDC_Daily_TXN_limit_Check' AS rule_name
FROM team_kingkong.offus_MID_CCDC_Daily_TXN_limit_Check_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'edc_card_velocity_count' AS rule_name 
FROM team_kingkong.offus_edc_card_velocity_count_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'Merchant_PerTxnLimit_Check' AS rule_name  
FROM team_kingkong.offus_Merchant_PerTxnLimit_Check_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'edc_card_velocity_amount' AS rule_name  
FROM team_kingkong.offus_edc_card_velocity_amount_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'MID_UPI_Daily_TXN_limit_Check' AS rule_name  
FROM team_kingkong.offus_MID_UPI_Daily_TXN_limit_Check_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'oil_gas_dc_limit_EDC' AS rule_name  
FROM team_kingkong.offus_oil_gas_dc_limit_EDC_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'ICA_Unsafe_Country_Transactions' AS rule_name  
FROM team_kingkong.offus_ICA_Unsafe_Country_Transactions_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'CCUPI_vpa_mid_hourly_limit' AS rule_name  
FROM team_kingkong.offus_CCUPI_vpa_mid_hourly_limit_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'ICA_PerCard_PerMID_TXN_Limit' AS rule_name  
FROM team_kingkong.offus_ICA_PerCard_PerMID_TXN_Limit_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'CCUPI_vpa_mid_daily_limit' AS rule_name  
FROM team_kingkong.offus_CCUPI_vpa_mid_daily_limit_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'ICA_OddTime_PerCard_PerMID_EDC' AS rule_name  
FROM team_kingkong.offus_ICA_OddTime_PerCard_PerMID_EDC_breaches
GROUP BY 1
 
UNION
 
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
, 'ICA_Bank_Decline_Threshold_Block' AS rule_name  
FROM team_kingkong.offus_ICA_Bank_Decline_Threshold_Block_breaches
GROUP BY 1;
 
-- OFFUS OVERALL BREACH RATE
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt FROM
(SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_MID_CCDC_Daily_TXN_limit_Check_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_edc_card_velocity_count_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount 
FROM team_kingkong.offus_Merchant_PerTxnLimit_Check_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_edc_card_velocity_amount_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_MID_UPI_Daily_TXN_limit_Check_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_oil_gas_dc_limit_EDC_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_ICA_Unsafe_Country_Transactions_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_CCUPI_vpa_mid_hourly_limit_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_ICA_PerCard_PerMID_TXN_Limit_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount 
FROM team_kingkong.offus_CCUPI_vpa_mid_daily_limit_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_ICA_OddTime_PerCard_PerMID_EDC_breaches
 
UNION
 
SELECT DATE(txn_date) AS txn_date, transactionid, txn_amount
FROM team_kingkong.offus_ICA_Bank_Decline_Threshold_Block_breaches)
GROUP BY 1;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "Combat Action", menuName = "New Combat Action")]
public class CombatAction : ScriptableObject
{
    public enum Type
    {
        Attack,
        Heal
    }

    public string DisplayName;
    public Type ActionType;

    [Header("Damage")]
    public int Damage;
    public GameObject ProjectilePrefab;

    [Header("Heal")]
    public int HealAmount;
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "Combat Action", menuName = "New Combat Action")]
public class CombatAction : ScriptableObject
{
    public enum Type
    {
        Attack,
        Heal
    }

    public string DisplayName;
    public Type ActionType;

    [Header("Damage")]
    public int Damage;
    public GameObject ProjectilePrefab;

    [Header("Heal")]
    public int HealAmount;
}
final_list = []
for _,row in dataset.iterrows():
    lat = row['latitude']
    lng = row['longitude']
    radius = row['radius']
    country_iso = row['country_iso']
    tran_month = row['month']
    tran_year = row['year']

    start_date,end_date = get_start_end_date(tran_month,tran_year)
    query = get_monthly_count_query(lat,lng,radius,tran_month,tran_year,country_iso)
    print(query)
    
    input_json = row.to_dict()
    result_dataset = execute_query(query,redshift_username, redshift_password)
    data_json = result_dataset.to_dict(orient='records')[0]
    final_json = {**input_json,**data_json}
    final_list.append(final_json)

final_dataset = pd.DataFrame(final_list)
final_dataset
nohup python manage.py runserver 0.0.0.0:8000 > Django_admin.log &
nohup celery -A mysite worker --loglevel=info > celery_worker.log &
nohup celery -A mysite beat --loglevel=info > celery_beat.log &
{
  "name": "Permissions Extension",
  ...
  "permissions": [
    "activeTab",
    "contextMenus",
    "storage"
  ],
  "optional_permissions": [
    "topSites",
  ],
  "host_permissions": [
    "https://www.developer.chrome.com/*"
  ],
  "optional_host_permissions":[
    "https://*/*",
    "http://*/*"
  ],
  ...
  "manifest_version": 3
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":star: Xero Boost Days! :star:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Hey Sydney, Happy Monday! Please see below whats in store this week! "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-4: Monday, 4th August",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy free coffee @ *Naked Duck*.\n:Lunch: *Lunch*:Join us for Lunch from *12pm* in the kitchen"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-6: Wednesday, 6th August",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy Free Coffee @ *Naked Duck* .\n:breakfast: *Breakfast*: Join us for Breakfast from *9am* in the Kitchen.\n:massage:*Wellbeing*: Crossfit class at *Be Athletic* from 11am."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-22: Thursday, 22nd May",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":coffee: *Café Partnership*: Café Partnership: Enjoy free coffee @ *Naked Duck.\n:late-cake: *Lunch*: Join us for Lunch from *12pm* in the kitchen.:party: *City2Surf Fundrasier Social* Kicks off from *4pm* in the kitchen."
			}
		},
		{
			"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/r?cid=Y185aW90ZWV0cXBiMGZwMnJ0YmtrOXM2cGFiZ0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Sydney Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":xeros-connect: Boost Days - What's on this week! :xeros-connect:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Morning Ahuriri :wave: Happy Monday, let's get ready to dive into another week with our Xeros Connect Boost Day programme! See below for what's in store :eyes:"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-21: Wednesday, 21st May :camel:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy coffee and café-style beverages from our cafe partner, *Adoro*, located in our office building *8:00AM - 11:30AM*.\n:wrap: *Lunch*: Provided by *Design Cuisine* from *12:30PM-1:30PM* in the Kitchen."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-22: Thursday, 22nd May",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy coffee and café-style beverages from our cafe partner, *Adoro*, located in our office building *8:00AM - 11:30AM*.\n:breakfast: *Breakfast*: Provided by *Roam* from *9:30AM-10:30AM* in the Kitchen."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-23: Friday, 23rd May",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:xero-hackathon: *Hackathon Social Happy Hour*: Enjoy some drinks and nibbles from *4:00PM-5:30PM* in Clearview, and celebrate our Hackathon Award winners!"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*What else?* Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0?cid=eGVyby5jb21fbXRhc2ZucThjaTl1b3BpY284dXN0OWlhdDRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ|*Hawkes Bay Social Calendar*>, and get ready to Boost your workdays!\n\nWX Team :party-wx:"
			}
		}
	]
}
<?php 

// A message stored in a string
$statusMessage = "Process completed#";

// Remove the last symbol from the message
$cleanMessage = substr($statusMessage, 0, -1);

// Display the messages
echo "Before cleanup: " . $statusMessage . "\n";
echo "After cleanup: " . $cleanMessage . "\n";


// Here is the output

/*
Before cleanup: Process completed#
After cleanup: Process completed
*/
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":cute-sun: Boost Days - What's On This Week :cute-sun:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n Let's get ready to dive into another week here in the Melbourne Office :yay: "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Xero Café :coffee:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n :new-thing: *This week we are offering:* \n\n :cookie:  A selection of yummy cookies from an Indigeous supplier Coocee Cookies. \n\n *Weekly Café Special :coffee-eyes:* Caramel Macchiato"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Tuesday 20th May :calendar-date-20:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":hands: Join us in the Wominjeka Breakout Space for the Global All Hands live in Melbourne from *9.00am-10.00am*.  "
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": " Wednesday 21st May :calendar-date-21:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": " \n\n :lunch: *Light Lunch*: from *12pm* in the Wominjeka Breakout Space. Please see the menu in the :thread: \n\n"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Thursday, 22nd May :calendar-date-22:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":waffle::juicebox:*Breakfast*:from *8:30am - 10:30am* in the Wominjeka Breakout Space."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned for more fun throughout the year. :party-wx:"
			}
		}
	]
}
<td><?= date("d/m/Y", strtotime($event['date'])) ?></td>
<?php
// Esempio di chiamata cURL che ritorna un JSON con un timestamp
$curl = curl_init("https://esempio.com/api/data"); // Cambia con la tua URL
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);

// Decodifica JSON (supponiamo che abbia un campo 'timestamp')
$data = json_decode($response, true);
$remoteTimestamp = isset($data['timestamp']) ? (int)$data['timestamp'] : null;

if ($remoteTimestamp === null) {
    die("Timestamp non trovato nella risposta");
}

// Crea oggetto DateTime dal timestamp ricevuto
$remoteDate = (new DateTime())->setTimestamp($remoteTimestamp);

// Crea oggetto DateTime per 1 anno fa a mezzanotte
$localDate = new DateTime();
$localDate->modify('-1 year')->setTime(0, 0, 0);

// Confronto
if ($remoteDate < $localDate) {
    echo "Il timestamp remoto è più vecchio di 1 anno.\n";
} else {
    echo "Il timestamp remoto è più recente di 1 anno.\n";
}

// Debug: stampa date
echo "Data remota: " . $remoteDate->format('Y-m-d H:i:s') . "\n";
echo "Data di riferimento: " . $localDate->format('Y-m-d H:i:s') . "\n";
?>
/lightning/o/Opportunity/new?RecordType={RecordTypeId}

/lightning/o/Opportunity/new?useRecordTypeCheck=1
/lightning/o/Contact/new?defaultFieldValues=LastName=Smith,AccountId={!Account.Id}

/lightning/o/Account/new?defaultFieldValues=CustomCheckbox__c={!IF(Account.SomeCheckbox__c, true, false)} 
display:flex;
flex-direction:column;
}
.widget.skin154 .cpSlider{
display:flex;

}
.widget.skin154 .text{
padding:1em;
padding-bottom:0;
position:relative;
display:flex;
flex-direction:column;
height:100%;
}

.widget.skin154 .widgetDesc{
display:flex;
flex-direction:column;
justify-content:space-between;
height:100%;
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Want to be a millionaire? Fantasy sports apps might just be your winning move. With the growing craze for online fantasy leagues, investing in a fantasy sports app is gaining serious attention. These apps offer users a chance to engage, compete, and win real rewards. If you're eyeing this booming trend, fantasy sports app development could open doors to massive returns. It’s not just a game—it’s a smart investment opportunity in the digital age.


Beleaf Technologies change your innovative ideas into real-world solutions by delivering custom software development, helping businesses grow with technology tailored to their unique goals and challenges.


Know more :https://www.beleaftechnologies.com/fantasy-sports-app-development-company

Whatsapp: +91 7904323274
Telegram: @BeleafSoftTech
Mail to: mailto:business@beleaftechnologies.com


d sdsad adsa dsa dsa dsa
-- MONTH x CATEGORY X RULE wise Rejected txn & gmv, Attempted txn & gmv and Rejection rate
DROP TABLE team_kingkong.onus_rej_rate_monthly;

CREATE TABLE team_kingkong.onus_rej_rate_monthly AS
WITH flattened as 
    (SELECT DISTINCT mnth, txn_date, transactionid, strategy_name, actionrecommended, amt, case when m1.mid is not null then category else 'Others' end as business_category FROM
        (select transactionid
        , json_extract_scalar(actionrecommendedrules,'$.actionRecommendedRules[0]') as strategy_name
        , cast(eventAmount as double)/100 as amt
        , substr(cast(dateinserted as varchar), 1,7) as mnth
        , dateinserted as txn_date
        , paytmmerchantid
        , actionrecommended
        FROM cdp_risk_transform.maquette_flattened_onus_snapshot_v3
        WHERE dl_last_updated BETWEEN date '2025-01-01' AND DATE'2025-07-08'
        AND SOURCE = 'PG') a
    left join 
        (select * from team_kingkong.voc_mid_categorization
        where mid != '') m1 
    on a.paytmmerchantid = m1.mid)
 
SELECT A.mnth, A.txn_date, A.business_category, A.strategy_name, A.rej_txns, A.rej_gmv, B.attempted_txns, B.attempted_gmv FROM
    (select mnth, txn_date
    , business_category
    , strategy_name
    , count(transactionid) as rej_txns
    , sum(amt) as rej_gmv
    from flattened
    WHERE actionrecommended = 'BLOCK'
    GROUP BY 1,2,3,4)A
INNER JOIN
    (SELECT mnth, txn_date, business_category
    , count(transactionid) as attempted_txns
    , sum(amt) as attempted_gmv
    FROM flattened
    GROUP BY 1,2,3)B
ON A.mnth = B.mnth AND A.business_category = B.business_category AND A.txn_date = B.txn_date;


-- Rule X Monthly Breach rate
SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'CCBP_attempt_Txn_user_1d_7d_30d' AS rule_name
FROM team_kingkong.onus_CCBP_attempt_Txn_user_1d_7d_30d_breaches
GROUP BY 1

-- UNION

-- SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(txn_amount) as breach_amt
-- , 'on_us_sbi_nb_limit' AS rule_name 
-- FROM team_kingkong.onus_on_us_sbi_nb_limit_breaches
-- GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'CCBP_sucTxn_user_1d_7d_30d' AS rule_name  
FROM team_kingkong.onus_CCBP_sucTxn_user_1d_7d_30d_breaches
GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'Fastag_TrustedUser_CCDC_Weekly_Monthly_limitCheck' AS rule_name  
FROM team_kingkong.onus_Fastag_TrustedUser_CCDC_Weekly_Monthly_limitCheck_breaches
GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'Fastag_Trusted_VRN_CCDC_Weekly_Monthly_limitCheck' AS rule_name  
FROM team_kingkong.onus_Fastag_Trusted_VRN_CCDC_Weekly_Monthly_limitCheck_breaches
GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'UtilityEventTxnLImit' AS rule_name  
FROM team_kingkong.onus_UtilityEventTxnLImit_breaches
GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'on_us_loan_repayments_user_limits' AS rule_name  
FROM team_kingkong.onus_on_us_loan_repayments_user_limits_breaches
GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'Fastag_NonTrustedUser_CCDC_Monthly_limitCheck' AS rule_name  
FROM team_kingkong.onus_Fastag_NonTrustedUser_CCDC_Monthly_limitCheck_breaches
GROUP BY 1

UNION

SELECT substr(cast(dateinserted as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt
, 'CCBP_GMV_per_user_1d_7d_30d' AS rule_name  
FROM team_kingkong.onus_CCBP_GMV_per_user_1d_7d_30d_breaches
GROUP BY 1;

-- ONUS OVERALL BREACH RATE
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(transactionid) as breach_cnt, SUM(amt) as breach_amt FROM
(SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_CCBP_attempt_Txn_user_1d_7d_30d_breaches

-- UNION

-- SELECT DATE(dateinserted) AS txn_date, transactionid, amt
-- FROM team_kingkong.onus_on_us_sbi_nb_limit_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt 
FROM team_kingkong.onus_CCBP_sucTxn_user_1d_7d_30d_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_Fastag_TrustedUser_CCDC_Weekly_Monthly_limitCheck_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_Fastag_Trusted_VRN_CCDC_Weekly_Monthly_limitCheck_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_UtilityEventTxnLImit_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_on_us_loan_repayments_user_limits_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_Fastag_NonTrustedUser_CCDC_Monthly_limitCheck_breaches

UNION

SELECT DATE(dateinserted) AS txn_date, transactionid, amt
FROM team_kingkong.onus_CCBP_GMV_per_user_1d_7d_30d_breaches
)
GROUP BY 1;


-- ONUS FILL RATE
CREATE TABLE team_kingkong.onus_fill_rate AS
WITH
-- 1. onus maquette
onus_maquette AS (
  SELECT *, count(*) OVER () AS total_rows
  FROM cdp_risk_transform.maquette_flattened_onus_snapshot_v3
  WHERE dl_last_updated > DATE(CURRENT_DATE - INTERVAL '7' DAY)
),

-- 2. pplus async
pplus_async AS (
  SELECT *, count(*) OVER () AS total_rows
  FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
  WHERE dl_last_updated > DATE(CURRENT_DATE - INTERVAL '7' DAY)
)

-- Fill Rate % for onus maquette
SELECT 'cdp_risk_transform' as db_name, 'maquette_flattened_onus_snapshot_v3' as table_name, 'transactionid' as column_name,
       100.0 * COUNT_IF(transactionid IS NOT NULL AND trim(transactionid) != '') / MAX(total_rows) AS fill_rate_pct
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'eventAmount',
       100.0 * COUNT_IF(eventAmount IS NOT NULL AND trim(eventAmount) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'paytmmerchantid',
       100.0 * COUNT_IF(paytmmerchantid IS NOT NULL AND trim(paytmmerchantid) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'actionrecommended',
       100.0 * COUNT_IF(actionrecommended IS NOT NULL AND trim(actionrecommended) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'actionrecommendedrules',
       100.0 * COUNT_IF(actionrecommendedrules IS NOT NULL AND trim(actionrecommendedrules) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'SOURCE',
       100.0 * COUNT_IF(SOURCE IS NOT NULL AND trim(SOURCE) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'userid',
       100.0 * COUNT_IF(userid IS NOT NULL AND trim(userid) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'paymethod',
       100.0 * COUNT_IF(paymethod IS NOT NULL AND trim(paymethod) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'responsestatus',
       100.0 * COUNT_IF(responsestatus IS NOT NULL AND trim(responsestatus) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'velocitytimestamp',
       100.0 * COUNT_IF(velocitytimestamp IS NOT NULL AND trim(velocitytimestamp) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'eventid',
       100.0 * COUNT_IF(eventid IS NOT NULL AND trim(eventid) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'apicodeoption',
       100.0 * COUNT_IF(apicodeoption IS NOT NULL AND trim(apicodeoption) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'subscriberid',
       100.0 * COUNT_IF(subscriberid IS NOT NULL AND trim(subscriberid) != '') / MAX(total_rows)
FROM onus_maquette
UNION ALL
SELECT 'cdp_risk_transform', 'maquette_flattened_onus_snapshot_v3', 'amount',
       100.0 * COUNT_IF(amount IS NOT NULL AND trim(amount) != '') / MAX(total_rows)
FROM onus_maquette

-- Fill Rate % for pplus async
UNION ALL
SELECT 'risk_maquette_data_async', 'pplus_payment_result_prod_async_snapshot_v3', 'eventlinkid',
       100.0 * COUNT_IF(eventlinkid IS NOT NULL AND trim(eventlinkid) != '') / MAX(total_rows)
FROM pplus_async;
DROP TABLE team_kingkong.tpap_rej_rate_monthly;

-- CREATE TABLE team_kingkong.tpap_rej_rate_monthly2 AS
INSERT INTO team_kingkong.tpap_rej_rate_monthly2
SELECT DISTINCT A.year_month
, A.txn_date
, A.category
, risk_code
, IF(C.upi_subtype IS NOT NULL, c.upi_subtype, IF(A.category = 'LITE_MANDATE', 'UPI_LITE_MANDATE', '')) AS upi_subtype
, SUM(IF(action_recommended = 'BLOCK', A.amount, 0)) AS rejected_gmv
, COUNT(IF(action_recommended = 'BLOCK', A.txn_id, NULL)) AS rejected_txns 
, SUM(A.amount) AS attempted_gmv
, COUNT(A.txn_id) AS attempted_txns 
FROM
    (SELECT DISTINCT substr(cast(created_on as varchar(30)), 1, 7) as year_month, DATE(created_on) AS txn_date
    , txn_id, amount, category
    FROM switch.txn_info_snapshot_v3
    WHERE DATE(dl_last_updated) BETWEEN date'2025-01-01' AND DATE('2025-02-28')
    AND DATE(created_on) BETWEEN date'2025-01-01' AND DATE('2025-02-28'))A
INNER JOIN
    (SELECT DISTINCT txnid
    , CAST(json_extract_scalar(request, '$.requestPayload.amount') AS DOUBLE) as txn_amount
    , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
    , regexp_replace(cast(json_extract(response, '$.messages.cst[0]') as varchar), '"', '') as risk_code
    , json_extract_scalar(response, '$.action_recommended') AS action_recommended
    FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
    WHERE DATE(dl_last_updated) BETWEEN date'2025-01-01' AND DATE('2025-02-28'))C
on A.txn_id = C.txnid
GROUP BY 1,2,3,4,5;
        
        
-- Rule X Monthly Breach rate
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk200_breaches' AS rule_name
FROM team_kingkong.tpap_risk200_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk307_breaches' AS rule_name 
FROM team_kingkong.tpap_risk307_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk304_breaches' AS rule_name  
FROM team_kingkong.tpap_risk304_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk127_breaches' AS rule_name  
FROM team_kingkong.tpap_risk127_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk005_breaches' AS rule_name  
FROM team_kingkong.tpap_risk005_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk306_breaches' AS rule_name  
FROM team_kingkong.tpap_risk306_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk236_breaches' AS rule_name  
FROM team_kingkong.tpap_risk236_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk235_breaches' AS rule_name  
FROM team_kingkong.tpap_risk235_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk152_breaches' AS rule_name  
FROM team_kingkong.tpap_risk152_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk292_breaches' AS rule_name  
FROM team_kingkong.tpap_risk292_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk510_breaches' AS rule_name  
FROM team_kingkong.tpap_risk510_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk318_breaches' AS rule_name  
FROM team_kingkong.tpap_risk318_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk239_breaches' AS rule_name  
FROM team_kingkong.tpap_risk239_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk151_breaches' AS rule_name  
FROM team_kingkong.tpap_risk151_breaches
GROUP BY 1

UNION

SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt
, 'tpap_risk009_breaches' AS rule_name  
FROM team_kingkong.tpap_risk009_breaches
GROUP BY 1
;


-- TPAP OVERALL BREACH RATE
SELECT substr(cast(txn_date as varchar(30)), 1, 7) as year_month, COUNT(txn_id) as breach_cnt, SUM(txn_amount) as breach_amt FROM
(SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk200_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk307_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount 
FROM team_kingkong.tpap_risk304_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk127_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk005_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk306_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk236_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk235_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk152_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk292_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk510_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk318_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk239_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk151_breaches

UNION

SELECT DATE(txn_date) AS txn_date, txn_id, txn_amount
FROM team_kingkong.tpap_risk009_breaches
)
GROUP BY 1;        
        
        
        
-- RISK314	oc69_mcc_4812_4814_collect_limit
-- DROP TABLE team_kingkong.tpap_risk314_breaches;
 
-- CREATE TABLE team_kingkong.tpap_risk314_breaches AS
INSERT INTO team_kingkong.tpap_risk314_breaches
SELECT DISTINCT B.*, C.category, C.txn_type, D.payerType
, IF(D.upi_subtype IS NOT NULL, D.upi_subtype, IF(C.category = 'LITE_MANDATE', 'UPI_LITE_MANDATE', '')) AS upi_subtype
FROM
    (SELECT txn_id, scope_cust_id,
    MAX(CASE WHEN participant_type = 'PAYER' THEN vpa END) AS payer_vpa,
    MAX(CASE WHEN participant_type = 'PAYEE' THEN vpa END) AS payee_vpa,
    MAX(CASE WHEN participant_type = 'PAYEE' THEN mcc END) AS payeeMccCode,
    MAX(created_on) as txn_date,
    MAX(amount) AS txn_amount,
    created_on AS txn_time
    FROM switch.txn_participants_snapshot_v3
    WHERE DATE(dl_last_updated) BETWEEN DATE(DATE'2025-01-01' - INTERVAL '1' DAY) AND DATE'2025-01-31'
    AND DATE(created_on) BETWEEN DATE(DATE'2025-01-01' - INTERVAL '1' DAY) AND DATE'2025-01-31'
    GROUP BY 1,2,8
    HAVING MAX(CASE WHEN participant_type = 'PAYEE' THEN mcc END) IN ('4812, 4814')
    AND MAX(amount) > 5000)B
inner join
    (select txn_id, category, "type" AS txn_type
    from switch.txn_info_snapshot_v3
    where DATE(dl_last_updated) BETWEEN DATE(DATE'2025-01-01' - INTERVAL '1' DAY) AND DATE'2025-01-31'
    and DATE(created_on) BETWEEN DATE(DATE'2025-01-01' - INTERVAL '1' DAY) AND DATE'2025-01-31'
    and upper(status) in ('SUCCESS') AND "type" = 'COLLECT') C
on B.txn_id = C.txn_id
INNER JOIN
    (SELECT txnid
    , regexp_replace(cast(json_extract(request, '$.requestPayload.payerType') AS varchar),'"','') AS payerType
    , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
    FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
    WHERE DATE(dl_last_updated) BETWEEN DATE(DATE'2025-01-01' - INTERVAL '1' DAY) AND DATE'2025-01-31'
    AND json_extract_scalar(response, '$.action_recommended') <> 'BLOCK')D
ON B.txn_id = D.txnid;
// bad
var leds = stage.selectAll('.led').data(data).enter().append('svg:svg').classed('led', true)
    .attr('width', (radius + margin) * 2).append('svg:g')
    .attr('transform', 'translate(' + (radius + margin) + ',' + (radius + margin) + ')')
    .call(tron.led);

// good
var leds = stage.selectAll('.led')
    .data(data)
  .enter().append('svg:svg')
    .classed('led', true)
    .attr('width', (radius + margin) * 2)
  .append('svg:g')
    .attr('transform', 'translate(' + (radius + margin) + ',' + (radius + margin) + ')')
    .call(tron.led);
DECLARE
    /*  -------------------------------------------------------------------------------------------
        - L_JSON_RESPONSE:  Variável do tipo CLOB (Character Large Object) que armazenará a resposta JSON da API.
        - L_NEXT_URL:       Variável do tipo VARCHAR2 que armazena a URL da próxima página de resultados da API.
        - L_POKEMON_NAME:   Variável do tipo VARCHAR2 que não é utilizada diretamente no código, mas poderia ser usada para armazenar o nome do Pokémon se necessário.
        - ID:               Variável do tipo NUMBER usada para armazenar o ID do Pokémon extraído da URL.
        -------------------------------------------------------------------------------------------
    */
    L_JSON_RESPONSE CLOB;
    L_NEXT_URL VARCHAR2(4000);
    L_POKEMON_NAME VARCHAR2(100);
    ID  NUMBER;
BEGIN

    -- URL inicial da API para obter os Pokémon
    L_NEXT_URL := 'https://pokeapi.co/api/v2/pokemon/';

    -- Loop para continuar a buscar enquanto houver uma próxima página
    LOOP
        -- Faz a requisição à API
        L_JSON_RESPONSE := APEX_WEB_SERVICE.MAKE_REST_REQUEST(
            P_URL         => L_NEXT_URL,
            P_HTTP_METHOD => 'GET'
        );

        -- Se a resposta não for nula, processa a lista de Pokémon
        IF L_JSON_RESPONSE IS NOT NULL THEN
            -- Loop para processar os nomes dos Pokémon
            FOR C1 IN (
                SELECT JT.name, JT.url
                FROM JSON_TABLE(
                    L_JSON_RESPONSE,
                    '$.results[*]' COLUMNS (
                        name PATH '$.name',
                        url PATH '$.url'
                    )
                ) JT
            ) LOOP

                ID := REGEXP_SUBSTR(C1.url, '(\d+)(/|\?)$', 1, 1, NULL, 1);

                -- Filtrar somente a 1° geração
                IF ID <= 151 THEN

                    -- Insert na tabela base
                    INSERT INTO POKEMON (ID_POKEMON, NAME_POKEMON, URL_POKEMON)
        	        VALUES (ID, C1.name, C1.url);

                END IF;

            END LOOP;

            -- Obtém a URL da próxima página de resultados
            BEGIN
                SELECT JT.next
                INTO L_NEXT_URL
                FROM JSON_TABLE(
                    L_JSON_RESPONSE,
                    '$' COLUMNS (
                        next PATH '$.next'
                    )
                ) JT;

                -- Se a URL for null ou vazia, sai do loop
                IF L_NEXT_URL IS NULL OR L_NEXT_URL = '' OR ID > 151 THEN
                    EXIT;
                END IF;

            EXCEPTION
                WHEN NO_DATA_FOUND THEN
                    -- Se não houver o campo 'next', sai do loop
                    EXIT;
            END;
        ELSE
            DBMS_OUTPUT.PUT_LINE('Resposta vazia recebida.');
            EXIT; -- Se não houver resposta, sai do loop
        END IF;
    END LOOP;

EXCEPTION
    WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('Erro ao processar a requisição: ' || SQLERRM);
END;
package com.til.tcc.manager.mongo.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.til.tcc.manager.mongo.config.MongoCollections;
import lombok.*;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@Data
@JsonInclude(value = Include.NON_NULL)
@Document(collection = MongoCollections.COLLECTION_AUFS_TRANSLATION)
@AllArgsConstructor
@NoArgsConstructor
public class AufsConfigTranslationEntity extends BaseMongoEntity {


    //Default Values
    public static final String IN = "IN";
    public static final String DARK = "dark";
    public static final String LIGHT = "light";
    public static final String INR = "INR";

    //Keys Query Node
    public static final String PC = "pc";
    public static final String PLATFORM = "pfm";
    public static final String KEY = "key";
    public static final String CC = "cc";
    public static final String LID = "langId";
    public static final String FV = "fv";
    public static final String THEME = "theme";
    public static final String IS_DEFAULT = "isDefault";
    public static final String ENABLE = "enable";
    public static final String DELETED = "deleted";
    public static final String ID = "_id";

    //Data Property
    @Indexed
    private String pc;

    @Indexed
    private String pfm;

    @Indexed
    private String client;

    @Indexed
    private String key;

    @Indexed
    private Set<String> cc;

    @Indexed
    private Set<Integer> lid;

    @Indexed
    private Integer fv;

    @Indexed
    private Set<String> theme;

    @Indexed
    private Boolean isDefault;

    @Indexed
    protected Boolean enable = false;

    @Indexed
    protected Boolean deleted = false;

    private Map<String, Object> rootTrans;

    public void setRootTrans(Map<String, Object> rootTrans) {
        if (rootTrans != null) {
            this.rootTrans = new HashMap<>();
            rootTrans.forEach((key, value) -> {
                // Convert dot notation to nested maps
                if (key.contains(".")) {
                    createNestedStructure(key, value);
                } else {
                    this.rootTrans.put(key, value);
                }
            });
        } else {
            this.rootTrans = null;
        }
    }

    /**
     * Converts dot-notated keys into proper nested structure
     * Example: "test1.test2" -> {test1: {test2: value}}
     */
    private void createNestedStructure(String keyPath, Object value) {
        String[] parts = keyPath.split("\\.");
        Map<String, Object> current = this.rootTrans;

        for (int i = 0; i < parts.length - 1; i++) {
            current = (Map<String, Object>) current.computeIfAbsent(parts[i], k -> new HashMap<>());
        }

        current.put(parts[parts.length - 1], value);
    }

    /**
     * Gets a value by dot-notated path
     */
    public Object getByPath(String path) {
        if (rootTrans == null || path == null) return null;

        String[] parts = path.split("\\.");
        Object current = rootTrans;

        for (String part : parts) {
            if (!(current instanceof Map)) return null;
            current = ((Map<?, ?>) current).get(part);
        }

        return current;
    }

    /**
     * Removes a value by dot-notated path
     */
    public void removeByPath(String path) {
        if (rootTrans == null || path == null) return;

        String[] parts = path.split("\\.");
        Map<String, Object> current = rootTrans;

        for (int i = 0; i < parts.length - 1; i++) {
            if (!(current.get(parts[i]) instanceof Map)) return;
            current = (Map<String, Object>) current.get(parts[i]);
        }
        current.remove(parts[parts.length - 1]);
    }

}
package com.til.tcc.manager.mongo.service;


import com.til.tcc.manager.constants.Constants;
import com.til.tcc.manager.mongo.entity.AufsConfigTranslationEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

@Service
@Slf4j
public class AufsConfigTranslationService {

    @Autowired
    private BaseMongoService baseMongoService;

    @Autowired
    private MongoTemplate mongoTemplate;

    public Map<String, Map<Integer, List<AufsConfigTranslationEntity>>> getTranslationConfigs(String pc) {
        if (pc == null) {
            throw new IllegalArgumentException("Parameter 'pc' cannot be null");
        }
        try {
            if(StringUtils.equalsIgnoreCase(pc, "eis")){
                pc = Constants.pc.es.name();
            }else if (StringUtils.equalsIgnoreCase(pc, "tml")){
                pc = Constants.pc.tamilsamayam.name();
            }else if (StringUtils.equalsIgnoreCase(pc, "mly")){
                pc = Constants.pc.malayalamsamayam.name();
            }else if (StringUtils.equalsIgnoreCase(pc, "tlg")){
                pc = Constants.pc.telugusamayam.name();
            }
            Query query = new Query();
            query.addCriteria(Criteria.where(AufsConfigTranslationEntity.PC).is(pc));
            query.addCriteria(Criteria.where(AufsConfigTranslationEntity.ENABLE).is(true));
            List<AufsConfigTranslationEntity> list = baseMongoService.find(query, AufsConfigTranslationEntity.class);
            list.forEach(x -> x.setRootTrans(null));
            return list.stream()
                    .collect(Collectors.groupingBy(AufsConfigTranslationEntity::getPfm,
                            Collectors.groupingBy(AufsConfigTranslationEntity::getFv, Collectors.toList())));
        } catch (Exception e) {
            log.error("Exception occurred for pc: {} ", pc, e);
            throw new RuntimeException("Failed to retrieve translation configs", e);
        }
    }

    public AufsConfigTranslationEntity getById(String id) {
        try {
            Query query = new Query();
            query.addCriteria(Criteria.where(AufsConfigTranslationEntity.ID).is(id));
            return baseMongoService.findOne(query, AufsConfigTranslationEntity.class);
        } catch (Exception e) {
            log.error("Exception occurred for {} ", id, e);
            throw new RuntimeException("Failed to retrieve translation config", e);
        }
    }

    public int updateById(String id, AufsConfigTranslationEntity updatedEntity) {
        try {
            Query query = new Query(Criteria.where("_id").is(id));
            Update update = new Update();
            if(StringUtils.isNotBlank(updatedEntity.getPfm())){
                update.set("pfm", updatedEntity.getPfm());
            }
            if(StringUtils.isNotBlank(updatedEntity.getPc())){
                update.set("pc", updatedEntity.getPc());
            }
            if(Objects.nonNull(updatedEntity.getFv())){
                update.set("fv", updatedEntity.getFv());
            }
            if(Objects.nonNull(updatedEntity.getEnable())){
                update.set("enable", updatedEntity.getEnable());
            }
            if(updatedEntity.getRootTrans() != null){
                update.set("rootTrans", updatedEntity.getRootTrans());
            }
            return baseMongoService.updateOne(query, update, AufsConfigTranslationEntity.class);

        } catch (Exception e) {
            log.error("Exception occurred for {} ", id, e);
            throw new RuntimeException("Failed to retrieve translation config", e);
        }
    }

    public void updateTranslations(String client, String pfm, Integer fv,
                                   Map<String, Object> updates, Map<String, Object> removals) {

        // 1. Get target feed version (use specified or latest)
        Integer targetFv = (fv != null) ? fv : getLatestFv(client, pfm);
        if (targetFv == null) {
            throw new RuntimeException("No translations found for client: " + client + ", platform: " + pfm);
        }

        // 2. Update the specified document
        updateSpecificDocument(client, pfm, targetFv, updates, removals);

        // 3. Update other language documents (pc ≠ "toi")
        updateOtherLanguageDocuments(client, pfm, updates, removals);
    }

    private void updateSpecificDocument(String client, String pfm, Integer fv,
                                        Map<String, Object> updates, Map<String, Object> removals) {
        Query query = Query.query(Criteria.where("client").is(client)
                .and("pfm").is(pfm)
                .and("fv").is(fv));

        AufsConfigTranslationEntity doc = mongoTemplate.findOne(query, AufsConfigTranslationEntity.class);
        if (doc == null) {
            doc = new AufsConfigTranslationEntity();
            doc.setClient(client);
            doc.setPfm(pfm);
            doc.setFv(fv);
            doc.setRootTrans(new HashMap<>());
        }

        Map<String, Object> rootTrans = doc.getRootTrans() != null
                ? new HashMap<>(doc.getRootTrans())
                : new HashMap<>();

        // Apply updates and removals with deep merge
        applyUpdatesAndRemovals(rootTrans, updates, removals);

        doc.setRootTrans(rootTrans);
        mongoTemplate.save(doc);
    }

    private void updateOtherLanguageDocuments(String client, String pfm,
                                              Map<String, Object> updates, Map<String, Object> removals) {
        Query query = new Query(Criteria.where("client").is(client)
                .and("pfm").is(pfm)
                .and("pc").ne("toi"));
        query.with(new Sort(Sort.Direction.DESC, "fv"));
        List<AufsConfigTranslationEntity> allLangDocs = mongoTemplate.find(query, AufsConfigTranslationEntity.class);

        // Keep only latest fv per unique pc
        Map<String, AufsConfigTranslationEntity> latestPerPc = allLangDocs.stream()
                .collect(Collectors.toMap(
                        AufsConfigTranslationEntity::getPc,
                        Function.identity(),
                        (doc1, doc2) -> doc1.getFv() >= doc2.getFv() ? doc1 : doc2
                ));

        int updateCount = 0;
        for (AufsConfigTranslationEntity doc : latestPerPc.values()) {
            Map<String, Object> rootTrans = doc.getRootTrans() != null
                    ? new HashMap<>(doc.getRootTrans())
                    : new HashMap<>();

            // Apply updates and removals with deep merge
            applyUpdatesAndRemovals(rootTrans, updates, removals);

            doc.setRootTrans(rootTrans);
            mongoTemplate.save(doc);
            updateCount++;
        }

        System.out.println("Updated " + updateCount + " other language documents.");
    }

    private Integer getLatestFv(String client, String pfm) {
        Query query = new Query(Criteria.where("client").is(client)
                .and("pfm").is(pfm))
                .with(new Sort(Sort.Direction.DESC, "fv"))
                .limit(1);
        AufsConfigTranslationEntity doc = mongoTemplate.findOne(query, AufsConfigTranslationEntity.class);
        return doc != null ? doc.getFv() : null;
    }

     //Apply updates and then apply removals to the root translation map with deep merge support
     @SuppressWarnings("unchecked")
    private void applyUpdatesAndRemovals(Map<String, Object> rootTrans,
                                         Map<String, Object> updates,
                                         Map<String, Object> removals) {
        // Apply updates with deep merge
        if (updates != null && !updates.isEmpty()) {
            // First unflatten dotted keys into a nested structure
            Map<String, Object> structuredUpdates = unflattenUpdates(updates);
            // Then merge with existing data
            deepMerge(rootTrans, structuredUpdates);
        }

        // Apply removals
        if (removals != null && !removals.isEmpty()) {
            for (Map.Entry<String, Object> entry : removals.entrySet()) {
                String key = entry.getKey();
                Object value = entry.getValue();

                // Handle removal based on key structure
                if (key.contains(".")) {
                    // For dot notation keys, handle nested removal
                    removeNestedMapValue(rootTrans, key, value);
                } else {
                    // For top-level keys
                    if (value == null) {
                        // Remove entire key if value is null
                        rootTrans.remove(key);
                    } else if (value instanceof Map) {
                        // Handle nested map removal
                        handleNestedMapRemoval(rootTrans, key, (Map<String, Object>) value);
                    } else {
                        // Remove key only if value matches exactly
                        Object currentValue = rootTrans.get(key);
                        if (currentValue != null && currentValue.equals(value)) {
                            rootTrans.remove(key);
                        }
                    }
                }
            }
        }
    }


     //Convert dotted notation keys to nested structure
     @SuppressWarnings("unchecked")
    private Map<String, Object> unflattenUpdates(Map<String, Object> updates) {
        Map<String, Object> result = new HashMap<>();

        for (Map.Entry<String, Object> entry : updates.entrySet()) {
            String key = entry.getKey();
            Object value = entry.getValue();

            if (key.contains(".")) {
                String[] parts = key.split("\\.");
                Map<String, Object> current = result;

                // Navigate to the correct level
                for (int i = 0; i < parts.length - 1; i++) {
                    if (!current.containsKey(parts[i])) {
                        current.put(parts[i], new HashMap<>());
                    }
                    Object next = current.get(parts[i]);
                    if (!(next instanceof Map)) {
                        // Override if not a map
                        Map<String, Object> newMap = new HashMap<>();
                        current.put(parts[i], newMap);
                        current = newMap;
                    } else {
                        current = (Map<String, Object>) next;
                    }
                }

                // Set the value at the deepest level
                current.put(parts[parts.length - 1], value);
            } else {
                // Handle top-level keys normally
                result.put(key, value);
            }
        }

        return result;
    }

     //Deep merge two maps - preserves existing values when not explicitly overwritten
    @SuppressWarnings("unchecked")
    private void deepMerge(Map<String, Object> target, Map<String, Object> source) {
        if (source == null) {
            return;
        }

        for (Map.Entry<String, Object> entry : source.entrySet()) {
            String key = entry.getKey();
            Object value = entry.getValue();

            // If both have a map for the same key, merge them
            if (value instanceof Map && target.containsKey(key) && target.get(key) instanceof Map) {
                deepMerge((Map<String, Object>) target.get(key), (Map<String, Object>) value);
            } else {
                // Otherwise just overwrite/add the value
                target.put(key, value);
            }
        }
    }

     //Handle removal of nested values in a map structure
    @SuppressWarnings("unchecked")
    private void handleNestedMapRemoval(Map<String, Object> rootMap, String key, Map<String, Object> valueToRemove) {
        // If the key doesn't exist in root map, nothing to remove
        if (!rootMap.containsKey(key)) {
            return;
        }

        Object currentValue = rootMap.get(key);

        // If current value is not a map, but removal specifies a map, something is wrong
        if (!(currentValue instanceof Map)) {
            return;
        }

        Map<String, Object> currentMap = (Map<String, Object>) currentValue;

        // If removal map is empty, remove the entire key
        if (valueToRemove.isEmpty()) {
            rootMap.remove(key);
            return;
        }

        // For each entry in the removal map, apply removal logic
        for (Map.Entry<String, Object> entry : valueToRemove.entrySet()) {
            String nestedKey = entry.getKey();
            Object nestedValue = entry.getValue();

            if (!currentMap.containsKey(nestedKey)) {
                continue;
            }

            Object existingNestedValue = currentMap.get(nestedKey);

            if (nestedValue == null) {
                // Remove entire nested key if value is null
                currentMap.remove(nestedKey);
            } else if (nestedValue instanceof Map && existingNestedValue instanceof Map) {
                // Recursively handle nested map removal
                handleNestedMapRemoval(currentMap, nestedKey, (Map<String, Object>) nestedValue);
                // If the nested map is now empty, remove it
                if (((Map<?, ?>) existingNestedValue).isEmpty()) {
                    currentMap.remove(nestedKey);
                }
            } else if (existingNestedValue != null && existingNestedValue.equals(nestedValue)) {
                // Remove if values match exactly
                currentMap.remove(nestedKey);
            }
        }

        // If the map is now empty after removals, remove the parent key
        if (currentMap.isEmpty()) {
            rootMap.remove(key);
        }
    }

    //Remove a value from a nested map structure using dot notation
    @SuppressWarnings("unchecked")
    private void removeNestedMapValue(Map<String, Object> rootMap, String dottedKey, Object valueToRemove) {
        String[] keyParts = dottedKey.split("\\.");

        // Navigate to the parent map that contains the final key
        Map<String, Object> currentMap = rootMap;
        for (int i = 0; i < keyParts.length - 1; i++) {
            Object value = currentMap.get(keyParts[i]);
            if (!(value instanceof Map)) {
                // Path doesn't exist, nothing to remove
                return;
            }
            currentMap = (Map<String, Object>) value;
        }

        String finalKey = keyParts[keyParts.length - 1];

        // Handle removal based on value type
        if (!currentMap.containsKey(finalKey)) {
            return;
        }

        Object currentValue = currentMap.get(finalKey);

        if (valueToRemove == null) {
            // Remove entire key if value to remove is null
            currentMap.remove(finalKey);
        } else if (valueToRemove instanceof Map && currentValue instanceof Map) {
            // Handle nested map removal
            handleNestedMapRemoval(currentMap, finalKey, (Map<String, Object>) valueToRemove);
        } else if (currentValue != null && currentValue.equals(valueToRemove)) {
            // Remove if values match exactly
            currentMap.remove(finalKey);
        }

        // Check if parent maps should be removed (if they're empty)
        if (keyParts.length > 1 && currentMap.isEmpty()) {
            // Remove empty parent maps recursively
            removeEmptyParentMaps(rootMap, keyParts, 0, keyParts.length - 1);
        }
    }

    //Recursively remove empty parent maps
    @SuppressWarnings("unchecked")
    private void removeEmptyParentMaps(Map<String, Object> rootMap, String[] keyParts, int startIdx, int endIdx) {
        if (startIdx >= endIdx) {
            return;
        }

        // Build the path to the current map
        Map<String, Object> currentMap = rootMap;
        for (int i = 0; i < endIdx - 1; i++) {
            Object value = currentMap.get(keyParts[i]);
            if (!(value instanceof Map)) {
                return;
            }
            currentMap = (Map<String, Object>) value;
        }

        // Check if the map at the path is empty
        Object value = currentMap.get(keyParts[endIdx - 1]);
        if (value instanceof Map && ((Map<?, ?>) value).isEmpty()) {
            currentMap.remove(keyParts[endIdx - 1]);
            //Recursively check parent
            removeEmptyParentMaps(rootMap, keyParts, startIdx, endIdx - 1);
        }
    }
}


Mira Yogashala offers transformative yoga teacher training programs in two breathtaking locations—Rishikesh, India, and Bali, Indonesia. Our **100 Hour Yoga Teacher Training in Rishikesh** is perfect for those looking to build a strong foundation in yoga while immersing themselves in the serene beauty of the Himalayas. Whether you seek a peaceful retreat in Rishikesh or a tropical escape in Bali, our courses provide a deep and immersive experience designed to help you grow in your practice and teaching journey.  

Nestled in the foothills of the Himalayas, along the sacred Ganges River, Rishikesh is known as the Yoga Capital of the World—a perfect destination for spiritual growth and self-discovery. Students train in Hatha, Ashtanga, and Vinyasa yoga, along with breathwork, meditation, yoga philosophy, anatomy, and teaching methods. Our experienced instructors, certified by Yoga Alliance, provide personal guidance to help you build confidence and deepen your practice.  

Beyond the classes, you can enjoy temple visits, meditation by the river, and nature walks, making the experience even more special. The fresh air and nourishing food help you refresh your mind and body. If you want a longer, more in-depth training, our 200 Hour Yoga Teacher Training in Bali offers a peaceful and immersive environment where you can explore yoga at a deeper level.  

Whether you choose Rishikesh or Bali, Mira Yogashala provides a nurturing and supportive environment where students can explore, grow, and embrace the true essence of yoga. Our programs are designed to offer authentic teachings, personal attention, and a deep connection to yoga’s spiritual roots.  

Join us for a life-changing experience and embark on a journey of self-discovery, balance, and inner peace with Mira Yogashala.  
For more information visit : https://www.mirayogashala.com/100-hour-yoga-teacher-training-in-rishikesh.php
# Remove DPKG config files for the package
# Replace {package_name} with the name of the package
sudo rm -rf /var/lib/dpkg/info/{package_name}.*

# Remove the package
sudo dpkg --remove --force-remove-reinstreq {package_name}


int findKthLargest(vector<int>& A, int k) {
    nth_element(begin(A), begin(A) + k - 1, end(A), greater<int>());
    return A[k - 1];
}
With the crypto industry evolving rapidly, many startups and entrepreneurs are exploring new ways to enter the market without building products from scratch. One approach that’s gaining popularity is  clone script—but is it really a smart business move?

Honestly, yes—if you approach it the right way.

It lets you launch your own branded crypto wallet app without the massive time or money investment required to build from scratch. You’re essentially starting with a solid foundation that’s already been tested and proven to work.

A good Trust Wallet clone script typically comes with packed features like:

Multi-coin and multi-token support
WalletConnect integration
Built-in staking options
DApp browser support
Private key and seed phrase backup
Biometric authentication (Face ID/Fingerprint)
In-app crypto swaps
Push notifications for transactions
Cross-platform support (Android & iOS)

And the best part? You get a proven product with all the necessary features already built in.

However, not all clone scripts are created equal. Some providers offer flashy websites and promises but fall short when it comes to security, scalability, or real-world functionality. I spent quite a bit of time reviewing different providers, trying out their live demos, reading through client feedback, and asking the right questions.

A standout provider for me was AppcloneX. With over three years in the blockchain industry and 50+ successful projects under their belt, they really knew their stuff. Their Trust Wallet clone script was feature-packed, secure, and highly customizable. On top of that, their post-launch support was exceptional—they walked me through every step, from customization to deployment.

In short, Trust Wallet clone script can be a brilliant business strategy, but only if you partner with the right team. For me approaching AppcloneX is one of the best decision. 

If you’re thinking about this approach or looking to launch your own trust wallet clone script, then you can reach out to them and checking out their live demos.
How Secure Is a Trust Wallet Clone Script?

One of the first questions I had when I started looking into a Trust Wallet clone script was about security. I mean, we’re talking about people’s crypto assets—security isn’t just important, it’s everything.

Naturally, the original Trust Wallet is open-source and has a strong track record in terms of safety. It follows all the best practices—end-to-end encryption, private key control, biometric protection, and seamless integration with DApps. So I wanted to make sure that any clone script I chose would offer the same level of protection.
During my research, I looked into several providers and tested different demo versions. What I quickly learned is that the quality of clone scripts varies widely. Some lacked proper encryption, while others didn’t offer any real security audits or wallet recovery systems.

One provider that really gave me confidence was AppcloneX. Their Trust Wallet clone script was built with security in mind. It included AES encryption, secure private key storage, biometric login, seed phrase backups, and even optional multi-factor authentication. They also emphasized using best practices for both frontend and backend security.

What reassured me even more was that their team took the time to explain how each feature worked and how they could customize or enhance it further based on my needs. That kind of transparency is rare.
To be clear: a Trust Wallet clone can be just as secure as the original—but only if it's developed by a team that prioritizes safety and follows industry standards.

If you’re thinking of going down this path, don’t just look at features. Ask the tough questions about security architecture, audits, and encryption methods. For me, AppcloneX stood out by getting those things right.

If you’re curious to see what their solution actually looks like, I’d recommend checking out their live demo. It gave me a clear picture of the product’s quality and features, and honestly—it helped me make my decision a lot faster.
DashBlox has a lot of features that aren't enabled by default, and if you want to customize the way DashBlox modifies Roblox, you can customize it in DashBlox settings.

If you don't want to customize settings right now, you can always do it later by pressing the gear icon in the top right and selecting 'DashBlox".
document.querySelectorAll('input, textarea').forEach((el) => {
      // Remove inline oncopy and onpaste handlers
        console.log(el)
      el.oncopy = null;
      el.onpaste = null;

      // Or remove attribute values if needed
      el.removeAttribute('oncopy');
      el.removeAttribute('onpaste');
    });
  
star

Mon May 19 2025 09:10:57 GMT+0000 (Coordinated Universal Time) https://www.techy247.com/how-to/how-to-fix-wi-fi-not-working-on-windows-11/

@Techy247 #commandline

star

Mon May 19 2025 07:58:42 GMT+0000 (Coordinated Universal Time)

@rrajatssharma

star

Mon May 19 2025 07:10:00 GMT+0000 (Coordinated Universal Time)

@iliavial #c#

star

Mon May 19 2025 07:02:09 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Mon May 19 2025 06:59:40 GMT+0000 (Coordinated Universal Time)

@iliavial #c#

star

Mon May 19 2025 06:57:16 GMT+0000 (Coordinated Universal Time)

@iliavial #c#

star

Mon May 19 2025 06:52:16 GMT+0000 (Coordinated Universal Time)

@Saravana_Kumar #python

star

Mon May 19 2025 02:31:15 GMT+0000 (Coordinated Universal Time)

@cvanwert

star

Mon May 19 2025 02:29:47 GMT+0000 (Coordinated Universal Time)

@cvanwert #seid #docker #rust

star

Mon May 19 2025 02:24:59 GMT+0000 (Coordinated Universal Time) https://www.firekirin.xyz:8888/Store.aspx

@cholillo18 #json

star

Sun May 18 2025 23:48:30 GMT+0000 (Coordinated Universal Time) https://developer.chrome.com/docs/extensions/develop/concepts/declare-permissions#host-permissions

@cholillo18

star

Sun May 18 2025 23:40:18 GMT+0000 (Coordinated Universal Time) https://dequeuniversity.com/rules/axe/4.4/image-alt?application

@cholillo18

star

Sun May 18 2025 23:03:55 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun May 18 2025 21:23:57 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun May 18 2025 21:17:15 GMT+0000 (Coordinated Universal Time) https://www.techy247.com/how-to/how-to-take-a-screenshot-on-mac/

@Techy247 #commandline

star

Sun May 18 2025 17:11:56 GMT+0000 (Coordinated Universal Time) https://trainpalaceonwheels.com/

@palacewheels901

star

Sun May 18 2025 06:36:03 GMT+0000 (Coordinated Universal Time) https://flatcoding.com/tutorials/php/php-remove-last-character-from-string/

@Samuel88 #php

star

Sun May 18 2025 02:47:58 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sat May 17 2025 23:13:02 GMT+0000 (Coordinated Universal Time)

@jdeveloper #php

star

Sat May 17 2025 06:51:27 GMT+0000 (Coordinated Universal Time)

@StefanoGi

star

Fri May 16 2025 21:28:35 GMT+0000 (Coordinated Universal Time) https://www.linkedin.com/posts/danny-gelfenbaum_8-things-you-can-do-using-salesforce-url-activity-7264272497162780672-egQk/

@dannygelf #salesforce #formula #urlhack

star

Fri May 16 2025 21:27:59 GMT+0000 (Coordinated Universal Time) https://www.linkedin.com/posts/danny-gelfenbaum_8-things-you-can-do-using-salesforce-url-activity-7264272497162780672-egQk/

@dannygelf #salesforce #formula #urlhack

star

Fri May 16 2025 21:27:27 GMT+0000 (Coordinated Universal Time)

@dannygelf #salesforce #formula #urlhack

star

Fri May 16 2025 21:26:22 GMT+0000 (Coordinated Universal Time)

@dannygelf #salesforce #formula #urlhack

star

Fri May 16 2025 21:24:51 GMT+0000 (Coordinated Universal Time) https://www.linkedin.com/posts/danny-gelfenbaum_8-things-you-can-do-using-salesforce-url-activity-7264272497162780672-egQk/

@dannygelf #salesforce #formula #urlhack

star

Fri May 16 2025 20:35:04 GMT+0000 (Coordinated Universal Time) https://www.lakevillemn.gov/DesignCenter/Themes/Index

@Cody_Gant

star

Fri May 16 2025 12:50:03 GMT+0000 (Coordinated Universal Time) https://www.apache.org/licenses/LICENSE-2.0

@TuckSmith541

star

Fri May 16 2025 11:52:09 GMT+0000 (Coordinated Universal Time) https://beleaftechnologies.com/p2p-cryptocurrency-exchange-development-company

@stvejhon #crypto #cryptocurrency #exchange #meme

star

Fri May 16 2025 10:44:51 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/white-label-digital-asset-exchange/

@CharleenStewar #whitelabel digital asset exchange

star

Fri May 16 2025 10:39:14 GMT+0000 (Coordinated Universal Time)

@toufeeque1989

star

Fri May 16 2025 10:27:34 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Fri May 16 2025 10:11:05 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Fri May 16 2025 09:42:30 GMT+0000 (Coordinated Universal Time) https://cryptocurrency-exchange-development-company.com/

@raydensmith #crypot #exchange #cryptoexchangedevelopment

star

Fri May 16 2025 06:14:50 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/blog/aave-clone-script

@Seraphina

star

Fri May 16 2025 05:28:12 GMT+0000 (Coordinated Universal Time)

@codejlw #javascript

star

Fri May 16 2025 02:39:19 GMT+0000 (Coordinated Universal Time) https://github.com/TaylorResearchLab/Petagraph

@metaphotonic

star

Thu May 15 2025 14:44:36 GMT+0000 (Coordinated Universal Time)

@chivchav

star

Thu May 15 2025 09:38:10 GMT+0000 (Coordinated Universal Time)

@rrajatssharma

star

Thu May 15 2025 09:32:32 GMT+0000 (Coordinated Universal Time)

@rrajatssharma

star

Thu May 15 2025 09:20:06 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/features-of-cryptocurrency-exchange/

@CharleenStewar #featuresofcryptoexchange #cryptocurrencyexchange

star

Thu May 15 2025 08:36:58 GMT+0000 (Coordinated Universal Time) https://www.mirayogashala.com/100-hour-yoga-teacher-training-in-rishikesh.php

@mirayogshala12 #php

star

Thu May 15 2025 07:05:10 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/amazon-clone

@raydensmith #amazonclone #e-commerceclone

star

Thu May 15 2025 06:59:30 GMT+0000 (Coordinated Universal Time)

@jrray ##linux ##terminal

star

Wed May 14 2025 13:40:52 GMT+0000 (Coordinated Universal Time) https://github.com/kiranpalsingh1806/DSA-Code-Snippets

@gohilghanu

star

Wed May 14 2025 12:24:46 GMT+0000 (Coordinated Universal Time) https://www.appclonex.com/trustwallet-clone-script

@riyageorge0895 #trustwalletclone

star

Wed May 14 2025 09:07:47 GMT+0000 (Coordinated Universal Time) https://rishikeshyogkendra.com/7-days-prenatal-postnatal-yoga-course-in-rishikesh.php

@Rskyogkendra #yoga #yttc #yogateacher #yogaschool #yogattc #education #yttcinrishikesh #yogattcinrishikesh

star

Wed May 14 2025 08:57:45 GMT+0000 (Coordinated Universal Time) https://www.mirayogashala.com/200-hour-yoga-teacher-training-in-rishikesh.php

@mirayogashala10

star

Wed May 14 2025 07:01:00 GMT+0000 (Coordinated Universal Time) https://www.roblox.com/

@mdevil1619

star

Tue May 13 2025 13:27:44 GMT+0000 (Coordinated Universal Time)

@reiddd #javascript

star

Tue May 13 2025 12:44:37 GMT+0000 (Coordinated Universal Time) https://dpbosse.net/pannel/PADMINIMORNING/159

@dpbossenet

Save snippets that work with our extensions

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