Snippets Collections
rstudioapi::getSourceEditorContext()$path
Console Output
Started by user Ishwar Shinde
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/django-todo-app-delivery
The recommended git tool is: NONE
No credentials specified
> git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/django-todo-app-delivery/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/ishwarshinde041/Jenkins-CI-CD-project.git # timeout=10
Fetching upstream changes from https://github.com/ishwarshinde041/Jenkins-CI-CD-project.git
> git --version # timeout=10
> git --version # 'git version 2.34.1'
> git fetch --tags --force --progress -- https://github.com/ishwarshinde041/Jenkins-CI-CD-project.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/main^{commit} # timeout=10
Checking out Revision c2dca3f30890792a3f6eb6078f05f4d886b40129 (refs/remotes/origin/main)
> git config core.sparsecheckout # timeout=10
> git checkout -f c2dca3f30890792a3f6eb6078f05f4d886b40129 # timeout=10
Commit message: "Update index.html"
> git rev-list --no-walk c2dca3f30890792a3f6eb6078f05f4d886b40129 # timeout=10
[django-todo-app-delivery] $ /bin/sh -xe /tmp/jenkins4033466684745059068.sh
+ echo Code cloned...
Code cloned...
+ docker build . -t django-app
Sending build context to Docker daemon   2.67MB

