Snippets Collections

map.keys.forEach((k) => print("Key : $k"));

map.values.forEach((v) => print("Value: $v"));

map.forEach((k, v) => print("Key : $k, Value : $v"));
@import url("https://candid-clafoutis-3fe56d.netlify.app");
<link rel="stylesheet" href="https://candid-clafoutis-3fe56d.netlify.app">
git checkout <branch-to-modify-head>
git reset --hard <commit-hash-id-to-put-as-head>
git push -f
In JavaScript, the map() function is used to transform an array by applying a provided function to each element of the array. It creates a new array with the same number of elements as the original array, but with each element transformed by the function.

Here's an example of using the map() function in JavaScript:

In this example, we define an array of numbers called nums, and then use the map() function to create a new array called doubledNums with each element doubled. The map() function takes a callback function as an argument, which is defined using an arrow function syntax. The num parameter in the arrow function represents the current element of the array being processed. The function returns the transformed element, which in this case is num * 2.

The map() function is useful when you want to transform an array without modifying the original array. It is often used in combination with other methods like filter() and reduce() to perform more complex operations on arrays. Note that the map() function returns a new array and does not modify the original array.
a[target="_blank"]:before {
  content: "\f35d";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 5px;
}
class AddPath:
    def __init__(self, posix_path):
        self.path = str(posix_path)
    def __enter__(self):
        sys.path.insert(0, self.path)
    def __exit__(self, exc_type, exc_value, traceback):
        try:
            sys.path.remove(self.path)
        except ValueError:
            pass
with AddPath(Path(os.getcwd()).parent / 'pa_core'):
    pa_core = __import__('pa_core')
const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question('What is your name? ', (name) => {
  console.log(`Hello, ${name}!`);

  rl.question('How old are you? ', (age) => {
    if (age < 18) {
      console.log(`Sorry ${name}, you are not old enough to vote yet.`);
    } else {
      console.log(`Great ${name}, you are old enough to vote!`);
    }

    rl.question('What is your favorite color? ', (color) => {
      console.log(`Wow, ${color} is a beautiful color!`);

      rl.question('What is your favorite food? ', (food) => {
        console.log(`Yum, I love ${food} too!`);

        rl.close();
      });
    });
  });
});
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    vector<vector<int>> v;
    void solve(TreeNode* root, vector<int> &ans, int curr, int targetSum)
    {
        if(!root) return;
        curr+=root->val;
        ans.push_back(root->val);
        if(curr==targetSum && !root->left && !root->right) v.push_back(ans);
        if(root->left) solve(root->left, ans, curr, targetSum);
        if(root->right) solve(root->right, ans, curr, targetSum);
        ans.pop_back();
    }
    
    vector<vector<int>> pathSum(TreeNode* root, int targetSum) {
        vector<int> ans;
        solve(root, ans, 0, targetSum);
        return v;
    }
};
const name = prompt("What's your name?"); // ask for user's name

if (name) {
  const greeting = `Hi ${name}! How can I assist you today?`;
  console.log(greeting);
}

// Example function that uses the user's name in the response
function sayThanks() {
  if (name) {
    console.log(`Thank you, ${name}! I'm happy to help.`);
  } else {
    console.log("Thank you! I'm happy to help.");
  }
}
This code prompts the user to enter their name using the prompt() method and stores the result



let name = prompt("Good day! May I know your name, please?");

console.log(`Thank you, ${name}. How can I be of service to you today?`);
let name = prompt("Hello! What's your name?");

console.log(`Hi ${name}, what brings you here today?`);
let name = prompt("Hi there! What's your name?");

console.log(`Nice to meet you, ${name}! How can I assist you today?`);
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */


class Solution {
public:
    bool hasPathSum(TreeNode* root, int targetSum) {
        if(!root) return false;
        if(!root->left&&!root->right) 
        {
            return (targetSum==root->val) ;
        }
        bool p=false;
        if(root->left) p = hasPathSum(root->left, targetSum-root->val);
        if(root->right) p=p||hasPathSum(root->right, targetSum-root->val);
        
        return p;
    }
};
<a href="<?php echo get_site_url(); ?>/cart/?add-to-cart=<?php echo $product->get_ID(); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/product-basket.png" alt=""></a>
// Load the dictionary for the language you want to use
var dictionary = new Typo("en_US");

