The best way to make data from a Spark cluster available for queries and custom dashboards in a web app?

I have a Spark cluster that contains my customer's data. I would like to enable my customers to query their data via our admin dashboard and to create their own reports.

An important consideration is that the customer is technical.

The best option I can think of is embedding Jupyter Notebook or Zeppelin Notebook in the dashboard as this gives them direct access to their data.

What other options do I have?

woocommerce – send email to custom field in custom post type when order is complete

So I have this function, which is supposed to send the finished order email via a CC to a user-defined email address. If the function contains only the if statement (see below), it works properly. However, if I add other custom code, the email won't fire.

I have a custom post type that stores the required email address.

The CC email is retrieved from an ACF post object field in the product meta. From this ACF Post object field, I grab the custom field (partner_email).

I know $ partnerEmail is valid because I see that it is logged in the error logs. However, if I put this variable in the headers, it doesn't work. Any help would be appreciated. Thank you in advance.

add_filter( 'woocommerce_email_headers', 'enyc_order_completed_email_add_cc_bcc', 9999, 3 );

function enyc_order_completed_email_add_cc_bcc( $headers, $email_id, $order ) {

$order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;  

$order = new WC_Order( $order_id );

$items = $order->get_items();

foreach ( $items as $item ) {

    //Get Product ID
    $product_id = $item('product_id');

    //Get Product Data
    $product = wc_get_product( $product_id );

    //Get Partner Data from Product
    $partner = get_field( 'venue', $product_id);

    //Get Partner ID
    $partnerID = $partner->ID;



    //Get Partner Email
    $partnerEmail = get_field( 'partner_email', $partnerID);

    //error_log( $partnerEmail);



}

 if ( 'customer_completed_order' == $email_id ) {
        $headers .= "Cc: Name <'.$partnerEmail.'>" . "rn"; // del if not needed
        $headers .= "Bcc: Name " . "rn"; // del if not needed
    }   


    return $headers;
}

Views – How do I grant access rights for custom text box plugins?

I want to give the custom text field handler access permissions in views to display the field based on the user permissions.

This is my custom view field handler referenced: https://www.webomelette.com/creating-custom-views-field-drupal-8

This is my custom link = & # 39; / group / {{raw_arguments.gid}} / admin / title / {{nid}} / assets & # 39; which uses the argument value from the Replacements pattern.

 public function render(ResultRow $values) {
    $path = $this->options('alter')('path');
    $url = Url::fromUserInput($path);    
    //kint(get_defined_vars());exit;
   //return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options('link_title')));
    $url = Url::fromUserInput($path);
    if($url->access(Drupal::currentUser())) {
      return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options('link_title')));
    //return Link::fromTextAndUrl($this->options('link_title'), Url::fromUserInput($path, $options))->toString();

    }
  }.

Output is shown in the code above, but access permission cannot be verified due to a custom argument that could not determine the actual URL path

Hooks – How to give access permissions for custom text box plugins in Drupal 8 views

I want to give the custom text field handler access permissions in views to display the field based on the user permissions.

This is my custom view field handler referenced: https://www.webomelette.com/creating-custom-views-field-drupal-8

This is my custom link = & # 39; / group / {{raw_arguments.gid}} / admin / title / {{nid}} / assets & # 39; which uses the argument value from the Replacements pattern.

 public function render(ResultRow $values) {
    $path = $this->options('alter')('path');
    $url = Url::fromUserInput($path);    
    //kint(get_defined_vars());exit;
   //return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options('link_title')));
    $url = Url::fromUserInput($path);
    if($url->access(Drupal::currentUser())) {
      return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options('link_title')));
    //return Link::fromTextAndUrl($this->options('link_title'), Url::fromUserInput($path, $options))->toString();

    }
  }.

Output is shown in the code above, but access permission cannot be verified due to a custom argument that could not determine the actual URL path

Possible security problem with the custom taxonomy search function

I would like to add some features to a client WordPress site that allow you to include taxonomy terms from custom post types in WordPress search, and encounter the following answer:

Include a custom taxonomy term in the search

This solution works, but in the comments, one user mentioned that "it is probably not a good idea to insert the raw publicly available search string directly into an SQL query". and added a link for further reading. I can't see anything in this link that relates to the details of the answer.

