Portfolio items created indefinitely from external API. Every time different number

I am trying to make new portfolio item for every json item from external api. I am working on WordPress and placed my code in functions.php of the theme used. When i run my code, it creates portfolio items more than necessary. The items seem to randomly get duplicated even tho i have made validation statement and made sure that each post lug is unique. I want it to stop when the array in json file finishes. Unfortunately I can’t share the api link because it is not supposed to be open-source. It consists of one page. $ model and $ results get correct info. I am new to these WP functions and API thing and got really confused at this point. Hope someone can help me out!:

add_action('wp_ajax_nopriv_get_3dmodels_from_api', 'get_3dmodels_from_api'); add_action('wp_ajax_get_3dmodels_from_api', 'get_3dmodels_from_api');  function get_3dmodels_from_api(){          $  results = wp_remote_retrieve_body(wp_remote_get('<api-url-here>',  array(         'timeout'     => 120,         'httpversion' => '1.1',     ) ) );            $  results = json_decode($  results);     //print_r($  results);           foreach($  results->scenes as $  model) {                  $  model_slug = sanitize_title($  model->name. '-' . $  model->id);                  $  existing_model = get_page_by_path($  model_slug, 'OBJECT', 'portfolio');          if ($  existing_model === null) {              $  inserted_model = wp_insert_post([                 'post_name'=> $  model_slug,                 'post_title'=> $  model_slug,                 'post_type'=> 'portfolio',                 'post_status' => 'publish',             ]);                          if (is_wp_error($  inserted_model)) {                 return false;             }                      $  fillable = [                 'field_605dcef7001bc' => 'name',                 'field_605dcf01001bd' => 'description',                 'field_605dcf09001be' => 'category',                 'field_605dcf13001bf' => 'preview',             ];                          foreach($  fillable as $  key => $  name) {                 $  model_content = $  model->$  name;                                  if ($  name == 'preview') {                     $  model_content = '<img src=' . $  model->$  name . '" alt="">';                 }                                  update_field($  key, $  model_content, $  inserted_model);             }         }  wp_remote_post(admin_url ('admin-ajax.php?action=get_3dmodels_from_api'), [         'blocking' => false,         'sslverify' => false,     ]); } 

Thank you!

Can a level 16 draconic sorcerer maintain their dragon wings indefinitely?

Draconic sorcerers gain the focus spell Dragon Wings at 5th level:


When the spell is heightened to 8th level, "the duration increases to ten minutes."

If a sorcerer has a focus point at time T, and expends it by casting Dragon Wings, then when do they regain that focus point?

From https://2e.aonprd.com/Bloodlines.aspx :

You refill your focus pool during your daily preparations, and you can regain 1 Focus Point by spending 10 minutes using the Refocus activity. Unlike other characters, you don’t need to do anything specific to Refocus, as the power of the blood flowing through your veins naturally replenishes your focus pool.

Does this imply that the sorcerer can’t maintain their wings indefinitely, as (presumably) they would cast the spell in combat, and thus would have some time (e.g. a couple of rounds) where they weren’t engaged in the Refocus activity? I.e. they would start refocusing at some time T + x, where x > 0, and they would only regain the Wings at T + x + 10m ?

I want to say this is correct, but I also like the notion of the sorcerer gaining those wings for as long as they reduce their focus pool by 1, to ‘keep it up’. But I’d appreciate your thoughts.

Why does Min-Max algorithm delays a good move indefinitely?

I implemented a min-max algorithm for a game and discovered a problem.

Let’s say there is a 2×2 grid:

.. .. 

Assume we start at location (0, 0) and the target is (1, 1):

S. .T 

Moves allowed: adjacent or diagonal move.

Evaluation: if I land at (1, 1), I get +100.

If I implement the mini-max algorithm for this with depth 1, some of the branches are as follows:

(0, 0) -> (0, 1) -> (1, 1) Here, we return +100

(0, 0) -> (1, 0) -> (1, 1) Here, we return +100

(0, 0) -> (1, 1) -> (0, 1) Here, we return +0

If you look at this, the algorithm should actually play the 3rd branch and immediately go to (1, 1) but rather it would select 1st or 2nd branch. And after playing that move it will again go into the same situation and continue to select branches that have (1, 1) as the 2nd step.

How to solve this problem? My game has entered a kind of an infinite situation where it is just playing another move with the hope of playing good move at depth 1 but again does the same process and repeats this infinitely.

What would be the balance implications of a house rule allowing a readied spell to be held indefinitely?

As established by this question, readied spells can only be held until the beginning of your next turn.

What would the balance implications be if there were no upper limit on how long the spell’s energy could be held? Or if the upper limit were higher?

Can a PC activate a Broom of Flying and remain in flight indefinitely?

The Broom of Flying description includes

[…]you stand astride it and speak its command word. It then hovers beneath you and can be ridden in the air. It has a flying speed of 50 feet. […] The broom stops hovering when you land.

Assuming you have activated it, until or unless you land, could you remain in flight indefinitely?

Amazon Admits Alexa Voice Recordings Saved Indefinitely

Something Alexa users (or those considering getting Alexa) should be aware of:


Amazon’s acknowledgment that it saves Alexa voice recordings – even sometimes after consumers manually delete their interaction history – has thrust voice assistant privacy policies into the spotlight once again.

Amazon has acknowledged that it retains the voice recordings and transcripts of customers’ interactions with its Alexa voice assistant indefinitely. The admission raises questions about how long companies should be able to save highly-personal data collected from voice assistant devices.

After U.S. Senator Chris Coons (D-Del.) demanded Amazon outline its data privacy policies, Amazon in a letter that was publicly disclosed on Tuesday said that consumers have the option to delete their recordings – but even if they do, the company or third-party developers may still save records of customers’ interactions with Alexa.

Continued: Amazon Admits Alexa Voice Recordings Saved Indefinitely
July 3, 2019

arduino create online ide not working, loading indefinitely

I have an Arduino Mega 2560 microcontroller. It was working fine excellently, until about two days ago when I dual booted with Ubuntu 18.04 LTS on my windows 10 laptop. Since then the online Arduino create IDE has problems uploading code to my microcontroller… gives me this error every time, even on the desktop IDE. I have been looking for a solution for a long time now, nothing has worked.

Sketch uses 2812 bytes (1%) of program storage space. Maximum is 253952 bytes.

Global variables use 67 bytes (0%) of dynamic memory, leaving 8125 bytes for local variables. Maximum is 8192 bytes.

Programming with: Serial

Flashing with command:/home/sai/.arduino-create/arduino/avrdude/6.3.0-arduino14/bin/avrdude -C/home/sai/.arduino-create/arduino/avrdude/6.3.0-arduino14/etc/avrdude.conf -v -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:/tmp/arduino-create-agent634272836/lcd_and_ultrasonic.hex:i

avrdude: Version 6.3-20171130

Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is “/home/sai/.arduino-create/arduino/avrdude/6.3.0-arduino14/etc/avrdude.conf”

User configuration file is “/home/sai/.avrduderc”

User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyACM0

Using Programmer : wiring

Overriding Baud Rate : 115200

avrdude: ser_open(): can’t open device “/dev/ttyACM0”: Permission denied

ioctl(“TIOCMGET”): Inappropriate ioctl for device

ioctl(“TIOCMGET”): Inappropriate ioctl for device

Bash script to restart systemd unit ran as a cron job repeats indefinitely

I have a quick and dirty bash script to restart a running Minecraft server by passing some announcement messages to the screen instance running it and then restarting the systemd unit:

#!/bin/bash screen -p 0 -S minecraft -X eval 'stuff "say Automated server restart in 60 seconds."\015' sleep 30 screen -p 0 -S minecraft -X eval 'stuff "say Automated server restart in 30 seconds."\015' sleep 20 screen -p 0 -S minecraft -X eval 'stuff "say Automated server restart in 10 seconds."\015' sleep 5 screen -p 0 -S minecraft -X eval 'stuff "say Restarting server! We'"'"'ll be back shortly."\015' sleep 5 systemctl --user restart minecraft 

This script works as expected when ran outside cron, but when I create a cron job like this, the script will fail to restart the server, and will instead repeatedly send the announcement messages to the screen instance over and over again:

* 7 * * * /bin/bash /home/mine/minecraft/restartserver.sh 1> /home/mine/minecraft/restart_log.txt 2> /home/mine/minecraft/restart_err.txt 

What could be going on here? My best guess is that the systemctl command must be failing somehow, which causes cron to re-run the script from the top. This is a server running Debian 9.

How would I force app store to save my password indefinitely, rather than for 15 minutes?

I’d like to either force app store to save my password, or have it automatically entered (just for the mac app store password prompt) when it asks for my password. I want this because “require after 15 minutes” is far too limiting, since it’s a pain to get my password. How can I force app store to extend the duration of saving to indefinite, despite that it’s designed to save the password for 15 minutes?

Note that I know this isn’t the case for free apps. I want to purchase apps without having to enter my password. Is there a way to do this?

How to receive call and force that call to ring indefinitely to the caller but not the receiver

My ultimate goal is to handle incoming calls that are obviously robospam, in such a way so that the robocaller cannot detect that this is a valid phone number with a real human at the end (including voicemail). If the robospammer detects that it is a valid number, they will record it for future spams. So I want that number to ring and ring indefinitely, and not go to voicemail.

Most importantly, even if they have prior knowledge that I have picked up and hung up, or they left voice mail in previous attempts at reaching a live human at this phone number, I still want to send the call to the “ring indefinitely” state, and not go to voice mail, such that the caller hears the ringing, but the receiving phone stops ringing. The reason is that eventually the robospam problem has increased to the extent that, by my current practice off simply allowing all of them to go to voicemail (e.g., flipping the phone over to trigger the proximity sensor logic which then pushes it to voicemail), means that I have the ever increasing burden of listening and deleting the voicemails that are obviously spam. And that is a waste of time and distracting.

So, is there a way to configure a Samsung Galaxy Note 8, under the AT&T carrier, to allow me to ring indefinitely, and not go to voicemail, and not be answered with some automated message? I’m not interested in rooting the phone.

Various Contact and Phone Tools – Android App Overview – IzzyOnDroid has a listing of related apps, but none are exactly what I’m after.