[Solved] How can I ...
 
Notifications
Clear all

[Solved] How can I plot the frequency response of the equation below using MATLAB?

0 Posts
1 Users
0 Likes
0 Views
0
Topic starter
Victor Calinao Jr Asks: How can I plot the frequency response of the equation below using MATLAB?
$$boxed{dfrac{V_{out}(jomega)}{V_{in}(jomega)}=dfrac{2times10^9}{(1+10jomega)(100times10^3jomega+20times10^3jomega+2times10^9-20times10^3jomega}}$$

and $$dfrac{V_{out}(jomega)}{V_{in}(jomega)}=dfrac{jomega LR_1R_2}{(jomega L)((1+jomega C R_2)(jomega LR_2+jomega LR_1+R_1R_2)-jomega LR_1)}$$

I am having a hard time figuring out how can I translate them into symbolic math or what I will do to them to get their frequency response plots.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Unreplied Posts

[Solved] Apple Watch Series 3 refusing to charge only at night

IntelCorei9 Asks: Apple Watch Series 3 refusing to charge only at night
I unplugged my watch (watchOS 8, Series 3, 38mm, Bought in 2020) yesterday and put it on. It was on nightstand mode with the clock & green lightning bolt indicating it was charging (the screen was on all night though, I don’t know why). I got a 10% low power alert at 8am, an hour after I put it on.

I threw it back on its charger (the one it came with), and I got really ticked off. I checked it this morning & put it on, and it was already down to 95%, indicating it charged, but stopped at night.

The battery graph in Settings doesn’t even show it was charging at all.

How can I fix this?! It’s really frustrating.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.
 
 
 

[Solved] Add custom column to post list table

Pagna Kong Asks: Add custom column to post list table
I have a custom post type called Book and I want to add the publisher and book author custom columns in the edit page.

I also want to fetch a specific value from each fields (I created two fields for the above columns) to display in those two additional columns. I actually can display with this code below but the point is I have to declare variable (for example: the $value variable) for each data.

So could you please share me some ideas to display that with loop or somethings.

Code:
add_filter( 'manage_book_posts_columns', 'set_custom_edit_book_columns' );
add_action( 'manage_book_posts_custom_column' , 'custom_book_column', 10, 2 );

function set_custom_edit_book_columns($columns) {
    $value = get_field( "contact_person" );
    unset( $columns['author'] );
    $columns['book_author'] = __( 'Author', 'your_text_domain' );
    $columns['publisher'] = __( 'Publisher', 'your_text_domain' );

    return $columns;
}

function custom_book_column( $column, $post_id ) {
    switch ( $column ) {

        case 'book_author' :
            $value = get_field( "contact_person" );
            $terms = get_the_term_list( $post_id , '$value' , '' , ',' , '' );
            if ( is_string( $value ) )
                echo $value;
            else
                _e( 'Unable to get author(s)', 'your_text_domain' );
            break;

        case 'publisher' :
            echo get_post_meta( $post_id , 'publisher' , true ); 
            break;

    }
}

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Issue with user meta_query

Travis Kline Asks: Issue with user meta_query
I am creating a zip code radius search. I am pulling the all the zip codes within a radius depending on the search term through an API, then doing a user query to compare a custom meta field that has their zip and display those users if there is a match within the array of zip codes. I am doing this for both US/Canada. This is working except when I increase the radius and if that location happens to have a large amount of zip codes it breaks and no users are found. Especially in Canada there are literally thousands of zip code variations within just a 10km radius. For example if you look here Find Canadian Postcodes Inside a Radius and search T5T 3E9 there are over 10k zip code results.

This only seems to be related to having a very large array. Any thoughts?

Code:
curl_setopt($ch, CURLOPT_URL, "https://app.zipcodebase.com/api/v1/radius?" . 
http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"apikey: ", ));

$zipresponse = curl_exec($ch);
curl_close($ch);

$json = json_decode($zipresponse);


$resultArray = json_decode($zipresponse, true);
$zipCodd = $resultArray['results'];


$newzipArray = array();
if ( !empty( $zipCodd ) ) {
    $i = 0;
    foreach($zipCodd as $data){
        $i++;
            $newzipArray[$i] = str_replace(' ', '', $data['code']);
    }
}

$user_search_args = array (
  'number'          => 50, // How many per users
  'role'            => 'subscriber',
  's'               => '*' . esc_attr( $search_term ) . '*',
  'meta_query'      => array(
     'relation'    => 'OR',
          array(
              'key'     => array('mepr-address-zip', 'mepr_second_location_zip_2','mepr_third_location_zip_3'),
              'value'   => $newzipArray,
              'compare' => 'IN'
          ),

      )
  );

$user_search_query = new WP_User_Query( $user_search_args );

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Adding donation buttons of campaign page into homepage list product

