How do I check if an element is present with Selenium (Python)?

Hi I’m trying to select the name “Saleem” from the HTML. It is inside a table, but I don’t know how if that is relevant. The name might not always be there, so I’m trying to find a way to select the element if the name is included in the table.

Here is the website (I just put Saleem in the name category and searched):
https://sanctionssearch.ofac.treas.gov/default.aspx

I tried the code below, but unfortunately does not work.

driver.find_element_by_id("btnDetails").click()

 <a> id="btnDetails" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$gvSearchResults$ctl02$btnDetails&quot;, &quot;&quot;, false, &quot;&quot;, &quot;Details.aspx?id=5839&quot;, false, true))" style="color:Blue">AL-IFRI, Saleem </a>

Any help is appreciated!

jquery – Hide specific element from frontend when a filed is checked with ACF

I added a checkbox to my ACF. the ACF shows on the admin post pages.
I have embed tag(video) on the content of some posts. I want to display embed off in frontend whenever I check the check box.

I set it with ACF and jQuery as the following codes but I am curious Are it possible with ACF plugin without jQuery?

if( get_field(‘checkbox’) ) {
// .wp-video{display==none}
//or better if all embed tag not wok on post content
}

I put it on single.php

<?php
if( get_field('checkbox') ) {
echo '<div id="msg"></div>';
}
?>

after that help jQuery:

if ($('#msg').length > 0) {
$('div.content-body > div.wp-video').hide();
}

How can I set a custom form’s element after a managed_file ajax callback?

Scenario:

I have a custom form whose first step is to upload a file using a managed_file field element.

Then, after this manged file is uploaded I want to rebuild the form using information from the managed file and display new form elements that should only exist after the managed file is uploaded.

I have struggled with this for days and cannot get a working solution. The first problem is that the managed_file already has an ajax callback so I can’t seem to add my own to populate and/or return field elements after the file is successfully uploaded.

I’ve gone as far as overriding the managed_file type with a custom form field type but I can’t seem to be able to return actual form elements AND an ajax response (one of the other). Code example of my override below.

In short, how can I repopulate a custom field after a managed file uploaded is completed and add new fields dependent on the file that was uploaded?

/**
 * My Managed File Element.
 *
 * @FormElement("my_managed_file")
 */
class MyManagedFile extends ManagedFile {

  /**
   * {@inheritdoc}
   */
  public static function uploadAjaxCallback(&$form, FormStateInterface &$form_state, Request $request) {


    $response = parent::uploadAjaxCallback($form, $form_state, $request);    
    
    return $response;

  }

}

algorithms – Find $k$’th smallest element in matrix with sorted rows

This is very hard question as mentioned on some site on google and firstly introduce on Interview Amazon Question.

We have an $mtimes n$ matrix in which all rows are sorted in ascending order and all elements are distinct. We want to find the $k$‘th smallest elements in this matrix.

There is an $O(m (log m + log n))$ algorithm for doing this!

I see lots of posts, especially here, but as Yuval Filmus mentioned in comments there are difference in large value of $k$.

We are familiar with median of medians method that throw half of elements with median, but here there is a very challenging question. How is this time complexity reached?

theming – Twig Tokens in Views not Rendering Inside an HTML Element

I’m using views to create a custom block of shortcut icons and need the images to link to the corresponding content. Using Rewrite Results I can overwrite the output of the view and have an anchor tag wrap around the image, however when I inspecting the output on the site, the href is blank making the images useless as links. Everything else renders though.

The view uses two fields, all from the same content type (shortcut). It consists of an image and a URL field. The image field is called first and then hidden to get the tokens, and the URL field holds the actual rewrite text. All of the these Twig tokens are listed as available within the Replacement Patterns dialog box.

<a href="{{ field_url__uri }}">
{{ field_image }}
</a>
<br>
{{ field_url }}

Does Twig Debug affect the output for content like this? Is there another format I should be using? I tried calling and hiding via CSS the {{field_url}} first, before the rest of the rewrite text to see if it had to do with render inheritance but it still didn’t change the blank href output.

Any insight on why the Twig token won’t render inside HTML would be GREATLY appreciated. Thank you.

sql server – OPENXML to get content by using element and attribute name

In this SQL Server OPENXML example:

declare @xmldata xml    

