Charts – Is there a shortest path algorithm that finds the shortest path between just two nodes?

The Dikstra algorithm for shortest paths in a weighted diagram, directional or bidirectional, pretty fast. There is also the Bellman Ford algorithm. However, these two find the shortest path between a source and all Key points. However, if I only want to know the way between two Vertices, is there a faster algorithm that only determines the distance between two nodes?

C programming finds min, max and sum without recursion and arrays

I'm trying to write a program that gets a series of numbers, n> = 5
The program prompts the user to enter n non-negative numbers and to calculate min, max and the sum of the numbers.
If the user enters negative numbers, the function prompts for a positive number.
I have a problem with the first negative number. Is there any indication of what's wrong with the following code?

    void main()
{
    int x;
    printf("Enter number:n);
    scanf("%d",&x);
    if (x >= 5)
    {
        int max=0, min, num1;
        printf("Enter numbers: n");
        scanf("%d", &num1);
        min = num1;
        int sum = num1;
        for (int i = 1; i < x; i++)
        {
            scanf("%d", num1);
            while (num1 < 0)
            {
                {
                    printf("Enter again number: /n");
                    scanf("%d", num1);
                }
                if (num1 > max)
                    max = num1;
                else if (num1 < min)
                    min = num1;
                sum += num1;
            }
        }
        printf("The max number is %d, and the min is %d, and the sum is %d", max, min, sum);
    }
    else
        printf("invalid number!");
}

Pagination – Finds the number of posts displayed on the current page

I am currently trying to implement a function for loading additional functions, which is described in this stackoverflow article. To do this, it must be known how many posts have already been loaded. So I try to return the number of current posts on a particular page.

The code in question is as follows:

 
0, 'posts_per_page' => 6 )); while ($posts->have_posts()) { $posts->the_post(); ?>
max_num_pages > 1) echo '
More posts
'; // you can use as well ?>

Although the WP_Query only returns 6 posts, the functions work get_query_var('posts_per_page') and $wp_query->post_countIf you get a call, return 10. Any ideas what I'm missing here?

Thank you in advance.

"When an element is created or modified" … "Get element" finds no dynamic ID content

I've tried so many options, but something that I think I've done before doesn't really happen.

  1. "When an item is created or modified"
  2. "Get All Lists And Libraries"
  3. "Get Article"
    * There is no dynamic content displayed at all, let alone "ID". There's a picture of what's going on

Office 365 – SharePoint Rest API – Finds accurate data that appears in the SharePoint list, regardless of the current user's time zone

I used moment js timezones to convert the date to the time zone used on the SharePoint site. To do this, go to the regional settings (http://site/_layouts/15/regionalsetng.aspx) and note the time zone.
Then add this time zone to your moment js in your code

https://github.com/moment/moment-timezone/blob/develop/data/packed/latest.json

For example, if it is Brussels, add

moment.tz.add(("Europe/Brussels|WET CET CEST WEST|0 -10 -20 -10|0121212103030303030303030303030303030303030303030303212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2ehc0 3zX0 11c0 1iO0 11A0 1o00 11A0 my0 Ic0 1qM0 Rc0 1EM0 UM0 1u00 10o0 1io0 1io0 17c0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a30 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 y00 5Wn0 WM0 1fA0 1cM0 16M0 1iM0 16M0 1C00 Uo0 1eeo0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|21e5"));

Then convert the date to the Brussels time zone using the following code

moment(data.d.StartDate).tz("Europe/Brussels").format("DD/MM/YYYY");

python 2.x – In theory, this code should work because it checks and finds all combinations between 1 and 1000, but my program continues to run without result

def sqr(number):
     return number ** 2

def triplet_check(a,b,c):
     if sqr(a) + sqr(b) == sqr(c) and (a < b) and (a < b) and (b < c):
          return True
     else:
          return False




for i in range(1,1001):
     for j in range(1,1001):
          for y in range(1,1001):

               if triplet_check(i,j,y) == True and i + y + j == 1000:
                    product = i * y * j
                    break


print product 

rust – Finds a file in current or parent directories

As a Rust beginner, I would like to know how I can improve the following points considering the following function:

  • handling Path and PathBuf type correctly;
  • Performance;
  • Rust writing style in general.

Here is the function, decorated with a complete working example:

use std::env;
use std::path::{Path, PathBuf};

const RUSV_FILENAME: &str = ".rusv.json";

/**
 * Find a rusv file in the current or parent directories of the given directory.
 */
fn find_rusv_file(starting_directory: &Path) -> Option {
    let mut directory = starting_directory;
    let rusv_filename = Path::new(&RUSV_FILENAME);

    loop {
        let filepath: PathBuf = (
            directory,
            rusv_filename
        ).iter().collect();

        if filepath.is_file() {
            return Some(filepath);
        }

        match directory.parent() {
            Some(parent) => directory = parent,
            None => return None,
        }
    }
}

fn main() -> std::io::Result<()> {
    let path = env::current_dir()?;

    match find_rusv_file(&path) {
        Some(filepath) => println!("Rusv file was found: {:?}", filepath),
        None => println!("No rusv file was found."),
    };

    Ok(())
}

My question is Not About:

  • Create a more general function (e.g. by specifying the file name as an argument);
  • Everything related to the main() Function.

sharepoint online – Pnp powershell script finds propertyBag on the SPO hub site – Assigned

Is there a way to get the properties of the site / web using Get-PnPPropertyBag by going through a hub site and associated sites?
Get-PnPPropertyBag -Key MyKey only for site properties, but I want to iterate through websites on SPO and get properties for output to a CSV file.

Connect-PnPOnline -Url "https://mytenat-admin.sharepoint.us/" 

#Getting the hub site id for which we want to generate the report - those are connected to this hub site.
$hubSiteURL="https://mytenatgov.sharepoint.us/sites/TargetSite"
$hubSite = Get-PnPTenantSite $hubSiteURL  
$hubSiteId = $hubSite.HubSiteId
write-host " #####Generating sites connected a single hub site report######: " -BackgroundColor DarkGreen
write-host "Hub Site URL: " $hubSiteURL


$associatedSites = @()


#Get all sites associated to the hub site(in the above hub site)
$sitesTenant = Get-PnPTenantSite -Detailed 
$sitesTenant | select url | % {$oneSite = Get-PnPTenantSite $_.url 

  if($oneSite.hubsiteid -eq $hubSiteId)
  {

    write-host "Associated Site URL: " $oneSite.url

     $assocatedSiteObject = New-Object PSObject     
     $assocatedSiteObject | Add-Member -MemberType NoteProperty -name "HubSiteURL" -value $hubSiteURL
     $assocatedSiteObject | Add-Member -MemberType NoteProperty -name "HubSiteID" -value $hubSiteId
     $assocatedSiteObject | Add-Member -MemberType NoteProperty -name "Title" -value $oneSite.Title
     $assocatedSiteObject | Add-Member -MemberType NoteProperty -Name "URL" -value $oneSite.Url
     $assocatedSiteObject | Add-Member -MemberType NoteProperty -name "AssociatedStatus" -value $oneSite.Status



     #Add the object with property to an Array
     $associatedSites += $assocatedSiteObject

  }
}

#Export the site array collection to a CSV file