NDSolve How do I insert another boundry condition

So I’m new to programming and I am trying to solve a very simple differential equation (i can do this by hand but the thing is i can’t program it), the equation is a'[t] == - 0.0118, with the boundary conditions a[0]==3 and I want to know a[180]=?, how do I insert this (a[180]=?) into the code, this is my short code.

Sol = NDSolve[{a'[t] == -0.0118 , a[0] == 3 }, a, {t, 0, 180}] Plot[Sol, {t, 0, 180}]  

It doesn’t show anything in the plot

Thanks a lot, any type of help will be appreciated

Insert custom data to custom table on wordpress database

i need some help here

i wanna create some form for user to subscribe our article and store the data to database. i have tried to search it on google, but nothing worked when i tried that. i know that some plugin can do that but i dont know how to create the validation when user already subscribed and the form never show again.

how do i do to insert the data to my database? hope you guys understand what the problem and any help will appreciate

thank you

here is my code

the form

                    <form action="<?php echo site_url() . '/insert-data.php'; ?>" method="POST" name="form-subscribe">                         <div class="row">                             <div class="col-12 col-lg-12 col-md-12">                                 <p>Name*</p>                                 <input type="text" name="subs_name" placeholder="Full Name*" required="">                                                            </div>                         </div>                         <div class="row mt-3">                             <div class="col-12 col-lg-12 col-md-12">                                 <p>Email*</p>                                 <input type="text" name="subs_email" placeholder="Email Address*" required="">                                                           </div>                         </div>                         <div class="row mt-3">                             <div class="col-12 col-lg-12 col-md-12">                                 <p><button type="submit" class="btn btn-primary" name="submitForm">Submit</button></p>                             </div>                         </div>                     </form> 

the action file aka insert-data.php

<?php      //setting up the form     function insertuser() {        $  name   = $  _POST['subs_name'];       $  email  = $  _POST['subs_email'];          global $  wpdb;        $  table_name = $  wpdb->prefix . "subscriber";       $  wpdb->insert($  table_name, array('subs_name' => $  name, 'subs_email' => $  email) );       }  if( isset($  _POST['submitForm']) ) insertuser();  ?> 

Here is the table of wp_subscriber enter image description here

insert an HTML element if there is a submenu only

I am trying to insert an HTML element "an arrow or a checkbox" to make use of the "checkbox technique" so I can use it to expand the submenu "only if submenu is there" when checked. my question is: how to insert this HTML element if there is a "sub-menu" class only or only when the list < li> has a class "menu-item-has-children" then insert this HTML element.

I have tried to hook on 2 filters: nav_menu_css_class and wp_nav_menu_items but didn’t succeed.

I have also tried to add this element when calling the menu:

wp_nav_menu(array(  'theme_location' => 'main-menu',  'depth'          => 0,  'menu_class'     => 'topNav-List',  'menu_id'        => 'topNL',  'after'          => ' <label for="dropDown" class="btn-dropdown"></label>                        <input class="dropdown-open" type="checkbox" id="dropDown"/>                        <label for="dropDown" class="dropdown-overlay"></label>' )); 

but it will add this checkbox to all list items, which I don’t want at all.

Ajax contact form widget plugin data not insert in database

I have been working at this for weeks without success. I’ve figured out problem after problem with the code, but none of the corrections seem to fix my core problem. The form doesn’t insert anything into the database and I don’t know why. all my data’s passed in the ajax call but it doesn’t insert in the data in the database.

I’m new to ajax and to WordPress plugins so I might be missing something obvious. Please help me know where I am going wrong. Thanks in advance.

My widget form plugin code

public function widget( $  args, $  instance ) {       if ( ! isset( $  args['widget_id'] ) ) {          $  args['widget_id'] = $  this->id;                  }          $  title = ( ! empty( $  instance['title'] ) ) ? $  instance['title'] : __( 'Contact' );          $  title = apply_filters( 'widget_title', $  title, $  instance, $  this->id_base );                            ?>     <?php         if ( $  title ) {            echo '<h2 class="widget-title">'.$  args['before_title'] . $  title . $  args['after_title'].'</h2>';                    }        ?>      <form  class="form-group" method="POST" id="form" action="">         <label>Name</label><br>         <input class="form-control" type="text" id="name" name="name" ><br>         <label>Mobile</label><br>         <input type="text" class="form-control" id="mobileno" name="mobileno" required><br>         <label>Email</label><br>         <input class="form-control"  type="email" id="email" name="email" ><br>         <label>Message</label><br>         <textarea class="form-control" id="message" name="message"  maxlength="10" onKeyPress="lengthcheck()"></textarea><br><br>         <button  class="btn btn-warning" type="submit" id="submit">Send Message</button>     </form> <?php }    

This is my enqueue methods:

add_action( 'wp_enqueue_scripts', 'vs_con_enqueue_scripts' );  function vs_con_enqueue_scripts(){  wp_register_script(     'ajaxHandle',     plugins_url('valid.js', __FILE__),     array('jquery'),     false,     true   );  wp_enqueue_script( 'ajaxHandle');  wp_localize_script(     'ajaxHandle',     'ajax_object',     array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) )   );  wp_enqueue_style( 'bootstrap-style','https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );  }   add_action( "wp_ajax_contact", "vs_contact_form" ); add_action( "wp_ajax_nopriv_contact", "vs_contact_form" );   function vs_contact_form(){     global $  wpdb;         $  name = $  _POST["name"];        $  email = $  _POST["email"];        $  mobileno = $  _POST["mobileno"];        $  messsage = $  _POST["messsage"];                $  tablename = $  wpdb->prefix.'contactdetails';        $  insert_row = $  wpdb->insert(           $  tablename,             array(                 'name' => $  name,                 'email' => $  email,                 'mobileno' => $  mobileno,                'messsage' => $  messsage             )          );            // if row inserted in table         if($  insert_row){            echo json_encode(array('res'=>true, 'message'=>__('Message Sent Successfully')));        }else{           echo json_encode(array('res'=>false, 'message'=>__('Something went wrong. Please try again later.')));        }        wp_die(); }  

Here this is my form submit jquery ajax call function

valid.js

jQuery(document).ready(function($  ){     $  ('form#form').on('submit', function(e){        e.preventDefault();        var name =jQuery('#name').val();        var email = jQuery('#email').val();        var mobileno = jQuery('#mobileno').val();        var message = jQuery('#message').val();        debugger;        var text;        if(name.length < 5){          text = "Please Enter valid Name";         alert(text);          return false;        }        if(isNaN(mobileno) || mobileno.length != 10){          text = "Please Enter valid mobileno Number";          alert(text);          return false;        }        if(email.indexOf("@") == -1 || email.length < 6){          text = "Please Enter valid Email";          alert(text);          return false;        }                $  .ajax({           url: ajax_object.ajaxurl,           type:"POST",           dataType:'json',           data: {              action:'contact',              name: name,              email: email,              mobileno: mobileno,              message: message         },   success: function(data){             if (data.res == true){                 alert(data.message);    // success message             }          }, error: function(data){             if (data.res == false){                 alert(data.message);    // success message             }            }        });     $  ('#form')[0].reset();       });     });  

please help me to find out where I am wrong?

Disk space efficient foreign key index for insert intensive scientific database?

I’m working tuning a scientific database whose associated simulation is very insert intensive (i.e., run for a long time inserting data, execute summary query at the end). One of the tables is starting to cause some problems since the table size is 235 GB with index sizes of 261 GB, and the server only has 800 GB so we would like to free up a bit of space.

Currently there is one foreign key reference (integer data) that is stored as a clustered b-true. This has been good for the summary queries, but likely isn’t helping the disk space issues.

Is there a more disk efficient way of storing this foreign key index? Would it make sense to switch over to a hash index instead of the b-tree index?

Improving: Insert up to X verified links from project

The “Insert up to X verified links from project” function is excellent, however, when i choose 10 for example, all 10 url anchors are the same! For example, all 10 URLs created in the article are different, but all have the same anchor “plumber Detroit”. This looks quite suspicious, and can be quite a fo0tprint. 

So, if possible, can we have randomised keywords from the Keywords section? So if I have 10 URLs in a single article created, then maybe it uses 10 different keywords. This way, it looks more natural.

Ensuring relationship between child tables exists prior to SQL insert

I have a situation where I have three tables: user, assignment and test. A user must have completed an assignment before he can take the test. This means the test table has both both a user foreign key and an assignment foreign key on it.

I could write a sql statement like this: insert into test (name, user_id, assignment_id) values ("final exam", 1, 1) which would check to see if the user and assignment exist before doing the insert. However it would not check to see if the user and assignment were related.

The easy way to solve this problem is to do a separate query before the insert to ensure the user has an assignment. I’m wondering if I can accomplish both in one query though. I’m not all that experienced with constraints or subqueries, both of which could be solutions. Looking for a best practice here as it will be used throughout an application.

How can I carry out SQL insert injection when there’s a select statement beforehand

So here’s the deal. I’ve been working on an SQL injection challenge and here’s what comes up.

There’s a registration page where you input your Username, password and confirm password. It’s vulnerable to INSERT SQL injection, I’m basically trying to insert my own data and make myself and admin (admin=1). However, there is a SELECT statement before the INSERT statement that checks if the username exists in the database. The problem is, if I try inserting data with SQL injection, the SELECT statement will fail and will generate an error, and the INSERT statement will never be executed.

I’ve made an in-a-nutshell PHP code to show you how it works.

<?php     $  username = $  _POST['username'];     $  password = md5($  _POST['password']);      $  sql = mysqli_query("SELECT * FROM users WHERE username = '$  username';");     if(mysqli_num_rows($  sql) > 0 || !$  sql) {         // this code will be run if the username already exists OR an SQL error in the query above.     }     else {         $  sql = mysqli_query("INSERT INTO users (`id`,`username`,`password`,`admin`) VALUES (NULL,'$  username','$  password',0);");     } ?> 

So the thing is, if I tried signing up with the username "admintest','password',1);-- " which should in theory INSERT myself into the database as an admin, here comes the problems.

The problem, is the SELECT query. Watch what happens.

SELECT * FROM users WHERE username = 'admintest','password',1);-- '; 

This of course is a syntax-error, and as we saw by the code I provided above, an IF statement will confirm that the SQL query was a syntax error, and the INSERT statement will NEVER run.

In an ideal world, this should happen in the INSERT statement, which will insert me as an ADMIN.

INSERT INTO users (`id`,`username`,`password`,`admin`) VALUES (NULL,'admintest','password',1);-- ','password',0); 

I’ve tried to work out something that doesn’t generate a syntax error on the SELECT, and also INSERTs the data I want to insert. Would be appreciated if anyone could help out 🙂

How to insert text in Table

I have

Table[{i^2, "mod",  i + 1, "=", Mod[i^2, i - 1]}, {i, 3, 4}] 

which gives me

{{9, mod, 4, =, 1}, {16, mod, 5, =, 1}} 

But I want to get

{{9 mod 4 = 1}, {16 mod 5 = 1}} 

How can I get rid of the commas in the output? I can drop the first comma in Table after i^2 but when dropping other commas things get messy. What am I doing wrong? What are the rules? I can’t find anything in Help.

wp insert post not working

my wp insert post not working. In post_title and post_name he not save the variable. So at place of Service + variable , i get only "Service", why?

function mic_create_new_page() {     global $  user_ID;         $  new_post = array(             'post_title' => 'Service ' . $  secteur,             'post_content' => '[makeitseo-keyword]',             'post_status' => 'publish',             'post_date' => date('Y-m-d H:i:s'),             'post_author' => $  user_ID,             'post_type' => 'page',             'post_name' => $  slugmic         );     global $  wpdb;     $  tableau_post = array ();     $  tableau_post = mic_stock_in_array($  tableau_post); $  res = $  wpdb->get_results('select * from wp_secteurs');   foreach ( $  res as $  ville ) {     $  id = $  ville->id_secteurs;     $  secteur = $  ville->libelle;     $  slugmic = strtolower(str_replace(" ","-",$  secteur))."-s". $  id ;      if(!in_array(normalize($  slugmic), $  tableau_post))         $  post_id = wp_insert_post($  new_post);              } 

}