10 Top Tourism APIs

Creating a tourism application can involve dozens of data sources. Developers may want to include maps, reviews, places of interest, transportation options, air travel booking, tour booking, weather reports, food and beverage choices and other information tourists can use.

Cache query result

I come across this problem every so often and end up having to do work arounds when I would prefer to keep it in the database. I have a query where the data in the query updates frequently so the query won't stay in the cache but I don't need the query to be accurate. I was trying to avoid adding an extra step of storing the data in a temp table and having to update it on a timer.

Does anyone know of a way to get MariaDB or MySQL to Keep the result set for a period of an hour or so before actually running the query again, I have an example of a query below which takes between 4.8-6 seconds to run and the wait is too long and also is needless work for the server, It can just do the query once and get the 4 numbers - then all subsequent requests just return the 4 numbers and every 20 minutes or 1 hour the 4 numbers get updated.

Is there a built in funtion for this or is the only solution to make your own table? I could end up with many of these and I don't want to end up with 100's

SELECT
    SUM(CASE WHEN p.id IS NULL AND f.loc = 1 THEN 1 ELSE 0 END)/250 to_print
    , SUM(CASE WHEN p.id IS NULL AND f.loc NOT IN(1,2,8) THEN 1 ELSE 0 END)/250 to_print_out
    , SUM(CASE WHEN p.id IS NOT NULL AND p.print_date BETWEEN '2020-01-09 14:00:00' AND '2020-01-16 14:00:00' THEN 1 ELSE 0 END)/250 printed_tw
    , SUM(CASE WHEN p.id IS NOT NULL THEN 1 ELSE 0 END)/250 printed
    FROM typist t
    LEFT JOIN printing p ON t.typed_id = p.print_id AND p.type = 4
    LEFT JOIN files f ON t.file_id = f.file_id
    WHERE
    t.type = 1
    AND f.file_id IS NOT NULL
    AND NOT EXISTS(SELECT DISTINCT l.id FROM letters l WHERE l.deleted = 1 AND t.letter_id = l.id)

This is the EXPLAIN for the query

"1" "PRIMARY"   "t" "ref"   "file_id,letter_type,print_stat"    "print_stat"    "2" "const" "134243"    "Using where; Using index"
"1" "PRIMARY"   "f" "eq_ref"    "PRIMARY"   "PRIMARY"   "3" "sys.t.file_id" "1" ""
"1" "PRIMARY"   "p" "ref"   "id,type"   "particle_id"   "8" "sys.t.typed_id"    "1" "Using where"
"2" "MATERIALIZED"  "l" "ref"   "PRIMARY,deleted,deleted_file_id"   "deleted"   "1" "const" "4741"  "Using index"

I have already had numerous variations to try optimising this and the above is the best I have got so far. t has around 200,000 rows, l has around 300,000, f has about 130,000, p has around 300,000 but will bloat well over 1,000,000 in time.

Why isn’t comment validation working?

I am trying to add Jquery validation to the comments page in WordPress. Everything works except it won't post the fields. May someone help?

FUNCTIONS PAGE

    function comment_validation_init() {
    if(is_single() && comments_open() ) { ?>

    <script type="text/javascript">

    jQuery(document).ready(function() {
jQuery('#commentform').bootstrapValidator({
    message: 'This value is not valid',
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        author: {
            validators: {
                    notEmpty: {
                        message: 'Please Enter Your Name'
                    }

            }
        },
        email: {
            validators: {
                    notEmpty: {
                        message: 'Please Enter Your Email'
                    },
                    emailAddress: {
                        message: 'This Is Not A Valid Email Address'
                }
            }

        },
        comment: {
            validators: {
                    notEmpty: {
                        message: "Don't Forget To Leave A Comment"
                    }
            }                
        }
    }
});
    });

    </script>

    <?php
}
}
add_action('wp_footer', 'comment_validation_init');

Comments page

    <?php foreach (get_comments() as $comment): ?> <ul class="uk-comment-list"> <li> <article class="uk-comment uk-visible-toggle" tabindex="-1"> <header class="uk-comment-header uk-position-relative"> <div class="uk-grid-medium uk-flex-middle" uk-grid> <div class="uk-width-auto"> <img class="uk-comment-avatar" src="images/avatar.jpg" width="80" height="80" alt=""> </div> <div class="uk-width-expand"> <h4 class="uk-comment-title uk-margin-remove"><a class="uk-link-reset" href="#"> <?php echo $comment->comment_author; ?> </a></h4> <p class="uk-comment-meta uk-margin-remove-top"><a class="uk-link-reset" href="#">12 days ago</a></p> </div> </div> <div class="uk-position-top-right uk-position-small uk-hidden-hover"><a class="uk-link-muted" href="#">Reply</a></div> </header> <div class="uk-comment-body"> <?php echo $comment->comment_content; ?> </div> </article> <?php endforeach;

    if ('open' == $post->comment_status) : ?> <div id="respond"> <h3><?php comment_form_title( 'Add a comment', 'Leave a Reply to %s' ); ?></h3> <div class="cancel-comment-reply"> <small><?php cancel_comment_reply_link(); ?></small> </div> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p>
        You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.
    </p> <?php else : ?> <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <p>
                Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>.
                <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out </a> </p> <?php else : ?> <div class="row"> <div class="form-group"> <div class="col-lg-12"><label class="control-label" for="author">Name</label></div> <div class="col-lg-5"><input class="form-control" name="author" id="author" value="" size="22" tabindex="1" type="text"></div> </div> </div> <div class="row"> <div class="form-group"> <div class="col-lg-12"><label class="control-label" for="email">Email</label></div> <div class="col-lg-5"><input class="form-control" name="email" id="email" value="" size="22" tabindex="2" type="text"></div> <span class="help-block col-lg-12">You're email address will not be published</span> </div> </div> <?php endif; ?> <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>--> <div class="row"> <div class="form-group"> <div class="col-lg-12"><label class="control-label" for="comment">Comment</label></div> <div class="col-lg-12"><textarea class="form-control" name="comment" id="comment" cols="100" rows="10" tabindex="3">