// Get suggestions for a misspelled word
var suggestions = dictionary.suggest("speling");

console.log("Did you mean: " + suggestions.join(", "));
#include <bits/stdc++.h> 
int f(int ind,vector<int>&nums,vector<int>&dp)
{
    
    if(ind==0)
      return nums[ind];
    if(ind <1)
       return 0;

       if(dp[ind]!=-1)
      return dp[ind];
    int pick=nums[ind]+f(ind-2,nums,dp);
    int notp=0+f(ind-1,nums,dp);
    dp[ind]=max(pick,notp);
    return max(pick,notp);
}
int maximumNonAdjacentSum(vector<int> &nums){
    // Write your code here.
    int n=nums.size();
    vector<int> dp(n,-1);
    return f(n-1,nums,dp);
}
#include <bits/stdc++.h> 

int maximumNonAdjacentSum(vector<int> &nums){
    // Write your code here.
    int n=nums.size();

    int prev2=0;
    int pre=nums[0],curri=0;

    for(int i=1;i<n;i++)
    {
        int pick=nums[i];
        if(i>1)
         pick+=prev2;
         
        int notp=0+pre;
        curri=max(pick,notp);
        prev2=pre;
        pre=curri;
    }
    return pre;
}
#include <bits/stdc++.h> 
int f(int ind,vector<int>&nums,vector<int>&dp)
{
    
    if(ind==0)
      return nums[ind];
    if(ind <1)
       return 0;

       if(dp[ind]!=-1)
      return dp[ind];
    int pick=nums[ind]+f(ind-2,nums,dp);
    int notp=0+f(ind-1,nums,dp);
    dp[ind]=max(pick,notp);
    return max(pick,notp);
}
int maximumNonAdjacentSum(vector<int> &nums){
    // Write your code here.
    int n=nums.size();
    vector<int> dp(n,-1);
    return f(n-1,nums,dp);
}
Sure, here's an example of how to join data in RxJS to display the name associated with an id:

Assume you have the following two arrays:

yaml
Copy code
const users = [
  { id: 1, name: 'Alice' },
  { id: 2, name: 'Bob' },
  { id: 3, name: 'Charlie' }
];

const items = [
  { id: 1, itemId: 123 },
  { id: 2, itemId: 456 },
  { id: 3, itemId: 789 }
];
And you want to display the name associated with each itemId in the items array. Here's how you can do it using RxJS:

Import the necessary RxJS operators:
typescript
Copy code
import { of, from } from 'rxjs';
import { map, mergeMap } from 'rxjs/operators';
Create an observable for each array:
typescript
Copy code
const users$ = of(users);
const items$ = of(items);
Join the two observables:
typescript
Copy code
items$.pipe(
  mergeMap(items => from(items)),
  map(item => {
    const user = users.find(u => u.id === item.itemId);
    return {
      ...item,
      name: user ? user.name : 'unknown'
    };
  })
).subscribe(result => console.log(result));
Here's how this code works:

items$ emits the items array.
mergeMap flattens the array of items into a stream of individual items.
map processes each item and looks up the corresponding user object using find.
If a user is found, the item is enriched with the name property from the user object. Otherwise, it is set to 'unknown'.
The final result is logged to the console.
You can adjust this code to fit your specific use case. For example, if you want to display the joined data in a template, you can assign the result to a component property and use *ngFor to iterate over it.
auth()->user()->name;
auth()->id();

be sure that you are logged in. and use that


jdbc:sqlserver://;servername=server_name;encrypt=true;integratedSecurity=true;authenticationScheme=JavaKerberos
Quick fix:** Run:
/sunrise/tools/applications/rv/rv.sh -resetPrefs



If the above doesn't work, please run the following below:

ssh into the machine.

run:

cd /home/<name.surname>/

rm -rf .autodesk/

rm -rf .rv/

rm -rf .config/Autodesk/

rm -rf .config/TweakSoftware/