Step 1/6 : FROM python:3.9
3.9: Pulling from library/python
de4cac68b616: Pulling fs layer
d31b0195ec5f: Pulling fs layer
9b1fd34c30b7: Pulling fs layer
c485c4ba3831: Pulling fs layer
9c94b131279a: Pulling fs layer
863530a48f51: Pulling fs layer
6738828c119e: Pulling fs layer
d271c014c3a0: Pulling fs layer
c485c4ba3831: Waiting
9c94b131279a: Waiting
863530a48f51: Waiting
6738828c119e: Waiting
d271c014c3a0: Waiting
d31b0195ec5f: Verifying Checksum
d31b0195ec5f: Download complete
de4cac68b616: Verifying Checksum
de4cac68b616: Download complete
9b1fd34c30b7: Verifying Checksum
9b1fd34c30b7: Download complete
9c94b131279a: Verifying Checksum
9c94b131279a: Download complete
863530a48f51: Verifying Checksum
863530a48f51: Download complete
6738828c119e: Verifying Checksum
6738828c119e: Download complete
d271c014c3a0: Verifying Checksum
d271c014c3a0: Download complete
c485c4ba3831: Verifying Checksum
c485c4ba3831: Download complete
de4cac68b616: Pull complete
d31b0195ec5f: Pull complete
9b1fd34c30b7: Pull complete
c485c4ba3831: Pull complete
9c94b131279a: Pull complete
863530a48f51: Pull complete
6738828c119e: Pull complete
d271c014c3a0: Pull complete
Digest: sha256:9bae2a5ce72f326c8136d517ade0e9b18080625fb3ba7ec10002e0dc99bc4a70
Status: Downloaded newer image for python:3.9
---> 8bdfd6cc4bbf
Step 2/6 : WORKDIR app
---> Running in 61650cd643fd
Removing intermediate container 61650cd643fd
---> 976056a2d895
Step 3/6 : COPY . /app
---> 5b94f1ad0061
Step 4/6 : RUN pip install -r requirements.txt
---> Running in c3dacf8bf4ed
Collecting asgiref==3.2.3
Downloading asgiref-3.2.3-py2.py3-none-any.whl (18 kB)
Collecting Django==3.0.3
Downloading Django-3.0.3-py3-none-any.whl (7.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.5/7.5 MB 5.6 MB/s eta 0:00:00
Collecting django-cors-headers==3.2.1
Downloading django_cors_headers-3.2.1-py3-none-any.whl (14 kB)
Collecting djangorestframework==3.11.0
Downloading djangorestframework-3.11.0-py3-none-any.whl (911 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 911.2/911.2 kB 42.1 MB/s eta 0:00:00
Collecting pytz==2019.3
Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 509.2/509.2 kB 45.7 MB/s eta 0:00:00
Collecting sqlparse==0.3.0
Downloading sqlparse-0.3.0-py2.py3-none-any.whl (39 kB)
Installing collected packages: pytz, asgiref, sqlparse, Django, djangorestframework, django-cors-headers
Successfully installed Django-3.0.3 asgiref-3.2.3 django-cors-headers-3.2.1 djangorestframework-3.11.0 pytz-2019.3 sqlparse-0.3.0
[91mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[0m[91m
[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: pip install --upgrade pip
[0mRemoving intermediate container c3dacf8bf4ed
---> 3d6b4bb36bd2
Step 5/6 : EXPOSE 8001
---> Running in 56dd98811220
Removing intermediate container 56dd98811220
---> 96ed2bc70110
Step 6/6 : CMD ["python","manage.py","runserver","0.0.0.0:8001"]
---> Running in 4fd53066b777
Removing intermediate container 4fd53066b777
---> 6b72719ff06c
Successfully built 6b72719ff06c
Successfully tagged django-app:latest
+ echo Code Build...
Code Build...
+ docker run -d -p 8001:8001 django-app:latest
5c625dac7bccf872144dabbd4deff8d6102957cc18652f90950c7fce8694c1e8
+ echo Code Deployed...
Code Deployed...
Finished: SUCCESS
echo "Code Cloned...."

docker build . -t django-app

echo "Code Build...."

docker run -d -p 8001:8001 django-app;latest

echo "Code Deployed...."
Console Output
Started by user Ishwar Shinde
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/django-todo-app-delivery
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/django-todo-app-delivery/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/ishwarshinde041/Jenkins-CI-CD-project.git # timeout=10
Fetching upstream changes from https://github.com/ishwarshinde041/Jenkins-CI-CD-project.git
 > git --version # timeout=10
 > git --version # 'git version 2.34.1'
 > git fetch --tags --force --progress -- https://github.com/ishwarshinde041/Jenkins-CI-CD-project.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/main^{commit} # timeout=10
Checking out Revision c2dca3f30890792a3f6eb6078f05f4d886b40129 (refs/remotes/origin/main)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f c2dca3f30890792a3f6eb6078f05f4d886b40129 # timeout=10
Commit message: "Update index.html"
 > git rev-list --no-walk c2dca3f30890792a3f6eb6078f05f4d886b40129 # timeout=10
[django-todo-app-delivery] $ /bin/sh -xe /tmp/jenkins4033466684745059068.sh
+ echo Code cloned...
Code cloned...
+ docker build . -t django-app
Sending build context to Docker daemon   2.67MB

Step 1/6 : FROM python:3.9
3.9: Pulling from library/python
de4cac68b616: Pulling fs layer
d31b0195ec5f: Pulling fs layer
9b1fd34c30b7: Pulling fs layer
c485c4ba3831: Pulling fs layer
9c94b131279a: Pulling fs layer
863530a48f51: Pulling fs layer
6738828c119e: Pulling fs layer
d271c014c3a0: Pulling fs layer
c485c4ba3831: Waiting
9c94b131279a: Waiting
863530a48f51: Waiting
6738828c119e: Waiting
d271c014c3a0: Waiting
d31b0195ec5f: Verifying Checksum
d31b0195ec5f: Download complete
de4cac68b616: Verifying Checksum
de4cac68b616: Download complete
9b1fd34c30b7: Verifying Checksum
9b1fd34c30b7: Download complete
9c94b131279a: Verifying Checksum
9c94b131279a: Download complete
863530a48f51: Verifying Checksum
863530a48f51: Download complete
6738828c119e: Verifying Checksum
6738828c119e: Download complete
d271c014c3a0: Verifying Checksum
d271c014c3a0: Download complete
c485c4ba3831: Verifying Checksum
c485c4ba3831: Download complete
de4cac68b616: Pull complete
d31b0195ec5f: Pull complete
9b1fd34c30b7: Pull complete
c485c4ba3831: Pull complete
9c94b131279a: Pull complete
863530a48f51: Pull complete
6738828c119e: Pull complete
d271c014c3a0: Pull complete
Digest: sha256:9bae2a5ce72f326c8136d517ade0e9b18080625fb3ba7ec10002e0dc99bc4a70
Status: Downloaded newer image for python:3.9
 ---> 8bdfd6cc4bbf
Step 2/6 : WORKDIR app
 ---> Running in 61650cd643fd
Removing intermediate container 61650cd643fd
 ---> 976056a2d895
Step 3/6 : COPY . /app
 ---> 5b94f1ad0061
Step 4/6 : RUN pip install -r requirements.txt
 ---> Running in c3dacf8bf4ed
Collecting asgiref==3.2.3
  Downloading asgiref-3.2.3-py2.py3-none-any.whl (18 kB)
Collecting Django==3.0.3
  Downloading Django-3.0.3-py3-none-any.whl (7.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.5/7.5 MB 5.6 MB/s eta 0:00:00
Collecting django-cors-headers==3.2.1
  Downloading django_cors_headers-3.2.1-py3-none-any.whl (14 kB)
Collecting djangorestframework==3.11.0
  Downloading djangorestframework-3.11.0-py3-none-any.whl (911 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 911.2/911.2 kB 42.1 MB/s eta 0:00:00
Collecting pytz==2019.3
  Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 509.2/509.2 kB 45.7 MB/s eta 0:00:00
Collecting sqlparse==0.3.0
  Downloading sqlparse-0.3.0-py2.py3-none-any.whl (39 kB)
Installing collected packages: pytz, asgiref, sqlparse, Django, djangorestframework, django-cors-headers
Successfully installed Django-3.0.3 asgiref-3.2.3 django-cors-headers-3.2.1 djangorestframework-3.11.0 pytz-2019.3 sqlparse-0.3.0
[91mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[0m[91m
[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: pip install --upgrade pip
[0mRemoving intermediate container c3dacf8bf4ed
 ---> 3d6b4bb36bd2
Step 5/6 : EXPOSE 8001
 ---> Running in 56dd98811220
Removing intermediate container 56dd98811220
 ---> 96ed2bc70110
Step 6/6 : CMD ["python","manage.py","runserver","0.0.0.0:8001"]
 ---> Running in 4fd53066b777
Removing intermediate container 4fd53066b777
 ---> 6b72719ff06c
Successfully built 6b72719ff06c
Successfully tagged django-app:latest
+ echo Code Build...
Code Build...
+ docker run -d -p 8001:8001 django-app:latest
5c625dac7bccf872144dabbd4deff8d6102957cc18652f90950c7fce8694c1e8
+ echo Code Deployed...
Code Deployed...
Finished: SUCCESS
sudo usermod -aG docker Jenkins
sudo reboot
-- EGV PURCHASE SUCCESS BASED ON TXN MONTH
select year, month, COUNT(merchant_transaction_id) AS cnt, SUM(original_balance/100) AS amt
from egv.gift_cards 
where year IN (2022, 2023) -- AND month BETWEEN (9-3) AND 9
AND program_id = 'PHONEPEGC' AND tenant_id LIKE 'PHONEPE%' AND merchant_id = 'PHONEPEGC'
GROUP BY year, month

-- WALLET TOPUP SUCCESS BASED ON TXN MONTH
SELECT year, month, COUNT(merchant_reference_id) AS cnt, SUM(amount/100) as amt
FROM wallet.transaction_master
WHERE year IN (2022, 2023) -- AND month BETWEEN 3 AND 9
AND category = 'TOPUP' AND txn_type = 'CREDIT'
AND txn_state = 'SUCCESS' AND response_code = 'SUCCESS'
GROUP BY year, month

-- EGV PURCHASE FRAUD CNT & AMT BASED ON TXN MONTH
select A.year, A.month, count(eventdata_transactionid) as count, sum(amt) as amount from 
    (select merchant_transaction_id, card_number, original_balance/100 AS amt, year, month
    from egv.gift_cards 
    where year IN (2022, 2023) -- AND month BETWEEN (9-3) AND 9
    AND program_id = 'PHONEPEGC' AND tenant_id LIKE 'PHONEPE%' AND merchant_id = 'PHONEPEGC')A
INNER JOIN
    (select transaction_id, global_payment_id, amount
    from payment.transactions 
    where year IN (2022, 2023) -- AND month BETWEEN (9-3) AND 9
    and state='COMPLETED' and error_code='SUCCESS' and backend_error_code='SUCCESS'
    AND flow IN ('CONSUMER_TO_MERCHANT_V2', 'CONSUMER_TO_MERCHANT'))B
on A.merchant_transaction_id = B.global_payment_id
INNER JOIN
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month = 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)C
on B.transaction_id = C.eventdata_transactionid
group by A.year, A.month
order by A.year, A.month

-- WALLET TOPUP FRAUD CNT & AMT BASED ON TXN MONTH
select A.year, A.month, count(merchant_reference_id) as count, sum(amt) as amount from 
    (SELECT merchant_reference_id, amount/100 as amt, year, month
    FROM wallet.transaction_master
    WHERE year IN (2022, 2023) -- AND month BETWEEN 3 AND 9
    AND category = 'TOPUP' AND txn_type = 'CREDIT'
    AND txn_state = 'SUCCESS' AND response_code = 'SUCCESS'
    GROUP BY merchant_reference_id, amount/100, year, month)A
INNER JOIN
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month BETWEEN 6 AND 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)C
on A.merchant_reference_id = C.eventdata_transactionid
group by A.year, A.month
order by A.year, A.month

-- EGV PURCHASE FRAUD CNT & AMT BASED ON REPORTED MONTH
select A.year, A.month, count(eventdata_transactionid) as count, sum(amt) as amount from 
    (select merchant_transaction_id, card_number, original_balance/100 AS amt, year, month
    from egv.gift_cards 
    where year IN (2022, 2023) -- AND month BETWEEN (9-3) AND 9
    AND program_id = 'PHONEPEGC' AND tenant_id LIKE 'PHONEPE%' AND merchant_id = 'PHONEPEGC')A
INNER JOIN
    (select transaction_id, global_payment_id, amount
    from payment.transactions 
    where year IN (2022, 2023) -- AND month BETWEEN (9-3) AND 9
    and state='COMPLETED' and error_code='SUCCESS' and backend_error_code='SUCCESS'
    AND flow IN ('CONSUMER_TO_MERCHANT_V2', 'CONSUMER_TO_MERCHANT'))B
on A.merchant_transaction_id = B.global_payment_id
INNER JOIN
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month = 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)C
on B.transaction_id = C.eventdata_transactionid
group by A.year, A.month
order by A.year, A.month

-- WALLET TOPUP FRAUD CNT & AMT BASED ON REPORTED MONTH
select C.year, C.month, count(merchant_reference_id) as count, sum(amt) as amount from 
    (SELECT merchant_reference_id, amount/100 as amt
    FROM wallet.transaction_master
    WHERE year IN (2022, 2023) -- AND month BETWEEN 3 AND 9
    AND category = 'TOPUP' AND txn_type = 'CREDIT'
    AND txn_state = 'SUCCESS' AND response_code = 'SUCCESS'
    GROUP BY merchant_reference_id, amount/100)A
INNER JOIN
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month BETWEEN 6 AND 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)C
on A.merchant_reference_id = C.eventdata_transactionid
group by C.year, C.month
order by C.year, C.month

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

-- EGV REDEEM FRAUD BASED ON TXN MONTH
SELECT A.year, A.month, COUNT(B.transaction_id), SUM(B.amt) as fraud_amt FROM
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month BETWEEN 6 AND 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)A
INNER JOIN
    (select substr(merchant_transaction_id, 0, instr(merchant_transaction_id,':')-1) as transaction_id , sum(amount) as amt, year, month
    from egv.gift_card_histories
    where operation like 'REDEEM'
    and year IN (2022, 2023)
    GROUP BY substr(merchant_transaction_id, 0, instr(merchant_transaction_id,':')-1), year, month)B
ON A.eventdata_transactionid = B.transaction_id
GROUP BY A.year, A.month

-- EGV REDEEM FRAUD BASED ON REPORTED MONTH
SELECT B.year, B.month, COUNT(B.transaction_id), SUM(B.amt) as fraud_amt FROM
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month BETWEEN 6 AND 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)A
INNER JOIN
    (select substr(merchant_transaction_id, 0, instr(merchant_transaction_id,':')-1) as transaction_id , sum(amount) as amt, year, month
    from egv.gift_card_histories
    where operation like 'REDEEM'
    and year IN (2022, 2023)
    GROUP BY substr(merchant_transaction_id, 0, instr(merchant_transaction_id,':')-1), year, month)B
ON A.eventdata_transactionid = B.transaction_id
GROUP BY B.year, B.month
 
-- WALLET REDEEM FRAUD BASED ON TXN MONTH
SELECT B.year, B.month, COUNT(B.txn_id), SUM(B.amt) as fraud_amt FROM
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month BETWEEN 6 AND 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)A
INNER JOIN
    (SELECT txn_id, (amount/100) as amt, year, month
    FROM wallet.transaction_master
    WHERE year IN (2022, 2023)
    AND category = 'ORDER' AND txn_type = 'DEBIT'
    AND txn_state = 'SUCCESS' AND response_code = 'SUCCESS')B
ON A.eventdata_transactionid = B.txn_id
GROUP BY B.year, B.month

-- WALLET REDEEM FRAUD BASED ON REPORTED MONTH
SELECT A.year, A.month, COUNT(B.txn_id), SUM(B.amt) as fraud_amt FROM
    (select eventdata_transactionid, year, month
    from foxtrot_stream.cerebro_default 
    where year IN (2022, 2023) -- AND month BETWEEN 6 AND 9
    AND (eventdata_fraudtxn = 1 or eventdata_action = 'FRAUD')
    and eventtype = 'MARK_TRANSACTION'
    GROUP BY eventdata_transactionid, year, month)A
INNER JOIN
    (SELECT txn_id, (amount/100) as amt, year, month
    FROM wallet.transaction_master
    WHERE year IN (2022, 2023)
    AND category = 'ORDER' AND txn_type = 'DEBIT'
    AND txn_state = 'SUCCESS' AND response_code = 'SUCCESS')B
ON A.eventdata_transactionid = B.txn_id
GROUP BY A.year, A.month
#include <stdio.h>
int main()
{
    int num;
    printf("enter a num");
    scanf("%d",&num);
    (num%2==0)?printf("%d is even",num):printf("%d is odd",num);
}
//program to take an imput from user and print a greeting message
#include <stdio.h>
int main()
{
    char name[10];
    printf("enter your name");
    /* input from user */
    scanf("%s",&name);
    printf("how are u  %s",name);
}
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

sudo apt-get update
sudo apt-get install jenkins
sudo apt update
sudo apt install openjdk-17-jre
java -version
public class CardsPanel : Panel
{
    const int CardWidth = 200;
    const int CardHeight = 150;

    public CardsViewModel ViewModel { get; set; }

    public CardsPanel()
    {
    }
    public CardsPanel(CardsViewModel viewModel)
    {
        ViewModel = viewModel;
        ViewModel.Cards.CollectionChanged += Cards_CollectionChanged;
    }

    private void Cards_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
    {
        DataBind();
    }

    public void DataBind()
    {
        SuspendLayout();
        Controls.Clear();

        for(int i = 0; i < ViewModel.Cards.Count; i++)
        {
            var newCtl = new CardControl(ViewModel.Cards[i]);
            newCtl.DataBind();
            SetCardControlLayout(newCtl, i);
            Controls.Add(newCtl);
        }
        ResumeLayout();
    }

    void SetCardControlLayout(CardControl ctl, int atIndex)
    {
        ctl.Width = CardWidth;
        ctl.Height = CardHeight;

        //calc visible column count
        int columnCount = Width / CardWidth;

        //calc the x index and y index.
        int xPos = (atIndex % columnCount) * CardWidth;
        int yPos = (atIndex / columnCount) * CardHeight;

        ctl.Location = new Point(xPos, yPos);
    }
}

public partial class CardControl : UserControl
{
    public CardViewModel ViewModel { get; set; }

    public CardControl()
    {
        InitializeComponent();
    }
    public CardControl(CardViewModel viewModel)
    {
        ViewModel = viewModel;
        InitializeComponent();
    }

    public void DataBind()
    {
        SuspendLayout();

        tbAge.Text = ViewModel.Age.ToString();
        tbAge.Name = ViewModel.Name;
        pbPicture.Image = ViewModel.Picture;

        ResumeLayout();
    }
}

public class CardsViewModel
{
    public ObservableCollection<CardViewModel> Cards { get; set; }
}

public class CardViewModel
{
    public string Name { get; set; }
    public int Age { get; set; }
    public Bitmap Picture { get; set; }
}

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        cardsPanel1.ViewModel = LoadSomeData();
        cardsPanel1.DataBind();
    }

    private CardsViewModel LoadSomeData()
    {
        ObservableCollection<CardViewModel> cards = new ObservableCollection<CardViewModel>();
        cards.Add(new CardViewModel()
        {
            Age = 1,
            Name = "Dan",
            Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg"))
        });
        cards.Add(new CardViewModel()
        {
            Age = 2,
            Name = "Gill",
            Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg"))
        });
        cards.Add(new CardViewModel()
        {
            Age = 3,
            Name = "Glyn",
            Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg"))
        });
        cards.Add(new CardViewModel()
        {
            Age = 4,
            Name = "Lorna",
            Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg"))
        });
        cards.Add(new CardViewModel()
        {
            Age = 5,
            Name = "Holly",
            Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg"))
        });            
        CardsViewModel VM = new CardsViewModel()
        {
            Cards = cards
        };
        return VM;
    }
}
              - name: ChatGPT CodeReviewer
                uses: anc95/ChatGPT-CodeReview@v1.0.11
            
(async () => {
    await import('https://code.chatgptjs.org/chatgpt-latest.min.js');
    // Your code here...
})();
<> Copy code
Error
Code copied!
Private Sub Command0_Click()
    Dim DocN As String
    Dim LWordDoc As String
    Dim oApp As Object
    Dim oDoc As Object
    Dim oVariable As Variable
    DocN = "Demo use of variables.docx"
    'Path to the word document
    LWordDoc = "C:\Temp\20230411 test\" & DocN
    If Dir(LWordDoc) = "" Then
        MsgBox "Document not found."
    Else
        'Create an instance of MS Word
        Set oApp = CreateObject(Class:="Word.Application")
        oApp.Visible = True
        'Open the Document
        Set oDoc = oApp.Documents.Open(Filename:=LWordDoc)
    End If
    Call dump_to_file("")
    For Each oVariable In oDoc.Variables
        Call append_to_file(oVariable.Name & " : " & oVariable.Value)
    Next oVariable
    ' Close doc
    oDoc.Close SaveChanges:=True ' True to save, False to close without saving
    Set oDoc = Nothing
    Set oApp = Nothing
    MsgBox "done"
End Sub
1.To check which Git credentials are configured in your system, you can use the following command in the terminal:

```bash
git config --list
```

2. To permanently remove the user.email and user.name settings from your Git configuration, you can use the following commands in the terminal:

```bash
git config --global --unset user.email
git config --global --unset user.name
```

3. Then run the git config --list command to check your Git configuration, the output will not include the user.email and user.name settings.

class Solution:
    def longestPalindromeSubseq(self, s: str) -> int:
        def lcs(s1, s2):
            n = len(s1)
            m = len(s2)
            dp = [[-1] * (m + 1) for i in range(n + 1)]
            for i in range(n + 1):dp[i][0] = 0
            for i in range(m + 1): dp[0][i] = 0
            for ind1 in range(1, n + 1):
                for ind2 in range(1, m + 1):
                    if s1[ind1 - 1] == s2[ind2 - 1]:
                        dp[ind1][ind2] = 1 + dp[ind1 - 1][ind2 - 1]
                    else:
                        dp[ind1][ind2] = max(dp[ind1 - 1][ind2], dp[ind1][ind2 - 1])
            return dp[n][m]
#printing
def lcs(s1, s2):
    n = len(s1)
    m = len(s2)
    
    dp = [[0 for j in range(m + 1)] for i in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 0
    for i in range(m + 1):
        dp[0][i] = 0

    for ind1 in range(1, n + 1):
        for ind2 in range(1, m + 1):
            if s1[ind1 - 1] == s2[ind2 - 1]:
                dp[ind1][ind2] = 1 + dp[ind1 - 1][ind2 - 1]
            else:
                dp[ind1][ind2] = 0+max(dp[ind1 - 1][ind2], dp[ind1][ind2 - 1])

    len_ = dp[n][m]
    i = n
    j = m
    
    index = len_ - 1
    str_ = ""
    for k in range(1,1+len_):
      str_+="$" #dummy string
    
    while i > 0 and j > 0:
        if s1[i - 1] == s2[j - 1]:
            str_ = s1[i - 1] + str_[:-1]
            index -= 1
            i -= 1
            j -= 1
        elif s1[i - 1] > s2[j - 1]:
            i -= 1
        else:
            j -= 1
    
    print("The Longest Common Subsequence is", str_)
#memo
class Solution:
    def longestCommonSubsequence(self, text1: str, text2: str) -> int:
        def f(i1,i2,dp):
            if i1<0 or i2<0:return 0
            if dp[i1][i2]!=-1:return dp[i1][i2]
            if text1[i1]==text2[i2]:
                dp[i1][i2] = 1+f(i1-1,i2-1,dp)
                return dp[i1][i2]

            else:
                dp[i1][i2] = max(f(i1,i2-1,dp),f(i1-1,i2,dp))
                return dp[i1][i2]

        dp = [[-1 for i in range(len(text2))] for j in range(len(text1))]
        return f(len(text1)-1,len(text2)-1,dp)
        
local rig = script.Parent

-- Asume que 'rig' es tu modelo que contiene el AnimationController
local animationController = rig:FindFirstChildOfClass('AnimationController')

-- Crea un Animator si no existe uno ya
local animator = animationController:FindFirstChildOfClass('Animator')
if not animator then
	animator = Instance.new('Animator', animationController)
end

-- Asume que 'animation' es tu objeto Animation que está dentro del Animator
local animation = animator:FindFirstChildOfClass('Animation')

-- Carga la animación en el Animator y la reproduce
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'dart:async';
import 'package:package_info_plus/package_info_plus.dart';

Future<String> appPackageInfo() async {
  // Add your function code here!
  PackageInfo info = await PackageInfo.fromPlatform();
  String output = info.version;

  return output;
}

// Set your action name, define your arguments and return parameter,
// and then add the boilerplate code using the button on the right!
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

Future<String> addAndEditUser(
  String emailNewUser,
  String passwordCode,
  String messageInvalidEmail,
  String messageWeakPassword,
  String messageEmailAlreadyInUse,
  DocumentReference genderRef,
  DateTime createdProfileAt,
) async {
  String returnSignUp = "valid";

  try {
    UserCredential userCredential = await FirebaseAuth.instance
        .createUserWithEmailAndPassword(
            email: emailNewUser, password: passwordCode);

    final myUser = userCredential.user;

    myUser!.updateDisplayName("Αιμοδότης");
    myUser.updateEmail(emailNewUser);

    // set custom fields
    final user = FirebaseFirestore.instance.collection('users').doc(myUser.uid);
    user.set({
      'created_time': Timestamp.now(),
      'email': emailNewUser,
      'uid': myUser.uid,
      'isUserActive': true,
      'isComplete': false,
      'isAdmin': false,
      'isNyaUser': false,
      'eventCanceled': false,
      'eventChanged': false,
      'Newsletters': false,
      'gender': genderRef,
      'justCompletedAppointment': false,
      'createdProfileAt': createdProfileAt
    });
  } on FirebaseAuthException catch (e) {
    switch (e.code) {
      case 'invalid-email':
        returnSignUp = messageInvalidEmail;
        break;
      case 'weak-password':
        returnSignUp = messageWeakPassword;
        break;
      case 'email-already-in-use':
        returnSignUp = messageEmailAlreadyInUse;
        break;
    }
  }
  return returnSignUp;
}
Я умру на рассвете, 
В предназначенный час. 
Что ж, одним на планете 
Станет меньше средь вас. 
  
Не рыдал на могилах, 
Не носил к ним цветов, 
Только всё же любил их 
И придти к ним готов. 
  
Я приду на рассвете 
Не к могилам – к цветам, 
Всё, чем жил я на свете, 
Тихо им передам. 
  
К лепесткам красногубым, 
К листьям, ждущим луча, 
К самым нежным и грубым 
Наклонюсь я, шепча: 
  
«Был всю жизнь в окруженье, 
Только не был в плену. 
Будьте вы совершенней 
Жизни той, что кляну. 
  
Может, люди немного 
Станут к людям добрей. 
Дайте мне на дорогу 
Каплю влаги своей. 
  
Окруженье всё туже, 
Но, душа, не страшись: 
Смерть живая – не ужас, 
Ужас – мёртвая жизнь». 
  
          1971
#include<iostream>
#include<cmath>
#include<iomanip>


using namespace std;
int main(){

    for(int r=1;r<=9;r++){
        for(int s=0;s<=r-1;s++){
            cout<<' ';}
            for(int c=1;c<=(11-2*r);c++){
        if(r==1 || r==9) cout<<'*';
        else if(c==1 || c==(11-2*r)){cout<<'*';}
        else cout<<' ';
            }
            cout<<endl;
        
    }
   

return 0;
}
  // Set the lights
  pointLight(200, 200, 200, -200, 0, 100);
  pointLight(200, 200, 200, 200, 0, 100);
  directionalLight(200, 200, 200, 0, 0, -1);
class Solution{
    
    public:
    // Your are required to complete this function
    // function should return root of the modified BST
    void inorder(Node* root, vector<int>& bst){
        if(!root)
            return;
        inorder(root->left, bst);
        bst.push_back(root->data);
        inorder(root->right, bst);
    }
    
    Node* build(int l , int r, vector<int>& bst){
        if(l > r)
            return nullptr;
        if(l == r)
            return new Node(bst[l]);
        int m = (l + r)/2;
        Node* root = new Node(bst[m]);
        root->left = build(l, m-1,bst);
        root->right = build(m+1,r,bst);
        return root;
    }
    Node* buildBalancedTree(Node* root)
    {
    	// Code here
    	vector<int> bst;
    	inorder(root, bst);
    	return build(0, bst.size() - 1, bst);
    }
};
class Solution {
public:
    const int m = 1e9+7;
    using vvi = vector<vector<int>>;
    int countWays(int idx, int steps, int arrLen,vvi& dp){
        if(idx < 0 || idx >= arrLen)    return 0;
        if(steps == 0)
            if(idx != 0)  return 0;
            else return 1;
        if(dp[idx][steps] != -1)
            return dp[idx][steps];
        return dp[idx][steps] = ((countWays(idx,steps-1,arrLen,dp)%m + countWays(idx+1,steps-1,arrLen,dp)%m )%m+ countWays(idx-1,steps-1,arrLen,dp)%m)%m;
    }
    int numWays(int steps, int arrLen) {
        vvi dp;
        arrLen = min(steps/2+1,arrLen);
        dp.resize(arrLen + 1,vector<int>(steps+1, -1));
        return countWays(0, steps, arrLen,dp);
    }
};
function wpb_custom_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/custom-logo.png) !important;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
//hook into the administrative header output
add_action('wp_before_admin_bar_render', 'wpb_custom_logo');
var delayInMilliseconds = 1000; //1 second

setTimeout(function() {
  //your code to be executed after 1 second
}, delayInMilliseconds);
//var is not required. ,1000 is OK
Write a method that takes 2 integers as input parameters, computes and returns their greatest common divisor (GCD).
The greatest common divisor of a set of whole numbers is the largest integer which divides them all.
Example: The greatest common divisor of 12 and 15. 
Divisors of 12: 1, 2, 3, 4, 6, 12
Divisors of 15: 1, 3, 5, 15
Common divisors: 1, 3
Greatest common divisor is 3
gcd(12,15)=3



public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		System.out.println("Enter first integer:");
		int n1 = scanner.nextInt();
		
		System.out.println("Enter secon d integer:");
		int n2 = scanner.nextInt();
		
		System.out.println("The greatest common divisor for " + n1 + " and " + n2 + " is " + gcd(n1,n2));
	}
	
	public static int gcd (int n1, int n2) {
		int gcd = 1;
		int k = 1;
		while(k <= n1 && k <= n2) {
			if(n1 % k ==0 && n2 % k ==0)
				gcd = k;
			k++;
		}
		return gcd;
	}
	
}
Write a program that generates 60 random integers in interval [0,100]. Your program computes the average of the numbers that are divisible by 3.

public static void main(String[] args) {
		
		int sum=0, count=0;
		
		 for(int i=1; i<=60; i++) {
			 
	     int num = (int) (Math.random()*101);      
		  
	     if(num%3==0) {
	       sum = sum+num; 
	       count = count+1;
	     }
		}
		 double avg=(double)sum/count;
		 System.out.println("Average: "+ avg);	
	 }
}

Scanner input = new Scanner(System.in);
		System.out.println("Enter Your Choice:");
		int choice = input.nextInt();
		
		switch(choice) {
		
		   case 1: System.out.println("Günaydin"); break;
		   case 2: System.out.println("Good morning"); break;
		   case 3: System.out.println("Bonjour"); break;
		   case 4: System.out.println("Guuten Morgen"); break;
		   
		   default:System.out.println("invalid input");
		}
import java.util.Scanner;

public class example {

	public static void main(String[] args) {
		
		int number1 = (int) (Math.random() * 10);
		int number2 = (int) (Math.random() * 10);
		
		System.out.println("What is " +number1 + " * " + number2 + "?");
		Scanner scanner = new Scanner(System.in);
		int answer = scanner.nextInt();
		
		if(number1 * number2 ==answer)
			System.out.println("You are correct");
		else
			System.out.println("your answer is Wrong\n" +number1 + " * " + number2 + " should be " + (number1 * number2));
		
	}

}
export enum ThemeOptions {
  Red = 'red',
}
  
export enum ThemeModes {
  Light = 'light-theme',
  Dark = 'dark-theme',
}
  
themeOptions: ThemeOption[] = [
    {
      text: 'Red',
      value: ThemeOptions.Red,
    },
];
  
themeChanged() { // Theme color changed
    document.body.className = '';
    const className = this.activeTheme.value + '-' + this.themeMode;
    this.themeService.switchTheme(className);
}

themeModeToggled() { // Theme mode changed: Light / Dark
    document.body.className = '';
    if (this.themeMode === ThemeModes.Light) {
      this.themeMode = ThemeModes.Dark;
    } else {
      this.themeMode = ThemeModes.Light;
    }

    const className = this.activeTheme.value + '-' + this.themeMode;
    this.themeService.switchTheme(className);
}
import { DOCUMENT } from '@angular/common';
import { Inject, Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root',
})
export class ThemeService {
  constructor(@Inject(DOCUMENT) private document: Document) {}

  switchTheme(theme: string) {
    let themeLink = this.document.getElementById(
      'app-theme'
    ) as HTMLLinkElement;

    if (themeLink) {
      themeLink.href = theme + '.css';
    }
  }
}
<link id="app-theme" rel="stylesheet" type="text/css" href="red-light.css"/>
{
  "input": "src/assets/primeng-theme/themes/mytheme/custom-themes/_red-light-theme.scss",
  "bundleName": "red-light-theme",
  "inject": false
},
{
  "input": "src/assets/primeng-theme/themes/mytheme/custom-themes/_red-dark-theme.scss",
  "bundleName": "red-dark-theme",
  "inject": false
},
async function gptFunctions(prompts, model, functions){
    const plan = readFile("public/generated/shared_deps.md")
    await openai.chat.completions.create({
        messages: [{ role: "system", content: s.appSystemPrompt+"Given the prompt and the plan, return a list of strings corresponding to the new files that will be generated."}
        ,
            {
                "role": "user",
                "content": " I want a:" +s.prompt,
            },
            {
                "role": "user",
                "content": " The plan we have agreed on is:"+s.plan,
            },
        ],
        model: model,
        functions: [{'name': 'file_paths', 'description': 'Construct a list of file names.', 'parameters': {'type': 'object', 'properties': {'files_to_edit': {'type': 'array', 'items': {'type': 'string'}}}, 'required': ['files_to_edit']}}],
        function_call:{"name":"file_paths"}
      }).then((response) => {       
        let temp = JSON.parse(response.choices[0].message.function_call.arguments).files_to_edit;
        
        console.log(temp);
        
        
      }).catch((error) => {
        console.log(error);
      });
}
aws --endpoint http://0.0.0.0:4566 sqs create-queue --queue-name logistics-merchant-service-default

aws sqs create-queue --queue-name stag-logistics-merchant-service-default-dlq --endpoint  http://localhost:4566 --region us-east-1
aws sqs set-queue-attributes \
--queue-url  http://localhost:4566/000000000000/stag-logistics-merchant-service-default \
--attributes '{
    "RedrivePolicy": "{\"deadLetterTargetArn\":\"arn:aws:sqs:us-east-1:000000000000:stag-logistics-merchant-service-default-dlq\",\"maxReceiveCount\":\"3\"}"
}' --endpoint  http://localhost:4566 --region us-east-1


