Do I just put the html in a page when enqueueng or do I also have to reference js file from the html page

I am trying to get my javascript to work in my page, but I have always just put the html on the actual page, but now am wondering if I am supposed to put the <script src before the html as well to make the code work in order to reference the javascript. I have enqueued everything, the js and css from the functions.php Here it is:

<script src='https://artandleatherspencer.local/wp-content/themes/twentythirteen-child/js/myscript.js)  <div id="clockContainer">  <div id="hour"></div>  <div id="minute"></div>  <div id="second"></div>  </div> 

here is the code in the functions.php:

function childtheme_parent_styles() {     wp_enqueue_style('parent', get_template_directory_uri().'/css/style.css' );     wp_enqueue_style('mytheme_main_style', get_stylesheet_uri());     wp_register_script('main-js', get_stylesheet_directory_uri() . '/js/main.js');     if( is_page(507) ) {         wp_enqueue_script( 'main-js');     } }  add_action( 'wp_enqueue_scripts', 'childtheme_parent_styles'); 

and here the javascript in main.js in js folder

console.log('executing scripts.js');  setInterval(() => {     d = new Date(); //object of date()     hr = d.getHours();     min = d.getMinutes();     sec = d.getSeconds();     hr_rotation = 30 * hr + min / 2; //converting current time     min_rotation = 6 * min;     sec_rotation = 6 * sec;       hour.style.transform = `rotate($  {hr_rotation}deg)`;     minute.style.transform = `rotate($  {min_rotation}deg)`;     second.style.transform = `rotate($  {sec_rotation}deg)`; }, 1000);       

css: in style.css file

#clockContainer {     position: relative;     margin: auto;     height: 40vw;     /*to make the height and width responsive*/     width: 40vw;     background: url(clock.png) no-repeat;     /*setting our background image*/     background-size: 100%; }    #hour, #minute, #second {     position: absolute;     background: black;     border-radius: 10px;     transform-origin: bottom; }    #hour {     width: 1.8%;     height: 25%;     top: 25%;     left: 48.85%;     opacity: 0.8; }    #minute {     width: 1.6%;     height: 30%;     top: 19%;     left: 48.9%;     opacity: 0.8; }    #second {     width: 1%;     height: 40%;     top: 9%;     left: 49.25%;     opacity: 0.8; } 

How to store the chi-square values in a text file?

I am new to Mathematica. I have a 3×3 textfile 3.txt of numerical values. Each column corresponds to a,b,c respectively. I have a function f(d,e,f). I found the bestfit values for d, e, and f using Chimin, performing a chi-square analysis contrasting with data in my 3×3 textfile 3.txt. The code i created for the same is as follows

<< NumericalCalculus`  SetDirectory["C:/Users/vmsha/Downloads"];  data = ReadList["3.txt", {Number, Number, Number}]  ndata = 3;  Do[a[i] = data[[i, 1]], {i, 1, ndata}]  Do[b[i] = data[[i, 2]], {i, 1, ndata}]  Do[c[i] = data[[i, 3]], {i, 1, ndata}]  Chi[d, e, f] := Sum[((c[i]) - (d*e*f*a[i]))^2/b[i]^2, {i, 1, ndata}]  Chimin = FindMinimum[{Chi[d, e, f], -10 < d < 10, -10 < e < 10, -10 < f < 10}, {d, e, f}]  {0.0177074, {d -> 3.36069, e -> 0.929241, f -> 0.929241}} 

Now, I am interested in getting the whole 3 chi-square values evaluated using chi(d,e,f) in a single text file. Could anybody help?

Google’s Play Asset Delivery Build aab File in Unity too large

I want to upload an aab file from my unity project to my play console account, but unfortunately, my file was rejected because it’s size is larger than the 150MB threshold limit for aab on google play store.

Then while looking for a solution, I found out that obb files are now made obsolete and I could use google’s Play Asset Delivery system to upload my file. So then I followed the "not so clear" instructions on how to use the PAD system in Unity, I made an asset bundle that contains all my font asset(because that was what increased my aab from 120MB to 260MB), and added it to the Asset Delivery Settings in Unity and selected "Separate Base APK Asset". Then I built the aab file using PAD(by clicking Google > Build Android App Bundle), and my generated aab went from 260MB to 680MB.

Why did the size increase enormously? Isn’t the point of it to reduce the size on the aab so that it can be accepted by play? Am I missing something or have I done something wrong?

Is there any way I can defend against automated file download bots?

My company offers a very specifically tailored Android application to supplement our other software. Since users must have an account in our other software in order to use the Android application, is not useful to anyone who does not already subscribe to use our other software. Because of this, we are in a position to know exactly how many Android app users we should have.

We host the application file (.apk file) on our own website and direct our first-time users to download the application from there. After that, we have an automated update system built into the app that notifies the users that there is an update available and it and will update their app for them if they choose to accept the update.

We have very basic analytics in place on our website to monitor manual vs. automatic (update) downloads of our APK. We can see what file was downloaded at what time and by what IP address. After several months of manual and automated download analytics numbers that match up with our user count, we suddenly logged several hundred more manual downloads than we have users last month.

The download pattern I observed when investigating is that the same IP address is downloading the APK in bursts of 2-9 times all within the span of about a minute, and then within another minute or two another IP address does the same thing. This happened on and off for several days and I suspect there is some kind of bot/automated software that found our APK and is now downloading several copies of it for reasons I can’t currently comprehend.

I am hoping to find out if there exists some server configuration, 3rd-party technology, or even some kind of website programming technique we may be able to put into place to protect our site from this behavior? I don’t have reason to believe this "bot" is causing us any monetary or intellectual harm at this point in time, but if this continues it will certainly render our download analytics useless.

submit two file input fields in the same form

I have a form which has two file input fields, when I try to submit the form it takes only the first one and ignore the second one!

here is my form

<form method="POST" name="vendor_form" enctype="multipart/form-data">  <div class="mb-3" style="margin-bottom: 20px;">             <label for="file_metabox" class="form-label">file metabox</label>             <input class="form-control" type="file" id="file_metabox" name="file_metabox[]" multiple="multiple">         </div>         <div class="mb-3" style="margin-bottom: 20px;">             <label for="file_cert" class="form-label">file Cert</label>             <input class="form-control" type="file" id="file_cert" name="file_cert[]" multiple="multiple">         </div> <button type="submit" class="btn btn-primary" id="submit" name="submit">Submit</button> 

and here is the php

if (isset($  _FILES['file_metabox'])) {     $  file_metabox = $  _FILES['file_metabox'];     foreach ($  file_metabox['name'] as $  key => $  value) {         if ($  file_metabox['name'][$  key]) {             $  file = array(                 'name' => $  file_metabox['name'][$  key],                 'type' => $  file_metabox['type'][$  key],                 'tmp_name' => $  file_metabox['tmp_name'][$  key],                 'error' => $  file_metabox['error'][$  key],                 'size' => $  file_metabox['size'][$  key]             );             $  _FILES = array("file_metabox" => $  file);             foreach ($  _FILES as $  file => $  array) {                 // $  newupload = frontend_handle_attachment( $  file, $  post_success );                 if ($  _FILES[$  file]['error'] !== UPLOAD_ERR_OK) __return_false();                  require_once(ABSPATH . "wp-admin" . '/includes/image.php');                 require_once(ABSPATH . "wp-admin" . '/includes/file.php');                 require_once(ABSPATH . "wp-admin" . '/includes/media.php');                  $  attach_id = media_handle_upload($  file, $  post_success);                  add_post_meta($  post_success, 'file_metabox', $  attach_id);             }         }     }     } if (isset($  _FILES['file_cert'])) {     $  file_cert = $  _FILES['file_cert'];     foreach ($  file_cert['name'] as $  key => $  value) {         if ($  file_cert['name'][$  key]) {             $  file = array(                 'name' => $  file_cert['name'][$  key],                 'type' => $  file_cert['type'][$  key],                 'tmp_name' => $  file_cert['tmp_name'][$  key],                 'error' => $  file_cert['error'][$  key],                 'size' => $  file_cert['size'][$  key]             );             $  _FILES = array("file_cert" => $  file);             foreach ($  _FILES as $  file => $  array) {                 // $  newupload = frontend_handle_attachment( $  file, $  post_success );                 if ($  _FILES[$  file]['error'] !== UPLOAD_ERR_OK) __return_false();                  require_once(ABSPATH . "wp-admin" . '/includes/image.php');                 require_once(ABSPATH . "wp-admin" . '/includes/file.php');                 require_once(ABSPATH . "wp-admin" . '/includes/media.php');                  $  attach_id = media_handle_upload($  file, $  post_success);                  add_post_meta($  post_success, 'file_cert', $  attach_id);             }         }     } } 

metabox upload multiple file

I have upload multiple file metabox, my problem is I need to display all files links attached to this post inside the post editor. when i upload the files it is already saved under the media but the links are not showing!! please note that in frontend form the links displayed normally!

 add_meta_box(     'file_metabox', // metabox ID     'File Upload', // title     'file_metabox_callback', // callback function     'job', // post type or post types in array     'normal', // position (normal, side, advanced)     'default' // priority (default, low, high, core) );        function file_metabox_callback($  post) {      wp_nonce_field(basename(__FILE__), 'file_metabox_nonce');          // here is my problem!!!      $  args = array(         'post_type' => 'attachment',         'post_parent' => $  post->ID     );      echo '<ul>';     foreach (get_posts($  args) as $  image) {         echo '<li><a href="' . wp_get_attachment_url($  image->ID) . '" target="_blank">' . basename(get_attached_file($  image->ID)) . '</a></li>';     }     echo '</ul>';      echo '<form method="POST" name="vendor_form" enctype="multipart/form-data">';     echo '<input class="form-control" type="file" id="file_metabox" name="file_metabox[]" multiple="multiple">';     echo '</form>'; }  function file_save_meta($  post_id, $  post) {      // nonce check     if (!isset($  _POST['_mishanonce']) || !wp_verify_nonce($  _POST['_mishanonce'], 'somerandomstr')) {         return $  post_id;     }      // check current use permissions     $  post_type = get_post_type_object($  post->post_type);      if (!current_user_can($  post_type->cap->edit_post, $  post_id)) {         return $  post_id;     }      // Do not save the data if autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return $  post_id;     }      // define your own post type here     if ($  post->post_type != 'job') {         return $  post_id;     }          if ($  _FILES) {         $  files = $  _FILES["file_metabox"];         foreach ($  files['name'] as $  key => $  value) {             if ($  files['name'][$  key]) {                 $  file = array(                     'name' => $  files['name'][$  key],                     'type' => $  files['type'][$  key],                     'tmp_name' => $  files['tmp_name'][$  key],                     'error' => $  files['error'][$  key],                     'size' => $  files['size'][$  key]                 );                 $  _FILES = array("file_metabox" => $  file);                 foreach ($  _FILES as $  file => $  array) {                     // $  newupload = frontend_handle_attachment( $  file, $  post_success );                     if ($  _FILES[$  file]['error'] !== UPLOAD_ERR_OK) __return_false();                      require_once(ABSPATH . "wp-admin" . '/includes/image.php');                     require_once(ABSPATH . "wp-admin" . '/includes/file.php');                     require_once(ABSPATH . "wp-admin" . '/includes/media.php');                      $  attach_id = media_handle_upload($  file, $  post_success);                                           add_post_meta($  post_id, 'file_metabox', $  attach_id);                     update_post_meta($  post_id, 'file_metabox', $  attach_id);                 }                 return $  attach_id;             }         }     }      return $  post_id; }   

and here is the function of the frontend form which is working perfectly!

add_action('init', 'vendor_new_post');  function vendor_new_post($  post_id) {      if (isset($  _POST['submit_seo']) || isset($  _POST['vendor_file_flag'])) {           $  first_name = sanitize_text_field($  _POST['submitted_first_name']);         $  seo_title = sanitize_text_field($  _POST['submitted_seo_title']);         $  seo_robots = sanitize_text_field($  _POST['submitted_seo_robots']);          $  vendor_post = array(             'post_type' => 'job',             'post_title' => $  first_name,             'post_status' => 'publish',             'meta_input' => array(                 'first_name' => $  first_name,                 'seo_title' => $  seo_title,                 'seo_robots' => $  seo_robots              )         );          $  post_success = wp_insert_post($  vendor_post);         update_post_meta($  post_id, 'file_metabox_callback', $  post_success);          if ($  _FILES) {             $  files = $  _FILES["vendor_file"];             foreach ($  files['name'] as $  key => $  value) {                 if ($  files['name'][$  key]) {                     $  file = array(                         'name' => $  files['name'][$  key],                         'type' => $  files['type'][$  key],                         'tmp_name' => $  files['tmp_name'][$  key],                         'error' => $  files['error'][$  key],                         'size' => $  files['size'][$  key]                     );                     $  _FILES = array("vendor_file" => $  file);                     foreach ($  _FILES as $  file => $  array) {                         // $  newupload = frontend_handle_attachment( $  file, $  post_success );                         if ($  _FILES[$  file]['error'] !== UPLOAD_ERR_OK) __return_false();                          require_once(ABSPATH . "wp-admin" . '/includes/image.php');                         require_once(ABSPATH . "wp-admin" . '/includes/file.php');                         require_once(ABSPATH . "wp-admin" . '/includes/media.php');                          $  attach_id = media_handle_upload($  file, $  post_success);                                                  update_post_meta($  post_success, 'file_metabox', $  attach_id);                     }                 }             }         }     } } 

i am trying to run the powershell script to get disk report for servers from text file but getting error

$  DiskSizeReport = @() $  servers = get-content "D:\Testing\Serverlist.txt" foreach ($  server in $  servers) { write-host "Executing query against server: " $  server $  Disks = Get-WmiObject win32_logicaldisk -computername $  server -Filter "Drivetype=3" -ErrorAction SilentlyContinue | Select-Object @{Label = "Server Name";Expression = {$  _.SystemName}}, @{Label = "Drive Letter";Expression = {$  _.DeviceID}},@{Label = "Total Capacity (GB)";Expression = {"{0:N1}" -f( $  _.Size / 1GB)}}, @{Label = "Used Space (GB)";Expression = {(Round($  _.Size /1GB,2)) - (Round($  _.FreeSpace /1GB,2))}}, @{Label = "Free Space (GB)";Expression = {"{0:N1}" -f( $  _.Freespace / 1GB ) }},@{Label = "Free Space (%)"; Expression = {"{0:P0}" -f ($  _.freespace/$  _.size) }} $  DiskSizeReport += $  Disks }    # Output to CSV   write-host "Saving Query Results in CSV format..." $  results | export-csv  "D:\Testing\Diskreport.csv"   -NoTypeInformation 

The below error I am getting

Get-WmiObject : Cannot validate argument on parameter ‘ComputerName’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:6 char:56

How do you make a webhook to get elementor form entry data and use it to modify the dowload URL of a file in woocommerce?

I am a beginner so hopefully someone can help me. I want to edit the download URL of a product based on any specific field in the form entry of elementor pro.

I used the filter code below to set up the change in the URL, but I don’t know how to get any data that was filled in the form in the function ([ELEMENTOR FORM FIELD]).

function filter_function_name_3287( $  file_path, $  that, $  download_id ){     $  file_path = '/wp-content/uploads/elementor/pdf/' . '[ELEMENTOR FORM FIELD]' . '.pdf';     return $  file_path;     } 

If it’s not possible to link it to the form, could I use the current user ID or name? and how?

PostgreSQL: Using the .pgpass file

I have been reading up on the .pgpass file, but I can’t get it working for me.

My .pgpass file looks something like this:

127.0.0.1:5432:accounts:fred:p@55w0rd 

I set the privilege to 0600 (this is on CentOS Linux) and try:

psql 

Where I get the message:

psql: error: FATAL: database "…" does not exist

where is my user name.

I can successfully connect if I use:

psql -u … -d accounts 

so I don’t think my .pgpass file is doing its job.

How can I get it to work?