Snippets Collections
#include <bits/stdc++.h>
#define INF 10000000000
#define ll long long int
#define pb push_back
#define mp make_pair
#define FOR(i, n) for (long long int i = 0; i < n; i++)
#define FORR(i, a, b) for (int i = a; i < b; i++)
// think about a question calmly, don't get panic to solve A fast
// if after 10 mins you are unable to think anything see dashboard
using namespace std;

void djk_fun(vector<vector<vector<int>>> &adj, int src, vector<int> &dis)
{
    priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> pq;
    dis[src] = 0;
    pq.push({{0, src}});

    while (pq.size() > 0)
    {
        vector<int> vr = pq.top();
        pq.pop();

        int nod = vr[1];
        for (int i = 0; i < adj[nod].size(); i++)
        {
            int neg = adj[nod][i][0], wt = adj[nod][i][1];
            if (dis[nod] + wt < dis[neg])
            {
                dis[neg] = dis[nod] + wt;
                pq.push({dis[neg], neg});
            }
        }
    }
}

int short_path(vector<vector<vector<int>>> &adj, vector<vector<int>> &nh, int st, int en, int n)
{
    int m = nh.size(), ans = INT_MAX;
    // apply shortest path on src and dest
    vector<int> dis_src(n + 1, 1e9);
    vector<int> dis_dst(n + 1, 1e9);

    djk_fun(adj, st, dis_src);
    djk_fun(adj, en, dis_dst);

    for (int i = 0; i < m; i++)
    {
        int n1 = nh[i][0], n2 = nh[i][1], wt = nh[i][2];
        ans = min({ans, dis_src[n1] + wt + dis_dst[n2], dis_src[n2] + wt + dis_dst[n1]});
    }
    ans = min(ans, dis_src[en]);

    if(ans > 1e9)
    {
        return -1;
    }
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, m, st, en;
    cin >> n >> m;

    vector<vector<vector<int>>> adj(n + 1, vector<vector<int>>());
    vector<vector<int>> nh;

    // construct graph using state highways
    for (int i = 0; i < m; i++)
    {
        int u, v, st, nt;
        cin >> u >> v >> st >> nt;

        nh.pb({u, v, nt});
        adj[u].pb({v, st});
        adj[v].pb({u, st});
    }
    cin >> st >> en;

    cout << short_path(adj, nh, st, en, n) << endl;
    return 0;
}
def find_type_of_research(soup):
    if soup.find_all('lbj-title', attrs = {'variant':'eyebrow'}):
        return soup.find_all('lbj-title', attrs = {'variant':'eyebrow'})[0].text.strip()
    else:
        return np.nan

def find_title(soup):
    if soup.find_all('lbj-title', attrs = {'variant':'heading-1'}):
        return soup.find_all('lbj-title', attrs = {'variant':'heading-1'})[0].text.strip()
    if soup.find_all('h1', attrs = {'class':'title heading-1'}):
        return soup.find_all('h1', attrs = {'class':'title heading-1'})[0].text.strip()
    return np.nan

def find_subtitle(soup):
    if soup.find_all('lbj-title', attrs = {'variant':'subtitle'}):
        return soup.find_all('lbj-title', attrs = {'variant':'subtitle'})[0].text.strip()

def find_authors(soup):
    if soup.find_all('lbj-title', attrs = {'variant':'paragraph'}):
        author_code = soup.find_all('lbj-title', attrs = {'variant':'paragraph'})[0]
        # find every lbj-link
        authors = author_code.find_all('lbj-link')
        authors = [author.text.strip() for author in authors]
        authors_str =  ', '.join(authors)
        return authors_str
    return np.nan

def find_date(soup):
    if soup.find_all('lbj-title', attrs = {'variant':'date'}):
        date_code = soup.find_all('lbj-title', attrs = {'variant':'date'})[0]
        date = date_code.find_all('time')[0].text.strip()
        return date
    return np.nan

def find_report_link(soup):
    if soup.find_all('lbj-button'):
        return soup.find_all('lbj-button')[0].get('href')
    return np.nan

def find_tags(soup):
    if soup.find_all('lbj-link', attrs = {'variant':'tag'}):
        tags = soup.find_all('lbj-link', attrs = {'variant':'tag'})
        print(tags)

def find_data_json(soup):
    # get the javascript code
    script = soup.find_all('script', attrs = {'type':'text/javascript'})

    # found the json after dataLayer_tags
    pattern = 'dataLayer_tags = (.+);'
    for s in script:
        if re.search(pattern, str(s)):
            info_json = re.search(pattern, str(s)).group(1)
            # transform it into a dictionary
            info = eval(info_json)['urban_page']
            publish_date = info.get('publish_date')
            title = info.get('urban_title')
            research_area = info.get('research_area')
            authors = info.get('authors')
            publication_type = info.get('publication_type')
            eyebrow = info.get('eyebrow')
            tags = info.get('tags')
            
            return publish_date, title, research_area, authors, publication_type, eyebrow, tags, info_json
    return np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan

df_links = pd.read_csv('urban_links.csv')
df_links_details = df_links.copy()

for i in range(len(df_links)):
    URL = "https://www.urban.org/" + df_links['link'][i]
    print(URL)
    r = requests.get(URL)
    soup = BeautifulSoup(r.content, 'html5lib')
    report_link = find_report_link(soup)
    publish_date, title, research_area, authors, publication_type, eyebrow, tags, info_json = find_data_json(soup)
    
    df_links_details.loc[i, 'eyebrow'] = eyebrow
    df_links_details.loc[i, 'title'] = title
    df_links_details.loc[i, 'authors'] = authors
    df_links_details.loc[i, 'date'] = publish_date
    df_links_details.loc[i, 'research_area'] = research_area
    df_links_details.loc[i, 'publication_type'] = publication_type
    df_links_details.loc[i, 'tags'] = tags
    df_links_details.loc[i, 'info_json'] = info_json
    df_links_details.loc[i, 'report_link'] = report_link
    
    print(publish_date, title, research_area, authors, publication_type, eyebrow, tags, report_link)
    
    if i % 200 == 0:
        df_links_details.to_csv('urban_links_details.csv', index = False)