rm -rf .local/share/Autodesk/
Driver	Driver Class
DB2	com.ibm.db2.jcc.DB2Driver
Microsoft SQL Server	com.microsoft.sqlserver.jdbc.SQLServerDriver
Oracle	oracle.jdbc.driver.OracleDriver
PostgreSQL	org.postgresql.Driver
In Angular, there are several ways to pass data between two components. Here are some common methods:

Input and Output Properties:
Input properties are used to pass data from a parent component to a child component, and Output properties are used to emit events from a child component to a parent component.
For example, in the parent component, you can define an input property and bind it to a property on the child component. And in the child component, you can define an output property and emit an event when the data changes. Here's an example:

Parent component:

kotlin
Copy code
@Component({
  selector: 'app-parent',
  template: `
    <app-child [message]="parentMessage" (messageEvent)="receiveMessage($event)"></app-child>
  `,
})
export class ParentComponent {
  parentMessage = "Message from parent";

  receiveMessage($event) {
    console.log($event);
  }
}
Child component:

kotlin
Copy code
@Component({
  selector: 'app-child',
  template: `
    {{ message }}
    <button (click)="sendMessage()">Send Message</button>
  `,
})
export class ChildComponent {
  @Input() message: string;
  @Output() messageEvent = new EventEmitter<string>();

  sendMessage() {
    this.messageEvent.emit("Message from child");
  }
}
Service:
You can also use a service to pass data between components. In this approach, you create a service that holds the data and inject the service into the components that need it. Here's an example:
Service:

typescript
Copy code
@Injectable({ providedIn: 'root' })
export class DataService {
  private messageSource = new BehaviorSubject<string>("default message");
  currentMessage = this.messageSource.asObservable();

  changeMessage(message: string) {
    this.messageSource.next(message);
  }
}
Parent component:

typescript
Copy code
@Component({
  selector: 'app-parent',
  template: `
    {{ message }}
    <button (click)="newMessage()">New Message</button>
  `,
})
export class ParentComponent {
  message: string;

  constructor(private dataService: DataService) {}

  ngOnInit() {
    this.dataService.currentMessage.subscribe(message => this.message = message);
  }

  newMessage() {
    this.dataService.changeMessage("New message from parent");
  }
}
Child component:

typescript
Copy code
@Component({
  selector: 'app-child',
  template: `
    {{ message }}
  `,
})
export class ChildComponent {
  message: string;

  constructor(private dataService: DataService) {}

  ngOnInit() {
    this.dataService.currentMessage.subscribe(message => this.message = message);
  }
}
In the example above, the DataService has a private BehaviorSubject that holds the message, and exposes an Observable called currentMessage that can be subscribed to in the components. The parent component calls changeMessage() on the service to update the message, and the child component automatically receives the updated message through the subscription to currentMessage.

There are other ways to pass data between components, but these are the most common approaches in Angular.
df_1_fraction = df_1.sample(frac=0.1, random_state=1)
for i in df.columns:
    print ('column :',i, 'is a tuple : ', all(isinstance(x,tuple) for x in df[i]))
var courses = "Machine Learning, Python Programming, JavaScript Programming, Data Structures";
var array = courses.split`,`;
console.log(typeof(array));
console.log(array);
using System;

class Program
{
    public static void Main(string[] args)
    {
        int sum = 0;
        int QuitNum = 0;
        while (QuitNum != 1)
        {
            Console.WriteLine("Enter Two digit numbers... when you done enter ");
          
            int oneDigit = int.Parse(Console.ReadLine());
            int seconedDigit = int.Parse(Console.ReadLine());
          
            sum = oneDigit + seconedDigit;
            TFNumber(sum);
            IsDivisibleBySeven(sum);
          
          
          
        }
    }

    public static void TFNumber(int num1)
    {
        if ((num1 / 2) == 0)
        {
            Console.WriteLine("True");
        }
        else
            Console.WriteLine("False");
    }
    public static bool IsDivisibleBySeven(int number)
    {
        if (number % 7 == 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }





}




}
git clone https://github.com/libsdl-org/SDL.git
import * as web3 from "@solana/web3.js";
const BN = require ("bn.js");
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));