Agustin Lohse Asks: Adding donation buttons of campaign page into homepage list product
im working whit WP crowdfunding and Woocomerce. I been trying to take the predefined amount buttons that are in this photo:

I know that these buttons are containg in “wpcrowdfunding>wpcftemplate>woocommerce>basic>include>fund-campaign-btn.php”

Code:
<?php
defined( 'ABSPATH' ) || exit;
?>
<div class="wpneo-single-sidebar ASA">
    <?php
    global $post, $product;
    $currency = '$';
    if ($product->get_type() == 'crowdfunding') {
        if (wpcf_function()->is_campaign_valid()) {
            $recomanded_price = get_post_meta($post->ID, 'wpneo_funding_recommended_price', true);
            $min_price = get_post_meta($post->ID, 'wpneo_funding_minimum_price', true);
            $max_price = get_post_meta($post->ID, 'wpneo_funding_maximum_price', true);
            $predefined_price = get_post_meta($post->ID, 'wpcf_predefined_pledge_amount', true);
            if ( ! empty($predefined_price)){
                $predefined_price = apply_filters('wpcf_predefined_pledge_amount_array_a', explode(',', $predefined_price));
            }

            if(function_exists( 'get_woocommerce_currency_symbol' )){
                $currency = get_woocommerce_currency_symbol();
            }

            if (! empty($_GET['reward_min_amount'])){
                $recomanded_price = (int) esc_html($_GET['reward_min_amount']);
            } ?>

            <span class="wpneo-tooltip">
                <span class="wpneo-tooltip-min"><?php _e('Minimum amount is ','wp-crowdfunding'); echo $currency.$min_price; ?></span>
                <span class="wpneo-tooltip-max"><?php _e('Maximum amount is ','wp-crowdfunding'); echo $currency.$max_price; ?></span>
                <span class="wpneo-tooltip-empty"><?php _e('Put a valid number','wp-crowdfunding'); ?></span>
            </span>

            <?php
            if (is_array($predefined_price) && count($predefined_price)){
                echo '<ul class="wpcf_predefined_pledge_amount">';
                foreach ($predefined_price as $price){
                    $price = trim($price);
                    $wooPrice = wc_price($price);
                    echo " <li><a href='javascript:;' data-predefined-price='{$price}'> {$wooPrice}</a> </li> ";
                }
                echo "</ul>";
            }
            ?>

            <form enctype="multipart/form-data" method="post" class="cart AA">
                <?php do_action('before_wpneo_donate_field'); ?>
                <?php echo get_woocommerce_currency_symbol(); ?>
                
                <input oninput="this.value = this.value.replace(/[^0-9.]/g, '').split(/./).slice(0, 2).join('.')" type="number" step="any" min="0" placeholder="<?php echo $recomanded_price; ?>" name="wpneo_donate_amount_field" class="input-text amount wpneo_donate_amount_field text" value="<?php echo ($recomanded_price ? $recomanded_price : $min_price); ?>" data-min-price="<?php echo $min_price; ?>" data-max-price="<?php echo $max_price ?>" >

                <?php do_action('after_wpneo_donate_field'); ?>
                <input type="hidden" value="<?php echo esc_attr($post->ID); ?>" name="add-to-cart">
                <button type="submit" class="<?php echo apply_filters('add_to_donate_button_class', 'wpneo_donate_button'); ?>"><?php _e('Back Campaign', 'wp-crowdfunding'); ?></button>
            </form>

        <?php
        } else {
            if ( ! wpcf_function()->is_campaign_started()){
                wpcf_function()->campaign_start_countdown();
            }else{
                if( wpcf_function()->is_reach_target_goal() ){
                    _e('The campaign is successful.','wp-crowdfunding');
                }else{
                    _e('This campaign has been invalid or not started yet.','wp-crowdfunding');
                }
            }
        }
    }

    ?>
</div>

and i want to take these buttons into description.php. (wpneo short-description).

Code:
<?php
defined( 'ABSPATH' ) || exit;
global $post;
if ( ! $post->post_excerpt ) {
    return;
}
?>
<div style="clear: both"></div>
<div class="wpneo-single-short-description">
    <h2><?php _e('Short Story','wp-crowdfunding'); ?></h2>
    <div itemprop="description">
        <?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
    </div>
</div>

Should be this area:

im not quite sure of how to insert the fund-campaign buttons into the wpneo short description. Any help?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] How do I modify the custom footer text and get theme version number to show in wordpress admin?

ShrockCo Asks: How do I modify the custom footer text and get theme version number to show in wordpress admin?
I am trying to modify the footer text inside the wordpress admin and also get my custom themes version number to show as well but my function is not working properly, I am still very green at PHP

~ Thank-you in advance!