df_links = []

PAGE_NUM = 281

for page in range(1, PAGE_NUM):
    URL = f"https://www.urban.org/research?page={page}"
    r = requests.get(URL) 
    soup = BeautifulSoup(r.content, 'html5lib')
    articles = soup.find_all('li', attrs = {'class':'mb-16 md:col-span-2 mb-8 sm:mb-0'})
    for article in articles:
        pattern = 'href="(.+?)"'
        if re.search(pattern, str(article)):
            df_links.append([page, re.search(pattern, str(article)).group(1)])
    print(f'Page {page} done')

df_links = pd.DataFrame(df_links, columns = ['page', 'link'])
df_links.to_csv('urban_links.csv', index = False)
<main>

  <span class="scroll">Scroll for more</span>

  <section class="shadow">

    <p data-attr="shadow">shadow</p>

  </section>

  <section class="break">

    <p data-attr="ak">bre</p>

  </section>

  <section class="slam">

    <p data-splitting>slam</p>

  </section>

  <section class="glitch">

    <p data-attr="glitch">glitch</p>

  </section>

</main>
Modified Script
python
Copy code
import os
import rasterio
import geopandas as gpd
from rasterio.mask import mask
import matplotlib.pyplot as plt

def convert_images_to_masks(input_image_dir, building_footprints_path, output_mask_dir):
    """
    Convert multiple satellite images to masks based on building footprints.
    """
    # Load the building footprints as a GeoDataFrame
    building_footprints = gpd.read_file(building_footprints_path)

    # Ensure both the raster and vector data are in the same CRS
    # Temporarily load the first image to get CRS
    first_image_path = os.path.join(input_image_dir, os.listdir(input_image_dir)[0])
    with rasterio.open(first_image_path) as src:
        satellite_meta = src.meta
    building_footprints = building_footprints.to_crs(crs=satellite_meta['crs'])

    # Iterate through each image in the input directory
    for file_name in os.listdir(input_image_dir):
        if file_name.endswith('.tif'):
            input_image_path = os.path.join(input_image_dir, file_name)
            output_mask_path = os.path.join(output_mask_dir, file_name.replace('.tif', '_mask.tif'))

            # Open the raster image
            with rasterio.open(input_image_path) as src:
                satellite_image = src.read()  # Read all bands
                satellite_meta = src.meta  # Metadata of the raster

            # Create a geometry mask from the building footprints
            geometries = building_footprints['geometry'].values

            # Clip the raster with the building footprints mask
            with rasterio.open(input_image_path) as src:
                out_image, out_transform = mask(src, geometries, crop=True)
                out_meta = src.meta.copy()
                out_meta.update({
                    "driver": "GTiff",
                    "height": out_image.shape[1],
                    "width": out_image.shape[2],
                    "transform": out_transform
                })

            # Save the clipped image
            with rasterio.open(output_mask_path, "w", **out_meta) as dest:
                dest.write(out_image)

            print(f"Processed and saved mask for {file_name}")

            # Display the result (optional)
            plt.figure(figsize=(10, 10))
            if out_image.shape[0] == 1:
                plt.imshow(out_image[0], cmap='gray')
            else:
                plt.imshow(out_image.transpose(1, 2, 0))
            plt.title(f'Clipped Satellite Image - {file_name}')
            plt.axis('off')  # Turn off axis labels
            plt.show()

# Example usage
input_directory = 'E:/isrooooooo/marchassam/satimgmarch/'  # Path to directory with TIFF images
building_footprints_path = 'C:/project isro/assambuildingfoot.shp'  # Path to building footprints
output_directory = 'E:/isrooooooo/marchassam/maskmarch/'  # Path to save masks

convert_images_to_masks(input_directory, building_footprints_path, output_directory)
Explanation
convert_images_to_masks Function:

Takes in the directory containing satellite images, the path to building footprints, and the output directory for masks.
Loads building footprints and ensures CRS alignment with the first image.
Processing Each Image:

Loops through all TIFF files in the input directory.
For each image, it applies the clipping process and saves the resulting mask.
Visualization:

Optionally displays the clipped image for each processed file.
File Handling:

Ensures each processed mask is saved with a unique name, corresponding to the original image file.
By following this script, you can efficiently process multiple satellite images and generate corresponding masks in one go. Adjust the directory paths and filenames as needed for your specific use case. If you encounter any issues or need further assistance, let me know!
#include<stdio.h>
void main()
{
    int a[5],i,j,n=5,temp;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<n-i-1;j++)
        {
            if(a[j]>a[j+1])
            {
                temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;
            }
        }
    }
    for(i=0;i<n;i++)
    {
        printf("%d",a[i]);
    }
}
version: '3'
services:
  web:
    image: 'nginx:latest'
    ports:
      - '80:80'
  db:
    image: 'mysql:latest'
    environment:
      MYSQL_ROOT_PASSWORD: password