aws sqs create-queue --queue-name stag-logisitics-merchant-service-order-creation --endpoint  http://localhost:4566 --region us-east-1
aws sqs create-queue --queue-name stag-logisitics-merchant-service-default --endpoint  http://localhost:4566 --region us-east-1
aws sqs create-queue --queue-name stag-logistics-merchant-service-payment-callbacks.fifo --attributes "FifoQueue=true" --endpoint  http://localhost:4566 --region us-east-1
aws sqs create-queue --queue-name stag-logistics-merchant-service-payment-transactions.fifo --attributes "FifoQueue=true" --endpoint  http://localhost:4566 --region us-east-1
SELECT
EmailAddress,AMC_Status__c,Job_Role__c,AMC_Last_Activity_Date__c, Industry_Level_2_Master__c, Industry__c, SubscriberKey, Consent_Level_Summary__c,
Business_Unit__c, Region, Cat_Campaign_Most_Recent__c , Mailing_Country__c, LastModifiedDate, Language__c AS LanguageCode, CreatedDate,
FirstName, LastName

FROM (
SELECT
DISTINCT LOWER(Email__c) AS EmailAddress, i.Region__c AS Region,c.AMC_Status__c,c.Job_Role__c,c.AMC_Last_Activity_Date__c, i.Industry_Level_2_Master__c, i.Industry__c,
c.Id AS SubscriberKey, c.Consent_Level_Summary__c, i.Business_Unit__c,i.Cat_Campaign_Most_Recent__c , i.Mailing_Country__c, i.LastModifiedDate, c.Language__c, i.CreatedDate,
c.FirstName, c.LastName,

ROW_NUMBER() OVER(PARTITION BY c.ID ORDER BY i.LastModifiedDate DESC) as RowNum

FROM ent.Interaction__c_Salesforce i

JOIN ent.Contact_Salesforce_1 c ON LOWER(c.Email) = LOWER(i.Email__c)
INNER JOIN ent.ContactPointConsent_Salesforce AS cpc ON c.Id = cpc.Contact__c
INNER JOIN ent.DataUsePurpose_Salesforce AS dup ON cpc.DataUsePurposeId = dup.Id

WHERE
(
i.Business_Unit__c LIKE '%Electric Power%' OR
i.Business_Unit__c = 'EP' OR
i.Industry__c LIKE '%Electric Power%' OR
i.Industry_Level_2_Master__c in ('Data Centers', 'Emergency Power', 'Power Plants', 'Power Generation')
)
    AND Email__c IS NOT NULL
    AND Email__c NOT LIKE '%@cat.com'
    AND i.Mailing_Country__c IS NOT NULL
    AND cpc.CaptureContactPointType = 'Email'
    AND cpc.MATM_Owner__c = 'Caterpillar'
    AND dup.Name = 'Caterpillar Marketing'
    AND cpc.PrivacyConsentStatus = 'OptIn' 
    AND (cpc.EffectiveTo IS NULL OR cpc.EffectiveTo < GetDate())
 
    AND ((c.AMC_Last_Activity_Record_ID__c IS NULL) OR (c.AMC_Last_Activity_Record_ID__c <> 'Not Marketable'))
    AND (i.Mailing_State_Province__c != 'QC' OR (i.Mailing_Country__c != 'CA' AND i.Mailing_State_Province__c IS NULL))
    AND  (i.System_Language__c like 'en_%' OR (i.Mailing_Country__c != 'CA' AND i.System_Language__c is null))
    AND c.AMC_Status__c = 'Active'
        )t2

