问:
Filtering WP_query by post meta key and value '_wp_attachment_image_alt'
I'm modifying a plugin code to retrieve the data by filtering by request parameters

```<code>public function get($posts_per_page = 25, $page = 1, $server ='tareq-test')
{
    if (!$posts_per_page || !$page || !$server) {
        return array();
    }

    $args = array(

        'post_type' => 'ml-slider',

        'post_status' => array('inherit', 'publish'),
        'orderby' => 'modified',
        'suppress_filters' => 1, // wpml, ignore language filter,
        'paged' => $page,
        'posts_per_page' => $posts_per_page,
        'meta_key'       => '_wp_attachment_image_alt',
        'meta_value'     =>$server,
    //     'meta_query' => array(
    //     array(
    //         'key' => '_wp_attachment_image_alt',
    //         'value' => $server,
    //         // 'compare' => '!EXISTS',
    //         // 'type' => 'STRING',
    //     ),
    // ),
    );

    $slideshows = new WP_Query(apply_filters('metaslider_get_single_slideshows_args', $args));
    if (is_wp_error($slideshows)) {
        return $slideshows;
    }
    // $slideshow2 = array();
    // foreach($slideshows->posts as $key=>$value){
    //     $metaC = get_post_meta(get_the_ID(), '_wp_attachment_image_alt', true);
    //     if($metaC == $server){
    //         array_push($slideshow2, $slideshows->posts[$key]);
    //     }
    // }
    // array_replace($slideshows->posts,$slideshow2);
    //  $slideshows->posts = $slideshow2;

    $slideshows_formatted = array_map('self::build_slideshow_object', $slideshows->posts);

    $remaining_pages = intval($slideshows->max_num_pages) - intval($page);
    if ($remaining_pages > 0) {
        $slideshows_formatted['page'] = $page;
        $slideshows_formatted['remaining_pages'] = $remaining_pages;
    }

    // Add the total count so we know there are more to fetch
    if (1 == $page) {
        $slideshows_formatted['totalSlideshows'] = $slideshows->found_posts;
    }

    return $slideshows_formatted;
}
</code>```

Now I'm filtering by post meta '_wp_attachment_image_alt', but when I add the following couple of lines to $args the post response will be zero.

The two lines are:

```<code>'meta_key'       => '_wp_attachment_image_alt',
'meta_value'     => $server,
</code>```

when commenting on them everything is ok.

The response is:

```<code>[
 {
    "totalSlideshows": 0
 }
]
</code>```

but the response is 200 ok.

Body:
I'm modifying a plugin code to retrieve the data by filtering by request parameters

public function get($posts_per_page = 25, $page = 1, $server ='tareq-test')
{
    if (!$posts_per_page || !$page || !$server) {
        return array();
    }

    $args = array(

        'post_type' => 'ml-slider',

        'post_status' => array('inherit', 'publish'),
        'orderby' => 'modified',
        'suppress_filters' => 1, // wpml, ignore language filter,
        'paged' => $page,
        'posts_per_page' => $posts_per_page,
        'meta_key'       => '_wp_attachment_image_alt',
        'meta_value'     =>$server,
    //     'meta_query' => array(
    //     array(
    //         'key' => '_wp_attachment_image_alt',
    //         'value' => $server,
    //         // 'compare' => '!EXISTS',
    //         // 'type' => 'STRING',
    //     ),
    // ),
    );

    $slideshows = new WP_Query(apply_filters('metaslider_get_single_slideshows_args', $args));
    if (is_wp_error($slideshows)) {
        return $slideshows;
    }
    // $slideshow2 = array();
    // foreach($slideshows->posts as $key=>$value){
    //     $metaC = get_post_meta(get_the_ID(), '_wp_attachment_image_alt', true);
    //     if($metaC == $server){
    //         array_push($slideshow2, $slideshows->posts[$key]);
    //     }
    // }
    // array_replace($slideshows->posts,$slideshow2);
    //  $slideshows->posts = $slideshow2;

    $slideshows_formatted = array_map('self::build_slideshow_object', $slideshows->posts);

    $remaining_pages = intval($slideshows->max_num_pages) - intval($page);
    if ($remaining_pages > 0) {
        $slideshows_formatted['page'] = $page;
        $slideshows_formatted['remaining_pages'] = $remaining_pages;
    }

    // Add the total count so we know there are more to fetch
    if (1 == $page) {
        $slideshows_formatted['totalSlideshows'] = $slideshows->found_posts;
    }

    return $slideshows_formatted;
}

Now I'm filtering by post meta '_wp_attachment_image_alt', but when I add the following couple of lines to $args the post response will be zero.

The two lines are:

'meta_key'       => '_wp_attachment_image_alt',
'meta_value'     => $server,

when commenting on them everything is ok.

The response is:

[
 {
    "totalSlideshows": 0
 }
]

but the response is 200 ok.


来源: stackexchange

问:
How to displaying different image repeatedly with query selector on javascript?
I want to displaying images as a questions which show itself with specific image link attached on questions. How's the const img and let image should be written? currently it produce blank page

function showQuetions(index) {
  const que_text = document.querySelector(".que_text"); **
  const img = document.querySelector(".image"); **

  //creating a new span and div tag for question and option and passing the value using array index
  let que_tag = '' + questions[index].numb + ". " + ''; **
  let image = img.src = questions[index].question; **
  let option_tag = '
' + questions[index].options[0] + '
' +
    '
' + questions[index].options[1] + '
' +
    '
' + questions[index].options[2] + '
' +
    '
' + questions[index].options[3] + '
';
  que_text.innerHTML = que_tag; //adding new span tag inside que_tag
  option_list.innerHTML = option_tag; //adding new div tag inside option_tag

  const option = option_list.querySelectorAll(".option");```
<pre class="snippet-code-html lang-html prettyprint-override"><code><section>
  <div class="que_text">
    <!-- Here I've inserted question from JavaScript -->
  </div>
  <div class="que_img">
    <!-- Here I've inserted image from JavaScript -->
  </div>
  <div class="option_list">
    <!-- Here I've inserted options from JavaScript -->
  </div>
</section></code>```

ContentLicense: CC BY-SA 4.0


问:
Exception calling "Send" with "1" argument(s): The server response was: Cannot connect to SMTP server, connect error 10060"
I have the following code to connect to ExchangeOnline  >> generate csv file >> send the file by email using Office 365 smtp:-

```<code>Connect-ExchangeOnline
$SiteIDs = '64898c8f-2d5f-4e0e-9a9b-eb9828975a9e','20e6140c-0441-4988-b36c-c61cf3400847'
$Operations = @('FileAccessed','FileDownloaded','FileDeleted')
$OutputFile = ".\UnifiedAuditLog_FULL.csv"
$Today = Get-Date -Date (Get-Date -Format “yyyy-MM-dd”)
$intDays = 14
For ($i=0; $i -le $intDays; $i++){
  For ($j=23; $j -ge 0; $j--){
    $StartDate = ($Today.AddDays(-$i)).AddHours($j)
    $EndDate = ($Today.AddDays(-$i)).AddHours($j + 1)
    $Audit = Search-UnifiedAuditLog -StartDate $StartDate -EndDate $EndDate -ResultSize 5000 -SiteIds $SiteIDs -RecordType SharePointFileOperation -Operations $Operations
    $ConvertAudit = $Audit | Select-Object -ExpandProperty AuditData | ConvertFrom-Json
    $OutputFile0 = ".\UnifiedAuditLog_FULL"+$i+$j+"ALL0.csv"
    $ConvertAudit | Select-Object CreationTime,UserId,Operation,Workload,ObjectID,SiteUrl,SourceFileName,ClientIP,UserAgent | Export-Csv $OutputFile0 -NoTypeInformation -Force -Append
    Write-Host $StartDate `t $Audit.Count
    # File to be attached in email
$attachment = new-object Net.Mail.Attachment("D:\"+$OutputFile0)

# Configure SMTP server
$smtpServer = "smtp.office365.com"
$mailMessage = new-object Net.Mail.MailMessage
$smtpObj = new-object Net.Mail.SmtpClient($smtpServer)

# Set email parameters
$mailMessage.From = "***"
$mailMessage.ReplyTo = "****"
$mailMessage.To.Add("****")
$mailMessage.subject = "[MAIL SUBJECT]"
$mailMessage.body = "[MAIL BODY]"
$mailMessage.Attachments.Add($attachment)

# Send email
$smtpObj.Send($mailMessage)
$attachment.Dispose()

  }
}
Disconnect-ExchangeOnline
</code>```

But i will get this exception:-

```<code>Exception calling "Send" with "1" argument(s): "Service not available, closing transmission channel. The server
response was: Cannot connect to SMTP server 40.101.76.178 (40.101.76.178:25), connect error 10060"
At line:28 char:1
+ $smtpObj.Send($mailMessage)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException
</code>```

Any advice?

Update-1

Now when i define the port number as follow:-

```<code>$smtpObj = new-object Net.Mail.SmtpClient($smtpServer,587)
</code>```

I will get this error instead:-

```<code>Exception calling "Send" with "1" argument(s): "Error in processing. The server response was: 5.7.3 STARTTLS is
required to send mail [VI1P194CA0025.EURP194.PROD.OUTLOOK.COM]"
At line:28 char:1
+ $smtpObj.Send($mailMessage)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException
</code>```

Edit I also tried this:-

```<code>Read-Host -Prompt "Enter your tenant password" -AsSecureString | ConvertFrom-SecureString | Out-File "O365.key"