bool isValidParenthesis (string expression) {
  stack<char> s;
  for (int i = 0; i < expression.length(); i++) {
    char ch = expression[i];
    // if opening bracket push it to stack
    // if closing bracket, pop from stack, check if the popped element is the                 matching opening bracket
    if (ch == '(' || ch =='{' || ch == '[') {
      s.push(ch);
    }
    else {
      // for closing bracket
      if (!s.empty()) {
        char top = s.top();
        if ((ch == ')' && top == '(') || (ch == '}' && top == '{') || (ch == ']' &&               top == '[')) {
          s.pop();
        }
      }
      else {
        return false;
      }
    }
  }
  if (s.empty()) {
    return true;
  }
  else {
    return false;
  }
}
// App.tsx
import React, { useState } from 'react';
import './App.css';

function App() {
  const [top, setTop] = useState(0);
  const [left, setLeft] = useState(0);
  const [backgroundColor, setBackgroundColor] = useState('#ffffff')

  const keyDownHandler = (e: React.KeyboardEvent<HTMLDivElement>) => {
    const key = e.code;

    if (key === 'ArrowUp') {
      setTop((top) => top - 10);
    }

    if (key === 'ArrowDown') {
      setTop((top) => top + 10);
    }

    if (key === 'ArrowLeft') {
      setLeft((left) => left - 10);
    }

    if (key === 'ArrowRight') {
      setLeft((left) => left + 10);
    }

    if (key === 'Space') {
      let color = Math.floor(Math.random() * 0xFFFFFF).toString(16);
      for(let count = color.length; count < 6; count++) {
        color = '0' + color;                     
      }
      setBackgroundColor('#' + color);
    }
  }

  return (
    <div
      className="container"
      tabIndex={0}
      onKeyDown={keyDownHandler}
    >
      <div
        className="box"
        style={{ 
          top: top,
          left: left,
          backgroundColor: backgroundColor,
        }}></div>
    </div>
  );
}

export default App;
node *findMid(node *head) {
  node *slow = head;
  node *fast = head->next;
  while (fast != NULL && fast->next != NULL) {
    slow = slow->next;
    fast = fast->next->next;
  }
  return slow;
}

node *merge(node *left, node *right) {
  if (left == NULL) {
    return right;
  }
  if (right == NULL) {
    return left;
  }
  node *ans = new node(-1);
  node *temp = ans;
  while (left != NULL && right != NULL) {
    if (left->data < right->data) {
      temp->next = left;
      temp = left;
      left = left->next;
    } else {
      temp->next = right;
      temp = right;
      right = right->next;
    }
  }
  while (left != NULL) {
    temp->next = left;
    temp = left;
    left = left->next;
  }
  while (right != NULL) {
    temp->next = right;
    temp = right;
    right = right->next;
  }
  ans = ans->next;
  return ans;
}

node *mergeSort(node *head) {
  // base case
  if (head == NULL || head->next == NULL) {
    return head;
  }
  // breaking the linked list into two halves
  node *mid = findMid(head);
  node *first = head;
  node *second = mid->next;
  mid->next = NULL;
  // recursive call
  first = mergeSort(first);
  second = mergeSort(second);
  // merging the two sorted halves
  node *result = merge(first, second);
  return result;
}
List<Account> accountList = [
    SELECT Id, Name, AccountNumber FROM Account WHERE Name LIKE 'Test Account - %' 
    LIMIT 10
];

Datetime startDttm = System.now();
Map<String, SObject> acctMapByNbr = 
    MapCreator.createMapByIndex( accountList, 'AccountNumber' );
system.debug( 'MapCreator -> ' + ( System.now().getTime() - startDttm.getTime() ) );

startDttm = System.now();
Map<String, SObject> acctMapByNbr2 = 
    new Map<String, SObject>();
for( Account anAccount : accountList ) {
	acctMapByNbr2.put( String.valueOf( anAccount.AccountNumber ), anAccount );
}
system.debug( 'standard map creation -> ' + ( System.now().getTime() - startDttm.getTime() ) );
using av_motion_api.Data;
using av_motion_api.Factory;
using av_motion_api.Models;
using av_motion_api.Interfaces;
using av_motion_api.Services;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Logging;
using System.Text;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.OpenApi.Models;

var builder = WebApplication.CreateBuilder(args);

// Configure the app environment
ConfigurationManager configuration = builder.Configuration;

builder.Configuration.SetBasePath(Directory.GetCurrentDirectory())
    .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: false);

builder.Host.ConfigureAppConfiguration((hostingContext, config) =>
{
    config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
    config.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true);
});

// Configure logging
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddDebug();

// CORS
if (builder.Environment.IsDevelopment())
{
    builder.Services.AddCors(options =>
    {
        options.AddPolicy("AllowAll", policy =>
        {
            policy.AllowAnyOrigin()
                  .AllowAnyHeader()
                  .AllowAnyMethod();
        });
    });
}

// Add services to the container
builder.Services.AddControllers()
    .AddJsonOptions(options =>
    {
        options.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.Preserve;
    });

// SQL
builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
builder.Services.AddScoped<IRepository, Repository>();

builder.Services.AddIdentity<User, Role>(options =>
                {
                    options.Password.RequireUppercase = false;
                    options.Password.RequireLowercase = false;
                    options.Password.RequireNonAlphanumeric = false;
                    options.Password.RequireDigit = true;
                    options.User.RequireUniqueEmail = true;
                })
                .AddRoles<Role>()
                .AddEntityFrameworkStores<AppDbContext>()
                .AddDefaultTokenProviders();