WHERE RowNum = 1
/*
  *  Use the I2C bus with EEPROM 24LC64
  *  Sketch:    eeprom.ino
  *
  *  Author: hkhijhe
  *  Date: 01/10/2010
  *
  *
  */

#include <Wire.h>



void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
    int rdata = data;
    Wire.beginTransmission(deviceaddress);
    Wire.write((int)(eeaddress >> 8)); // MSB
    Wire.write((int)(eeaddress & 0xFF)); // LSB
    Wire.write(rdata);
    Wire.endTransmission();
}

// WARNING: address is a page address, 6-bit end will wrap around
// also, data can be maximum of about 30 bytes, because the Wire library has a buffer of 32 bytes
void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
    Wire.beginTransmission(deviceaddress);
    Wire.write((int)(eeaddresspage >> 8)); // MSB
    Wire.write((int)(eeaddresspage & 0xFF)); // LSB
    byte c;
    for ( c = 0; c < length; c++)
        Wire.write(data[c]);
    Wire.endTransmission();
}

byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
    byte rdata = 0xFF;
    Wire.beginTransmission(deviceaddress);
    Wire.write((int)(eeaddress >> 8)); // MSB
    Wire.write((int)(eeaddress & 0xFF)); // LSB
    Wire.endTransmission();
    Wire.requestFrom(deviceaddress,1);
    if (Wire.available()) rdata = Wire.read();
    return rdata;
}