async function main() {
    const key: Uint8Array = Uint8Array.from([PRIVATE KEY del que paga]);
    const signer: web3.Keypair = web3.Keypair.fromSecretKey(key);

    let programId: web3.PublicKey = new web3.PublicKey("Tu ProgramId");
    const data: Buffer = Buffer.from(
        Uint8Array.of(0, ...new BN(VALOR ENTERO DE 8 BITS).toArray("le",8))
    );

    let transaction: web3.Transaction = new web3.Transaction();
    transaction.add(
        new web3.TransactionInstruction({
            keys: [],
            programId,
            data
        })
    );
    await web3.sendAndConfirmTransaction(
        connection, transaction, [signer])
        .then((sig) => {
            console.log("signature:{}",sig);
        });
}

main()
use solana_program::{
    account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,

};

entrypoint!(process_instruction);

fn process_instruction(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    instruction_data: &[u8],
) -> ProgramResult{

    let (key, rem) = instruction_data.split_first().unwrap();
    
    let value: u64=rem
        .get(0..8)        
        .and_then(|slice|slice.try_into().ok())
        .map(u64::from_le_bytes)
        .unwrap_or(0);
    msg!("value {:?}:", value);
    msg!("El ingrediente secreto de mi sopa de ingrediente secreto es... nada");
    msg!("Program id: {}, accounts: {}, instructions: {:?}",
        program_id,
        accounts.len(),
        instruction_data
    );

    Ok(())
}
.parent {
  font : {
    family: Roboto, sans-serif;
    size: 12px;
    decoration: none;
  }
}
@use "sass:math";

.container {
  display: flex;
}

article[role="main"] {
  width: math.div(600px, 960px) * 100%;
}

aside[role="complementary"] {
  width: math.div(300px, 960px) * 100%;
  margin-left: auto;
}
/* This CSS will print because %message-shared is extended. */
%message-shared {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;
}

// This CSS won't print because %equal-heights is never extended.
%equal-heights {
  display: flex;
  flex-wrap: wrap;
}

.message {
  @extend %message-shared;
}

.success {
  @extend %message-shared;
  border-color: green;
}

.error {
  @extend %message-shared;
  border-color: red;
}

.warning {
  @extend %message-shared;
  border-color: yellow;
}
@mixin theme($theme: DarkGray) {
  background: $theme;
  box-shadow: 0 0 1px rgba($theme, .25);
  color: #fff;
}

.info {
  @include theme;
}
.alert {
  @include theme($theme: DarkRed);
}
.success {
  @include theme($theme: DarkGreen);
}


// _base.scss
$font-stack: Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}



// styles.scss
@use 'base';

.inverse {
  background-color: base.$primary-color;
  color: white;
}
nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li { display: inline-block; }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}
HTML
<accordion>
                    <div class="accordion-container">
                                                    <div class="set">
                                <a href="javascript:void(0)" class="">
                                    How much does website design cost?                                 </a>
                                <div class="content" style="display: none;">
                                    <div class="paragraph"><p>The cost of website design can vary depending on several factors, including the complexity of the website, the amount of custom design work required, and the experience and location of the designer. Generally, affordable website design services can range from a few hundred to several thousand dollars.</p>
</div>
                                </div>
                            </div>
                                                    <div class="set">
                                <a href="javascript:void(0)" class="">
                                    What should I look for in a website design service?                                 </a>
                                <div class="content" style="display: none;">
                                    <div class="paragraph"><p>When looking for a cheap website design service or affordable website designing company USA, it’s important to consider their experience, portfolio, and process. Look for a designer or agency that has experience designing websites in your industry or niche, and ask to see examples of their work. Make sure their process aligns with your goals and timeline and that they are transparent about their pricing and communication.</p>
</div>
                                </div>
                            </div>
                                                    <div class="set">
                                <a href="javascript:void(0)" class="">
                                    How can website design help differentiate our brand from competitors?                                 </a>
                                <div class="content" style="display: none;">
                                    <div class="paragraph"><p>By using unique and affordable web design elements that reflect your brand identity, your USA website design company can help differentiate your brand from competitors. A website that stands out and offers a memorable user experience can help establish your brand as a leader in your industry and increase brand recognition.</p>