Connect-ExchangeOnline
$SiteIDs = '64898c8f-2d5f-4e0e-9a9b-eb9828975a9e','20e6140c-0441-4988-b36c-c61cf3400847'
$Operations = @('FileAccessed','FileDownloaded','FileDeleted')
$OutputFile = ".\UnifiedAuditLog_FULL.csv"
$Today = Get-Date -Date (Get-Date -Format “yyyy-MM-dd”)
$intDays = 2
$TenantPass = cat "O365.key" | ConvertTo-SecureString
$emailCredential = New-Object System.Net.NetworkCredential("test.user@***.com", $TenantPass)
For ($i=0; $i -le $intDays; $i++){
  For ($j=23; $j -ge 0; $j--){
    $StartDate = ($Today.AddDays(-$i)).AddHours($j)
    $EndDate = ($Today.AddDays(-$i)).AddHours($j + 1)
    $Audit = Search-UnifiedAuditLog -StartDate $StartDate -EndDate $EndDate -ResultSize 5000 -SiteIds $SiteIDs -RecordType SharePointFileOperation -Operations $Operations
    $ConvertAudit = $Audit | Select-Object -ExpandProperty AuditData | ConvertFrom-Json
    $OutputFile0 = ".\UnifiedAuditLog_FULL"+$i+$j+"ALL0.csv"
    $ConvertAudit | Select-Object CreationTime,UserId,Operation,Workload,ObjectID,SiteUrl,SourceFileName,ClientIP,UserAgent | Export-Csv $OutputFile0 -NoTypeInformation -Force -Append
    Write-Host $StartDate `t $Audit.Count

    # File to be attached in email
$attachment = new-object Net.Mail.Attachment("D:\"+$OutputFile0)

# Configure SMTP server
$smtpServer = "smtp.office365.com"
$mailMessage = new-object Net.Mail.MailMessage
$smtpObj = new-object Net.Mail.SmtpClient($smtpServer,587)
$smtpObj.EnableSSl = $true
$smtpObj.Credentials = $emailCredential
# Set email parameters
$mailMessage.From = "test.user@***.com"
$mailMessage.To.add("test.user@***.com")
$mailMessage.subject = "[MAIL SUBJECT]"
#$mailMessage.body = "[MAIL BODY]"
#$mailMessage.Attachments.Add($attachment)

# Send email
$smtpObj.Send($mailMessage)
$attachment.Dispose()

  }
}
Disconnect-ExchangeOnline
</code>```

but i got this error:-

```<code>Exception calling "Send" with "1" argument(s): "The SMTP server requires a secure connection or the client was not
authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139
Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your
administrator. [VI1P191CA0005.EURP191.PROD.OUTLOOK.COM]"
At line:26 char:1
+ $smtpObj.Send($mailMessage)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException
</code>```

Although the user i am using has SmtpClientAuthenticationDisabled = False, as follow

```<code>PS D:\> Get-CASMailbox -Identity test.user@***.com
Name          ActiveSyncEnabled OWAEnabled PopEnabled ImapEnabled MapiEnabled SmtpClientAuthenticationDisabled
----          ----------------- ---------- ---------- ----------- ----------- --------------------------------
test.user@***.com True              True       True       True        True        False
</code>```

Body:
I have the following code to connect to ExchangeOnline  >> generate csv file >> send the file by email using Office 365 smtp:-

Connect-ExchangeOnline
$SiteIDs = '64898c8f-2d5f-4e0e-9a9b-eb9828975a9e','20e6140c-0441-4988-b36c-c61cf3400847'
$Operations = @('FileAccessed','FileDownloaded','FileDeleted')
$OutputFile = ".\UnifiedAuditLog_FULL.csv"
$Today = Get-Date -Date (Get-Date -Format “yyyy-MM-dd”)
$intDays = 14
For ($i=0; $i -le $intDays; $i++){
  For ($j=23; $j -ge 0; $j--){
    $StartDate = ($Today.AddDays(-$i)).AddHours($j)
    $EndDate = ($Today.AddDays(-$i)).AddHours($j + 1)
    $Audit = Search-UnifiedAuditLog -StartDate $StartDate -EndDate $EndDate -ResultSize 5000 -SiteIds $SiteIDs -RecordType SharePointFileOperation -Operations $Operations
    $ConvertAudit = $Audit | Select-Object -ExpandProperty AuditData | ConvertFrom-Json
    $OutputFile0 = ".\UnifiedAuditLog_FULL"+$i+$j+"ALL0.csv"
    $ConvertAudit | Select-Object CreationTime,UserId,Operation,Workload,ObjectID,SiteUrl,SourceFileName,ClientIP,UserAgent | Export-Csv $OutputFile0 -NoTypeInformation -Force -Append
    Write-Host $StartDate `t $Audit.Count
    # File to be attached in email
$attachment = new-object Net.Mail.Attachment("D:\"+$OutputFile0)

# Configure SMTP server
$smtpServer = "smtp.office365.com"
$mailMessage = new-object Net.Mail.MailMessage
$smtpObj = new-object Net.Mail.SmtpClient($smtpServer)

# Set email parameters
$mailMessage.From = "***"
$mailMessage.ReplyTo = "****"
$mailMessage.To.Add("****")
$mailMessage.subject = "[MAIL SUBJECT]"
$mailMessage.body = "[MAIL BODY]"
$mailMessage.Attachments.Add($attachment)

# Send email
$smtpObj.Send($mailMessage)
$attachment.Dispose()

  }
}
Disconnect-ExchangeOnline

But i will get this exception:-

Exception calling "Send" with "1" argument(s): "Service not available, closing transmission channel. The server
response was: Cannot connect to SMTP server 40.101.76.178 (40.101.76.178:25), connect error 10060"
At line:28 char:1
+ $smtpObj.Send($mailMessage)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException

Any advice?

Update-1

Now when i define the port number as follow:-

$smtpObj = new-object Net.Mail.SmtpClient($smtpServer,587)

I will get this error instead:-

Exception calling "Send" with "1" argument(s): "Error in processing. The server response was: 5.7.3 STARTTLS is
required to send mail [VI1P194CA0025.EURP194.PROD.OUTLOOK.COM]"
At line:28 char:1
+ $smtpObj.Send($mailMessage)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException

Edit I also tried this:-

Read-Host -Prompt "Enter your tenant password" -AsSecureString | ConvertFrom-SecureString | Out-File "O365.key"

Connect-ExchangeOnline
$SiteIDs = '64898c8f-2d5f-4e0e-9a9b-eb9828975a9e','20e6140c-0441-4988-b36c-c61cf3400847'
$Operations = @('FileAccessed','FileDownloaded','FileDeleted')
$OutputFile = ".\UnifiedAuditLog_FULL.csv"
$Today = Get-Date -Date (Get-Date -Format “yyyy-MM-dd”)
$intDays = 2
$TenantPass = cat "O365.key" | ConvertTo-SecureString
$emailCredential = New-Object System.Net.NetworkCredential("test.user@***.com", $TenantPass)
For ($i=0; $i -le $intDays; $i++){
  For ($j=23; $j -ge 0; $j--){
    $StartDate = ($Today.AddDays(-$i)).AddHours($j)
    $EndDate = ($Today.AddDays(-$i)).AddHours($j + 1)
    $Audit = Search-UnifiedAuditLog -StartDate $StartDate -EndDate $EndDate -ResultSize 5000 -SiteIds $SiteIDs -RecordType SharePointFileOperation -Operations $Operations
    $ConvertAudit = $Audit | Select-Object -ExpandProperty AuditData | ConvertFrom-Json
    $OutputFile0 = ".\UnifiedAuditLog_FULL"+$i+$j+"ALL0.csv"
    $ConvertAudit | Select-Object CreationTime,UserId,Operation,Workload,ObjectID,SiteUrl,SourceFileName,ClientIP,UserAgent | Export-Csv $OutputFile0 -NoTypeInformation -Force -Append
    Write-Host $StartDate `t $Audit.Count

    # File to be attached in email
$attachment = new-object Net.Mail.Attachment("D:\"+$OutputFile0)

# Configure SMTP server
$smtpServer = "smtp.office365.com"
$mailMessage = new-object Net.Mail.MailMessage
$smtpObj = new-object Net.Mail.SmtpClient($smtpServer,587)
$smtpObj.EnableSSl = $true
$smtpObj.Credentials = $emailCredential
# Set email parameters
$mailMessage.From = "test.user@***.com"
$mailMessage.To.add("test.user@***.com")
$mailMessage.subject = "[MAIL SUBJECT]"
#$mailMessage.body = "[MAIL BODY]"
#$mailMessage.Attachments.Add($attachment)

# Send email
$smtpObj.Send($mailMessage)
$attachment.Dispose()

  }
}
Disconnect-ExchangeOnline

but i got this error:-

Exception calling "Send" with "1" argument(s): "The SMTP server requires a secure connection or the client was not
authenticated. The server response was: 5.7.57 Client not authenticated to send mail. Error: 535 5.7.139
Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your
administrator. [VI1P191CA0005.EURP191.PROD.OUTLOOK.COM]"
At line:26 char:1
+ $smtpObj.Send($mailMessage)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SmtpException

Although the user i am using has SmtpClientAuthenticationDisabled = False, as follow

PS D:\> Get-CASMailbox -Identity test.user@***.com
Name          ActiveSyncEnabled OWAEnabled PopEnabled ImapEnabled MapiEnabled SmtpClientAuthenticationDisabled
----          ----------------- ---------- ---------- ----------- ----------- --------------------------------
test.user@***.com True              True       True       True        True        False


问:
Understanding Firebase Audience based remote variable updation
My app is fetching data of remote config on each session start.
Now I made an audience based on game difficulty i.e "Level3_stuck_users"

my remote variable is "game_difficulty" having value of 1f.
I want to change the difficulty of users specially on the same session of the game when they meet the "Level3_stuck_users" audience .

Will remote config variable be auto updated when they meet the audience or have to fetch data specifically in the game to get updated value?
How can I update the data on the same session if user meet the audience?
Thanks in Advance!

I can't understand how can I send back some trigger to the app to fetch that changed remote variable.


问:
Sharing setOnValueChangedListener of a NmmberPicker to other classes
I am fairly new to Java and android development.
I am currently coding a number picker to get user to choose a value as follows;

```<code>public class ValPicker extends AppCompatActivity {

public Activity activity;

public ValPicker(Activity _activity) {
    this.activity = _activity;
}

public static String[] root = {"a", "b", "c", "d"};

public int rootPicker() {
    NumberPicker root_picker = (NumberPicker) this.activity.findViewById(R.id.root_picker);
    root_picker.setMinValue(0);
    root_picker.setMaxValue(root.length - 1);
    root_picker.setDisplayedValues(root);
    //String chosenRoot = root[root_picker.getValue()];

    root_picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker numberPicker, int i, int i1) {
            int chosenRoot = root_picker.getValue();
        }
    });
}
</code>```

This number picker is in main/java/com.xxx.xxx/utils and is planned to be used by a few activities. I would like to make setOnValueChangedListener available for ither activities to get a value from the picker.

If you know how, please comment.
Thank you so much for your help in advance!

Body:
I am fairly new to Java and android development.
I am currently coding a number picker to get user to choose a value as follows;

public class ValPicker extends AppCompatActivity {

public Activity activity;

public ValPicker(Activity _activity) {
    this.activity = _activity;
}

public static String[] root = {"a", "b", "c", "d"};

public int rootPicker() {
    NumberPicker root_picker = (NumberPicker) this.activity.findViewById(R.id.root_picker);
    root_picker.setMinValue(0);
    root_picker.setMaxValue(root.length - 1);
    root_picker.setDisplayedValues(root);
    //String chosenRoot = root[root_picker.getValue()];

    root_picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker numberPicker, int i, int i1) {
            int chosenRoot = root_picker.getValue();
        }
    });
}

This number picker is in main/java/com.xxx.xxx/utils and is planned to be used by a few activities. I would like to make setOnValueChangedListener available for ither activities to get a value from the picker.

If you know how, please comment.
Thank you so much for your help in advance!


问:
can we rename the previous generated output XML file on same location using XSLT
I am writing an XSLT and generating one output named of output.xml in one location, which is not a problem but if I am running that XSLT again then the new output should name be the same but previous generated output should be renamed. Example:

**new output name** should be **output.xml**

**Previous run output name** should be **output1.xml, output2.xml ......... outputn.xml**

If anyone know the solution, then please comment


问:
Tailwind sometimes not applying styles to Wordpress project
I'm facing an issue with tailwindcss on my wordpress project. I made all the configuration and sometimes tailwind is applying styles but when i try it next day it wont work. Basically Tailwind is compiling their classes to my output.css file but then wordpress does not recognize the classes in the front. Note that this happens some times.

I'm showing my config there:Tailwind Config.Tailwind config in functions.php:Tailwind script in functions.php. And i'm attaching there two example, and as you can see in first screenshot i'm writing tailwind class pl-16 but isnt working: example1.But in my output tailwind already compiled the class.example2


问:
Undefined reference to copy
This is a function for doubling the circular queue capacity in C

(https://i.stack.imgur.com/xxhah.jpg)

Code source : Fundamentals of data structures in C

```<code>#include <stdio.h>
#include <stdlib.h>

typedef struct {
  int key;
} element;

element *queue;
void addq(element);
element deleteq(void);
void queueFull(void);
void displayq(void);
int capacity = 1;
int f, r;

void main() {
  element e, temp;
  int choice, done = 0;
  f = 0;
  r = 0;
  while (!done) {
    printf("1.Insert\t2.Delete\t3.Display\t4.Exit\n");
    printf("Enter choice");
    scanf("%d", &choice);
    switch (choice) {
      case 1:
        printf("Enter element");
        scanf("%d", &e.key);
        addq(e);
        break;
      case 2:
        temp = deleteq();
        if (temp.key == -1)
          printf("Queue Underflow\n");
        else
          printf("Queue element deleted : %d\n", temp.key);
        break;
      case 3:
        displayq();
        break;
      case 4:
        done = 1;
        break;
      default:
        printf("Illegal Entry\n");
        break;
    }
  }
}

void addq(element e) {
  if (f == (r + 1) % capacity)
    queueFull();
  r = (r + 1) % capacity;
  queue[r] = e;
}

void queueFull() {
  int start;
  element *newQueue;
  newQueue = (element*) malloc(2 * capacity * sizeof(queue));
  /*Copy from queue to newQueue*/
  start = (f + 1) % capacity;
  if (start < 2)
    /*No wrap around*/
    copy(queue + start, queue + start + capacity - 1, newQueue);
  else {
    copy(queue + start, queue + capacity, newQueue);
    copy(queue + start, queue + r + 1, newQueue + capacity - start);
  }
  /*Switch to newqueue*/
  f = 2 * capacity - 1;
  r = capacity - 1;
  capacity *= 2;
  free(queue);
  queue = newQueue;
}

element deleteq() {
  element temp;
  temp.key = -1;
  if (f == r)
    return temp;
  else {
    f = (f + 1) % capacity;
    temp = queue[f];
    return temp;
  }
}

void displayq() {
  int i;
  i = f;
  if (f == r)
    printf("Queue empty\n");
  else {
    while (i != r) {
      i = (i + 1) % capacity;
      printf("%d", queue[i].key);
    }
    printf("\n");
  }
}
</code>```

When I compile the code, I get the error undefined reference to copy.

Does anyone know in which library this function exists? Or is there any other way around?

Title: Undefined reference to copy

Body:
This is a function for doubling the circular queue capacity in C

(https://i.stack.imgur.com/xxhah.jpg)

Code source : Fundamentals of data structures in C

#include <stdio.h>
#include <stdlib.h>

typedef struct {
  int key;
} element;

element *queue;
void addq(element);
element deleteq(void);
void queueFull(void);
void displayq(void);
int capacity = 1;
int f, r;

void main() {
  element e, temp;
  int choice, done = 0;
  f = 0;
  r = 0;
  while (!done) {
    printf("1.Insert\t2.Delete\t3.Display\t4.Exit\n");
    printf("Enter choice");
    scanf("%d", &choice);
    switch (choice) {
      case 1:
        printf("Enter element");
        scanf("%d", &e.key);
        addq(e);
        break;
      case 2:
        temp = deleteq();
        if (temp.key == -1)
          printf("Queue Underflow\n");
        else
          printf("Queue element deleted : %d\n", temp.key);
        break;
      case 3:
        displayq();
        break;
      case 4:
        done = 1;
        break;
      default:
        printf("Illegal Entry\n");
        break;
    }
  }
}

void addq(element e) {
  if (f == (r + 1) % capacity)
    queueFull();
  r = (r + 1) % capacity;
  queue[r] = e;
}

void queueFull() {
  int start;
  element *newQueue;
  newQueue = (element*) malloc(2 * capacity * sizeof(queue));
  /*Copy from queue to newQueue*/
  start = (f + 1) % capacity;
  if (start < 2)
    /*No wrap around*/
    copy(queue + start, queue + start + capacity - 1, newQueue);
  else {
    copy(queue + start, queue + capacity, newQueue);
    copy(queue + start, queue + r + 1, newQueue + capacity - start);
  }
  /*Switch to newqueue*/
  f = 2 * capacity - 1;
  r = capacity - 1;
  capacity *= 2;
  free(queue);
  queue = newQueue;
}

element deleteq() {
  element temp;
  temp.key = -1;
  if (f == r)
    return temp;
  else {
    f = (f + 1) % capacity;
    temp = queue[f];
    return temp;
  }
}

void displayq() {
  int i;
  i = f;
  if (f == r)
    printf("Queue empty\n");
  else {
    while (i != r) {
      i = (i + 1) % capacity;
      printf("%d", queue[i].key);
    }
    printf("\n");
  }
}

When I compile the code, I get the error undefined reference to copy.

Does anyone know in which library this function exists? Or is there any other way around?


问:
Liquibase 2.0 slower than 1.9?
I've just upgraded to Liquibase 2.0.2 using the provided jar file, and I've found that it runs slower than its predecessor.  If no updates are necessary, it still takes about 15 seconds to run, compared to the <5 it took before.  I've updated the xsd formats as well.

I'm just wondering if anyone else has encountered this, as I'm afraid to see how long it will take when it has to do real updates to our production environment.  Thanks.

Here is a log with some simple updates:

```<code>[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Successfully acquired change log lock
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Reading from `DATABASECHANGELOG`
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Reading from `DATABASECHANGELOG`
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: ChangeSet foo ran successfully in 27ms
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: ChangeSet bar ran successfully in 11ms
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Successfully released change log lock

BUILD SUCCESSFUL
Total time: 15 seconds
</code>```

ContentLicense: CC BY-SA 3.0

Title: Liquibase 2.0 slower than 1.9?

Body:
I've just upgraded to Liquibase 2.0.2 using the provided jar file, and I've found that it runs slower than its predecessor.  If no updates are necessary, it still takes about 15 seconds to run, compared to the <5 it took before.  I've updated the xsd formats as well.

I'm just wondering if anyone else has encountered this, as I'm afraid to see how long it will take when it has to do real updates to our production environment.  Thanks.

Here is a log with some simple updates:

[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Successfully acquired change log lock
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Reading from `DATABASECHANGELOG`
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Reading from `DATABASECHANGELOG`
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: ChangeSet foo ran successfully in 27ms
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: ChangeSet bar ran successfully in 11ms
[updateDatabase] INFO 9/20/11 11:41 AM:liquibase: Successfully released change log lock

BUILD SUCCESSFUL
Total time: 15 seconds


问:
jQuery - Call function from .each() function
I have a first function :

```<code>$(document).find('.entries > div').each(color_red);
function color_red() {
    $(this).css('color','red')
    console.log('red')
}
</code>```

Which works fine.

Then I have another, separate function :

```<code>$( '.entries > div' ).each(function(){

        var thetab = $(this).attr('tab');

        if(thetab == 'all') {
            $(this).removeClass('hide').addClass( 'show' );
        }
        else {
            $(this).removeClass('show').addClass( 'hide' )
        }
})
</code>```

It also works fine.

Now, in the first if statement, I would like to call the first function :

```<code>if(thetab == 'all' || thetab == tab) {
            $(this).removeClass('hide').addClass( 'show' );
            color_red();
        }
</code>```

Somehow this doesn't work. The function is executed (the console displays "red" for each div), but the color isn't applied. I understood that the "THIS" is not passed correctly to the second function (sorry if I'm not expressing myself correctly) but I don't know the correct syntax

Body:
I have a first function :

$(document).find('.entries > div').each(color_red);
function color_red() {
    $(this).css('color','red')
    console.log('red')
}

Which works fine.

Then I have another, separate function :

$( '.entries > div' ).each(function(){

        var thetab = $(this).attr('tab');

        if(thetab == 'all') {
            $(this).removeClass('hide').addClass( 'show' );
        }
        else {
            $(this).removeClass('show').addClass( 'hide' )
        }
})

It also works fine.

Now, in the first if statement, I would like to call the first function :

if(thetab == 'all' || thetab == tab) {
            $(this).removeClass('hide').addClass( 'show' );
            color_red();
        }

Somehow this doesn't work. The function is executed (the console displays "red" for each div), but the color isn't applied. I understood that the "THIS" is not passed correctly to the second function (sorry if I'm not expressing myself correctly) but I don't know the correct syntax


问:
Auth0 native Android app token expires_at value is always 12 or 24 hours
When I login to my native Android application using Auth0, the expires_at value from the Credentials object is always:

12 hours, when the scope does not include offline_access

24 hours, when the scope does include offline_access

However, this is despite me setting the ID token and access token to both be 60 seconds.

However, this is not the only issue. When I receive the tokens and decode them, the ID token does expire in 60 seconds but the access token expires in 1 hour - not the 60 seconds that was stated in the Auth0 Management API.

This is causing an issue with our setup as our developers looking after our Auth0 configuration are setting it as we want, but our native apps are not receiving those values

Why does the access token expiry not follow what I’ve put in the Auth0 Management API

Why does the expires_at value in the Credentials object default to 24 or 12 hours, which is very far off the 60 seconds that we want?


问:
How to import both playbooks and tasks in an Ansible playbook
I have several playbooks that I sometimes execute individually but I also want to group them in one "master" playbook so that they can all be executed sequentially. I do this using ansible.builtin.import_playbook. In this same playbook I also want import a given task. However I am not able to write this in such a way that the ansible linter is happy.

I would expect that something like:

```<code>---
- name: Master Playbook
  hosts: all

- name: Playbook 1
  ansible.builtin.import_playbook: playbook1.yml

- name: Playbook 2
  ansible.builtin.import_playbook: playbook2.yml

- name: Task 1
  ansible.builtin.import_tasks: task1.yml
</code>```

would work, however I get 'ansible.builtin.import_tasks' is not a valid attribute for a Play

If for the tasks I instead use:

```<code>  tasks:
    - name: Task 1
      ansible.builtin.import_tasks: .task1.yml
</code>```

I get 'tasks' is not a valid attribute for a PlaybookInclude

If I set the tasks: line before - name: Playbook 1 I get instead

```<code>This task 'ansible.builtin.import_playbook' has extra params, which is only allowed in the following modules: ansible.windows.win_command, ansible.builtin.import_role, ansible.builtin.meta, include, ansible.builtin.command, ansible.builtin.group_by, ansible.builtin.win_shell, ansible.builtin.set_fact (...)
</code>```

So how can I import both playbooks and tasks in the same playbook?

Unfortunately I haven't been able to find good documentation for this example, and the ones for the import_playbook and import_tasks aren't very clear. They also don't seem to be present in the Ansible lint documentation.

Thank you in advance

Body:
I have several playbooks that I sometimes execute individually but I also want to group them in one "master" playbook so that they can all be executed sequentially. I do this using ansible.builtin.import_playbook. In this same playbook I also want import a given task. However I am not able to write this in such a way that the ansible linter is happy.

I would expect that something like:

---
- name: Master Playbook
  hosts: all

- name: Playbook 1
  ansible.builtin.import_playbook: playbook1.yml

- name: Playbook 2
  ansible.builtin.import_playbook: playbook2.yml

- name: Task 1
  ansible.builtin.import_tasks: task1.yml

would work, however I get 'ansible.builtin.import_tasks' is not a valid attribute for a Play

If for the tasks I instead use:

  tasks:
    - name: Task 1
      ansible.builtin.import_tasks: .task1.yml

I get 'tasks' is not a valid attribute for a PlaybookInclude

If I set the tasks: line before - name: Playbook 1 I get instead

This task 'ansible.builtin.import_playbook' has extra params, which is only allowed in the following modules: ansible.windows.win_command, ansible.builtin.import_role, ansible.builtin.meta, include, ansible.builtin.command, ansible.builtin.group_by, ansible.builtin.win_shell, ansible.builtin.set_fact (...)

So how can I import both playbooks and tasks in the same playbook?

Unfortunately I haven't been able to find good documentation for this example, and the ones for the import_playbook and import_tasks aren't very clear. They also don't seem to be present in the Ansible lint documentation.

Thank you in advance


问:
Generated clock constraint -edges -inverted usage
I have a clock need to be define in a constraint and need confirmation whether this is correct usage or not. Please have a look on the diagram:

Clk waveform

May I know what is the correct way to constraint this GEN_CLK?

Constraint:
create_generated_clock -name GEN_CLK -source CLKA -edges {3 5 9} [get_pins reg/Q]

or

create_generated_clock -name GEN_CLK -source CLKA -edges {1 3 7} [get_pins reg/Q]  //if calculated from GEN_CLK starts to fall

Does the -invert option needed?


问:
Flutter Just Audio plugin is unable to play complete playlist and gives playback error
I am using on_audio_query package to query the list of the audio files.

```<code>_audioQuery.querySongs(
  sortType: null,
  orderType: OrderType.ASC_OR_SMALLER,
  uriType: UriType.EXTERNAL,
  ignoreCase: true,
)
</code>```

using Just Audio plugin to play the audio files.
Here in the initState function I am preparing a list of AudioiSources from the songModel returned by the query.

```<code>void initState() {
  super.initState();
  for( int i=0; i<songModel!.length; i++){
    if(i<index){
      uri_list[songModel!.length-index+i] = AudioSource.uri(Uri.parse("${songModel![i].uri}"));
      print("${songModel![i].uri}");
    }
    else{
      uri_list[i-index] = AudioSource.uri(Uri.parse(songModel![i].uri!));
      print(songModel![i].uri!);
    }
  }
  _audioPlayer
      .setAudioSource(ConcatenatingAudioSource(children: uri_list))
      .catchError((error) {
    print("An error occured $error");
  });
}
</code>```

** next button works fine, however, only few audio files are running from list and not all.**

```<code>Widget _nextButton() {
  return IconButton(
    icon: const Icon(Icons.skip_next),
    color: Colors.white,
    onPressed: audioPlayer.hasNext ? audioPlayer.seekToNext : null,
  );
}
</code>```

Here, is the error I am getting.

E/ExoPlayerImplInternal(31375): Playback error
E/ExoPlayerImplInternal(31375):   com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal(31375):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:632)
E/ExoPlayerImplInternal(31375):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:604)
E/ExoPlayerImplInternal(31375):       at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal(31375):       at android.os.Looper.loopOnce(Looper.java:233)
E/ExoPlayerImplInternal(31375):       at android.os.Looper.loop(Looper.java:344)
E/ExoPlayerImplInternal(31375):       at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal(31375):   Caused by: com.google.android.exoplayer2.upstream.FileDataSource$FileDataSourceException: java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)

I was expecting that all the audio files will be played from the list.

P.S. I have already checked, that URIs are correct and there is no redundancy in the list.

Body:
I am using on_audio_query package to query the list of the audio files.

_audioQuery.querySongs(
  sortType: null,
  orderType: OrderType.ASC_OR_SMALLER,
  uriType: UriType.EXTERNAL,
  ignoreCase: true,
)

using Just Audio plugin to play the audio files.
Here in the initState function I am preparing a list of AudioiSources from the songModel returned by the query.

void initState() {
  super.initState();
  for( int i=0; i<songModel!.length; i++){
    if(i<index){
      uri_list[songModel!.length-index+i] = AudioSource.uri(Uri.parse("${songModel![i].uri}"));
      print("${songModel![i].uri}");
    }
    else{
      uri_list[i-index] = AudioSource.uri(Uri.parse(songModel![i].uri!));
      print(songModel![i].uri!);
    }
  }
  _audioPlayer
      .setAudioSource(ConcatenatingAudioSource(children: uri_list))
      .catchError((error) {
    print("An error occured $error");
  });
}

** next button works fine, however, only few audio files are running from list and not all.**

Widget _nextButton() {
  return IconButton(
    icon: const Icon(Icons.skip_next),
    color: Colors.white,
    onPressed: audioPlayer.hasNext ? audioPlayer.seekToNext : null,
  );
}

Here, is the error I am getting.

E/ExoPlayerImplInternal(31375): Playback error
E/ExoPlayerImplInternal(31375):   com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal(31375):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:632)
E/ExoPlayerImplInternal(31375):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:604)
E/ExoPlayerImplInternal(31375):       at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal(31375):       at android.os.Looper.loopOnce(Looper.java:233)
E/ExoPlayerImplInternal(31375):       at android.os.Looper.loop(Looper.java:344)
E/ExoPlayerImplInternal(31375):       at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal(31375):   Caused by: com.google.android.exoplayer2.upstream.FileDataSource$FileDataSourceException: java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)