builder.Services.AddAuthentication(options =>
                {
                    options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                    options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
                    options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
                })
                .AddCookie()
                .AddJwtBearer(options =>
                {
                    options.Events = new JwtBearerEvents
                    {
                        OnAuthenticationFailed = context =>
                        {
                            context.Response.Headers.Add("Authentication-Failed", context.Exception.Message);
                            return Task.CompletedTask;
                        },
                        OnTokenValidated = context =>
                        {
                            var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<StartupBase>>();
                            logger.LogInformation("Token validated for user: {0}", context.Principal.Identity.Name);
                            return Task.CompletedTask;
                        }
                    };
                    options.TokenValidationParameters = new TokenValidationParameters()
                    {
                        ValidateIssuer = true,
                        ValidateAudience = true,
                        ValidateLifetime = true,
                        ValidateIssuerSigningKey = true,
                        ValidIssuer = builder.Configuration["Tokens:Issuer"],
                        ValidAudience = builder.Configuration["Tokens:Audience"],
                        IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Tokens:Key"]))
                    };
                });

// Configure FormOptions for file uploads
builder.Services.Configure<FormOptions>(o =>
{
    o.ValueLengthLimit = int.MaxValue;
    o.MultipartBodyLengthLimit = int.MaxValue;
    o.MemoryBufferThreshold = int.MaxValue;
});

builder.Services.AddScoped<IUserClaimsPrincipalFactory<User>, AppUserClaimsPrincipalFactory>();

builder.Services.Configure<DataProtectionTokenProviderOptions>(options => options.TokenLifespan = TimeSpan.FromHours(3));

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
    // Add JWT Authentication to Swagger
    c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
    {
        Description = @"JWT Authorization header using the Bearer scheme. \r\n\r\n 
          Enter 'Bearer' [space] and then your token in the text input below.
          \r\n\r\nExample: 'Bearer 12345abcdef'",
        Name = "Authorization",
        In = ParameterLocation.Header,
        Type = SecuritySchemeType.ApiKey,
        Scheme = "Bearer"
    });

    c.AddSecurityRequirement(new OpenApiSecurityRequirement()
    {
        {
            new OpenApiSecurityScheme
            {
                Reference = new OpenApiReference
                {
                    Type = ReferenceType.SecurityScheme,
                    Id = "Bearer"
                },
                Scheme = "oauth2",
                Name = "Bearer",
                In = ParameterLocation.Header,
            },
            new List<string>()
        }
    });
});

var app = builder.Build();

// Configure the HTTP request pipeline
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

// Use CORS
app.UseCors("AllowAll");

app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();

app.MapControllers();

app.Use(async (context, next) =>
{
    var logger = app.Services.GetRequiredService<ILogger<Program>>();
    logger.LogInformation("Handling request: " + context.Request.Path);
    await next.Invoke();
    logger.LogInformation("Finished handling request.");
});

app.Run();
//Method before error
loadRewardTypes(): void {
    this.rewardTypeService.getAllRewardTypes().subscribe((rewardTypes: RewardTypeViewModel[]) => {
      this.rewardTypes = rewardTypes;
      this.filteredRewardTypes = rewardTypes;
    });
  }
  
//Method after error
loadRewardTypes(): void {
    this.rewardTypeService.getAllRewardTypes().subscribe({
      next: (rewardTypes: RewardTypeViewModel[]) => {
        console.log('API Response:', rewardTypes); // Check if the data is an array
        this.rewardTypes = Array.isArray(rewardTypes) ? rewardTypes : [];
        this.filteredRewardTypes = this.rewardTypes;
        console.log('Assigned rewardTypes:', this.rewardTypes); // Confirm assignment
      },
      error: (error) => {
        console.error('Error loading reward types:', error);
      }
    });
  }
App\Models\Category {#310 ▼ // resources\views/courses/show.blade.php
  #connection: null
  #table: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  +preventsLazyLoading: false
  #perPage: 15
  +exists: false
  +wasRecentlyCreated: false
  #escapeWhenCastingToString: false
  #attributes: []
  #original: []
  #changes: []
  #casts: []
  #classCastCache: []
  #attributeCastCache: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  +usesUniqueIds: false
  #hidden: []
  #visible: []
  #fillable: array:2 [▶]
  #guarded: array:1 [▶]
}
onSubmit() {
    if (this.profileForm.valid) {
      const userId = JSON.parse(localStorage.getItem('User')!).userId;
      this.userService.updateUser(userId, this.profileForm.value).subscribe({
        next: (result) => {
          console.log('User to be updated:', result);
          this.router.navigateByUrl(`/ProfilePage/${userId}`);
          alert('Successfully updated profile');
        },
        error: () => {
          console.error('Error updating user profile:');
          alert('Error updating profile');
        }
      });
    }
  }

onPhotoChange(event: Event): void {
    if (!this.isEditMode) return;

    const input = event.target as HTMLInputElement;
    if (input.files && input.files[0]) {
      const reader = new FileReader();
      reader.onload = (e: any) => {
        this.userProfileImage = e.target.result; // Update the image source
        this.profileForm.patchValue({ photo: e.target.result }); // Update the form control
      };
      reader.readAsDataURL(input.files[0]);
    }
  }
<link href="splendor.css" rel="stylesheet">
<script type="application/ld+json">
{
  "@context": "https://schema.org/", 
  "@type": "Product", 
  "name": "Terminus Developers",
  "image": "https://terminus-developers.com/wp-content/themes/terminus/assets/images/projects/_MG_4516.webp",
  "description": "Terminus Developers: Offering Premium Building Construction, Real Estate Services, and a Range of Flats, Plots, and Apartments in TSPA Junction, Kokapet, Kollur, Hyderabad.",
  "brand": {
    "@type": "Brand",
    "name": "Terminus"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.7",
    "bestRating": "5",
    "worstRating": "1",
    "ratingCount": "836"
  }
}
</script>
<script src="https://rawcdn.githack.com/oscarmorrison/md-page/232e97938de9f4d79f4110f6cfd637e186b63317/md-page.js"></script><noscript>
List<Account> accountList = [
    SELECT Id, Name, AccountNumber 
    FROM Account 
    WHERE Name LIKE 'Test Account - %' 
        AND AccountNumber != NULL
    LIMIT 5
];