set @xmldata = 
'<?xml version="1.0"?>
<wddxPacket version="1.0">
    <data>
        <var dimension="task"><string>Task 1</string></var>
        <var dimension="startdate"><string>2020-11-14</string></var>
    </data>
    <data>
        <var dimension="startdate"><string>2020-11-15</string></var>
        <var dimension="task"><string>Task 2</string></var>
    </data>
</wddxPacket>'

DECLARE @hDoc int
EXEC sp_xml_preparedocument @hDoc OUTPUT, @xmldata

SELECT *
FROM OPENXML(@hDoc, '//wddxPacket/data',2)
        WITH(
            task          varchar(200) 'var(1)/string',
            startdate     varchar(200) 'var(2)/string'
    )

EXEC sp_xml_removedocument @hDoc

This is the current output:

task         startdate
------       ----------
Task 1       2020-11-14
2020-11-15   Task 2   

But I really want this output:

task         startdate
------       ----------
Task 1       2020-11-14
Task 2       2020-11-15

To identify the content, I cannot use “var” alone, because all elements of interest are named “var”. I cannot use position (1) or (2), because the position numbers are inconsistent in the XML, resulting in the current mixed-up output. How do I identify the elements based on “var” and the “dimension” attribute names of “task” or “startdate”?

How to set the value of an Excel cell to an element of that cell validation list by passing its rank in the list, in VBA?

I have some cells in an Excel WorkSheet whose values are constrained by a Validation List. I need to be able to set the value of these cells to the value of one of the element of their own Validation List, by passing as argument the rank of the value in this Validation List.

In pseudo-code : = SelfCell.ValidationList0

How can I do that please?

PC Games – The Last Element [FitGirl Repack] | NulledTeam UnderGround

The Last Element [FitGirl Repack] | Size :1.27 GB
Title: The Last Element: Looking For Tomorrow
Date:11 Nov, 2020
Developer :The Last Developer
Publisher : The Last Developer
Genre : :Racing​

About This Game:

The ceaseless rumble of flying machines, whose dense streams have already become commonplace for this Cyberpunk City . . . .

ScreenShoot

System Requirements :
OS: Windows 7 or better
Processor: Dual-Core processor
Memory: 4 GB RAM
Graphics: NVIDIA GeForce GTX 650 Ti
DirectX: Version 10
Network: Broadband Internet connection
Storage: 6 GB available space

Game intro in Youtube

Download Links

What would be a descriptive name for this UI element?

I’m looking for a descriptive and relatively intuitive name for this UI element you very often find in game’s settings screens. It’s a list of options (labels) that you can horizontally run through and that usually convey a "from lower to higher" or "from worse to better" feeling when going from left to right.

UI Element

python 3.x – Is there an elegant solution to concatenating Dataframes as fixed element in a list?

Arguably I can improve on function design choices in the first place, but currently I am in a situation where a function returns a tuple, or list, of dataframes pertaining to different data streams.
The idea is that each data stream separately needs to be concatenated at the end. For now limited to three, but scalable.

import pandas as pd

def spit_out_three_dfs():
    df1 = pd.DataFrame({"Timestamp": ("x", "y"), "Data": (1,1)})
    df2 = pd.DataFrame({"Timestamp": ("x", "y"), "Data": (2,2)})
    df3 = pd.DataFrame({"Timestamp": ("x", "y"), "Data": (3,3)})
    return df1, df2, df3

df1_concat, df2_concat, df3_concat = map(lambda x: pd.concat, (spit_out_three_dfs() for i in range(3)))

will yield all 3 dataframes to return as

df1_concat
Out(14): 
  Timestamp  Data
0         x     1
1         y     1
0         x     2
1         y     2
0         x     3
1         y     3

instead of the wished for:

df1_concat
Out(14): 
  Timestamp  Data
0         x     1
1         y     1
0         x     1
1         y     1
0         x     1
1         y     1

and similarly data stream 2 in df2_concat, etc.
What I am explicitly looking for is a way to concatenate the three streams in one go.

What I can do, is to merge the streams and later filter/query: this runs into memory problems.

Another effort I can make, is to run a nested list comprehension to pick the xth element every time, which will exhaust the generator, requiring me to run the entire operation again for the next element.
For 3 data streams this is manageable, but horribly inefficient still.

Is there a pandas wizard out there who can point me in the right direction?