I was expecting that all the audio files will be played from the list.

P.S. I have already checked, that URIs are correct and there is no redundancy in the list.


问:
LtrPipeline in RepeatModerer2 encounter error
LtrPipeline in RepeatModerer2 encounter error
No output from LtrPipeline

I have been running RepeatModeler2 in the Conda environment which runs smoothly until round 6. The RepeatModeler job completes, but the LTR Structural Analysis not return any results.
Error return like:

LtrPipeline: GenomeTools failed to build suffixtree datastructure. This is frequently
caused by a lack of disk space. Error code: 1


问:
Are repeated measures a problem in my PCA?
Two groups of animals were under different management.
Every week, for 6 months, behaviour data (20 factors) was recorded at group level.
This totals approx. 48 observations, 24 for each group.

Is it fine to do a PCA for all 48 observations to see the differences between group A & B?
Or are repeated measures such as this not suitable for PCA?

Thank you.


问:
java.lang.IllegalStateException: This operation is not allowed on a closed folder
```<code>store.connect("outlook.office365.com", "email@bussness.com", token);

            Folder folder = store.getFolder("INBOX");
            Message[] messages = folder.getMessages();

            for(Message msg : messages) {
                System.out.println(msg);
            }
</code>```

I am trying to read the messages of an email associated with a javaMail in Microsoft Azure when trying to extract the information I get the following oauth2 protocols error:

```<code>Exception in thread "main" java.lang.IllegalStateException: This operation is not allowed on a closed folder
    at com.sun.mail.imap.IMAPFolder.checkOpened(IMAPFolder.java:478)
    at com.sun.mail.imap.IMAPFolder.getMessages(IMAPFolder.java:1856)
    at com.communication.quickstart.ExecuteTwo.main(ExecuteTwo.java:57)
</code>```

at com.sun.mail.imap.IMAPFolder.checkOpened(IMAPFolder.java:478)

Body:
store.connect("outlook.office365.com", "email@bussness.com", token);

            Folder folder = store.getFolder("INBOX");
            Message[] messages = folder.getMessages();

            for(Message msg : messages) {
                System.out.println(msg);
            }

I am trying to read the messages of an email associated with a javaMail in Microsoft Azure when trying to extract the information I get the following oauth2 protocols error:

Exception in thread "main" java.lang.IllegalStateException: This operation is not allowed on a closed folder
    at com.sun.mail.imap.IMAPFolder.checkOpened(IMAPFolder.java:478)
    at com.sun.mail.imap.IMAPFolder.getMessages(IMAPFolder.java:1856)
    at com.communication.quickstart.ExecuteTwo.main(ExecuteTwo.java:57)

at com.sun.mail.imap.IMAPFolder.checkOpened(IMAPFolder.java:478)


问:
React Full Calendar views are not adjusting their width

I have a side menu, on expanding the view the calendar is getting pushed away, upon clicking any date it is adjusting itself, how can i fix this issue.
Expected behaviour: The view should not get hidden on expanding side menu.


问:
How to fill the QTableWidget using another thread?
I would like to display a table that has a lot of rows using QTableWidget in pyqt5 in python3.
However creating cells takes time so my app becomes unresponsive when the user tries to open the large table filled with data. The solution could be generating the table in another thread and just calling table.show() function after trying to open the table. However the app crashes when i try to fill the table in another thread (most likely because of being not thread-safe).

Here I send the basic example that shows the problem:

```<code>from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

import sys
import threading as th

class Window(QMainWindow):
    def __init__(self):
        super().__init__()
        self.table = QTableWidget()
        self.table.setColumnCount(20)
        self.table.setRowCount(8000)
        self.widget = QWidget()
        layout = QVBoxLayout()
        button = QPushButton("Check if I live!")
        button.clicked.connect(lambda: print("WORKED!"))
        nbutton = QPushButton("Fill Table and see if i live!")
        nbutton.clicked.connect(lambda: self.setTable())
        #nbutton.clicked.connect(lambda: th.Thread(target=self.setTable, daemon=True).start()) This line doesn't work sadly
        layout.addWidget(button)
        layout.addWidget(nbutton)
        layout.addWidget(self.table)
        self.widget.setLayout(layout)
        self.setCentralWidget(self.widget)
        self.setWindowTitle("TEST")
        self.show()

    def setTable(self):
        for i in range(self.table.columnCount()):
            for j in range(self.table.rowCount()):
                item = QTableWidgetItem()
                item.setData(Qt.DisplayRole, 10)
                if i % 10 == 0:
                    self.table.setCellWidget(j, i, QLineEdit("Line to edit"))
                self.table.setItem(j, i, item)
        self.table.resizeColumnsToContents()

app = QApplication(sys.argv)
window = Window()
app.exec_()
</code>```

it just creates simple window with table and buttons - when we press Fill Table button the app becomes unresponsive - rather than being responsive and making the data shown when the setTable function finishes its job.
Using signals here won't help because most of the work is just making widgets rather than processing non GUI data.
Is there any way I could make it work? Maybe I just have wrong approach or miss something important.. Anyways, thank you in advance for help!

EDIT: I noticed that removing the line with QLineEdit prevents crash but I want to have widgets in my table

Body:
I would like to display a table that has a lot of rows using QTableWidget in pyqt5 in python3.
However creating cells takes time so my app becomes unresponsive when the user tries to open the large table filled with data. The solution could be generating the table in another thread and just calling table.show() function after trying to open the table. However the app crashes when i try to fill the table in another thread (most likely because of being not thread-safe).

Here I send the basic example that shows the problem:

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

import sys
import threading as th

class Window(QMainWindow):
    def __init__(self):
        super().__init__()
        self.table = QTableWidget()
        self.table.setColumnCount(20)
        self.table.setRowCount(8000)
        self.widget = QWidget()
        layout = QVBoxLayout()
        button = QPushButton("Check if I live!")
        button.clicked.connect(lambda: print("WORKED!"))
        nbutton = QPushButton("Fill Table and see if i live!")
        nbutton.clicked.connect(lambda: self.setTable())
        #nbutton.clicked.connect(lambda: th.Thread(target=self.setTable, daemon=True).start()) This line doesn't work sadly
        layout.addWidget(button)
        layout.addWidget(nbutton)
        layout.addWidget(self.table)
        self.widget.setLayout(layout)
        self.setCentralWidget(self.widget)
        self.setWindowTitle("TEST")
        self.show()

    def setTable(self):
        for i in range(self.table.columnCount()):
            for j in range(self.table.rowCount()):
                item = QTableWidgetItem()
                item.setData(Qt.DisplayRole, 10)
                if i % 10 == 0:
                    self.table.setCellWidget(j, i, QLineEdit("Line to edit"))
                self.table.setItem(j, i, item)
        self.table.resizeColumnsToContents()

app = QApplication(sys.argv)
window = Window()
app.exec_()

it just creates simple window with table and buttons - when we press Fill Table button the app becomes unresponsive - rather than being responsive and making the data shown when the setTable function finishes its job.
Using signals here won't help because most of the work is just making widgets rather than processing non GUI data.
Is there any way I could make it work? Maybe I just have wrong approach or miss something important.. Anyways, thank you in advance for help!

EDIT: I noticed that removing the line with QLineEdit prevents crash but I want to have widgets in my table


问:
ValueError: 'session' argument must be a ClientSession or None
What am I doing wrong here, I've connected to my DB and all seems to work good but when I use aggregation I get this error below:</p>
```<code>Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'gym')

Traceback (most recent call last):
  File "c:\Users\ibtissam\Desktop\pymongo\main.py", line 17, in <module>
    sportifsCouple =  myCollection.aggregate(
  File "C:\Python\Python310\lib\site-packages\pymongo\collection.py", line 2435, in aggregate

    with self.__database.client._tmp_session(session, close=False) as s:
  File "C:\Python\Python310\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "C:\Python\Python310\lib\site-packages\pymongo\mongo_client.py", line 1752, in _tmp_session

    raise ValueError("'session' argument must be a ClientSession or None.")
ValueError: 'session' argument must be a ClientSession or None.
</code>```
```<code>import pymongo

client = pymongo.MongoClient()
db = client["gym"]
print(db)

pipeline = [
    {
        "$group": {
            "_id": "$Age",
            "sportifs": {"$push": {"fullName": {"$concat": ["$Prenom", " ", "$Nom"]}}},
        }
    }
]

projection = {"$project": {"Age": "$_id", "ListOfSportifs": "$sportifs", "_id": 0}}

myCollection = db["Sportifs"]
sportifsCouple = myCollection.aggregate(pipeline, projection)

for sportif in sportifsCouple:
    print(sportif)
</code>```

Body:
What am I doing wrong here, I've connected to my DB and all seems to work good but when I use aggregation I get this error below:

Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'gym')