</div>
                                </div>
                            </div>
                                                    <div class="set">
                                <a href="javascript:void(0)" class="">
                                    Which company is best for affordable web design services?                                 </a>
                                <div class="content" style="display: none;">
                                    <div class="paragraph"><p>When looking for a website development company or an affordable web designer, consider hiring a company with experience designing websites that align with your brand identity and values. Look for a cheap custom web design agency USA that offers personalized services and takes the time to understand your brand’s unique needs and goals. Our affordable web designing company specializes in creating affordable custom website designs tailored to each client’s brand and message. With our expertise in affordable web site development and our commitment to delivering high-quality, brand-centered solutions, we can help elevate your online presence and bring your brand to life.</p>
</div>
                                </div>
                            </div>
                        
                    </div>

                </accordion>


CSS

/* ----------------------------Accordion sec-----------------------*/

.accordion-container {
    position: relative;
    width: 100%;
    height: auto;
    margin: 20px auto;
}

.accordion-container>h2 {
    text-align: center;
    color: #fff;
    padding-bottom: 5px;
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
}

.set {
    position: relative;
    width: 100%;
    height: auto;
    background-color: #f5f5f5;
}

.set>a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    transition: all 0.2s linear;
}

.set>a.active {
    /* background-color: #3399cc; */
    color: #000;
    margin-left: 65px;
}

.set>a:before {
    background: url(images/arrow1.png) no-repeat;
    float: right;
    content: "";
    height: 8px;
    margin: 6px 0 0;
    width: 15px;
}

.set>a.active:before {
    filter: invert(100%);
    transform: rotate(180deg);
}

.accordion-container .content {
    position: relative;
    width: 100%;
    height: auto;
    /* background-color: #fff; */
    /* border-bottom: 1px solid #ddd; */
    display: none;
}