Map<String, Object> paramMap = 
    new Map<String, Object>{ 'records' => JSON.serialize( accountList )
                        , 'fieldName' => 'AccountNumber' };
DataWeave.Script dwScript = 
    DataWeave.Script.createScript( 'ListToMap' );
DataWeave.Result result = dwScript.execute( paramMap );

String resultString = result.getValueAsString();
// system.debug( resultString );

Map<String, SObject> objMap = (Map<String, SObject>)
    JSON.deserialize( resultString, Map<String, SObject>.class );

system.debug( objMap );
system.debug( objMap.get( '1' ) );
system.debug( objMap.get( '101' ) );
%dw 2.0
input records application/json
input fieldName text
output application/json
---
{(records map (record) -> 
    ( record[ fieldName ] ) : record 
)}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
video {
  width: 100%;
  height: auto;
}
</style>
</head>
<body>
​
<video width="400" controls>
  <source src="mov_bbb.mp4" type="video/mp4">
  <source src="mov_bbb.ogg" type="video/ogg">
  Your browser does not support HTML5 video.
</video>
​
<p>Resize the browser window to see how the size of the video player will scale.</p>
​
</body>
</html>
​
​
​
node* sortList (node* head) {
  int zeroCount = 0;
  int oneCount = 0;
  int twoCount = 0;
  node* temp = head;
  while (temp != NULL) {
    if (temp -> data == 0) {
      zeroCount++;
    }
    else if (temp -> data == 0) {
      oneCount++;
    }
    else if (temp -> data == 0) {
      twoCount++;
    }
    temp = temp -> next;
  }
  temp = head;
  while (temp != NULL) {
    if (zeroCount != 0) {
      temp -> data = 0;
      zeroCount--;
    }
    else if (oneCount != 0) {
      temp -> data = 1;
      oneCount--;
    }
    else if (twoCount != 0) {
      temp -> data = 2;
      twoCount--;
    }
    temp = temp -> next;
  }
  return temp;
}
void removeLoop(node *head) {
  if (head == NULL) {
    return;
  }
  node *startOfLoop = getStartingNode(head);
  node *temp = startOfLoop;
  while (temp->next != startOfLoop) {
    temp = temp->next;
  }
  temp->next = NULL;
  cout << "loop is removed " << endl;
}
node *floyedDetectionLoop(node *head) {
  if (head == NULL) {
    return NULL;
  }
  node *fast = head;
  node *slow = head;
  while (fast != NULL && slow != NULL) {
    fast = fast->next;
    if (fast->next != NULL) {
      fast = fast->next;
    }
    slow = slow->next;
    if (fast == slow) {
      return slow;
    }
  }
  return NULL;
}

node *getStartingNode(node *head) {
  if (head == NULL) {
    return NULL;
  }
  node *intersection = floyedDetectionLoop(head);
  node *slow = head;
  while (slow != intersection) {
    slow = slow->next;
    intersection = intersection->next;
  }
  return slow;
}
function onOpen() {
  var ui = SpreadsheetApp.getUi();
  ui.createMenu('Custom Tools')
      .addItem('Remove Blank Rows', 'removeBlankRows')
      .addToUi();
}

function removeBlankRows() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getDataRange();
  var values = range.getValues();
  var rowsToDelete = [];

  // Loop through all rows and check for blank rows
  for (var i = values.length - 1; i >= 0; i--) {
    var isBlank = values[i].every(function(cell) { return cell === ''; });
    if (isBlank) {
      rowsToDelete.push(i + 1);
    }
  }

  // Delete rows in reverse order to avoid shifting indices
  for (var j = 0; j < rowsToDelete.length; j++) {
    sheet.deleteRow(rowsToDelete[j]);
  }
}
/**
 * Create the test data, ideally run 1 by 1 to prevent govenor limits
 * Run accounts and contacts first. Cases and opportunities require both
 */
upsertAccounts(0,10);
upsertContacts(0,10,0,10);
upsertCases(0,10,0,10);
upsertOpportunities(0,10,0,10);

/**
 * @description Method to create Basic Test Contacts
 */
public void upsertAccounts(Integer accountOffset, Integer numberOfAccounts){
    
    // List to store the new cases
    Account[] accounts = new Account[]{};

    // Loop for to create all top level accounts
    for (Integer i = accountOffset; i < numberOfAccounts; i++) {
    
        // A postfix to keep track of what item we're dealing with
        String postfix = String.valueOf(i+1).leftPad(4,'0');
        
        // Create a new account
        accounts.add(new Account(
            Name           = 'LWT - Test - Account - ' + postfix,
            UUID__c        = UUID.randomUUID().toString(),
            External_Id__c = 'ACC - ' + postfix
        ));
    }
    upsert accounts External_Id__c;
}


/**
 * @description Method to create Basic Test Contacts
 */
public void upsertContacts(Integer accountOffset, Integer numberOfAccounts, Integer contactOffset,Integer numberOfContacts){
    
    // Get the account and contact data
    Account[] accounts = [SELECT Id FROM Account WHERE Name LIKE 'LWT - Test - %' ORDER BY Name ASC LIMIT :numberOfAccounts];
    
    // Basic error handling
    if(numberOfAccounts != accounts.size()){throw new StringException('Number of accounts does not match number returned by the query');}
    
    // List to store the new contacts
    Contact[] contacts = new Contact[]{};

    // Iterate the top level accounts
    for(Integer i=accountOffset; i<numberOfAccounts; i++){
        
        // Create a number of contacts for each account
        for(Integer j=contactOffset; j < numberOfContacts; j++){
        
            // Postfix to keep track of where we are
            String postfix = String.valueOf(i+1).leftPad(4,'0') + ' - ' + String.valueOf(j+1).leftPad(4,'0');
            
            // Add a new contact to the list
            contacts.add(new Contact(
                AccountId      = accounts[i].Id,
                FirstName      = 'LWT - Test - ' + postfix,
                LastName       = 'Contact - ' + postfix,
                UUID__c        = UUID.randomUUID().toString(),
                External_Id__c = 'CON - ' + postfix
            ));
        }
    }
    upsert contacts External_Id__c;
}