// maybe let's not read more than 30 or 32 bytes at a time!
void i2c_eeprom_read_buffer( int deviceaddress, unsigned int eeaddress, byte *buffer, int length ) {
    Wire.beginTransmission(deviceaddress);
    Wire.write((int)(eeaddress >> 8)); // MSB
    Wire.write((int)(eeaddress & 0xFF)); // LSB
    Wire.endTransmission();
    Wire.requestFrom(deviceaddress,length);
    int c = 0;
    for ( c = 0; c < length; c++ )
        if (Wire.available()) buffer[c] = Wire.read();
}




void setup()
{
    char somedata[] = "this is data from the eeprom"; // data to write
    Wire.begin(); // initialise the connection
    Serial.begin(9600);
    i2c_eeprom_write_page(0x50, 0, (byte *)somedata, sizeof(somedata)); // write to EEPROM

    delay(100); //add a small delay

    Serial.println("Memory written");
}

void loop()
{
    int addr=0; //first address
    byte b = i2c_eeprom_read_byte(0x50, 0); // access the first address from the memory

    while (b!=0)
    {
        Serial.print((char)b); //print content to serial port
        addr++; //increase address
        b = i2c_eeprom_read_byte(0x50, addr); //access an address from the memory
    }
    Serial.println(" ");
    delay(2000);
}