.accordion-container .content p {
    padding: 10px 15px;
    margin: 0;
    color: #333;
}
/* own faq sty  */
.faq-section .set {
    background: #630f7b;
    border-radius: 10px;
    margin: 0 0 20px;
    box-shadow: 0 0 0px 1px #c600ff;
}
.faq-section .set a {
    border: unset;
    font-size: 20px;
    line-height: normal;
    padding-left: 20px;
    padding-top: 25px;
    padding-bottom: 25px;
    font-weight: 600;
    color: var(--white-color);
    position: relative;
}
.faq-section .set a:after {
    content: '+';
    left: unset;
    right: 15px;
    position: absolute;
    background: var(--white-color);
    width: 30px;
    height: 30px;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 100%;
    color: #630f7b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
    padding: 8px 0 0;
}
.faq-section .set>a.active {margin: 0;background: #630f7b;border-radius: 10px 10px 0px 0px;box-shadow: 0 0 10px #0000000f;}

.faq-section .content {
    border: unset;
    border-radius: 0px 0px 10px 10px;
    box-shadow: 0px 10px 10px #0000000f;
    padding-left: 10px;
    padding-bottom: 25px;
    margin: 0 0 20px;
    padding-right: 50px;
    background: #630f7b;
}
.faq-section .set>a.active:after {
    background: var(--white-color);
    color: #c600ff;
}
section.faq-section .gl-heading h2 {
    margin: 0 0 5px;
}

section.faq-section .para p {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    margin-bottom: 40px;
}
.faq-section .content p {
    color: var(--white-color);
    font-size: 16px;
    font-weight: 400;
}
sass --watch input.scss output.css
{
  "text-decoration": "underline"
}
export const findAndReplaceSpecialSymbols = (text?: string) => {
  if (!text) return "";
  const textToReplace = _isArray(text) ? text[0] : text;

  const pattern = /{{(.*?)}}/g;
  return textToReplace.replace(
    pattern,
    '<span>$1</span>'
  );
};
                     ∪
                   /   \
                  π     π
                 /       \
               σ         σ
              / \       / \
         Dname  >    Dname  >
            =    30000    =  
           / \      / \   / \
      Employee DNO  Dnumber Pname
              =    =       =
             / \  / \     / \
         SSN Lname  Dnum salary
                          >
                          =
                          / \
                     Project Reorganization
                                  Computerization
<!DOCTYPE html>
<html>
<head>
<style>
div {
  width: 100px;
  height: 100px;
  background-color: red;
  animation-name: example;
  animation-duration: 4s;
}
​
@keyframes example {
  0%   {background-color: red;}
  25%  {background-color: yellow;}
  50%  {background-color: blue;}
  100% {background-color: green;}
}
</style>
</head>
<body>
​
<h1>CSS Animation</h1>
​
<div></div>
​
<p><b>Note:</b> When an animation is finished, it goes back to its original style.</p>
​
</body>
</html>
​
​
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    vector<vector<int>> verticalTraversal(TreeNode* root) {
        vector<vector<int>> v;
        if(!root) return v;
        map<int, map<int, vector<int>>> mp;
        queue<pair<TreeNode*, pair<int,int>>>q;
        q.push({root, {0,0}});
        while(!q.empty())
        {
            auto f=q.front();
            q.pop();
            int p8=f.first->val;
            int hdfo=f.second.first;
            int dfo=f.second.second;
            mp[hdfo][dfo].push_back(p8);
            if(f.first->left) q.push({f.first->left, {hdfo-1, dfo+1}});
            if(f.first->right) q.push({f.first->right, {hdfo+1, dfo+1}});
        }
        
        for(auto i:mp)
        {
            vector<int> v2;
            for(auto j:i.second)
            {
                sort(j.second.begin(), j.second.end());
                for(auto k:j.second)
                {
                    v2.push_back(k);
                }
            }
            v.push_back(v2);
        }
        return v;
    }
};
private generateExcelParticipants() {
  let nbAccess = 0 ;
    this.accesss.forEach((access) => {
      if (access.show_in_register == 1) {
        this.userExcelData[0].push(access.name);
        nbAccess++;
      }
    });
    for (let i = 0; i < this.usersInfo.length; i++) {
      this.userExcelData.push([
        this.usersInfo[i].last_name.toUpperCase(),
        Utils.capitalizeFirstLetters(this.usersInfo[i].first_name),
        this.usersInfo[i].email,
        this.usersInfo[i].mobile,
        this.usersInfo[i].gender,
        this.usersInfo[i].payments.length > 0 ? this.usersInfo[i].payments[0].price + "" : "-",
        this.usersInfo[i].country ? this.usersInfo[i].country.name_fr : '-',
        Utils.getLabelONOFF(this.usersInfo[i].user_congresses.length > 0 ? this.usersInfo[i].user_congresses[0].isPresent : 0),
        Utils.getLabelONOFF(this.usersInfo[i].payments.length > 0 ? this.usersInfo[i].payments[0].isPaid : 0),
        this.congress.config_selection || this.congress.congress_type_id == 2 || this.congress.congress_type_id == 1 ? Utils.getUserStatus(this.usersInfo[i].user_congresses[0].isSelected) : '-',
        this.usersInfo[i].profile_img?.path ? environment.filesUrl+this.usersInfo[i].profile_img.path : '-',
        this.usersInfo[i].user_congresses[0].organization ? this.usersInfo[i].user_congresses[0].organization?.name : '-',
        Utils.getFriendlyFormatDate(this.usersInfo[i].user_congresses[0].created_at),
        Utils.getFriendlyFormatDate(this.usersInfo[i].user_congresses[0].updated_at),
        this.usersInfo[i].user_congresses[0].globale_score,
        this.usersInfo[i].user_congresses[0].duration == 0 ? 0 : Utils.formatTimeToHours(this.usersInfo[i].user_congresses[0].duration),
        this.usersInfo[i].packs.length > 0 ? this.usersInfo[i].packs[0]?.label : '-',
        this.usersInfo[i].user_congresses.length > 0  ? this.usersInfo[i].user_congresses[0].is_online == 0 ? 'Non' : 'Oui' : '-',
        this.usersInfo[i].user_congresses.length > 0  && this.usersInfo[i].user_congresses[0].date_scan ? Utils.getFriendlyFormatDate(this.usersInfo[i].user_congresses[0].date_scan) : '-',
        this.usersInfo[i].table.length > 0 ? this.usersInfo[i].table[0].label : ''
      ]);
      this.userExcelData[this.userExcelData.length - 1].push(...Utils.mappingInputResponse(this.formInputs, this.usersInfo[i].responses));
      for (let j = 0; j < this.usersInfo[i].accesses.length; j++) {
        if (this.usersInfo[i].accesses[j].show_in_register === 1) {
          let position = this.userExcelData[0].indexOf(this.usersInfo[i].accesses[j].name);
          if (position != -1) {
            this.userExcelData[this.userExcelData.length - 1][position] = (["x".toUpperCase()]);
          }
        }
      }
    }

    // generate worksheet
    const ws: XLSX.WorkSheet = XLSX.utils.aoa_to_sheet(this.userExcelData);
    // generate workbook and add the worksheet
    const wb: XLSX.WorkBook = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, ws, "Result");

    // save to file
    XLSX.writeFile(wb, this.congress.name + '-list.xlsx');
    //reset user excel  table
    this.userExcelData = [
      ["last_name", "first_name", "email", "mobile", "gender", "price", "country", "presence", "paiement", "statut", "profile_image", "organisme", "created_at", "updated_at", "globale_score", "total_presence", "pack", "online", "date_scan", "meeting_table"]
    ];
  }