Traceback (most recent call last):
  File "c:\Users\ibtissam\Desktop\pymongo\main.py", line 17, in <module>
    sportifsCouple =  myCollection.aggregate(
  File "C:\Python\Python310\lib\site-packages\pymongo\collection.py", line 2435, in aggregate

    with self.__database.client._tmp_session(session, close=False) as s:
  File "C:\Python\Python310\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "C:\Python\Python310\lib\site-packages\pymongo\mongo_client.py", line 1752, in _tmp_session

    raise ValueError("'session' argument must be a ClientSession or None.")
ValueError: 'session' argument must be a ClientSession or None.

import pymongo

client = pymongo.MongoClient()
db = client["gym"]
print(db)

pipeline = [
    {
        "$group": {
            "_id": "$Age",
            "sportifs": {"$push": {"fullName": {"$concat": ["$Prenom", " ", "$Nom"]}}},
        }
    }
]

projection = {"$project": {"Age": "$_id", "ListOfSportifs": "$sportifs", "_id": 0}}

myCollection = db["Sportifs"]
sportifsCouple = myCollection.aggregate(pipeline, projection)

for sportif in sportifsCouple:
    print(sportif)


问:
Insert jpg into html R markdown by values in dataframe
I have the following problem:

I want to create a html R markdown report which will print a table of this form.

```<code>df <- data.frame(c("Apple", "Tomato", "Banana"),
                 c("symbol 01", "symbol 02", NA),
                 c(NA, "symbol 03", "symbol 04"))
colnames(df) = c("Name", "col1", "col2")
</code>```

I have a folder which contains images/symbols named like the values in the columns 2 and 3, i.e."symbol01.jpg". When I knit my markdown report of my dataframe, I want to display/insert those images instead of the values in the columns "col1" and "col2"

like i.e. Apple and right next to it symbol01.jpg

Can someone give me an idea how to do this?

Body:
I have the following problem:

I want to create a html R markdown report which will print a table of this form.

df <- data.frame(c("Apple", "Tomato", "Banana"),
                 c("symbol 01", "symbol 02", NA),
                 c(NA, "symbol 03", "symbol 04"))
colnames(df) = c("Name", "col1", "col2")

I have a folder which contains images/symbols named like the values in the columns 2 and 3, i.e."symbol01.jpg". When I knit my markdown report of my dataframe, I want to display/insert those images instead of the values in the columns "col1" and "col2"

like i.e. Apple and right next to it symbol01.jpg

Can someone give me an idea how to do this?


问:
Question about Google Calendar API and create multiple Calendars
I would like to create a script in python that creates events for me for each individual user, I know how to get the list of calendars, but I would like the script to check if there is already a calendar available with that user name and if there isn't one, it creates one, in a way.
Thanks</p>
```<code>from datetime import datetime, timedelta
from cal_setup import get_calendar_service

currentDateTime = datetime.now()
userfinder = 'Tuxone'
#Create a new calendar
calendar_name = userfinder
calendar = {
    'summary': calendar_name,
    'timeZone': 'America/Los_Angeles'
}

created_calendar = get_calendar_service().calendars().insert(body=calendar).execute()

#Print calendar list
# # calendar_list_entry = get_calendar_service().calendarList().get(calendarId=created_calendar['id']).execute()
# # print(calendar_list_entry)

def main():
   # creates one hour event tomorrow 10 AM IST
   service = get_calendar_service()

   d = datetime.now().date()
   tomorrow = datetime(d.year, d.month, d.day, 10)+timedelta(days=1)
   start = tomorrow.isoformat()
   end = (tomorrow + timedelta(hours=1)).isoformat()

   event_result = service.events().insert(calendarId='ici1sgh7untsn7650edoknqblk@group.calendar.google.com',
       body={
           "summary": f'{currentDateTime}',
           "description": 'This is a tutorial example of automating google calendar with python',
           "start": {"dateTime": start, "timeZone": 'Asia/Kolkata'},
           "end": {"dateTime": end, "timeZone": 'Asia/Kolkata'},
       }
   ).execute()

   print("created event")
   print("id: ", event_result['id'])
   print("summary: ", event_result['summary'])
   print("starts at: ", event_result['start']['dateTime'])
   print("ends at: ", event_result['end']['dateTime'])

if __name__ == '__main__':
   main()

</code>```

Body:
I would like to create a script in python that creates events for me for each individual user, I know how to get the list of calendars, but I would like the script to check if there is already a calendar available with that user name and if there isn't one, it creates one, in a way.
Thanks

from datetime import datetime, timedelta
from cal_setup import get_calendar_service

currentDateTime = datetime.now()
userfinder = 'Tuxone'
#Create a new calendar
calendar_name = userfinder
calendar = {
    'summary': calendar_name,
    'timeZone': 'America/Los_Angeles'
}

created_calendar = get_calendar_service().calendars().insert(body=calendar).execute()

#Print calendar list
# # calendar_list_entry = get_calendar_service().calendarList().get(calendarId=created_calendar['id']).execute()
# # print(calendar_list_entry)

def main():
   # creates one hour event tomorrow 10 AM IST
   service = get_calendar_service()

   d = datetime.now().date()
   tomorrow = datetime(d.year, d.month, d.day, 10)+timedelta(days=1)
   start = tomorrow.isoformat()
   end = (tomorrow + timedelta(hours=1)).isoformat()

   event_result = service.events().insert(calendarId='ici1sgh7untsn7650edoknqblk@group.calendar.google.com',
       body={
           "summary": f'{currentDateTime}',
           "description": 'This is a tutorial example of automating google calendar with python',
           "start": {"dateTime": start, "timeZone": 'Asia/Kolkata'},
           "end": {"dateTime": end, "timeZone": 'Asia/Kolkata'},
       }
   ).execute()

   print("created event")
   print("id: ", event_result['id'])
   print("summary: ", event_result['summary'])
   print("starts at: ", event_result['start']['dateTime'])
   print("ends at: ", event_result['end']['dateTime'])

if __name__ == '__main__':
   main()


问:
How to properly silence mypy when you have a setter with a decorator?
Consider the following code, that is also basically the example given at https://pyro5.readthedocs.io/en/latest/servercode.html :

```<code>import Pyro5.server

class PyroService(object):

    value = 42                  # not exposed

    def __dunder__(self):       # exposed
        pass

    def _private(self):         # not exposed
        pass

    def __private(self):        # not exposed
        pass

    @Pyro5.server.expose
    def get_value(self):        # exposed
        return self.value

    @Pyro5.server.expose #type: ignore
    @property
    def attr(self):             # exposed as 'proxy.attr' remote attribute
        return self.value

    @Pyro5.server.expose #type: ignore
    @attr.setter
    def attr(self, value):      # exposed as 'proxy.attr' writable
        self.value = value

a = PyroService()
a.attr = 5
</code>```

When using mypy, there are several problems with this code.

We need to ignore the import Pyro5.server

Decorators on top of property are not supported. We need to include the #type: ignore (https://github.com/python/mypy/issues/1362)

Mypy has issues with setters (https://github.com/python/mypy/issues/1465).
This issue also appears in this case, even if the setter comes right after the getter.

So when using mypy ignoring the import, I still get the following error:
error: Property "attr" defined in "PyroService" is read-only  [misc].
How do I properly fix this?

Body:
Consider the following code, that is also basically the example given at https://pyro5.readthedocs.io/en/latest/servercode.html :

import Pyro5.server

class PyroService(object):

    value = 42                  # not exposed

    def __dunder__(self):       # exposed
        pass

    def _private(self):         # not exposed
        pass

    def __private(self):        # not exposed
        pass

    @Pyro5.server.expose
    def get_value(self):        # exposed
        return self.value

    @Pyro5.server.expose #type: ignore
    @property
    def attr(self):             # exposed as 'proxy.attr' remote attribute
        return self.value

    @Pyro5.server.expose #type: ignore
    @attr.setter
    def attr(self, value):      # exposed as 'proxy.attr' writable
        self.value = value

a = PyroService()
a.attr = 5

When using mypy, there are several problems with this code.

We need to ignore the import Pyro5.server

Decorators on top of property are not supported. We need to include the #type: ignore (https://github.com/python/mypy/issues/1362)

Mypy has issues with setters (https://github.com/python/mypy/issues/1465).
This issue also appears in this case, even if the setter comes right after the getter.

So when using mypy ignoring the import, I still get the following error:
error: Property "attr" defined in "PyroService" is read-only  [misc].
How do I properly fix this?


问:
Formatting issue in Sphinx HTML output: How to wrap long function names?
I am new to Sphinx and can't figure out how to solve this formatting issue.
Currently, the Sphinx generated HTML output looks like this:

The long module and function names lead to the blue text boxes ending up outside the white space. Similarly, in the left sidebar, the long function names are not fully visible. Is there a way to to automatically wrap/line-break the function names?

The .rst files are created with sphinx-apidoc, which produces relevant code blocks like this one:

```<code>.. automodule:: monai_inference_from_nnunet_folder.custom_transforms.custom_transforms_array
   :members:
   :undoc-members:
   :show-inheritance:
</code>```

The image above shows the read-the-docs theme "sphinx-rtd-theme". I tried different themes, the default "alabaster" theme works better in the sidebar, where it breaks the long function names into multiple lines:

But on the main page, the same problem occurs:

Body:
I am new to Sphinx and can't figure out how to solve this formatting issue.
Currently, the Sphinx generated HTML output looks like this:

The long module and function names lead to the blue text boxes ending up outside the white space. Similarly, in the left sidebar, the long function names are not fully visible. Is there a way to to automatically wrap/line-break the function names?

The .rst files are created with sphinx-apidoc, which produces relevant code blocks like this one:

.. automodule:: monai_inference_from_nnunet_folder.custom_transforms.custom_transforms_array
   :members:
   :undoc-members:
   :show-inheritance:

The image above shows the read-the-docs theme "sphinx-rtd-theme". I tried different themes, the default "alabaster" theme works better in the sidebar, where it breaks the long function names into multiple lines:

But on the main page, the same problem occurs:


问:
Impersonation to Sharepoint onPrem through restservice not working on IIS
I have made a restservice that combines data from different origins on a local environment. One of the origins is an onprem SharePoint 2019 where I need to use the rights from the user that accesses the restservice. I am using impersonation for that and if I debug from Visual Studio through IIS express it works fine.. but when I publish it to IIS it doesn't.

In the web.config I have added

<identity impersonate="true" />
```
<p>And my test code is this..</p>
<pre class="lang-cs prettyprint-override"><code>            SPSecurity.RunWithElevatedPrivileges(delegate ()
            {
                using (WindowsImpersonationContext impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate())
                {
                    try
                    {
                        values.Add(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
                        SPSite sPSite = new Microsoft.SharePoint.SPSite(ConfigurationManager.AppSettings["SPUrl"]);
                        values.Add(sPSite.RootWeb.CurrentUser.Name);
                        values.Add(sPSite.RootWeb.Title);
                    }
                    catch (Exception ex)
                    {
                        values.Add(ex.Message);
                    }
                }
            });
</code>```

I just return an array of information and the values are

impersonated username - OK

the name of the current user - Ok

the title of the rootweb - access denied

error if it fails.. and it does.

We have tried to set spn on the server. But that's still not enough.

Body:
I have made a restservice that combines data from different origins on a local environment. One of the origins is an onprem SharePoint 2019 where I need to use the rights from the user that accesses the restservice. I am using impersonation for that and if I debug from Visual Studio through IIS express it works fine.. but when I publish it to IIS it doesn't.

In the web.config I have added

<identity impersonate="true" />

And my test code is this..

            SPSecurity.RunWithElevatedPrivileges(delegate ()
            {
                using (WindowsImpersonationContext impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate())
                {
                    try
                    {
                        values.Add(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
                        SPSite sPSite = new Microsoft.SharePoint.SPSite(ConfigurationManager.AppSettings["SPUrl"]);
                        values.Add(sPSite.RootWeb.CurrentUser.Name);
                        values.Add(sPSite.RootWeb.Title);
                    }
                    catch (Exception ex)
                    {
                        values.Add(ex.Message);
                    }
                }
            });

I just return an array of information and the values are

impersonated username - OK

the name of the current user - Ok

the title of the rootweb - access denied

error if it fails.. and it does.

We have tried to set spn on the server. But that's still not enough.


问:
Ubuntu Clang linker error: undefined reference to symbol '__gxx_personality_v0
I wanted to try and use clang instead of gcc on my Ubuntu system. I set up the most basic C++ project possible, with a minimal CMakeLists.txt:

```<code>cmake_minimum_required(VERSION 3.20)

project(pcb_engine)

add_executable(main main.cpp)
</code>```

My main.cpp is also very simple:

```<code>#include <iostream>

int main() {
    std::cout << "Hello World" << std::endl;
    return 0;
}
</code>```

No when I run g++ -o main_g++ ../main.cpp everything compiles just fine. Also, if I set my system's default compiler to be gcc and g++ using

```<code>sudo update-alternatives --config c++
sudo update-alternatives --config cc
</code>```

and I run cmake .. and make from my build folder, everything works!

The error:

Now I switch to using clang and clang++ as my default compiler via the update-alternatives command and while the build file generation succeeds, the make command fails with the following error message:

```<code>fatal error: 'iostream' file not found
#include <iostream>
</code>```

When I run clang++ -v -stdlib=libc++ -Wall ../main.cpp -o main_clang manually, I get a linker error:

```<code>Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/ivan/Documents/TEST/build -resource-dir /usr/lib/llvm-14/lib/clang/14.0.0 -internal-isystem /usr/lib/llvm-14/bin/../include/c++/v1 -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -fdeprecated-macro -fdebug-compilation-dir=/home/ivan/Documents/TEST/build -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/main-482542.o -x c++ ../main.cpp
clang -cc1 version 14.0.0 based upon LLVM 14.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/llvm-14/bin/../include/c++/v1
 /usr/lib/llvm-14/lib/clang/14.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
 "/usr/bin/ld" -pie -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o main_clang /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/llvm-14/bin/../lib -L/lib -L/usr/lib /tmp/main-482542.o -lc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o
/usr/bin/ld: /tmp/main-482542.o: undefined reference to symbol '__gxx_personality_v0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libc++abi.so.1: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code>```

The non-verbose error message:

```<code>/usr/bin/ld: /tmp/main-f39fec.o: undefined reference to symbol '__gxx_personality_v0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libc++abi.so.1: error adding symbols: DSO missing from command line
</code>```

Can anyone help me identify where to start fixing this?

Interestingly, when I run clang++ -v -stdlib=libstdc++ -Wall ../main.cpp -o main_clang (note the -stdlib=libstdc++ flag change to the gnu standard library), then I get the same simple fatal error: 'iostream' file not found error as with cmake! So there is a difference in the behavior with the two different standard c++ libraries...

The background:

I come from using gcc, and installed clang via get-apt install clang. I've read that clang does not come with its own standard C++ library, but I have trouble understanding the implications for me: Previously, I had issues with clang finding a correct standard library .so file... I tried some more installs and I have got the libstdc++.so (default gnu) and the libc++.so as well as libc++.a and libc++.abi.so in my /usr/lib/x86_64-linux-gnu folder with a correct symlink hierarchy. For some reason, after a system restart, the /usr/bin/ld: cannot find -lstdc++ error went away, and now I have this linker error where it seems that clang can not find the include header files when running cmake. Now, I am at the end of my limited wisdom.

Body:
I wanted to try and use clang instead of gcc on my Ubuntu system. I set up the most basic C++ project possible, with a minimal CMakeLists.txt:

cmake_minimum_required(VERSION 3.20)

project(pcb_engine)

add_executable(main main.cpp)

My main.cpp is also very simple:

#include <iostream>

int main() {
    std::cout << "Hello World" << std::endl;
    return 0;
}

No when I run g++ -o main_g++ ../main.cpp everything compiles just fine. Also, if I set my system's default compiler to be gcc and g++ using

sudo update-alternatives --config c++
sudo update-alternatives --config cc

and I run cmake .. and make from my build folder, everything works!

The error:

Now I switch to using clang and clang++ as my default compiler via the update-alternatives command and while the build file generation succeeds, the make command fails with the following error message:

fatal error: 'iostream' file not found
#include <iostream>

When I run clang++ -v -stdlib=libc++ -Wall ../main.cpp -o main_clang manually, I get a linker error:

Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/ivan/Documents/TEST/build -resource-dir /usr/lib/llvm-14/lib/clang/14.0.0 -internal-isystem /usr/lib/llvm-14/bin/../include/c++/v1 -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -fdeprecated-macro -fdebug-compilation-dir=/home/ivan/Documents/TEST/build -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/main-482542.o -x c++ ../main.cpp
clang -cc1 version 14.0.0 based upon LLVM 14.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/llvm-14/bin/../include/c++/v1
 /usr/lib/llvm-14/lib/clang/14.0.0/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
 "/usr/bin/ld" -pie -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o main_clang /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/llvm-14/bin/../lib -L/lib -L/usr/lib /tmp/main-482542.o -lc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o
/usr/bin/ld: /tmp/main-482542.o: undefined reference to symbol '__gxx_personality_v0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libc++abi.so.1: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The non-verbose error message:

/usr/bin/ld: /tmp/main-f39fec.o: undefined reference to symbol '__gxx_personality_v0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libc++abi.so.1: error adding symbols: DSO missing from command line

Can anyone help me identify where to start fixing this?

Interestingly, when I run clang++ -v -stdlib=libstdc++ -Wall ../main.cpp -o main_clang (note the -stdlib=libstdc++ flag change to the gnu standard library), then I get the same simple fatal error: 'iostream' file not found error as with cmake! So there is a difference in the behavior with the two different standard c++ libraries...

The background:

I come from using gcc, and installed clang via get-apt install clang. I've read that clang does not come with its own standard C++ library, but I have trouble understanding the implications for me: Previously, I had issues with clang finding a correct standard library .so file... I tried some more installs and I have got the libstdc++.so (default gnu) and the libc++.so as well as libc++.a and libc++.abi.so in my /usr/lib/x86_64-linux-gnu folder with a correct symlink hierarchy. For some reason, after a system restart, the /usr/bin/ld: cannot find -lstdc++ error went away, and now I have this linker error where it seems that clang can not find the include header files when running cmake. Now, I am at the end of my limited wisdom.


问:
Material UI pagination show vise versa when I change the direction to rtl
click here to see the image

When the direction is ltr the pagination is working correctly, but when I change the direction to rtl
the pagination becomes like above image

I search a lot but did not found a good answer.


问:
how to turn one to many mapping in a python df to a one to one mapping dropping the Nones
I have two python dataframe columns, one column has consistent namings while the second column has the necessary mappings and some contain None's. For example:

```<code>df = pd.DataFrame({'column1':['apple','apple','orange','orange'],'column2':['green',None,'Orange',None]})
</code>```
```<code>  column1 column2
0   apple   green
1   apple    None
2  orange  Orange
3  orange    None

</code>```

The resulting dataframe has other columns im grouping by so I cant simply drop the None rows, I would like to replace the None's with the other mappings in column 2 which would allow me to then group the df properly, so I would want :

```<code>  column1 column2
0   apple   green
1   apple   green
2  orange  Orange
3  orange  Orange

</code>```

Not sure how to tackle this

Body:
I have two python dataframe columns, one column has consistent namings while the second column has the necessary mappings and some contain None's. For example:

df = pd.DataFrame({'column1':['apple','apple','orange','orange'],'column2':['green',None,'Orange',None]})

  column1 column2
0   apple   green
1   apple    None
2  orange  Orange
3  orange    None

The resulting dataframe has other columns im grouping by so I cant simply drop the None rows, I would like to replace the None's with the other mappings in column 2 which would allow me to then group the df properly, so I would want :

  column1 column2
0   apple   green
1   apple   green
2  orange  Orange
3  orange  Orange

Not sure how to tackle this


问:
how to lookup deeply nested mongodb field
I want to lookup for dynamic field of object

Schema

```<code>const settingsRef = new mongoose.Schema({
  onsiteCounter: { ... },
  onsiteOffCounter: { ... },
});

const DemoSchema = new mongoose.Schema({
  settings: {
    type: settingsRef,
    default: {},
  }
});
mongoose.model(Demo, DemoSchema);
</code>```

Schema on which I'm aggregating

```<code>const OtherSchema = new mongoose.Schema({
  siteLocation: {
    type: String,
    required: true,
  }
})
mongoose.model(Other, OtherSchema);
</code>```

What should be exact code here : "$eq": ["$settings", "$$serviceType"]
query

```<code>Other.aggregate([{
      $lookup: {
        "from": Demo.collection.collectionName,
        "let": {
          "serviceType": "$siteLocation"
        },
        "pipeline": [
          {
            "$match": {
              "$expr": {
                "$eq": ["$settings", "$$serviceType"]
              }
            }
          },
          {
            "$project": {
              isAutoServiceChargeActive: 1,
              serviceChargeType: 1,
              serviceChargeAmount: 1,
              serviceChargeCutOff: 1,
              absoluteMinOrder: 1,
              preSetTipType: 1,
              preSetTipAmount: 1,
              isAutoAcceptActive: 1
            }
          }
        ],
        "as": "serviceTypeDetails"
      }
    }])
</code>```

I'm getting serviceTypeDetails as empty array []. Thank you so much for help in advance!

Body:
I want to lookup for dynamic field of object

Schema

const settingsRef = new mongoose.Schema({
  onsiteCounter: { ... },
  onsiteOffCounter: { ... },
});

const DemoSchema = new mongoose.Schema({
  settings: {
    type: settingsRef,
    default: {},
  }
});
mongoose.model(Demo, DemoSchema);

Schema on which I'm aggregating

const OtherSchema = new mongoose.Schema({
  siteLocation: {
    type: String,
    required: true,
  }
})
mongoose.model(Other, OtherSchema);

What should be exact code here : "$eq": ["$settings", "$$serviceType"]
query

Other.aggregate([{
      $lookup: {
        "from": Demo.collection.collectionName,
        "let": {
          "serviceType": "$siteLocation"
        },
        "pipeline": [
          {
            "$match": {
              "$expr": {
                "$eq": ["$settings", "$$serviceType"]
              }
            }
          },
          {
            "$project": {
              isAutoServiceChargeActive: 1,
              serviceChargeType: 1,
              serviceChargeAmount: 1,
              serviceChargeCutOff: 1,
              absoluteMinOrder: 1,
              preSetTipType: 1,
              preSetTipAmount: 1,
              isAutoAcceptActive: 1
            }
          }
        ],
        "as": "serviceTypeDetails"
      }
    }])

I'm getting serviceTypeDetails as empty array []. Thank you so much for help in advance!


问:
How to access value from a promise in typescript?
```<code>import firestore from "./firebase";
import { doc, type DocumentData, getDoc } from "@firebase/firestore";

var fontData : DocumentData | undefined
const fontDoc = doc(firestore, "fl_content", "Cql65iKgsQ7NIaF3gUNe")
console.log('fontDoc',fontDoc)
const fontDocData = getDoc(fontDoc);
console.log('fontDocData',fontDocData)
fontDocData.then((value) => {
    console.log('fontValue',value)
    fontData = value.data()
    console.log('fontData',fontData)
})
console.log('afterfontData',fontData)
</code>```

Above is the code I wrote to get data from a firebase document. Since this is purely a Typescript file and I am writing this code at the top-level, I couldn't use await, hence, I resolved the Promise using the then statement. Now I would like to access the value outside of the then block, but I couldn't access it even though I assigned to a variable. Is there any workaround for this ?

This is the output :

As you can see the console.log returns the intended value inside the then block, but outside of it, it returns undefined.

Body:
import firestore from "./firebase";
import { doc, type DocumentData, getDoc } from "@firebase/firestore";

var fontData : DocumentData | undefined
const fontDoc = doc(firestore, "fl_content", "Cql65iKgsQ7NIaF3gUNe")
console.log('fontDoc',fontDoc)
const fontDocData = getDoc(fontDoc);
console.log('fontDocData',fontDocData)
fontDocData.then((value) => {
    console.log('fontValue',value)
    fontData = value.data()
    console.log('fontData',fontData)
})
console.log('afterfontData',fontData)

Above is the code I wrote to get data from a firebase document. Since this is purely a Typescript file and I am writing this code at the top-level, I couldn't use await, hence, I resolved the Promise using the then statement. Now I would like to access the value outside of the then block, but I couldn't access it even though I assigned to a variable. Is there any workaround for this ?

This is the output :

As you can see the console.log returns the intended value inside the then block, but outside of it, it returns undefined.


问:
Making all the checked checkboxes marked with the dropdown option selected value for the icons of the rows with selected checkbox
I am having 3 dropdown values for the same I am also having icons in the rows. All the rows are having checkbox. If the selected dropdown value is number 1 then the checked checkboxes with the icon of number 1 should be marked leaving all the icons remaining unchanged.</p>


问:
Postgresql function return table? with different number of columns each time
I have a table called all_checks(code integer,sql_state text) that have some checks on my db.

My table all_checks is like:

code
sql_state

100
select kind,discs,bands from music  where kind='rock'

200
select name,surname,type,period from singers where period>1970

....
...

3500
select type,period from concerts

I need to create a function that runs each sql_state from all_checks  according to code.

I wrote a function called run_checks(thecode integer) like this:

```<code>CREATE OR REPLACE FUNCTION run_checks(thecode integer)
  RETURNS SETOF record AS
$$

declare
    rec record;
    sql_query character varying;
BEGIN

select distinct sql_state
from all_checks
where code=thecode
into sql_query;

RAISE NOTICE 'executing: %',sql_query;
for rec in EXECUTE sql_query loop
  return next rec;
end loop;
RETURN;
END
$$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION run_checks(integer)
</code>```

but when I run for ex select all_checks(200) it gives this error:

```<code>ERROR: set-valued function called in context that cannot accept a set
SQL state: 0A000
Context: PL/pgSQL function run_checks(integer) line 18 at RETURN NEXT
</code>```

I made some search about it and I think the problem is on SETOF record but since I don't know how many columns returns each sql_state, I am confused of what return type my function should have.

Body:
I have a table called all_checks(code integer,sql_state text) that have some checks on my db.

My table all_checks is like:

code
sql_state

100
select kind,discs,bands from music  where kind='rock'

200
select name,surname,type,period from singers where period>1970

....
...

3500
select type,period from concerts

I need to create a function that runs each sql_state from all_checks  according to code.

I wrote a function called run_checks(thecode integer) like this:

CREATE OR REPLACE FUNCTION run_checks(thecode integer)
  RETURNS SETOF record AS
$$

declare
    rec record;
    sql_query character varying;
BEGIN

select distinct sql_state
from all_checks
where code=thecode
into sql_query;

RAISE NOTICE 'executing: %',sql_query;
for rec in EXECUTE sql_query loop
  return next rec;
end loop;
RETURN;
END
$$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION run_checks(integer)

but when I run for ex select all_checks(200) it gives this error:

ERROR: set-valued function called in context that cannot accept a set
SQL state: 0A000
Context: PL/pgSQL function run_checks(integer) line 18 at RETURN NEXT

I made some search about it and I think the problem is on SETOF record but since I don't know how many columns returns each sql_state, I am confused of what return type my function should have.


问:
IntelliJ shows syntax error for JPQL with ORDER BY xyz DESC NULLS LAST
IntelliJ IDEA and TeamCity are showing an error for a JPQL query with ORDER BY xyz DESC NULLS LAST.

Can this error be suppressed? Why is FIRST supported but LAST not?

The query is working flawlessly with eclipselink.


问:
how to create json string using a list of objects and need to group day wise
I have a list of objects containing Name, DayName, and count I have 5 different names data in a day and can be repeated in other days, and this way I have last week's data. means each day I have 5 records and for one week I have 7X5 = 35.

now I want to create a JSON string using a List of Objects and need to group per day data in one JSON array but I am not understanding the JSON part.

```<code>Sample1,50,Monday
Sample2,40,Monday
Sample3,30,Monday
Sample4,20,Monday
Sample5,10,Monday

Sample5,55,Tuesday
Sample3,45,Tuesday
Sample4,35,Tuesday
Sample1,25,Tuesday
Sample2,15,Tuesday so on..
</code>```

I want a JSON string like this

```<code>[
{"Day":"Monday","Sample1":50,"Sample2":40,"Sample3":30,"Sample4":20,"Sample5":10},
{"Day":"Tuesday","Sample5":55,"Sample3":45,"Sample4":35,"Sample1":25,"Sample2":15},
]
</code>```

java code:

```<code>Class1{
        public  void Class1(String name,String day,int cnt){
               this.name=name;
               this.day=day;
               this.count = cnt;
       }
}

class2{
    ArrayList<Class1> list = new ArrayList<Class1>();
    list.add(new Class1("Sample1","Monday",50));
    list.add(new Class1("Sample2","Monday",40));
    list.add(new Class1("Sample3","Monday",30));
    list.add(new Class1("Sample4","Monday",20));
    list.add(new Class1("Sample5","Monday",10));
    //like other days
}
</code>```

now using the list how to get json string like this

```<code>[
{"Day":"Monday","Sample1":50,"Sample2":40,"Sample3":30,"Sample4":20,"Sample5":10},
{"Day":"Tuesday","Sample5":55,"Sample3":45,"Sample4":35,"Sample1":25,"Sample2":15},
]
</code>```

please help me

thanks

Body:
I have a list of objects containing Name, DayName, and count I have 5 different names data in a day and can be repeated in other days, and this way I have last week's data. means each day I have 5 records and for one week I have 7X5 = 35.

now I want to create a JSON string using a List of Objects and need to group per day data in one JSON array but I am not understanding the JSON part.

Sample1,50,Monday
Sample2,40,Monday
Sample3,30,Monday
Sample4,20,Monday
Sample5,10,Monday

Sample5,55,Tuesday
Sample3,45,Tuesday
Sample4,35,Tuesday
Sample1,25,Tuesday
Sample2,15,Tuesday so on..

I want a JSON string like this

[
{"Day":"Monday","Sample1":50,"Sample2":40,"Sample3":30,"Sample4":20,"Sample5":10},
{"Day":"Tuesday","Sample5":55,"Sample3":45,"Sample4":35,"Sample1":25,"Sample2":15},
]

java code:

Class1{
        public  void Class1(String name,String day,int cnt){
               this.name=name;
               this.day=day;
               this.count = cnt;
       }
}

class2{
    ArrayList<Class1> list = new ArrayList<Class1>();
    list.add(new Class1("Sample1","Monday",50));
    list.add(new Class1("Sample2","Monday",40));
    list.add(new Class1("Sample3","Monday",30));
    list.add(new Class1("Sample4","Monday",20));
    list.add(new Class1("Sample5","Monday",10));
    //like other days
}

now using the list how to get json string like this

[
{"Day":"Monday","Sample1":50,"Sample2":40,"Sample3":30,"Sample4":20,"Sample5":10},
{"Day":"Tuesday","Sample5":55,"Sample3":45,"Sample4":35,"Sample1":25,"Sample2":15},
]

please help me

thanks


问:
Android Studio on Windows, Failed to read or create install properties file
I am trying to install Flutter on Windows 10, part of the installation is to install Android Studio and Android SDK Command-line Tools (latest).

Trying to do so results in this error:

The log file shows:

```<code>2022-12-15 10:17:39,888 [  23153]   INFO - ectedPackagesStep$CustomLogger - Preparing "Install Android SDK Command-line Tools (latest) (revision: 8.0)".
2022-12-15 10:17:39,892 [  23157]   WARN - ectedPackagesStep$CustomLogger - Failed to read or create install properties file.
2022-12-15 10:17:39,892 [  23157]   INFO - ectedPackagesStep$CustomLogger - Failed packages:
2022-12-15 10:17:39,892 [  23157]   INFO - ectedPackagesStep$CustomLogger - - Android SDK Command-line Tools (latest) (cmdline-tools;latest)
2022-12-15 10:18:04,033 [  47298]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\build-tools\33.0.1\package.xml
2022-12-15 10:18:04,039 [  47304]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\emulator\package.xml
2022-12-15 10:18:04,039 [  47304]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager\package.xml
2022-12-15 10:18:04,039 [  47304]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\patcher\v4\package.xml
2022-12-15 10:18:04,043 [  47308]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\platform-tools\package.xml
2022-12-15 10:18:04,047 [  47312]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\platforms\android-33\package.xml
2022-12-15 10:18:04,049 [  47314]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\sources\android-33\package.xml
2022-12-15 10:18:04,049 [  47314]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\system-images\android-33\google_apis\x86_64\package.xml
</code>```

I have tried starting Android Studio as administrator and installing it in a different folder than the default Program Files folder, both with no success. I have not been able to find any other possible solutions on Stackoverflow.

One note that I doubt matters. I can see the SDK path is set to C:\Users\****\AppData\Local\Android\Sdk, however Users on my system is the translation to my native language (Dutch installation of Windows).

Body:
I am trying to install Flutter on Windows 10, part of the installation is to install Android Studio and Android SDK Command-line Tools (latest).

Trying to do so results in this error:

The log file shows:

2022-12-15 10:17:39,888 [  23153]   INFO - ectedPackagesStep$CustomLogger - Preparing "Install Android SDK Command-line Tools (latest) (revision: 8.0)".
2022-12-15 10:17:39,892 [  23157]   WARN - ectedPackagesStep$CustomLogger - Failed to read or create install properties file.
2022-12-15 10:17:39,892 [  23157]   INFO - ectedPackagesStep$CustomLogger - Failed packages:
2022-12-15 10:17:39,892 [  23157]   INFO - ectedPackagesStep$CustomLogger - - Android SDK Command-line Tools (latest) (cmdline-tools;latest)
2022-12-15 10:18:04,033 [  47298]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\build-tools\33.0.1\package.xml
2022-12-15 10:18:04,039 [  47304]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\emulator\package.xml
2022-12-15 10:18:04,039 [  47304]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager\package.xml
2022-12-15 10:18:04,039 [  47304]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\patcher\v4\package.xml
2022-12-15 10:18:04,043 [  47308]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\platform-tools\package.xml
2022-12-15 10:18:04,047 [  47312]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\platforms\android-33\package.xml
2022-12-15 10:18:04,049 [  47314]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\sources\android-33\package.xml
2022-12-15 10:18:04,049 [  47314]   INFO - s.RepoProgressIndicatorAdapter - Parsing C:\Users\****\AppData\Local\Android\Sdk\system-images\android-33\google_apis\x86_64\package.xml

I have tried starting Android Studio as administrator and installing it in a different folder than the default Program Files folder, both with no success. I have not been able to find any other possible solutions on Stackoverflow.

One note that I doubt matters. I can see the SDK path is set to C:\Users\****\AppData\Local\Android\Sdk, however Users on my system is the translation to my native language (Dutch installation of Windows).


问:
running migration for multiple schema - typeorm/postgres
I have a schema based multitenancy setup in postgres.

Typeorm allows us to run migration using a single command:

```<code>typeorm migration:run -d db.connection.js
</code>```

the connection is defined like this:

```<code>{
    type: 'postgres',
    host: process.env.DB_HOST,
    port: Number(process.env.DB_PORT),
    username: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME,
    ssl: process.env.DB_SSL === 'true',
    schema,
    migrations: migrations || ['./**/*.migration.js'],
    ...options,
  }
</code>```

Now, I have 3 schema in my database: A, B and C, how do I run the migration for all 3 of them at once? This is a really big issue for me as manually triggering migration for each schema individually is time consuming and cumbersome.  Does typeorm have a method to specify multiple schemas?

Body:
I have a schema based multitenancy setup in postgres.

Typeorm allows us to run migration using a single command:

typeorm migration:run -d db.connection.js

the connection is defined like this:

{
    type: 'postgres',
    host: process.env.DB_HOST,
    port: Number(process.env.DB_PORT),
    username: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME,
    ssl: process.env.DB_SSL === 'true',
    schema,
    migrations: migrations || ['./**/*.migration.js'],
    ...options,
  }

Now, I have 3 schema in my database: A, B and C, how do I run the migration for all 3 of them at once? This is a really big issue for me as manually triggering migration for each schema individually is time consuming and cumbersome.  Does typeorm have a method to specify multiple schemas?


问:
How do I implement physics attributes into an already made 3D model?
If I create a 3d model with c++ and directx, how do I implement the physics engine (let's say havok) to use that 3d model and add physics and collision properties?</p>


问:
Python script to import last file sent in Slack channel
I'm receiving a daily report automatically to my Slack channel.
I don't want to save it every day and then import it to my python script.
I want to use python script to access my Slack channel and import the last file in the channel.

Additional info:
File format is csv.
Cadence is daily.

Thanks!

I tried using slacker library to access my Slack content, but not really sure I to import files from specific channel.


问:
Getting commas in number format in OpenSearch Dashboards
I changed the Field Type from string to integer from there the value I am getting is with commas in between the value. Example mobile number(9748376253) destination field as (9,748,376,253), this is because the default number format in opensearch will take as 1000's place so it divides in such a way. So by following the below stackoverflow i changed accordingly(Kibana unwanted thousand-seperator) as  type number and changed the format to 00.[000] from 0,0.[000]. but changes are not effected. Will it take time to effect or any other issue ? Is there any option to change this format number setting only for one particular index ?</p>