C++ merge sort code

#include <iostream> #include <vector> using namespace std;  void merge(vector<int>& arr,int start,int mid, int end) {     vector<int> temp;     int ptr1 = start;     int ptr2 = mid+1;     while(ptr1 <= mid && ptr2 <= end) {         if(arr[ptr1] <= arr[ptr2]) {             temp.push_back(arr[ptr1++]);         } else if (arr[ptr1] > arr[ptr2]) {             temp.push_back(arr[ptr2++]);         }      }     while (ptr1 <= mid) {         temp.push_back(arr[ptr1++]);     }     while (ptr2 <= end) {         temp.push_back(arr[ptr2++]);     }     for(int i=start;i<=end;i++) {         arr[i] = temp[i];     } }  void mergeSortHelper(vector<int>& arr,int start, int end) {     if (start>=end) {         return;     }     int mid = (start+end)/2;     mergeSortHelper(arr,start,mid);     mergeSortHelper(arr,mid+1,end);     merge(arr,start,mid,end);     }  void mergeSort(vector<int>& arr, int sz) {     return mergeSortHelper(arr,0,sz-1); }   int main() {     vector<int> arr{2,4,1,3};     mergeSort(arr,4);     for(int i=0;i<arr.size();i++){         cout<<arr[i]<<" ";     }     return 0; } 

Can someone review this code please? I have written an implementation of merge sort and it does not seem to work for below case.

Is it possible to securely run user defined python code in AWS?

I would like to create an app that accepts users python scripts and executes them as part of its functionality. What I am wondering is if its possible to block I/O, network and other attack vectors so I can have some confidence my AWS resources/account won’t be compromised?

Or if I isolate the process into a linux user account with few permissions would that be good enough?

Or is my best bet trying to adopt it to something like Brython or Jupyter to have it run in the browser and rely on those libraries for security?

I know there are companies like Codility that SEEM to do this successfully. However I know of others like Quantopian, that have been hacked. I apologize I don’t have a lot of experience with this type of issue.

What is an efficient method to convert Windows MS Access database files, code, forms, etc. to Mac FileMaker Pro

As much as possible, I need to convert Windows Access forms (entry screens, reports), tables and code to FileMaker Pro. The databases need to be brought over to Mac from an older Windows computer and updated going forward.

Note: A similar question was asked many years back with most recent updates in 2014. As much time has passed, I am checking for possible new information. How to port an Access database to the Mac?

Getting prompted for verification code but where do I put it in?

I am using an old iPad — it’s an iPad 2 model MC990LL/A — running iOS 9.3.5 I noticed when I go to settings –> iCloud and tap the top part where my name and ID is, I get this:

Account Details Unavailable

If you are signing in to iCloud on another device or at iCloud.com, you can get a verification code while offline.

I tap “Get verification code” and it sends one — but where do I put it in? I saw the answers that said to tack it onto the end of your password but there’s no password prompt!

I wanted to add my iPad to my list of trusted devices (my phone and computer are there) but there does not seem to be a way to do it.

Any help appreciated.

Pivotal tracker story is not getting updated after code push

We had pivotal tracker integrated with GitHub and when we used to commit with story id, it used to update the story with a commit message update story status.

We recently migrated to Team Foundation Server from GitHub and that integration is not working anymore.

Looks like there is no integration App exists yet.

Is there a programmatic way of doing it?

How can I change this javascript so it does target my code for this Ajax filter?

I want an Ajax filter for my WordPress catagories. The script I show here is targeting a select dropdown, but I want to have some buttons instead. My Javascript knowledge isn’t 100%, so I don’t know how I can change some to be able to use buttons instead of the dropdown. Can you help me out here?

I tried to change the html code to input:radio, and then change the javascript to onclick, but it doesn’t work. The filter keeps showing all. The only way it works is with the dropdown. The script I used was found on http://dominykasgel.com/ajax-posts-filter/

The Javascript I used.

jQuery( ".js-category, .js-date" ).on( "change", function() {         var category = $  ( '.js-category' ).val();         var date = $  ( '.js-date' ).val()         data = {             'action': 'filterposts',             'category': category,             'date': date         };         $  .ajax({             url : ajaxurl,             data : data,             type : 'POST',             beforeSend : function ( xhr ) {                 $  ('.filtered-posts').html( 'Laden...' );                 $  ('.js-category').attr( 'disabled', 'disabled' );                 $  ('.js-date').attr( 'disabled', 'disabled' );             },             success : function( data ) {                 if ( data ) {                     $  ('.filtered-posts').html( data.projecten );                      $  ('.js-category').removeAttr('disabled');                     $  ('.js-date').removeAttr('disabled');                 } else {                     $  ('.filtered-posts').html( 'Helaas, er zijn geen projecten gevonden.' );                 }             }         });     }); 

The php code I used for the functions.php

 function ajax_filterposts_handler() {       $  category = esc_attr( $  _POST['category'] );       $  date = esc_attr( $  _POST['date'] );        $  args = array(            'post_type' => 'projecten',            'post_status' => 'publish',            'posts_per_page' => -1,            'orderby' => 'date',            'order' => 'DESC'       );        if ( $  category != 'all' )            $  args['cat'] = $  category;        if ( $  date == 'new' ) {            $  args['order'] = 'DESC';       } else {            $  args['order'] = 'ASC';       }        $  posts = 'Helaas, er zijn geen projecten gevonden.';        $  the_query = new WP_Query( $  args );        if ( $  the_query->have_posts() ) :            ob_start();             while ( $  the_query->have_posts() ) : $  the_query->the_post();                 get_template_part( 'includes/content-post' );            endwhile;             $  posts = ob_get_clean();       endif;        $  return = array(       'projecten' => $  posts       );        wp_send_json($  return); } add_action( 'wp_ajax_filterposts', 'ajax_filterposts_handler' ); add_action( 'wp_ajax_nopriv_filterposts', 'ajax_filterposts_handler' ); 

The code for in the archive.php file:

<div class="filter-wrap">     <div class="category">         <!-- <div class="field-title">Category</div> -->         <?php $  get_categories = get_categories(array('hide_empty' => 0)); ?>         <select class="js-category">             <option value="all">alles</option>             <?php                 if ( $  get_categories ) :                      foreach ( $  get_categories as $  cat ) :             ?>                      <option value="<?php echo $  cat->term_id; ?>">                          <?php echo $  cat->name; ?>                      </option>                 <?php endforeach;                           endif;                      ?>         </select>     </div> </div>  <div class="filtered-posts"> <?php  if ( have_posts() ) :     while ( have_posts() ) : the_post();         get_template_part( 'includes/content-post' );     endwhile; endif;  ?> </div> 

The code for my content-post.php:

<article id="post-id-<?php the_id(); ?>" <?php post_class('clearfiks archive-projecten'); ?>>     <a href="<?php the_permalink() ?>"><h3><?php the_title(); ?></h3> </article> 

Метод execute vk возвращает Runtime error occurred during code invocation: too many operations

Прошу помощи с ошибкой too many operations. В параметре code пытаюсь делать не более 25 запросов к методу groups.getMembers. В группах до 1000 участников работает, а где более 1000 падает ошибка. Python 3.7.

`def all_members_from_group(self, group_name, cnt):             tk = 'token'             code = '''                 var step='''+str(cnt)+''';                 var members=[];                 var count = 0;                   var i = 0;                 while (i < 25 && step <= count) {                     var c = API.groups.getMembers({group_id:'''+str(group_name)+''',offset:step+1000*i});                     var member_id = c.items;                     count = c.count;                     var len_m = member_id.length;                     var j = 0;                     while (j < len_m) {                         members.push(member_id[j]);                         j = j + 1;                     }                     i = i+1;                            }                 return members;                 '''             code = urllib.parse.quote(code, safe='/', encoding='utf-8', errors=None)             try:                 r = requests.get('https://api.vk.com/method/execute?code='+code+'&access_token='+tk+'&v=5.92')                 a = r.json()              except Exception as exc:                 text = str(exc)                 if 'limit' not in text:                     time.sleep(3)                     return                 else:                     raise              for member_id in a['response']:                 yield member_id             time.sleep(3) ` 

Java Source Code for Constrcuting Buchi Automata from LTL formulas [on hold]

I am looking for a java implementation of constructing nondeterministic B\”uchi automata from linear temporal logic formulas. I tested several ones, but none of them worked for me. For example:

1) LTL2BA4J, which is a java interface for LTL2BA implemented in C, does not work duo to that LTL2BA cannot be executed. Besides, I need something fully implemented in java.

Problem to structure code permissions (ACL) [migrated]

I have a problem here to structure the code to validate the permissions.

Let’s suppose I have three actions: read:own_users, read:my_users, read:all_users.

And I have a route get/users.

I want this route returning all users if the guy which is doing the request have read:all_users. But if he only have read:my_users permission, this route should return just the users that this guy inserted. And the last possibility, if the user just have read:own_users permission, I wants this route returning just your own object.

So, what I want to solve is: How to do that without doing a switch case in my code for every route putting a where in my SQL.

Or maybe I’m doing this by the wrong way and I need to plan all the stuff trying a new strategy.