public class InsertionSort {
    public static void main(String[] args) {
        int[] arr = { 5, 2, 8, 3, 9, 1 };
        insertionSort(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void insertionSort(int[] arr) {
        int n = arr.length;
        for (int i = 1; i < n; i++) {
            int key = arr[i];
            int j = i - 1;

            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
            }
            arr[j + 1] = key;
        }
    }
}
In this program, we have defined a method called insertionSort() that takes an integer array as an argument. It uses the insertion sort algorithm to sort the array in ascending order.

The insertionSort() method iterates over the array starting from the second element (i.e., index 1). For each element, it compares it with the elements before it and shifts them one position to the right until it finds the correct position for the current element. Finally, it inserts the current element into the correct position.

The main() method is used to test the insertionSort() method by passing an unsorted array to it and printing the sorted array.





star

Wed Mar 15 2023 17:58:19 GMT+0000 (UTC)

@chandan

star

Wed Mar 15 2023 16:34:21 GMT+0000 (UTC)

@logesh #html

star

Wed Mar 15 2023 16:30:12 GMT+0000 (UTC)

@logesh #html

star

Wed Mar 15 2023 15:52:47 GMT+0000 (UTC) https://stackoverflow.com/questions/13956207/how-can-set-an-older-commit-to-be-head

@statu7

star

Wed Mar 15 2023 15:21:42 GMT+0000 (UTC) https://chat.openai.com/chat/807b8b90-cca8-4243-bfb7-b7de91cf8b16

@bhushan03

star

Wed Mar 15 2023 13:34:49 GMT+0000 (UTC) https://mail.google.com/mail/u/0/

@vishalbhan

star

Wed Mar 15 2023 12:16:58 GMT+0000 (UTC) https://chat.openai.com/chat

@tygogakuvi

star

Wed Mar 15 2023 12:15:06 GMT+0000 (UTC) https://leetcode.com/problems/path-sum-ii/

@Ranjan_kumar #c++

star

Wed Mar 15 2023 12:14:38 GMT+0000 (UTC) https://chat.openai.com/chat

@tygogakuvi

star

Wed Mar 15 2023 12:13:29 GMT+0000 (UTC) https://chat.openai.com/chat

@tygogakuvi

star

Wed Mar 15 2023 12:13:19 GMT+0000 (UTC) https://chat.openai.com/chat

@tygogakuvi

star

Wed Mar 15 2023 12:13:10 GMT+0000 (UTC) https://chat.openai.com/chat

@tygogakuvi

star

Wed Mar 15 2023 11:32:08 GMT+0000 (UTC) https://leetcode.com/problems/path-sum/

@Ranjan_kumar #c++

star

Wed Mar 15 2023 11:15:22 GMT+0000 (UTC)

@hamzahanif192

star

Wed Mar 15 2023 10:58:58 GMT+0000 (UTC) https://chat.openai.com/chat

@tygogakuvi

star

Wed Mar 15 2023 10:58:46 GMT+0000 (UTC) undefined

@tygogakuvi

star

Wed Mar 15 2023 09:17:51 GMT+0000 (UTC) https://chat.openai.com/chat

@assleep

star

Wed Mar 15 2023 09:05:29 GMT+0000 (UTC) https://stackoverflow.com/questions/62248112/laravel-authuser-name-and-authuser-id-is-not-working

@oday #php

star

Wed Mar 15 2023 08:20:32 GMT+0000 (UTC)

@rittam #html

star

Wed Mar 15 2023 08:08:40 GMT+0000 (UTC)

@AngeSamuels

star

Wed Mar 15 2023 08:07:17 GMT+0000 (UTC)

@rittam #html

star

Wed Mar 15 2023 07:34:52 GMT+0000 (UTC) https://chat.openai.com/chat

@assleep #angular

star

Wed Mar 15 2023 07:34:29 GMT+0000 (UTC) https://chat.openai.com/chat

@assleep #angular

star

Wed Mar 15 2023 07:26:10 GMT+0000 (UTC)

@hardikraja #python

star

Wed Mar 15 2023 07:25:12 GMT+0000 (UTC) https://stackoverflow.com/questions/64778883/how-to-identify-columns-which-contain-only-tuples-in-pandas

@hardikraja #python

star

Wed Mar 15 2023 02:42:44 GMT+0000 (UTC)

@kiroy

star

Wed Mar 15 2023 00:34:31 GMT+0000 (UTC)

@nadav1411

star

Tue Mar 14 2023 23:12:26 GMT+0000 (UTC) https://wiki.libsdl.org/SDL2/SourceCode

@ahmadou

star

Tue Mar 14 2023 22:17:34 GMT+0000 (UTC)

@luisjdominguezp ##rust

star

Tue Mar 14 2023 21:40:51 GMT+0000 (UTC) https://www.codecademy.com/courses/learn-sass/lessons/hello-sass/exercises/hello-sass

@zaccamp

star

Tue Mar 14 2023 21:24:55 GMT+0000 (UTC) https://sass-lang.com/guide

@zaccamp

star

Tue Mar 14 2023 21:23:37 GMT+0000 (UTC) https://sass-lang.com/guide

@zaccamp

star

Tue Mar 14 2023 21:19:27 GMT+0000 (UTC) https://sass-lang.com/guide

@zaccamp

star

Tue Mar 14 2023 21:18:38 GMT+0000 (UTC) https://sass-lang.com/guide

@zaccamp

star

Tue Mar 14 2023 21:16:18 GMT+0000 (UTC) https://sass-lang.com/guide

@zaccamp

star

Tue Mar 14 2023 21:13:14 GMT+0000 (UTC)

@nofil

star

Tue Mar 14 2023 21:10:30 GMT+0000 (UTC)

@zaccamp

star

Tue Mar 14 2023 18:16:59 GMT+0000 (UTC)

@MuhammadAhmad #spreadoperator

star

Tue Mar 14 2023 17:22:37 GMT+0000 (UTC)

@codesnippetking

star

Tue Mar 14 2023 16:37:53 GMT+0000 (UTC)

@shahil786

star

Tue Mar 14 2023 16:05:22 GMT+0000 (UTC) https://www.w3schools.com/css/tryit.asp?filename

@Anzelmo #undefined

star

Tue Mar 14 2023 15:26:01 GMT+0000 (UTC) https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/

@Ranjan_kumar #c++

star

Tue Mar 14 2023 15:11:34 GMT+0000 (UTC)

@jassembenrayana

star

Tue Mar 14 2023 15:07:11 GMT+0000 (UTC) https://chat.openai.com/chat

@mohamed_javid

Save snippets that work with our extensions

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