/**
 * @description Method to create Basic Test Cases
 */
public void upsertCases(Integer offset, Integer numberOfAccounts, Integer contactOffset, Integer numberOfContacts){

    // Get the account and contact data
    Account[] accounts = [SELECT Id FROM Account WHERE Name LIKE 'LWT - Test - %' ORDER BY Name ASC LIMIT :numberOfAccounts];
    Contact[] contacts = [SELECT Id FROM Contact WHERE Name LIKE 'LWT - Test - %' ORDER BY Name ASC LIMIT :numberOfContacts];

    // Basic error handling
    if(numberOfAccounts != accounts.size()){throw new StringException('Number of accounts does not match number returned by the query');}
    if(numberOfContacts != contacts.size()){throw new StringException('Number of contacts does not match number returned by the query');}

    // List to store the new cases
    Case[] cases = new Case[]{};

    // Iterate the top level accounts
    for(Integer i=offset; i<numberOfAccounts; i++){
        
        // Create a case for each contact in the account
        for(Integer j=offset; j<numberOfContacts; j++){
        
            // Postfix to keep track of where we are
            String postfix = String.valueOf(i+1).leftPad(4,'0') + ' - ' + String.valueOf(j+1).leftPad(4,'0');
            
            // Add a new case
            cases.add(new Case(
                AccountId      = accounts[i].Id,
                ContactId      = contacts[j].Id,
                Subject        = 'LWT - Test - Case - ' + postfix,
                UUID__c        = UUID.randomUUID().toString(),
                External_Id__c = 'CSE - ' + postfix
            ));
        }
    }
    upsert cases External_Id__c;
}


/**
 * @description Method to create Basic Test Opportunities
 */
public void upsertOpportunities(Integer offset, Integer numberOfAccounts, Integer contactOffset, Integer numberOfContacts){
    
    // Get the account and contact data
    Account[] accounts = [SELECT Id FROM Account WHERE Name LIKE 'LWT - Test - %' ORDER BY Name ASC LIMIT :numberOfAccounts];
    Contact[] contacts = [SELECT Id FROM Contact WHERE Name LIKE 'LWT - Test - %' ORDER BY Name ASC LIMIT :numberOfContacts];

    // Basic error handling
    if(numberOfAccounts != accounts.size()){throw new StringException('Number of accounts does not match number returned by the query');}
    if(numberOfContacts != contacts.size()){throw new StringException('Number of contacts does not match number returned by the query');}
    
    // List to store the new cases
    Opportunity[] opportunities = new Opportunity[]{};

    // Iterate the top level accounts
    for(Integer i=offset; i<numberOfAccounts; i++){
        
        // Create an opportunity for each contact in the account
        for(Integer j=offset; j<numberOfContacts; j++){
        
            // Postfix to keep track of where we are
            String postfix = String.valueOf(i+1).leftPad(4,'0') + ' - ' + String.valueOf(j+1).leftPad(4,'0');
            
            // Add a new opportunity to the list
            opportunities.add(new Opportunity(
                AccountId      = accounts[i].Id,
                ContactId      = contacts[j].Id,
                Name           = 'LWT - Test - Opportunity - ' + postfix,
                StageName      = (Math.mod(j,2) == 0) ? 'New' : 'Closed/Won',
                CloseDate      = Date.today().addDays(j),
                UUID__c        = UUID.randomUUID().toString(),
                External_Id__c = 'OPP - ' + postfix
            ));
        }
    }
    upsert opportunities External_Id__c;
}
#include<stdio.h>
void interchange(int a[],int i,int j){
	int p=a[i];
	a[i]=a[j];
	a[j]=p;
}

int partition(int a[],int m,int p){
	int v=a[m],i=m,j=p;
	
	do{
		do{
			i=i+1;
		}while(a[i] < v);
		do{
			j=j-1;
		}while(a[j] > v);

		if(i<j){
			interchange(a,i,j);
		}
	}while(i < j);
	a[m]=a[j];
	a[j]=v;
	return j;
}



void QuickSort(int a[],int p,int q){
	if(p<q){
		int j=partition(a,p,q+1);
		QuickSort(a,p,j-1);
		QuickSort(a,j+1,q);
	}
}

int main(){
	int n;
	printf("Enter the size of array : ");
	scanf(" %d",&n);

	int a[n];
	for(int i=0;i<n;i++){
		printf("Enter the element %d : ",(i+1));
		scanf(" %d",&a[i]);		
	}

	QuickSort(a,0,n-1);
	printf("Sorted array is ");
	for(int i=0;i<n;i++){
		printf(" %d",a[i]);
	}

return 0;}
bool floyedDetectionLoop (node* head) {
  if (head == NULL) {
    return false;
  }
  node* fast = head;
  node* slow = head;
  while (fast != NULL && slow != NULL) {
    fast = fast -> next;
    if (fast -> next == NULL) {
      fast = fast -> next;
    }
    slow = slow -> next;
    if (fast == slow) {
      return true;
    }
    
  }
  return false;
}
🖌️ 3D Artist & Developer of Zombie Rush! 🧟‍♂️
💬 Messages are open to everyone. Feel free to ask questions, make suggestions or let me know about bugs in Zombie Rush!