Code:
function modify_admin_footer() {
echo '<span id="footer-thankyou">Developed by <a href="http://www.toolcart.com" target="_blank" rel="noopener noreferrer">Toolcart Theme Version:</a>.</span>'; wp_get_theme()->parent()->Version;
}
add_filter( 'admin_footer_text', 'modify_admin_footer' );

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] What is the most efficient way to reverse an array in Javascript?

luisgo Asks: What is the most efficient way to reverse an array in Javascript?
I was asked recently what was the most efficient way to reverse an array in Javascript. At the moment, I suggested using a for loop and fiddling with the array but then realized there is a native Array.reverse() method.

For curiosity’s sake, can anyone help me explore this by showing examples or pointing in the right direction so I can read into this? Any suggestions regarding how to measure performance would be awesome too.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Docker build different in Github Actions

Ben Flowers Asks: Docker build different in Github Actions
When I build my docker file locally and push my application runs correctly. However when I Build through github actions I get an error that ‘flask’ is not installed.

It seems that the pip install step does nothing in Github actions – it just shows:

Code:
Step 8/13 : RUN pip install --trusted-host pypi.python.org -r /app/requirements.txt
 ---> Running in 6b0816c1bdc8
Removing intermediate container 6b0816c1bdc8

However on my local i get the full pip install output..

Is there something I am missing with Github Actions?

DockerFile:

Code:
FROM python:3.8-alpine
WORKDIR /app
ARG DB_PASSWORD

RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev

ADD ./requirements.txt /app
ADD ./src /app


RUN cat /app/requirements.txt
RUN pip install -r /app/requirements.txt

ENV DEBUG=false
ENV FLASE_DEBUG=false
ENV TESTING=false

ENTRYPOINT [ "python" ]

CMD [ "app.py" ]

Action Step:

Code:
- name: Build docker image and push to ECR
  run: /bin/bash $GITHUB_WORKSPACE/scripts/build_and_push.sh
  env:
    AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
    AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
    AWS_DEFAULT_REGION: "eu-west-1"

Build Script:

Code:
pipenv run pip freeze > requirements.txt

aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin {{ ECR Address}}

docker build -t {{ image name }} .

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Accessing the camera in iOS Safari on an iPhone

s5b Asks: Accessing the camera in iOS Safari on an iPhone
I have Single Page Webapp (SPA) that verifies the users as part of the signup process. Part of the verification is to capture a selfie of the user. To this end, I’ve implemented a version of the following code to get the camera input into a video element on the webpage, from which I can then sample images into a canvas.

Code:
navigator.mediaDevices.getUserMedia({ video: true, audio: false })
    .then(localMediaStream => {
      if ('srcObject' in video) {
        video.srcObject = localMediaStream;
      } else {
        video.src = window.URL.createObjectURL(localMediaStream);
      }
      video.play();
    })
    .catch(err => {
      console.error(`Not available!!!!`, err);
    });

This code is based on an example by Wes Bos, from his JavaScript30 course (#19 Unreal Webcam Fun). You can try it out here.

This code appears to work fine on most browsers, with the major exception of Apple Safari on iOS on an iPhone (example: iPhone 12 Pro, iOS 14.7.1). On the iPhone I get the first frame of the camera image captured and there after, the video element displays a black square.

Oddly, it works fine on an iPad (example: iPad Pro (11-inch), iOS 14.7.1), but not on any iPhone that I’ve tried.

I’ve seen a lot of discussion here on StackOverflow and elsewhere describing similar issues, but I’m yet to find a definitive answer, or better yet, a solution.

Does anybody have any idea?

Cheers, S t u a r t .

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] parse function in date-fns returns one day previous value

Asit Prakash Asks: parse function in date-fns returns one day previous value
I am trying to parse date using date-fns library but getting one day previous as result. How can I avoid this and get the right result?

Code:
start = '2021-08-16'
const parseStart = parse(start, 'yyyy-MM-dd', new Date());

output:

Code:
2021-08-15T18:30:00.000Z

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Is there a way to change the page number in the TOC when inserting a PDF?

Austin Benny Asks: Is there a way to change the page number in the TOC when inserting a PDF?
At the beginning of my document, i insert a 3 page pdf. In the TOC, i reference the items in the aforementioned 3 page pdf. However, the page number beside the TOC is incorrect. Is there a way to change this page number. Here is a MWE

I import to LaTeX like this:

Code:
includepdf[pages=-]{resources/frontmatter.pdf}

Right now I am putting this after begin{document}

Code:
% add signature block stuff
addcontentsline{toc}{section}{Signature Block}
addcontentsline{toc}{section}{Record of Revision}
setcounter{page}{4}

then this is what my TOC shows:


TOC

I want the page number beside signature block and record of revision to be 2 and 3 respectively. I don’t care about whether the TOC hyperlinks to the Signature block or Record of revisions; just want to change the page numver.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Share: