Snippets Collections
<?php 

for($sum = 10;$num < 100; $num++) {
  echo $num . "<br>";
}
  
?>
<?php  
  
$num1=10;
$num2=20;
//جمع اعداد
$sum=$num1 + $num2;

//جمع اعداد بالا به علاوه یک
$sum++;
// جمع اعداد بالا منهای یک
$sum--;
echo $sum;
  
  
  
?>
<script>
let x=112;

	
</script>

<h1>Welcomeaaaa to SvelteKit {x}</h1>
<input value={parseInt(x)+2}/>
<input bind:value={x}/>
class Grandparent {

    void displayGrandparent() {

        System.out.println("This is the Grandparent class.");

    }

}

class Parent extends Grandparent {

    void displayParent() {

        System.out.println("This is the Parent class.");

    }

}

class Child extends Parent {

    void displayChild() {

        System.out.println("This is the Child class.");

    }

}

public class MultiLevelInheritanceExample {

    public static void main(String[] args) {

        Child child = new Child();

        child.displayGrandparent(); // Accessing method from Grandparent class

        child.displayParent();      // Accessing method from Parent class

        child.displayChild();       // Accessing method from Child class

    }

}

<?php
$num1=10;
$num2:158;
$num3:815;
$num4=915;
$num5=515;
$num6:115;
$num7=150;
$num8=125;
//کلمات باید داخل""باشند
$str="hello php";
$bool=false;
$arr=array(10,"sara",false);
echo $numl." - ".$num2 .$num3." * " .$num4."<br>". ;
//با دو تقطه پشت هم فاصله گذاری میکتیم.اگر تک نقطه باشه نحوه نمایش پشت هم هستند
//خط بعدی رفتن با کد <br>
echo $num8;
//نمایش کلمات
echo $str;
//نحوه نمایش از سمت برنامه نویس
var_dump($arr);
//  نحوه نمایش از سمت کاربر حنما اون چیزی رو که میخواد نمایش بده باید داحل اندیس [] باشه
echo $arr[1];
//نمایش چندتایی
echo $arr[0]."  - ".$arr[1];
?>
<?php 
//متغیر نباید با عدد شروع بشه
//$0mamad=1; اشتباه هست
$mamad0=1;
//حروف بزرگ و کوچک اول متعیر دو دسته جدا هستند مصلا mamad با Mamad فرق داره
//فاصله نباید بین کلمات باشه مصلا $mamad 12 اشتباه هست
$Mamad_12=1;

?>
  
<?php

//نحوه کامنت کردن با دوتا اسلش هست
/*نحوه کامنت کردن با ctrl+shift+/*/

//نمایش حواب در php

echo "Salam";
echo'Salam';
print "Hello";
//نمایش حطا و جواب دهی کد برای برنامه نویس 
var_dump();
?>
class Animal {
    void eat() {
        System.out.println("The animal eats food.");
    }
}

class Dog extends Animal {
    void bark() {
        System.out.println("The dog barks.");
    }
}

public class InheritanceExample {
    public static void main(String[] args) {
        Dog myDog = new Dog();
        myDog.eat();
        myDog.bark();

        
    }
}
#include "ofConwaysGameOfLife.h"

//--------------------------------------------------------------
void ofConwaysGameOfLife::setup(){
    ofSetFrameRate(3);
    ofSetWindowShape(w, h);
    canvas.allocate(w, h, OF_IMAGE_GRAYSCALE);
    
    rPentomino();
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::update(){

}

//--------------------------------------------------------------
void ofConwaysGameOfLife::draw(){
    canvas.draw(0, 0);
    
    if (!paused) {
        ofPixels pixels = canvas.getPixels();
        for (int x = 0; x < canvas.getWidth(); x += l) {
            for (int y = 0; y < canvas.getHeight(); y += l) {
                int numAliveNeighbors = countNumAliveNeighbors(x, y);
                
                if (isAlive(x, y) && (numAliveNeighbors < 2 ||
                                      numAliveNeighbors > 3)) {
                    ofColor color = ofColor(0);
                    drawCell(x, y, pixels, color);
                    continue;
                }
                if (!isAlive(x, y) && (numAliveNeighbors == 3)) {
                    ofColor color = ofColor(255);
                    drawCell(x, y, pixels, color);
                }
            }
        }
        canvas.setFromPixels(pixels);
    }
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::exit(){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::keyPressed(int key){
    if (key == 'p') {
        paused = !paused;
    }

    if (key == 'r') {
        random();
    }
    
    if (key == 'l') {
        setAllCells(true);
    }
    
    if (key == 'd') {
        setAllCells(false);
    }
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::keyReleased(int key){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::mouseMoved(int x, int y ){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::mouseDragged(int x, int y, int button){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::mousePressed(int x, int y, int button){
    ofPixels pixels = canvas.getPixels();
        
    ofColor color = canvas.getColor(x, y);
    ofColor new_color = (color == ofColor(255)) ? ofColor(0) : ofColor(255);
        
    drawCell((x / l) * l, (y / l) * l, pixels, new_color);
    canvas.setFromPixels(pixels);
}
    

//--------------------------------------------------------------
void ofConwaysGameOfLife::mouseReleased(int x, int y, int button){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::mouseScrolled(int x, int y, float scrollX, float scrollY){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::mouseEntered(int x, int y){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::mouseExited(int x, int y){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::windowResized(int w, int h){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::gotMessage(ofMessage msg){
    
}

//--------------------------------------------------------------
void ofConwaysGameOfLife::dragEvent(ofDragInfo dragInfo){
    
}

void ofConwaysGameOfLife::setAllCells(bool isAlive) {
    ofPixels pixels = canvas.getPixels();
    ofColor color = isAlive ? ofColor(255) : ofColor(0);
    for (int x = 0; x < canvas.getWidth(); x++) {
        for (int y = 0; y < canvas.getHeight(); y++) {
            pixels.setColor(x, y, color);
        }
    }
    
    canvas.setFromPixels(pixels);
}

void ofConwaysGameOfLife::rPentomino() {
    setAllCells(false);
    
    ofPixels pixels = canvas.getPixels();
    drawCell(190, 150, pixels, ofColor(255));
    drawCell(200, 150, pixels, ofColor(255));
    drawCell(180, 160, pixels, ofColor(255));
    drawCell(190, 160, pixels, ofColor(255));
    drawCell(190, 170, pixels, ofColor(255));
    
    canvas.setFromPixels(pixels);
}

void ofConwaysGameOfLife::random() {
    ofPixels pixels = canvas.getPixels();
    for (int x = 0; x < canvas.getWidth(); x += l) {
        for (int y = 0; y < canvas.getHeight(); y+= l) {
            ofColor color = (ofRandomuf() < 0.5) ? ofColor(0) : ofColor(255);
            drawCell(x, y, pixels, color);
        }
    }
    
    canvas.setFromPixels(pixels);
}

void ofConwaysGameOfLife::drawCell(int x, int y, ofPixels& pixels, ofColor color) {
    for (int i = x; i < x + l; i++) {
        for (int j = y; j < y + l; j++) {
            pixels.setColor(i, j, color);
        }
    }
}

int ofConwaysGameOfLife::isAlive(int x, int y) {
    ofColor color = canvas.getColor(x, y);
    if (x < 0 || x > canvas.getWidth() ||
        y < 0 || y > canvas.getHeight()) {
        return 0;
    }
    int i = (color == ofColor(255)) ? 1 : 0;
    
    return i;
}

int ofConwaysGameOfLife::countNumAliveNeighbors(int x, int y) {
    int n = 0;
    
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            if (i == 0 && j == 0) {
                continue;
            }
            n += isAlive(x + i * l, y + j * l);
        }
    }
    
    return n;
}
#include <iostream>
using namespace std;

string ending(int sum, int cash) {
  const string s = "купюр";
  const string end1 = "a";
  const string end2 = "ы";
  string banknote;

  sum /= cash;

  if (sum > 4 && sum < 21 || sum > 24 && sum % 10 > 4 
    && sum % 10 <= 9 && sum % 10 == 0 || sum == 0) banknote = s;
  if (sum == 1 || sum % 10 == 1) banknote = s + end1;
  if (sum > 1 && sum < 5 || sum % 10 > 1 
    && sum % 10 < 5)  banknote = s + end2;
  
  return banknote;
}

int remainder(int sum, int cash) {
  sum -= 1;

  if (sum >= 100 && sum != 0 && sum / cash != 0) {
    cout << sum / cash << " - " << ending(sum, cash) << " " << cash << " руб.\n";
  }
  return sum;
}

int main() {
  system("clear");
  
  int sum;
  cout << "Введите сумму, которую хотите обналичить : ";
  cin >> sum;
  sum += 1;
  
  if (sum > 100 && sum < 150000 && sum % 100 == 1) {

    int cash = 5000;
    remainder(sum, cash);
      cash = 2000; sum = sum % 5000;
    remainder(sum, cash);
      cash = 1000; sum = sum % 2000;
    remainder(sum, cash);
      cash = 500; sum = sum % 1000;
    remainder(sum, cash);
      cash = 200; sum = sum % 500;
    remainder(sum, cash);
      cash = 100; sum = sum % 200;
    remainder(sum, cash);

  } else {
    cout << "Не корректная сумма для вывода денег.";
  }
}
void ofApp::draw(){
    
// for testing whether the image can display correctly.
// image.draw(0, 0);


    for (int i = 0; i < gridSize; i++) {
       for (int j = 0; j < gridSize; j++) {

           if (grid[i][j]) {
               ofSetColor(255);
           } else {
               ofSetColor(0);
           }
           ofDrawRectangle(i*cellSize , j*cellSize , cellSize, cellSize);
//         ofDrawRectangle(i , j , cellSize, cellSize);
       }
    }
}
void ofApp::update(){    

// Calculate the next generation based on the rules
    for (int i = 0; i < gridSize; i++) {
        for (int j = 0; j < gridSize; j++) {

            int neighbors = countNeighbors(i, j);

            if (grid[i][j]) {
                     nextGrid[i][j] = (neighbors == 2 || neighbors == 3);
                        // the same meaning ⬇️
//                       if (neighbors == 2 || neighbors == 3) {
//                           nextGrid[i][j] = true;
//                       } else {
//                           nextGrid[i][j] = false;
//                       }
                   } else {
                       nextGrid[i][j] = neighbors == 3;
                        // the same meaning ⬇️
//                       if (neighbors == 3) {
//                           nextGrid[i][j] = true;
//                       } else {
//                           nextGrid[i][j] = false;
//                       }
                   }
        }
    }


    // Copy the next generation to the current grid
    for (int i = 0; i < gridSize; i++) {
        for (int j = 0; j < gridSize; j++) {
            //update the changes to show them!
            grid[i][j] = nextGrid[i][j];
        }
    }
void ofApp::setup(){
//    Img.load("Water Spinach.jpg");
//    ofSetWindowShape(Img.getWidth(), Img.getHeight());
    

//  ====== Random version ========
//    ofSetFrameRate(10);
//    ofBackground(0);
//     //Initialize the grid with random values
//    for (int i = 0; i < gridSize; i++) {
//        for (int j = 0; j < gridSize; j++) {
//            grid[i][j] = ofRandom(1) > 0.5;
//        }
//    }
    
    
//   ===== image version =====
    ofSetFrameRate(10);
    image.load("Water Spinach.jpg");
//    image.load("cat-fully-charged.jpg");
    image.resize(gridSize, gridSize);
    cout << "Image width: " << image.getWidth() << " height: " << image.getHeight() << endl;


    for (int i = 0; i < gridSize; i++) {
        for (int j = 0; j < gridSize; j++) {
            ofColor pixelColor = image.getColor(i, j);
            int totalRGB = pixelColor.r + pixelColor.g + pixelColor.b;
//            cout << totalRGB << endl;

            if (totalRGB > 255*3/4) {
                grid[i][j] = true;
            } else {
                grid[i][j] = false;

            }
        }
    }


    
    
}
#include "ofApp.h"

// Variable length array declaration not allowed at file scope
// So add "const" to declare the variable is fixed

const int gridSize = 480;
const int cellSize = 1;

bool grid[gridSize][gridSize];
bool nextGrid[gridSize][gridSize];


int countNeighbors(int x, int y) {
    int count = 0;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            
            int ni = x + i;
            int nj = y + j;
            
            // x, y , and expect the cell itself
            if (ni >= 0 && ni < gridSize &&
                nj >= 0 && nj < gridSize &&
                !(i == 0 && j == 0)) {
                // if grid == true aka (1), count++
                if (grid[ni][nj]) {
                    count++;
                }
            }
        }
    }
    return count;
}


ofImage image;
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Hola Mundo</title>
  </head>
  <body>
    <h1>Hola Mundo</h1>
  </body>
</html>
//Replace Your Field with "custom_salary1" //


frappe.ui.form.on('Employee', {
    refresh: function(frm) {
        // Add a trigger when the form is refreshed or loaded
        frm.events.custom_salary1_from_ctc(frm);
    },
    ctc: function(frm) {
        // Add a trigger when the ctc field is changed
        frm.events.custom_salary1_from_ctc(frm);
    },
    custom_salary1_from_ctc: function(frm) {
        // Get the value from the ctc field and set it in custom_salary1
        var ctc_value = frm.doc.ctc;
        frm.set_value('custom_salary1', ctc_value);
    }
});
//Rename your Custom Field...
//Replace Your Custom Field with "custom_eobi_salary"
//Replace Custom Field wiht "custom_percentage_of_employee_contribution"
//Replace Custom Field wiht "custom_eobi_1_pct_by_employee"
____________________________________________________________


frappe.ui.form.on('Employee', {
    custom_eobi_salary: function(frm) {
        calculate_eobi_1_pct_by_employee(frm);
    },
    custom_percentage_of_employee_contribution: function(frm) {
        calculate_eobi_1_pct_by_employee(frm);
    }
});

function calculate_eobi_1_pct_by_employee(frm) {
    var eobi_salary = frm.doc.custom_eobi_salary;
    var employee_contribution_percentage = frm.doc.custom_percentage_of_employee_contribution;
    
    if (eobi_salary && employee_contribution_percentage) {
        var eobi_1_pct_by_employee = (eobi_salary * (employee_contribution_percentage / 100)).toFixed(2);
        frm.set_value('custom_eobi_1_pct_by_employee', eobi_1_pct_by_employee);
    }
}
//Rename your Custom Field...
//Replace Your Custom Field with "custom_eobi_salary"
//Replace Custom Field wiht "custom_percentage_of_employeer_contribution"
//Replace Custom Field wiht "calculate_eobi_5_pct_by_employer"

frappe.ui.form.on('Employee', {
    custom_eobi_salary: function(frm) {
        calculate_eobi_5_pct_by_employer(frm);
    },
    custom_percentage_of_employeer_contribution: function(frm) {
        calculate_eobi_5_pct_by_employer(frm);
    }
});

function calculate_eobi_5_pct_by_employer(frm) {
    var eobi_salary = frm.doc.custom_eobi_salary;
    var employeer_contribution_percentage = frm.doc.custom_percentage_of_employeer_contribution;
    
    if (eobi_salary && employeer_contribution_percentage) {
        var eobi_5_pct_by_employer = (eobi_salary * (employeer_contribution_percentage / 100)).toFixed(2);
        frm.set_value('custom_eobi_5_pct_by_employer', eobi_5_pct_by_employer);
    }
}
//Rename your Custom Field...
//Replace Your Custom Field with "custom_pessi_salary"
//Replace Custom Field wiht "custom_percentage_of_pessi_contribution"
//Replace Custom Field wiht "custom_pessi_6_pct_by_employer_"

frappe.ui.form.on('Employee', {
custom_pessi_salary: function(frm) {
calculate_pessi_6_pct_by_employer(frm);
},
custom_percentage_of_pessi_contribution: function(frm) {
calculate_pessi_6_pct_by_employer(frm);
}
});

function calculate_pessi_6_pct_by_employer(frm) {
var pessi_salary = frm.doc.custom_pessi_salary;
var pessi_contribution_percentage = frm.doc.custom_percentage_of_pessi_contribution;

if (pessi_salary && pessi_contribution_percentage) {
var pessi_6_pct_by_employer = (pessi_salary * (pessi_contribution_percentage / 100)).toFixed(2);
frm.set_value('custom_pessi_6_pct_by_employer_', pessi_6_pct_by_employer);
}
}
Sub listfiles()
'Updateby Extendoffice
    Dim xFSO As Object
    Dim xFolder As Object
    Dim xFile As Object
    Dim xFiDialog As FileDialog
    Dim xPath As String
    Dim I As Integer
    Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker)
    If xFiDialog.Show = -1 Then
        xPath = xFiDialog.SelectedItems(1)
    End If
    Set xFiDialog = Nothing
    If xPath = "" Then Exit Sub
    Set xFSO = CreateObject("Scripting.FileSystemObject")
    Set xFolder = xFSO.GetFolder(xPath)
    For Each xFile In xFolder.Files
        I = I + 1
        ActiveSheet.Hyperlinks.Add Cells(I, 1), xFile.Path, , , xFile.Name
    Next
End Sub
<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>A Basic HTML5 Template</title>
  <meta name="description" content="A simple HTML5 Template for new projects.">
  <meta name="author" content="SitePoint">

  <meta property="og:title" content="A Basic HTML5 Template">
  <meta property="og:type" content="website">
  <meta property="og:url" content="https://www.sitepoint.com/a-basic-html5-template/">
  <meta property="og:description" content="A simple HTML5 Template for new projects.">
  <meta property="og:image" content="image.png">

  <link rel="icon" href="/favicon.ico">
  <link rel="icon" href="/favicon.svg" type="image/svg+xml">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">

  <link rel="stylesheet" href="css/styles.css?v=1.0">

</head>

<body>
  <!-- your content here... -->
  <script src="js/scripts.js"></script>
</body>
</html>
cvat-cli --server-host app.cvat.ai --auth mk auto-annotate 274373 --function-module cvat_sdk.autocvat_sdk.auto_annotation.functions.torchvision_detection -p model_name=str:fcos_resnet50_fpn -p score_thresh=float:0.7 --allow-unmatched-labels
cvat-cli auto-annotate "<task ID>" --function-module cvat_sdk.auto_annotation.functions.torchvision_detection \
      -p model_name=str:"<model name>" ...

$ENV:PASS = Read-Host -MaskInput
pip install cvat-sdk[pytorch] cvat-cli
.\venv\Scripts\Activate.ps1
2- To Calculate Age
------------------------------
--->> BUILD -->DOCTYPE --> SEARCH "EMPLOYEE"
--->> BUILD -->CLIENT SCRIPT -->ADD NEW --> DOCTYPE=EMPLOYEE-->ENTER CODE
//RENAME "age" TO YOUR CUSTOM FIELD NAME.//
_____________________________________________
frappe.ui.form.on('Employee', {
    date_of_birth: function(frm) {
        if (frm.doc.date_of_birth) {
            var birthDate = new Date(frm.doc.date_of_birth);
            var today = new Date();
            var ageInMilliseconds = today - birthDate;
            var ageInYears = Math.floor(ageInMilliseconds / (365.25 * 24 * 60 * 60 * 1000));
            frm.set_value('age', ageInYears);
        }
    }
});
HR MODULE CONFIGURATION 

-Add Custom Fields in Employees Doctype 
-Add Client Scripts 
-Employees Work Experience in Years 
‐-------------------------

Codes to Enter in Scripts:
--->> BUILD -->DOCTYPE --> SEARCH "EMPLOYEE"
--->> BUILD -->CLIENT SCRIPT -->ADD NEW --> DOCTYPE=EMPLOYEE-->ENTER CODE
-----------------------------
To Calculate Work Experienc:

_________________________________________________________________________
frappe.ui.form.on('Employee', {
    onload: function (frm) {
        frm.add_fetch('date_of_joining', 'date_of_joining', 'date_of_joining');
    },
    refresh: function (frm) {
        calculateWorkExperience(frm);
    },
    date_of_joining: function (frm) {
        calculateWorkExperience(frm);
    },
});

function calculateWorkExperience(frm) {
    if (frm.doc.date_of_joining) {
        const dateOfJoining = new Date(frm.doc.date_of_joining);
        const currentDate = new Date();
        const diffInMilliseconds = currentDate - dateOfJoining;
        const years = Math.floor(diffInMilliseconds / (1000 * 60 * 60 * 24 * 365));
        const months = Math.floor((diffInMilliseconds % (1000 * 60 * 60 * 24 * 365)) / (1000 * 60 * 60 * 24 * 30));
        const fractionalYears = (years + months / 12).toFixed(2);
        frm.set_value('work_experience', parseFloat(fractionalYears));
    } else {
        frm.set_value('work_experience', '');
    }
}
fetch('/cart.js')
  .then(response => response.json())
  .then(cart => {
    if (
      typeof window.BOLD !== 'undefined' &&
      typeof window.BOLD.common !== 'undefined' &&
      typeof window.BOLD.common.cartDoctor !== 'undefined'
    ) {
      cart = window.BOLD.common.cartDoctor.fix(cart);
    }
    // Rest of your code here
  })
  .catch(error => {
    console.log('Error fetching cart:', error);
  });
auto compare = [](const std::pair<char, int>& lhs, const std::pair<char, int>& rhs) {
        return lhs.second < rhs.second;
    };

    // Create a priority queue of pairs (char, int) using the custom comparison function
    std::priority_queue<std::pair<char, int>, std::vector<std::pair<char, int>>, decltype(compare)> pq(compare);
<a href='' target='_blank'><img src='https://res.cloudinary.com/dnqgtf0hc/image/upload/v1693147103/apk-download-android_jmucejpng'/></a>
:root {
  --main-color: #3498db;
}
button {
  background-color: var(--main-color);
  color: white;
}
h1 {
  font-size: 24px;
  color: #FF5733;
  text-align: center;
  text-transform: uppercase;
}
css
Copy code
div {
  width: 100% - 20px;
}
/* styles.css */

/* Change the text color of the <h1> element to red */
h1 {
    color: red;
}

/* Change the text color of the <p> element to blue */
p {
    color: blue;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Text Color Example</title>
    <!-- Link your CSS file here -->
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <h1>Welcome to My Webpage</h1>
    <p>This is a sample paragraph with text that we'll style.</p>
</body>
</html>
for "laravel-mix": "^6.0.49",

"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},




BACKUP RESTORE:

//Copy your backup file to frappe-bench folder:
LS -- To show files in folder:

//REPLACE SITE1.LOCAL WITH YOUR SITE NAME:
//REPLACE DATABASE_FILE NAME WITH YOUR DATABASE BACKUP FILE.

bench --site site1.local --force restore [database_file] --with-private-files [private_file] --with-public-files [public_file]


//bench --site site1.local --force restore 20230918_102707-site1_local-database-enc.sql.gz --with-private-files 20230918_102707-site1_local-private-files-enc.tar --with-public-files 20230918_102707-site1_local-files-enc.tar

bench --site site1.local 
--force restore 20230918_102707-site1_local-database-enc.sql.gz 
--with-private-files 20230918_102707-site1_local-private-files-enc.tar 
--with-public-files 20230918_102707-site1_local-files-enc.tar

----------------------------------------------------------------------------------
APPs INSTALL ON BACKUP..
1-ERPNEXT
2-FRAPPE
3-HRMS
4-CHAT
-------------
APPS INTALL ON YOUR LOCAL SITE....???
CHECK YOUR INSTALLATION BY "bench version"
-----------------------------------------

    
REMOVE APP:
bench --site site1.local uninstall-app chat
bench --site site1.local uninstall-app app_name

//REMOVE OTHER APP THAT YOU HAVE EXTRA INSTALL.

REMOVE APP FROM YOUR BACKUP:
bench --site site1.local remove-from-installed-apps erpnext_support
bench --site site1.local remove-from-installed-apps journeys

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

INSTALL HRM:
bench get-app hrms --branch version-14
bench --site sitename install-app hrms

INSTALL CHAT:
bench get-app chat
bench --site site1.local install-app chat

//INSTALL APP THAT YOU DO NOT HAVE ON YOUR SITE BUT HAVE IN BACKUP.

-------------------------------------------------------------------------------------
//Finally Bench Migrate
bench migrate

=====================​

Taimoor
Whatsapp::  +92300-9808900
import random
print("Hi,Please enter your name:",end="")
name=input()
print("\nWelcome",name)
print("\nenter your mail:",end="")
mail=input()
oin=random.randint(100,200)
print("\nMail: Your otp is",oin,"\nwe have sent an otp to your email:",end="")
while (True):
    otp=int(input())
    if otp==oin:
        print("you have logged in :)")
        break
    else:
        print("please enter a valid one")
        continue
#defining calculator
a=int(input("enter 1st num"))
b=int(input("enter 2nd num"))
def addi(a,b):
    summ=a+b
    return(summ)
def sub(a,b):
    minu=a-b
    return(minu)
def mul(a,b):
    prod=a*b
    return(prod)
def divid(a,b):
    div=a/b
    return(div)

t=input("addi(add),sub(subtract),mul(multiply),divid(division):")
if t=='addi':
    print(addi(a,b))
elif t=='sub':
    print(sub(a,b))
elif t=='divid':
    print(divid(a,b))
else:
    print(mul(a,b))
"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},
var wd = screen.width; console.log(wd);
if (wd > 767) {



} else {
console.log('mobile else');

jQuery(document).ready(function($) {
$(".tabs li span").on("click", function() {
if ($(this).hasClass("active")) {
$(this).removeClass("active");
$(this)
.siblings(".content")
.slideUp(200);
$(".tabs li span")
.removeClass("fa-minus")
.addClass("fa-plus");
} else {
$(".tabs li span")
.removeClass("fa-minus")
.addClass("fa-plus");
$(this)
.find("i")
.removeClass("fa-plus")
.addClass("fa-minus");
$(".tabs li span").removeClass("active");
$(this).addClass("active");
$(".content").slideUp(200);
$(this)
.siblings(".content")
.slideDown(200);
}
});
});


};
  useEffect(() => {
    
    // Begin here.
    
  }, []);
# Create a copy of template.yml named template.local.yml and set your local env.
# -t = use specific template
# -p = port
# --host = 0.0.0.0 (lan access)

sudo sam local start-api -p 8181 --host 0.0.0.0 -t template.local.yml
 /boot/config.txt

dtoverlay=gpio-fan,gpiopin=18,temp=75000
Дано трехзначное число. Найдите сумму его цифр.
n = int(input())
a = n // 100
b = n // 10 % 10
c = n % 10
print(a + b + c)

Как найти число десятков в числе python
n = int(input())
print(n // 10 % 10)
      
      Последнее число
      a = int(input())
print(a % 10)

Парты
a = int(input())
b = int(input())
c = int(input())
print(a // 2 + b // 2 + c // 2 + a % 2 + b % 2 + c % 2)
      Дано положительное действительное число X. Выведите его дробную часть.

      x = float(input())
print(x - int(x))

X = float(input())
Y = int(X)
print(X - Y)

 Выведите его первую цифру после десятичной точки.
x = float(input())
print(int(x * 10) % 10)

print(str(float(input()) % 1)[2])
import React from "react";

function Pagination({ currentPage, totalPages, onPageChange }) {
  const getPageNumbers = () => {
    const pageNumbers = [];
    const visiblePages = 5; // Number of visible page links

    if (totalPages <= visiblePages) {
      // If the total number of pages is less than or equal to the visible pages,
      // show all page links
      for (let i = 1; i <= totalPages; i++) {
        pageNumbers.push(i);
      }
    } else {
      // If the total number of pages is greater than the visible pages,
      // calculate the range of page links to display based on the current page

      let startPage = currentPage - Math.floor(visiblePages / 2);
      let endPage = currentPage + Math.floor(visiblePages / 2);

      if (startPage < 1) {
        // Adjust the start and end page numbers if they go below 1 or above the total pages
        endPage += Math.abs(startPage) + 1;
        startPage = 1;
      }

      if (endPage > totalPages) {
        // Adjust the start and end page numbers if they go above the total pages
        startPage -= endPage - totalPages;
        endPage = totalPages;
      }

      for (let i = startPage; i <= endPage; i++) {
        pageNumbers.push(i);
      }
    }

    return pageNumbers;
  };

  return (
    <nav>
      <ul className="pagination">
        <li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}>
          <span className="page-link" onClick={() => onPageChange(currentPage - 1)}>
            Previous
          </span>
        </li>
        {getPageNumbers().map((pageNumber) => (
          <li
            key={pageNumber}
            className={`page-item ${pageNumber === currentPage ? "active" : ""}`}
          >
            <span className="page-link" onClick={() => onPageChange(pageNumber)}>
              {pageNumber}
            </span>
          </li>
        ))}
        <li className={`page-item ${currentPage === totalPages ? "disabled" : ""}`}>
          <span className="page-link" onClick={() => onPageChange(currentPage + 1)}>
            Next
          </span>
        </li>
      </ul>
    </nav>
  );
}

export default Pagination;


import { useState, useEffect } from "react";
import axios from "axios";
import Headers from "./parcelView/Headers";
import Sidebar from "./parcelView/sidebar";
import { Helmet } from "react-helmet-async";
import "./parcelView/admin.css";
import { RiFileEditFill } from "react-icons/ri";
import { NavLink } from "react-router-dom";
import Pagination from "../component/Pagination";
import { API_URL } from "../API/config";

function Designation() {
  const [products, setProduct] = useState([0]);
  const [currentPage, setCurrentPage] = useState(1);
  const [perPage, setPerPage] = useState(10);

  const totalPages = Math.ceil(products.length / perPage);

  const startIndex = (currentPage - 1) * perPage;
  const endIndex = startIndex + perPage - 1;

  const handlePageChange = (pageNumber) => {
     if (pageNumber >= 1 && pageNumber <= totalPages) {
      setCurrentPage(pageNumber);
    }
  };

  const getProfile = async () => {
    await axios
      .get(`${API_URL.designation.get}`)
      .then(function (response) {
        // handle success
        console.log(response.data.data);
        setProduct(response.data.data);
      })
      .catch(function (error) {
        // handle error
        console.log(error);
      });
  };

  useEffect(() => {
    getProfile();
  }, []);

  return (
    <>
      <Helmet>
        <title> Designation</title>
      </Helmet>
      <div className="wrapper ">
        <Headers />

        <Sidebar />
        <div className="content-wrapper" style={{ backgroundColor: "white" }}>
          <section className="content-header">
            <div className="container-fluid">
              <div className="row mb-2">
                <div className="col-sm-6">
                  <h1>Designation</h1>
                </div>
              </div>
            </div>
          </section>

          <section className="content">
            <div className="container-fluid">
              <div className="row">
                <div className="col-12">
                  <div className="card">
                    <div className="card-header">
                      <NavLink
                        to="/designation/add"
                        className="btn btn-primary"
                      >
                        Add Designation
                      </NavLink>
                    </div>
                    {/* /.card-header */}
                    <div className="card-body">
                      <table
                        id="example2"
                        className="table table-bordered table-hover"
                      >
                        <thead>
                          <tr>
                            <th></th>
                            <th>DesignationName</th>
                          </tr>
                        </thead>
                        <tbody>
                          {products
                            .slice(startIndex, endIndex + 1)
                            .map((item, index) => (
                              <tr key={index}>
                                <td className="">
                                  <NavLink to="/designation/update">
                                    <RiFileEditFill />
                                  </NavLink>
                                </td>
                                <td className="">{item.DesignationName}</td>
                              </tr>
                            ))}
                        </tbody>
                      </table>
                      <div className="entries-range d-flex justify-content-between mt-2">
                        <div>
                          Showing {startIndex + 1} to{" "}
                          {Math.min(endIndex + 1, products.length)} of{" "}
                          {products.length} entries
                        </div>
                        <div>
                          <Pagination
                            currentPage={currentPage}
                            totalPages={totalPages}
                            onPageChange={handlePageChange}
                          />
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </section>
        </div>
      </div>
    </>
  );
}

export default Designation;



import { toast } from "react-toastify";

export const validatePassword = (password, NewPassword) => {
  if (!password) {
    toast.error("Password is required");
    // return;
  } else if (password.length < 8) {
    toast.error("Password must be at least 8 characters long");
    return false;
  } else if (!/(?=.*[a-z])/.test(password)) {
    toast.error("Password must contain at least one lowercase letter");
    return false;
  } else if (!/(?=.*[A-Z])/.test(password)) {
    toast.error("Password must contain at least one uppercase letter");
    return false;
  } else if (!/(?=.*\d)/.test(password)) {
    toast.error("Password must contain at least one digit");
    return false;
  } else if (!/(?=.*[!@#$%^&*])/.test(password)) {
    toast.error("Password must contain at least one special character");
    return false;
  } else if (/\s/.test(password)) {
    toast.error("Password cannot contain whitespace");
    return false;
  }
  if (!NewPassword) {
    toast.error("Confirmpassword is required");
    return false;
  } else if (password != NewPassword) {
    toast.error("Passwords do not match.");
    return false;
  }

  return true;
};

export const validateLogin = (credentials, password) => {
  if (credentials == "") {
    toast.error("UserName is required...........");
    return false;
  } else if (!password) {
    toast.error("Password is required");
    return false;
  } else if (!/(?=.*[a-z])/.test(password)) {
    toast.error("Password must contain at least one lowercase letter");
    return false;
  } else if (!/(?=.*[A-Z])/.test(password)) {
    toast.error("Password must contain at least one uppercase letter");
    return false;
  }
  else if (!/(?=.*\d)/.test(password)) {
    toast.error("Password must contain at least one digit");
    return false;
  } else if (!/(?=.*[!@#$%^&*])/.test(password)) {
    toast.error("Password must contain at least one special character");
    return false;
  } else if (password.length < 8) {
    toast.error("Password must be at least 8 characters long");
    return false;
  } else if (/\s/.test(password)) {
    toast.error("Password cannot contain whitespace");
    return false;
  }
  return true;
};

export const UserForm = (credentials, password) => {
  if (credentials == "") {
    toast.error("UserName is required...........");
    return false;
  } else if (!password) {
    toast.error("Password is required");
    return false;
  } else if (!/(?=.*[a-z])/.test(password)) {
    toast.error("Password must contain at least one lowercase letter");
    return false;
  } else if (!/(?=.*[A-Z])/.test(password)) {
    toast.error("Password must contain at least one uppercase letter");
    return false;
  }
  else if (!/(?=.*\d)/.test(password)) {
    toast.error("Password must contain at least one digit");
    return false;
  } else if (!/(?=.*[!@#$%^&*])/.test(password)) {
    toast.error("Password must contain at least one special character");
    return false;
  } else if (password.length < 8) {
    toast.error("Password must be at least 8 characters long");
    return false;
  } else if (/\s/.test(password)) {
    toast.error("Password cannot contain whitespace");
    return false;
  }
  return true;
};


import React, { useState, useEffect } from "react";
import Header from "./Header";
import "./login.css";
import { Link } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { toast } from "react-toastify";
import axios from "axios";
import { API_URL } from "../../API/config";
import { validateLogin } from "../../component/Validation";

const Loginform = () => {
  const navigate = useNavigate();
  const [user, setUser] = useState({
    credentials: "",
    password: "",
  });

  let name, value;

  const handleinput = (e) => {
    name = e.target.name;
    value = e.target.value;
    setUser({ ...user, [name]: value });
  };

  const SubmitData = async (e) => {
    e.preventDefault();
    const isValidLogin = validateLogin(user.credentials, user.password);
    if (!isValidLogin) {
      toast.error(isValidLogin);
    } else {
      try {
        await axios
          .post(`${API_URL.auth.login}`, user)

          .then((response) => {
            console.log(response.data);
            toast.success(response.data.message);
            localStorage.setItem("Token", response.data.success[1]);

            navigate("/dashboard");
          });
      } catch (error) {
        if (error.response) {
          const { status, data } = error.response;
          console.log(status, data);

          if (data.error && data.error.length > 0) {
            data.error.forEach((errorMessage) => {
              toast.error(errorMessage);
            });
          } else {
            toast.error(error.response.data);
          }
        }
      }
    }
  };

  return (
    <>
      <div
        style={{
          width: "100%",
          backgroundColor: "hsl(0, 0%, 96%)",
          position: "absolute",
          zIndex: "1",
        }}
      >
        <Header />
      </div>

      <section className=" position-relative">
        <div className="px-4 py-5 px-md-5 text-center text-lg-start ">
          <div className="">
            <div
              className="row align-items-top "
              style={{
                marginLeft: "10px",
                marginRight: "10px",
                marginTop: "90px",
              }}
            >
              <div className="col-lg-6 col-md-6 mb-5 mb-lg-0">
                <h1 className="my-5 display-4 fw-bold ls-tight ">
                  The best offer <br />
                  <span className="text-primary">for your business</span>
                </h1>
                <p
                  style={{ color: "hsl(217, 10%, 50.8%)" }}
                  className="text-left"
                >
                  Lorem ipsum dolor sit amet consectetur adipisicing elit.
                  Eveniet, itaque accusantium odio, soluta, corrupti aliquam
                  quibusdam tempora at cupiditate quis eum maiores libero
                  veritatis? Dicta facilis sint aliquid ipsum atque?
                </p>
              </div>
              <div className="col-lg-6 col-md-6 mb-5 mb-lg-0 d-flex justify-content-center">
                <div className="card" style={{ width: "400px" }}>
                  <div className="card-body py-4 px-md-4">
                    <form method="POST">
                      <div className="form-outline mb-2">
                        <label
                          className="form-label  d-flex justify-content-start"
                          htmlFor="form3Example4"
                        >
                          User Name
                        </label>
                        <input
                          type="text"
                          id="credentials"
                          className="form-control"
                          name="credentials"
                          placeholder="enter your Username"
                          autoComplete="off"
                          value={user.credentials}
                          onChange={handleinput}
                        />
                      </div>

                      <div className="form-outline mb-4">
                        <label
                          className="form-label d-flex justify-content-start"
                          htmlFor="form3Example4"
                        >
                          Password
                        </label>
                        <input
                          type="password"
                          id="password"
                          className="form-control"
                          name="password"
                          minLength={8}
                          maxLength={15}
                          placeholder="enter your Password"
                          autoComplete="off"
                          value={user.password}
                          onChange={handleinput}
                        />{" "}
                      </div>
                      <div className="col text-start mb-3 mt-0 ">
                        <Link to="/forgotpassword">Forgot password?</Link>
                      </div>
                      <button
                        type="submit"
                        className="btn btn-primary  mb-2 d-flex justify-content-start"
                        onClick={SubmitData}
                      >
                        Sign in
                      </button>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </>
  );
};

export default Loginform;
star

Tue Sep 19 2023 04:32:30 GMT+0000 (Coordinated Universal Time)

@Mohammadrezasmz

star

Tue Sep 19 2023 04:28:03 GMT+0000 (Coordinated Universal Time)

@Mohammadrezasmz

star

Tue Sep 19 2023 04:18:39 GMT+0000 (Coordinated Universal Time)

@pablo1766

star

Tue Sep 19 2023 03:54:29 GMT+0000 (Coordinated Universal Time)

@viinod07

star

Tue Sep 19 2023 03:35:43 GMT+0000 (Coordinated Universal Time)

@Mohammadrezasmz

star

Tue Sep 19 2023 03:20:46 GMT+0000 (Coordinated Universal Time)

@Mohammadrezasmz

star

Tue Sep 19 2023 02:49:49 GMT+0000 (Coordinated Universal Time)

@Mohammadrezasmz

star

Tue Sep 19 2023 01:26:36 GMT+0000 (Coordinated Universal Time)

@viinod07

star

Tue Sep 19 2023 00:54:56 GMT+0000 (Coordinated Universal Time)

@yc_lan

star

Mon Sep 18 2023 22:35:01 GMT+0000 (Coordinated Universal Time)

@Stealth #c++

star

Mon Sep 18 2023 22:18:47 GMT+0000 (Coordinated Universal Time)

@yc_lan

star

Mon Sep 18 2023 22:16:43 GMT+0000 (Coordinated Universal Time)

@yc_lan

star

Mon Sep 18 2023 22:12:48 GMT+0000 (Coordinated Universal Time)

@yc_lan

star

Mon Sep 18 2023 22:02:00 GMT+0000 (Coordinated Universal Time)

@yc_lan

star

Mon Sep 18 2023 21:25:22 GMT+0000 (Coordinated Universal Time)

@puntocode

star

Mon Sep 18 2023 20:26:33 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 20:04:45 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 19:40:52 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 19:27:07 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 19:14:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/12865411/group-by-partial-string

@raca12

star

Mon Sep 18 2023 17:34:39 GMT+0000 (Coordinated Universal Time)

@Thiago_Medeiros

star

Mon Sep 18 2023 17:06:17 GMT+0000 (Coordinated Universal Time) https://www.sitepoint.com/a-basic-html5-template/?utm_source

@lbj #markup

star

Mon Sep 18 2023 17:04:50 GMT+0000 (Coordinated Universal Time)

@cvataicode

star

Mon Sep 18 2023 16:47:52 GMT+0000 (Coordinated Universal Time)

@cvataicode

star

Mon Sep 18 2023 16:16:02 GMT+0000 (Coordinated Universal Time)

@cvataicode

star

Mon Sep 18 2023 16:01:44 GMT+0000 (Coordinated Universal Time)

@cvataicode

star

Mon Sep 18 2023 16:00:49 GMT+0000 (Coordinated Universal Time)

@cvataicode

star

Mon Sep 18 2023 16:00:02 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 15:58:56 GMT+0000 (Coordinated Universal Time)

@cvataicode

star

Mon Sep 18 2023 15:55:48 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 15:23:04 GMT+0000 (Coordinated Universal Time)

@DeelenSC

star

Mon Sep 18 2023 14:46:59 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/

@sahil002

star

Mon Sep 18 2023 14:30:46 GMT+0000 (Coordinated Universal Time)

@onlinecesaref #html

star

Mon Sep 18 2023 13:39:35 GMT+0000 (Coordinated Universal Time)

@Remi

star

Mon Sep 18 2023 13:37:14 GMT+0000 (Coordinated Universal Time)

@Remi

star

Mon Sep 18 2023 13:29:34 GMT+0000 (Coordinated Universal Time)

@Remi

star

Mon Sep 18 2023 13:23:28 GMT+0000 (Coordinated Universal Time)

@Remi

star

Mon Sep 18 2023 13:00:12 GMT+0000 (Coordinated Universal Time)

@Remi

star

Mon Sep 18 2023 10:58:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/68706922/laravel-8-npm-run-dev-error-unknown-option-hide-modules

@oday #php

star

Mon Sep 18 2023 10:22:00 GMT+0000 (Coordinated Universal Time)

@Taimoor #terminal

star

Mon Sep 18 2023 10:14:38 GMT+0000 (Coordinated Universal Time)

star

Mon Sep 18 2023 10:13:24 GMT+0000 (Coordinated Universal Time)

star

Mon Sep 18 2023 10:00:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/68706922/laravel-8-npm-run-dev-error-unknown-option-hide-modules

@oday #php

star

Mon Sep 18 2023 09:13:05 GMT+0000 (Coordinated Universal Time)

@mubashir_aziz

star

Sun Sep 17 2023 22:37:38 GMT+0000 (Coordinated Universal Time)

@thecowsays #react.js

star

Sun Sep 17 2023 22:12:11 GMT+0000 (Coordinated Universal Time)

@swina

star

Sun Sep 17 2023 19:12:30 GMT+0000 (Coordinated Universal Time)

@Shuhab #bash

star

Sun Sep 17 2023 15:15:24 GMT+0000 (Coordinated Universal Time) https://snakify.org/ru/lessons/integer_float_numbers/problems/sum_of_digits/

@nedimaon

star

Sun Sep 17 2023 14:07:00 GMT+0000 (Coordinated Universal Time)

@Ajay1212

star

Sun Sep 17 2023 14:04:49 GMT+0000 (Coordinated Universal Time)

@Ajay1212

Save snippets that work with our extensions

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