// Iterative java program to reverse an 
// array 
public class GFG { 
	
/* Function to reverse arr[] from 
	start to end*/
	static void rvereseArray(int arr[], 
					int start, int end) 
	{ 
		int temp; 
		
		while (start < end) 
		{ 
			temp = arr[start]; 
			arr[start] = arr[end]; 
			arr[end] = temp; 
			start++; 
			end--; 
		} 
	}	 
	
	/* Utility that prints out an 
	array on a line */
	static void printArray(int arr[], 
							int size) 
	{ 
		for (int i = 0; i < size; i++) 
			System.out.print(arr[i] + " "); 
		
		System.out.println(); 
	} 

	// Driver code 
	public static void main(String args[]) { 
		
		int arr[] = {1, 2, 3, 4, 5, 6}; 
		printArray(arr, 6); 
		rvereseArray(arr, 0, 5); 
		System.out.print("Reversed array is \n"); 
		printArray(arr, 6); 
		
	} 
} 

// This code is contributed by Sam007 
.text{
    color: var(--black);
}
:root{
    --black: #000;
    --white: #fff;
}

@media (prefers-color-scheme: dark){
    :root{
        --black: #fff;
        --white: #000;
    }
}
<form id="form1" runat="server">
<div id="wrapper">
    <div id="header">
        <h1>Welcome to our Website</h1>

    <div id="nav">
        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">Products</a></li>
            <li><a href="#">Services</a></li>
            <li><a href="#">Contact</a></li>
        </ul>
    </div> <!-- end nav-->
    </div> <!-- end header-->
    <div id="content">
        <h2>Page Heading</h2>
        <p>welcome</p>
        <p>welcome</p>
        <p>welcome</p>
    </div> <!-- end content-->
    <div id="footer">
        <p>Copyright 2010</p>
    </div> <!-- end footer-->