For quick reference, the code for the answer is below. Would this code be a security risk? If so, what would the solution look like so that you still have the functionality to be able to include taxonomy terms in the WP search without any security risk?

Many thanks

// search all taxonomies, based on: http://projects.jesseheap.com/all-projects/wordpress-plugin-tag-search-in-wordpress-23

function atom_search_where($where){
global $wpdb;
if (is_search())
    $where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')";
return $where;
}

function atom_search_join($join){
global $wpdb;
if (is_search())
    $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id";
return $join;
}

function atom_search_groupby($groupby){
global $wpdb;

// we need to group on post ID
$groupby_id = "{$wpdb->posts}.ID";
if(!is_search() || strpos($groupby, $groupby_id) !== false) return $groupby;

// groupby was empty, use ours
if(!strlen(trim($groupby))) return $groupby_id;

// wasn't empty, append ours
return $groupby.", ".$groupby_id;
}

add_filter('posts_where','atom_search_where');
add_filter('posts_join', 'atom_search_join');
add_filter('posts_groupby', 'atom_search_groupby');

Altcoin development – how can I mine the first block of my custom Litecoin fork?

In fact, you don't have to be connected to another node to mine your first block or another block within the core. Simply use youraltcoin-cli to generate nblocks in a terminal with a running core, or use nblocks via the integrated console in the core (in the debug window).

If you want to use a mining pool or if you want to mine your coin externally using mining software (e.g. cpuminer), you need at least 2 synchronized nodes in the network.

Pagination does not work on a custom page, only on a post page

global $wp_query;
$result = $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$original_query = $wp_query;
$wp_query = null;
$args=array(
    'post_type'=> 'post',
    'orderby'    => 'ID',
    'post_status' => 'publish',
    'order'    => 'DESC',         
    'posts_per_page'=>get_option( 'posts_per_page' ),
    'paged'=>$paged
);
$wp_query = new WP_Query( $args );
$result = new WP_Query( $args );
if ( $result-> have_posts() ) : ?>
    have_posts() ) : $result->the_post(); 
          get_template_part( 'template-parts/content', get_post_type() );
     endwhile; 
     echo "";
else :
     get_template_part( 'template-parts/content', 'none' );
endif; 
wp_reset_postdata(); ?>

react.js – Custom react debouncer hook

I am new to React Hooks and am trying to learn how to write custom hooks. Today I wrote a hook that I think acts as an effective debouncer for a setter function to prevent excessive updates when data changes quickly. I try to keep this as simple as possible so that it can be reused throughout the app and by other developers on my team when they need it.

I've tested this and it seems to be working as expected. It is currently used to prevent excessive updates from a text field. I'm not sure if this could result in hidden performance degradation, and I don't know if I did it in a meaningful way (or if there are less complicated ways to do what I want.

// Returns a callback function that wraps the passed setter in a debouncer mechanism
// While the timer is off, the setter will be called immediately and trigger a new timer.
// While the timer is on, the value to be set is captured and used at the end of the timer period.
// Subsequent calls during the timer period will replace the captured value to be set, there is no queue.
export function useDebouncedSetter(setter: (value: any) => void, timeout = 1000) {
    const timerActive = useRef(false);
    const valueCapture = useRef(null);  
    const setterCapture = useRef(setter);  // Capture the setter value to detect if a new one is passed

    return useCallback(async (value: any) => {
        if (timerActive.current === true) {
            valueCapture.current = value;
        } else {
            setter(value);
            valueCapture.current = value;
            timerActive.current = true;
            setterCapture.current = setter;
            setTimeout(() => {
                timerActive.current = false;
                // If the last captured value is the same as the value when the timeout was started, do nothing
                // If the last captured setter is different from the current setter, do nothing
                // This later case means a new setter was passed invalidating the old one.
                if (valueCapture.current !== value && setterCapture.current === setter) {
                    setter(valueCapture.current);
                }
            }, timeout);
        }
        return () => {
            // Cleanup, set the flag to false, get rid of the last value.
            timerActive.current = false;
            valueCapture.current = null;
        }
    }, (setter, timeout));
}

How can I best improve this? How can I test effectiveness against other methods if possible?