🛒 Shop my UGC! 👉 www.roblox.com/catalog/?Category=11&CreatorName=FracturedSkies
🖌️ 3D Artist & Developer of Zombie Rush! 🧟‍♂️
💬 Messages are open to everyone. Feel free to ask questions, make suggestions or let me know about bugs in Zombie Rush!

🛒 Shop my UGC! 👉 www.roblox.com/catalog/?Category=11&CreatorName=FracturedSkies
bool detectLoop (node* head) {
  if (head == NULL) {
    return false;
  }
  map <node*, bool> visited;
  node* temp = head;
  while (temp != NULL) {
    if (visited[temp] == true) {
      return true;
    }
    visited[temp] = true;
    temp = temp -> next;
  }
  return false;
}
// check if a linked list is circular or not
bool isCircular (node* head) {
  if (head == NULL) {
    return true;
  }
  node* temp = head -> next;
  while (temp != NULL && temp != head) {
    temp = temp -> next;
  }
  if (temp == head) {
    return true;
  }
  return false;
}
node* kReverse (node* head, int k) {
  // base case
  if (head == NULL) {
    return NULL;
  }

  // step 1: reverse first k nodes
  node* forward = NULL;
  node* curr = head;
  node* prev = NULL;
  int cnt = 0;
  while (curr != NULL && cnt < k) {
    forward = curr -> next;
    curr -> next = prev;
    prev = curr;
    curr = forward;
    cnt++;
    
  }
  // step 2: recursion
  if (forward != NULL) {
    head -> next = kReverse(forward, k);
    
  }
  // step 3: return head of the modified list
  return prev;
}
function generateButtons(buttons) {
    // get the dataset value
    let uniqueCategories = [...new Set()];

    buttons.forEach((button) => {
      const category = button.dataset.category;
      uniqueCategories.push(category);
    });

    uniqueCategories = uniqueCategories.filter(function (item, pos) {
      return uniqueCategories.indexOf(item) == pos;
    });

    uniqueCategories.unshift("All");

    console.log(uniqueCategories);

    // return ` <button type="button" class="filter-btn" data-id="${category}">${category}</button>`;
  }
Diversie dashboards, analyses en rapportages werkbladen obv. het dagelijks ververste Proactis datamodel. 
int getLength (node* head) {
  int length = 0;
  node* temp = head;
  while (temp != NULL) {
    length++;
    temp = temp -> next;
  }
  return length;
}

node* middleNode (node* head) {
  int length = getLength(head);
  int mid = (length/2) + 1;
  int cnt = 1;
  node* temp = head;
  while (cnt < mid) {
    temp = temp -> next;
    cnt++;
  }
  return temp;
}
node* reverseLinkedList (node* & head) {
  //empty list or single node
  if (head == NULL || head -> next == NULL) {
    return head;
  }
  node* prev = NULL;
  node* curr = head;
  node* forword = NULL;
  while (curr != NULL) {
    forword = curr -> next;
    curr -> next = prev;
    prev = curr;
    curr = forword;
  }
  return prev;
}
// it will return the head of the reversed linked list
node* reverse1 (node* head) {
  // base case
  if (head == NULL || head -> next == NULL) {
    return head;
  }
  node* chotaHead = reverse1(head -> next) {
    head -> next -> next = head;
    head -> next = NULL;

    return chotaHead;
  }
}
node* reverseLinkedList (node* head) {
  // empty  list 
	if (head == NULL || head -> next == NULL) {
	return head;
	}
  node* prev = NULL;
  node* curr = head;
  node* forword = NULL;
  
  while (curr != NULL) {
	forword = curr -> next;
    curr -> next = prev;
    prev = curr;
    curr = forword;
  }
  return prev;
}
.more-less .e-n-accordion-item span.mniej {
    display: none;
}

.more-less.elementor-widget-n-accordion .e-n-accordion-item[open] .e-n-accordion-item-title span.more {
    display: none;
}
.more-less.elementor-widget-n-accordion .e-n-accordion-item[open] .e-n-accordion-item-title span.less {
    display: inline;
}
star

Sun Jul 21 2024 16:25:54 GMT+0000 (Coordinated Universal Time)

@codestored #cpp

star

Sun Jul 21 2024 12:50:18 GMT+0000 (Coordinated Universal Time)

@sty003 #python

star

Sun Jul 21 2024 12:08:54 GMT+0000 (Coordinated Universal Time)

@sty003 #python

star

Sun Jul 21 2024 10:30:29 GMT+0000 (Coordinated Universal Time) https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem?isFullScreen=true

@vishwanath_m

star

Sun Jul 21 2024 09:47:28 GMT+0000 (Coordinated Universal Time) https://codepen.io/dominickjay217/pen/zYdaxLG

@nader #undefined

star

Sun Jul 21 2024 09:26:56 GMT+0000 (Coordinated Universal Time) https://gunsbuyerusa.com/product/mini-draco-w-brace-for-sale/

@ak74uforsale

star

Sun Jul 21 2024 08:34:17 GMT+0000 (Coordinated Universal Time)

@samaymalik7

star

Sun Jul 21 2024 08:01:26 GMT+0000 (Coordinated Universal Time)

@pvignesh

star

Sun Jul 21 2024 05:34:32 GMT+0000 (Coordinated Universal Time) https://qiita.com/arihori13/items/442f13ccb6300b727492

@maridann1022

star

Sun Jul 21 2024 02:58:48 GMT+0000 (Coordinated Universal Time)

@destinyChuck #html #css #javascript

star

Sun Jul 21 2024 01:15:18 GMT+0000 (Coordinated Universal Time) undefined