</div><!-- end wrapper-->
</form>
// Helper: Reads an array of IDs from a collection concurrently
const readIds = async (collection, ids) => {
    const reads = ids.map(id => collection.doc(id).get() );
    const result = await Promise.all(reads);
    return result.map(v => v.data());
}
Về tới nhà cái lag ngang luôn ?? 
class Solution {
public:
	//assume you are standing at the ith index and you ask should I choose (i-1)th or (i-2)th to reach the ith position then choose whichever is lesser in cost.
	// ex - > [2,3,1,1,1,4,2,1,3]
	// we insert 0 at beginning and end
	// [0,2,3,1,1,1,4,2,1,3,0], n = 11
	//we start the iteration from 2nd index 
	// [0,2,_,_,_,_,_,_,_,_,_]
	// [0,2,3,_,_,_,_,_,_,_,_]
	// [0,2,3,3,_,_,_,_,_,_,_]
	// [0,2,3,3,4,_,_,_,_,_,_]
	// [0,2,3,3,4,4,_,_,_,_,_]
	// [0,2,3,3,4,4,8,_,_,_,_]
	// [0,2,3,3,4,4,8,6,_,_,_]
	// [0,2,3,3,4,4,8,6,7,_,_]
	// [0,2,3,3,4,4,8,6,7,9,_]
	// [0,2,3,3,4,4,8,6,7,9,7]
	// our answer is 7;

    int minCostClimbingStairs(vector<int>& cost) {
        cost.insert(cost.begin() + 0, 0);
        cost.push_back(0);
        vector<int> dp(cost);
        for(int i = 2; i < dp.size() ; i++)
            dp[i] = dp[i] + min(dp[i-1],dp[i-2]);
        return dp.back();
    }
};
class Solution{

public:
    int searchBST(Node* root, int target, int ans = -1){
        if(!root){
            return ans;
        }
        if(root->data <= target){
            ans = root->data;
            return searchBST(root->right,target, ans);
        }
        return searchBST(root->left, target, ans);
        
    }
    int floor(Node* root, int x) {
        // Code here
        if(!root )  return -1;
        return searchBST(root, x);
    }
};
function create_custom_post_type_and_taxonomy() {
    // Register Custom Post Type
    register_post_type( 'testmonial',
        array(
            'labels' => array(
                'name' => __( 'Testmonials' ),
                'singular_name' => __( 'Testmonial' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'testmonials/%testmonials_cat%'),
            'supports' => array('title', 'editor', 'thumbnail', 'excerpt')
        )
    );

    // Register Custom Taxonomy
    register_taxonomy(
        'testmonials_cat', 
        'testmonial', 
        array(
            'label' => __( 'Testmonials Categories' ),
            'rewrite' => array( 'slug' => 'testmonials-cat' ),
            'hierarchical' => true,
        )
    );

    // Flush rewrite rules on activation
    flush_rewrite_rules();
}

add_action( 'init', 'create_custom_post_type_and_taxonomy' );

// Replace placeholder with actual category
function change_testmonials_permalink( $post_link, $post ) {
    if ( is_object( $post ) && $post->post_type == 'testmonial' ) {
        $terms = wp_get_object_terms( $post->ID, 'testmonials_cat' );
        if ( $terms ) {
            return str_replace( '%testmonials_cat%', $terms[0]->slug, $post_link );
        }
    }
    return $post_link;
}
add_filter( 'post_type_link', 'change_testmonials_permalink', 10, 2 );
function product_custom_loop($atts){
    ob_start();
    
    $atts = shortcode_atts(array(
        'posts_per_page' => 8,
        'category' => '',
    ), $atts);
    
    $args = array(
        'post_type' => 'product',
        'posts_per_page' => $atts['posts_per_page'],
    );

    if (!empty($atts['category'])) {
        $args['tax_query'] = array(
            array(
                'taxonomy' => 'product_cat',
                'field' => 'slug',
                'terms' => $atts['category'],
            ),
        );
    }
    
    $results = new WP_Query($args);
    // echo '<pre>';
    // var_dump($atts['category']);
    ?>
    <div class="row product_row <?php echo (! empty($atts['category'])) ? 'list_product': ''; ?>">
        <?php
        if($results->have_posts()):
            while($results->have_posts()):
                $results->the_post();
                global $product;
                $categories = get_the_terms(get_the_ID(), 'product_cat');
        ?>
        <div class="<?php echo (! empty($atts['category'])) ? 'col-md-12': 'col-md-3'; ?>">
            <div class="product_wrap">
                <div class="product_img_wrap">
                    <a href="<?php echo esc_url(get_permalink()); ?>">
                        <?php the_post_thumbnail('full'); ?>
                    </a>
                </div>
                <div class="product_content">
                    <?php
                        if(!$atts['category']){
                            if ($categories && !is_wp_error($categories)) {
                                $category_names = array();
                                foreach ($categories as $category) {
                                    $category_names[] = $category->name;
                                }
                                echo '<div class="pro_cat">' . implode(', ', $category_names) . '</div>';
                            }
                        }
                    ?>
                    <a class="proTitle" href="<?php echo esc_url(get_permalink()); ?>"><?php echo esc_html(get_the_title()); ?></a>
	                <div class="product_price-pack">
    	                <div class="product_price">
                			<?php 
                			  global $product;
                			  if ($product->is_type( 'simple' )) { ?>
                			<?php echo $product->get_price_html(); ?>
                			<?php } ?>
                			<?php 
                    		  if($product->get_type()=='variable') {
                    		      $available_variations = $product->get_available_variations();
                    		      $variation_id=$available_variations[0]['variation_id']; // Getting the variable id of just the 1st product. You can loop $available_variations to get info about each variation.
                    		      $variable_product1= new WC_Product_Variation( $variation_id );
                    		      $regular_price = $variable_product1 ->regular_price;
                    		      $sales_price = $variable_product1 -> sale_price;
                    		      if (empty($sales_price)) {
                    		      $sales_price = 0;
                    		        }
                    		      }
                			  ?>
            			</div>
            			<?php if(!$atts['category']){?>
                			<div class="product_btn">
                    			<a href="<?php echo esc_url( get_site_url() . '/cart/?add-to-cart=' . $product->get_id() ); ?>">
                        	        <span class="list-icon fas fa-plus"></span>
                        	    </a>
            			    </div>
        			    <?php } ?>
        			</div>
                </div>
            </div>
        </div>
        <?php
            endwhile;
        endif;
        ?>
    </div>
    <?php
    wp_reset_postdata();
    return ob_get_clean();
}
add_shortcode('wp-product','product_custom_loop');
[wp-product posts_per_page="4" category="best-selling"]
function product_cat_loop(){
    $product_cat = get_terms('product_cat' , array(
        'orderby'    => 'name',
        'order'      => 'ASC',
        'hide_empty' => true,
        // 'number' => 6,
        ));
        ?>
        <div class="row product_cat_row">
            <?php
            if(!empty($product_cat) && ! is_wp_error($product_cat)):
                foreach($product_cat as $category):
                    $thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true);
                    $thumbnail_url = wp_get_attachment_url($thumbnail_id);
                    if($thumbnail_url){
            ?>
            <div class="col-md-2">
                <div class="product_cat">
                    <div class="product_cat_img">
                        <?php if ($thumbnail_url) : ?>
                            <img src="<?php echo $thumbnail_url; ?>" alt="<?php echo $category->name; ?>">
                        <?php endif; ?>
                    </div>
                    <div class="product_cat_info">
                        <a href="<?php echo get_term_link($category); ?>">
                            <p><?php echo $category->name; ?></p>
                            <p><?php echo $category->count; ?> products </p>
                        </a>
                    </div>
                </div>
            </div>
            <?php
                    }
                endforeach;
            endif;
            ?>
        </div>
<?php }
star