@maridann1022

star

Sat Jul 20 2024 17:23:52 GMT+0000 (Coordinated Universal Time) https://youtu.be/BmZnJehDzyU?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA

@vishnu_jha ##c++ ##dsa ##loop ##algorithm #stack #parenthesis #validparenthesis

star

Sat Jul 20 2024 14:29:46 GMT+0000 (Coordinated Universal Time) https://zenn.dev/gashi/articles/20211209-article013

@maridann1022 #javascript #reac #type #typescript

star

Sat Jul 20 2024 13:48:17 GMT+0000 (Coordinated Universal Time) lecture 53 dsa babbar

@vishnu_jha ##c++ ##dsa ##linkedlist ##circular ##loop #floyd'sloopdetection ##algorithm #mergesort

star

Sat Jul 20 2024 12:59:11 GMT+0000 (Coordinated Universal Time)

@taurenhunter

star

Sat Jul 20 2024 12:29:24 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sat Jul 20 2024 12:26:19 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sat Jul 20 2024 12:05:06 GMT+0000 (Coordinated Universal Time) http://localhost:8000/courses/1

@bekzatkalau

star

Sat Jul 20 2024 10:16:17 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sat Jul 20 2024 09:54:20 GMT+0000 (Coordinated Universal Time)

@sty003 #html

star

Sat Jul 20 2024 09:52:22 GMT+0000 (Coordinated Universal Time) https://sub.shaheenenclave.com/

@isamardev

star

Sat Jul 20 2024 09:32:03 GMT+0000 (Coordinated Universal Time) http://octoprint.local/

@amccall23

star

Sat Jul 20 2024 09:31:44 GMT+0000 (Coordinated Universal Time) http://octoprint.local/

@amccall23

star

Sat Jul 20 2024 08:02:58 GMT+0000 (Coordinated Universal Time) https://www.coursera.org/learn/machine-learning/ungradedLab/7GEJh/optional-lab-multiple-linear-regression/lab?path

@wowthrisha

star

Sat Jul 20 2024 07:09:35 GMT+0000 (Coordinated Universal Time) https://terminus-developers.com/

@Zampa #html

star

Sat Jul 20 2024 06:13:14 GMT+0000 (Coordinated Universal Time)

@sty003 #html

star

Fri Jul 19 2024 22:20:54 GMT+0000 (Coordinated Universal Time) https://modly.netlify.app/

@nnjkjjkjk

star

Fri Jul 19 2024 21:52:09 GMT+0000 (Coordinated Universal Time)

@taurenhunter

star

Fri Jul 19 2024 15:09:10 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/css/tryit.asp?filename

@ElyasAkbari #undefined

star

Fri Jul 19 2024 12:48:09 GMT+0000 (Coordinated Universal Time) https://youtu.be/ogmBt6f9hw8?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA

@vishnu_jha ##c++ ##dsa ##linkedlist ##circular ##loop #floyd'sloopdetection ##algorithm

star

Fri Jul 19 2024 11:08:49 GMT+0000 (Coordinated Universal Time)

@roamtravel

star

Fri Jul 19 2024 11:01:38 GMT+0000 (Coordinated Universal Time)

@Justus

star

Fri Jul 19 2024 10:44:34 GMT+0000 (Coordinated Universal Time) https://www.blockchainappfactory.com/crypto-marketing-agency

@albertpeter

star

Fri Jul 19 2024 09:52:03 GMT+0000 (Coordinated Universal Time)

@signup

star

Fri Jul 19 2024 06:42:54 GMT+0000 (Coordinated Universal Time) https://www.roblox.com/users/13540173/profile

@Vitinlonlon73

star

Fri Jul 19 2024 06:42:38 GMT+0000 (Coordinated Universal Time) https://www.roblox.com/users/13540173/profile

@Vitinlonlon73

star

Fri Jul 19 2024 06:37:38 GMT+0000 (Coordinated Universal Time) https://youtu.be/VxOFflTXlXo?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA

@vishnu_jha ##c++ ##dsa ##linkedlist ##circular ##loop

star

Fri Jul 19 2024 06:27:21 GMT+0000 (Coordinated Universal Time) https://youtu.be/fi2vh0nQLi0?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA

@vishnu_jha #c++ #dsa #linkedlist #reverselinkedlist #recursion #circular

star

Fri Jul 19 2024 06:09:29 GMT+0000 (Coordinated Universal Time) https://youtu.be/fi2vh0nQLi0?list=PLDzeHZWIZsTryvtXdMr6rPh4IDexB5NIA

@vishnu_jha #c++ #dsa #linkedlist #reverselinkedlist #recursion

star

Fri Jul 19 2024 06:03:42 GMT+0000 (Coordinated Universal Time)

@davidmchale #function #filter

star

Fri Jul 19 2024 04:43:42 GMT+0000 (Coordinated Universal Time)

@bogeyboogaard

star

Fri Jul 19 2024 04:14:41 GMT+0000 (Coordinated Universal Time) https://youtu.be/vqS1nVQdCJM

@vishnu_jha #c++ #dsa #linkedlist #reverselinkedlist #recursion

star

Fri Jul 19 2024 04:13:46 GMT+0000 (Coordinated Universal Time) https://youtu.be/vqS1nVQdCJM

@vishnu_jha #c++ #dsa #linkedlist #reverselinkedlist #recursion

star

Thu Jul 18 2024 17:17:04 GMT+0000 (Coordinated Universal Time) https://youtu.be/vqS1nVQdCJM

@vishnu_jha #c++ #dsa #linkedlist #reverselinkedlist

star

Thu Jul 18 2024 17:12:19 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=IzvCG7v1KHg

@webisko #css

Save snippets that work with our extensions

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