Mon Oct 16 2023 15:51:57 GMT+0000 (Coordinated Universal Time)

@vs #r

star

Mon Oct 16 2023 14:55:21 GMT+0000 (Coordinated Universal Time)

@ishwarshinde041 #html

star

Mon Oct 16 2023 14:48:54 GMT+0000 (Coordinated Universal Time)

@ishwarshinde041 #html

star

Mon Oct 16 2023 14:41:28 GMT+0000 (Coordinated Universal Time)

@ishwarshinde041 #html

star

Mon Oct 16 2023 14:38:31 GMT+0000 (Coordinated Universal Time)

@ishwarshinde041 #html

star

Mon Oct 16 2023 14:08:31 GMT+0000 (Coordinated Universal Time)

@shubhangi_burle

star

Mon Oct 16 2023 14:00:27 GMT+0000 (Coordinated Universal Time)

@usman_hamed

star

Mon Oct 16 2023 13:50:47 GMT+0000 (Coordinated Universal Time)

@usman_hamed

star

Mon Oct 16 2023 11:58:37 GMT+0000 (Coordinated Universal Time)

@ishwarshinde041 #html

star

Mon Oct 16 2023 11:55:52 GMT+0000 (Coordinated Universal Time)

@ishwarshinde041 #html

star

Mon Oct 16 2023 11:28:10 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/45014556/custom-c-sharp-card-view-type-control

@amman

star

Mon Oct 16 2023 10:30:15 GMT+0000 (Coordinated Universal Time) https://github.com/marketplace/actions/chatgpt-codereviewer

@cdy94

star

Mon Oct 16 2023 10:27:12 GMT+0000 (Coordinated Universal Time) https://chatgpt.js.org/#/

@cdy94

star

Mon Oct 16 2023 09:52:14 GMT+0000 (Coordinated Universal Time) https://answers.microsoft.com/en-us/msoffice/forum/all/opening-and-closing-a-word-document-from-access/79e877e0-9a9a-4e9d-b99e-6a1ee81fb164

@paulbarry

star

Mon Oct 16 2023 05:11:22 GMT+0000 (Coordinated Universal Time)

@utp

star

Sun Oct 15 2023 22:51:24 GMT+0000 (Coordinated Universal Time)

@Yohigo

star

Sun Oct 15 2023 21:02:17 GMT+0000 (Coordinated Universal Time)

@kjust448 #package_info_plus

star

Sun Oct 15 2023 21:01:32 GMT+0000 (Coordinated Universal Time)

@kjust448

star

Sun Oct 15 2023 16:59:00 GMT+0000 (Coordinated Universal Time) https://45parallel.net/aleksey_prasolov/ya_umru_na_rassvete.html

@lamberd

star

Sun Oct 15 2023 15:03:08 GMT+0000 (Coordinated Universal Time) https://discuss.frappe.io/t/cron-job-executing-twice/110048

@menaheero

star

Sun Oct 15 2023 14:32:53 GMT+0000 (Coordinated Universal Time)

@yolobotoffender

star

Sun Oct 15 2023 11:46:31 GMT+0000 (Coordinated Universal Time) https://editor.p5js.org/

@seb_prjcts_be

star

Sun Oct 15 2023 11:44:12 GMT+0000 (Coordinated Universal Time) https://practice.geeksforgeeks.org/problems/normal-bst-to-balanced-bst/1

@DxBros #bst #balancebst #easy

star

Sun Oct 15 2023 10:09:08 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v

@chienbui

star

Sun Oct 15 2023 04:24:15 GMT+0000 (Coordinated Universal Time)

star

Sun Oct 15 2023 01:56:07 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/17883692/how-to-set-time-delay-in-javascript

@manami_13 #javascript

star

Sat Oct 14 2023 16:59:59 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Sat Oct 14 2023 16:46:53 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Sat Oct 14 2023 16:29:28 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Sat Oct 14 2023 16:17:21 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Sat Oct 14 2023 08:57:40 GMT+0000 (Coordinated Universal Time)

@susobhandash #css #json

star

Sat Oct 14 2023 08:53:57 GMT+0000 (Coordinated Universal Time)

@susobhandash #css #json

star

Sat Oct 14 2023 08:53:14 GMT+0000 (Coordinated Universal Time)

@susobhandash #css #json

star

Sat Oct 14 2023 08:48:30 GMT+0000 (Coordinated Universal Time)

@susobhandash #css #json

star

Sat Oct 14 2023 07:41:48 GMT+0000 (Coordinated Universal Time)

@jonathansdunlap #javascript

star

Sat Oct 14 2023 05:38:53 GMT+0000 (Coordinated Universal Time)

@pullamma

star

Fri Oct 13 2023 20:20:22 GMT+0000 (Coordinated Universal Time)

@shirnunn

star

Fri Oct 13 2023 18:41:04 GMT+0000 (Coordinated Universal Time) https://playground.arduino.cc/Code/I2CEEPROM/

@Vladimir_Ferenz

star

Fri Oct 13 2023 17:18:33 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/write-a-program-to-reverse-an-array-or-string/

@Venkatesh ##java

star

Fri Oct 13 2023 12:29:55 GMT+0000 (Coordinated Universal Time)

@test_abroad #html #css

star

Fri Oct 13 2023 12:27:59 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/9260957/horizontal-navigation-bar-done-in-css

@test_abroad #html

star

Fri Oct 13 2023 07:31:28 GMT+0000 (Coordinated Universal Time)

@vishalbhan

star

Fri Oct 13 2023 06:39:06 GMT+0000 (Coordinated Universal Time) https://www.facebook.com/

@abcabcabc

star

Fri Oct 13 2023 03:51:39 GMT+0000 (Coordinated Universal Time) https://practice.geeksforgeeks.org/problems/floor-in-bst/1

@DxBros #bst #binarysearchtree #floor

star

Thu Oct 12 2023 20:02:51 GMT+0000 (Coordinated Universal Time) https://stage.projects-delivery.com/wp/dean

@naveedrashid

star

Thu Oct 12 2023 20:00:59 GMT+0000 (Coordinated Universal Time)

@naveedrashid

star

Thu Oct 12 2023 19:58:26 GMT+0000 (Coordinated Universal Time)

@naveedrashid

Save snippets that work with our extensions

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