macos – How can I make rsync run through cron on Catalina?

Despite relying on two Time Capsules and two wired-disk Time Machine backups, I still like to backup hourly just one folder in my home directory (source code files, etc), which is particularly useful when I’m away from home.

~/ > crontab -l
45 * * * * /usr/bin/rsync -av --delete-after  /Users/john/current  /Volumes/Kingston64/

This worked fine from Tiger to High Sierra.

Now Catalina introduced a new “Full Disk Access”. Adding both /usr/bin/rsync and /usr/sbin/cron is necessary to complete this cron job.

But the backups are still not happening, and no email is sent to confirm either way (whether success or failure).

How can I make rsync run through cron on Catalina?

performance – Trying to find a way to optimize a script that takes a really long time to run

I was wondering if it is possible to speed up this script? The source file has 90,000 rows, and it has to create a separate forecast for 1200 unique dealers using fbprophet. I’m new to python so I’m not sure if there is something obvious I’m missing, or if it’s just going to have to take a really long time. If any sees a simple solution that would speed it up, I would appreciate any insight. Thank you

Additional details about code:
The code takes a CSV file that has 3 columns(Month, Dealer, and Sales) and creates a filter essentially for each unique dealer name, and then uses Fbprophet to forecast the future results of each dealer. Then it combines all the information in a CSV file. It’s 90,000+ rows of data typically, and normally 1200 unique dealers that need to be forecasted. The historical data is 7 years of history.

from pandas import read_csv
from pandas import to_datetime
from pandas import DataFrame


from fbprophet import Prophet
from matplotlib import pyplot
import pandas as pd
# load data
data = read_csv(X.csv', header=0)
# prepare expected column names
data.columns = ('ds','Dealer', 'y')
data('ds')= to_datetime(data('ds'))

results = pd.DataFrame()

for dealer in data('Dealer').unique():
    df_filtered = data(data('Dealer')==dealer)
    prophet_df = data(('ds', 'y'))
    # define the model
    model = Prophet()
    # fit the model
    model.fit(prophet_df)
    # define the period for which we want a prediction
    future = list()
    for h in range(11, 13):
        date = '2020-%02d' % h
        future.append((date))
    for i in range(1, 13):
        date = '2021-%02d' % i
        future.append((date))
    for j in range(1, 13):
        date = '2022-%02d' % j
        future.append((date))
    for k in range(1, 13):
        date = '2023-%02d' % k
        future.append((date))
    future = DataFrame(future)
    future.columns = ('ds')
    future('ds')= to_datetime(future('ds'))
    # use the model to make a forecast
    forecast = model.predict(future)
    forecast('Dealer') = dealer
#     forecast.head(5)
    results = results.append(forecast)

results.to_csv('X1.csv')

```

composer – How to make laravel run automatically each time I open a new terminal?

I came from windows to Ubuntu and tried to install laravel following link https://laravel.com/docs/5.0 I ended with the installer 1.4…. I don’t recall which one so I decided to use

composer global require "laravel/installer"

I ended with the installer 4.1.1 but if I close the terminal and open it again and run laravel it does not find the command. I found the following command searching for a solution PATH="~/.config/composer/vendor/bin:$PATH" I have to run this each time for the laravel command to work. Is there a permanent solution? I’m new to linux and I’m having so many issues and could not find a solution. I plan to update laravel but I cannot even get this running properly. Is there a better way? and would this affect my current project if I don’t run the mentioned command?

macos – How do I run XCode after a factory reset?

I have a Macbook Pro. It is about 3 years old. I just did a factory reset, because it was bugging out.

I am trying to install XCode, but it says I need to have MacOS 10.15. I have version 10.12, and I see no option to update to 10.15. (I just updated, and there are no more updates available.)

How do I get XCode installed? Is there an older version I can use? Is there a way to update to MacOS 10.15?

Not sure what I am missing here…

Every time I run my application in android studio it opens a white page

I am using the android studio to build an application. I did my login and signup page and connected them together but every time I try to open the signup page from my main page it opens a white page. this is the code for Signup page

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:app=”http://schemas.android.com/apk/res-auto”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
tools:context=”.SignUp”>

<View
    android:id="@+id/view3"
    android:layout_width="wrap_content"
    android:layout_height="150dp"
    android:background="@color/colorPrimary"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<View
    android:id="@+id/view6"
    android:layout_width="0dp"
    android:layout_height="100dp"
    android:background="@drawable/wave"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/view3" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="163dp"
    android:layout_height="96dp"
    android:layout_marginTop="36dp"
    android:text="@string/create_account"
    android:textColor="#FFFFFF"
    android:textSize="30sp"
    android:textStyle="bold"
    app:layout_constraintEnd_toEndOf="@+id/view3"
    app:layout_constraintHorizontal_bias="0.129"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<ImageView
    android:id="@+id/imageView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    android:layout_marginEnd="16dp"
    android:layout_marginRight="16dp"
    app:layout_constraintEnd_toEndOf="@+id/view3"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/ic_person"
    tools:ignore="ContentDescription" />

<EditText
    android:id="@+id/textName"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="32dp"
    android:layout_marginLeft="32dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="32dp"
    android:layout_marginRight="32dp"
    android:background="@drawable/round_border"
    android:drawableStart="@drawable/ic_person_2"
    android:drawablePadding="16dp"
    android:ems="10"
    android:hint="@string/name"
    android:inputType="text"
    android:padding="16dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/view6"
    tools:ignore="Autofill,RtlCompat" />

<EditText
    android:id="@+id/inputEmail2"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="32dp"
    android:layout_marginLeft="32dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="32dp"
    android:layout_marginRight="32dp"
    android:background="@drawable/round_border"
    android:drawableStart="@drawable/ic_email"
    android:drawablePadding="16dp"
    android:ems="10"
    android:hint="@string/email_create_account"
    android:inputType="textEmailAddress"
    android:padding="16dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textName"
    tools:ignore="Autofill,RtlCompat" />

<EditText
    android:id="@+id/textPass"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="32dp"
    android:layout_marginLeft="32dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="32dp"
    android:layout_marginRight="32dp"
    android:background="@drawable/round_border"
    android:drawableStart="@drawable/ic_lock"
    android:drawablePadding="16dp"
    android:ems="10"
    android:hint="@string/password_create_account"
    android:inputType="textPassword"
    android:padding="16dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/inputEmail2"
    tools:ignore="Autofill,RtlCompat" />

<Button
    android:id="@+id/btnUp"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="50dp"
    android:layout_marginLeft="50dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="50dp"
    android:layout_marginRight="50dp"
    android:background="@drawable/round_bg"
    android:text="@string/sign_up2"
    android:textColor="#FFFFFF"
    android:textSize="18sp"
    android:textStyle="bold"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/textPass" />

<Button
    android:id="@+id/btnIn"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginStart="50dp"
    android:layout_marginLeft="50dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="50dp"
    android:layout_marginRight="50dp"
    android:background="@drawable/round_bg"
    android:text="@string/sign_in2"
    android:textColor="#FFFFFF"
    android:textSize="18sp"
    android:textStyle="bold"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/btnUp" />

</androidx.constraintlayout.widget.ConstraintLayout>

my main activity java code page:

public class MainActivity extends AppCompatActivity {

Button btnLogin, btnSignUp;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Hooks

    btnLogin=findViewById(R.id.btnSigning);
    btnSignUP=findViewById(R.id.btnSignUpMain);

    btnLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent (MainActivity.this,SignIn.class);
            startActivity(intent);
        }
    });
    btnSignUp.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent (getApplicationContext(),SignUp.class);
            startActivity(intent);
        }
    });
}

}

Thanks for your help in advance 🙂

hash – Will a recursive sha256 run over all 2^256 inputs before a collision?

Will a recursive sha256 run over all 2^256 inputs before a collision?

Here’a a python program showing my question – will this loop for 2^256 times – given endless memory or will it terminate before – if so when?

import hashlib

# start with 0
input = (0).to_bytes(32, byteorder="little", signed=False)

# dictionary to detect hash collisions - yes, this will eat up ALL memory
hit = {}

print ("first input:" + input.hex())

while (1):
    hash = hashlib.sha256(input).digest()
    
    # do we have a collision?
    assert (hash not in hit), "Collision!"
    
    # store current hash
    hit(hash)=1

    print ("Hash: " + hash.hex())

    # try again with the hash output as input
    input=hash

magento2 – Run Magento 2 On low end system resources,

I saw a system with below configuration :-

  • dual core processor
  • 8 gb ddr3 Ram
  • 240 gb SSD
  • windows 10

I’ve tried to run Magento 2 in it using Bitnami stack, but its very slow.

Is their any other way or Virtual system available to install magento in it & use it for development ?

A little better speed would be better then very slow speed.

Feel free to share thoughts.

Thankyou

privacy – What settings required to privately run bitcoin core on tails?

I am running bitcoin-core on TailsOS which seems to work out of the box. I think TailsOS blocks all unsafe requests but I would like to know what settings I should enable to run it really privately. So far I start my node via

$ ./bitcoin-qt onlynet=onion

Is anything else required? In this answer I read about a bunch of other settings but feel that isn’t required on tails, correct?

8 – How can I have a single QueueWorker run for multiple Queues?

I have a site in which I associate multiple Config Entities with a single Queue ie. example_queue (using the default QueueInterface).

My Config Entities produce records that are processed as queue items via that Queue.

Each of these Config Entities have the ability to enable or disable the processing of their records via that queue, so for that I am utilising the SuspendQueueException which I only throw when I know that the items from Config Entity A are disabled for processing.

Because I am using a single Queue, this now also suspends the queue processing for records from Config Entity B which is enabled.

I was thinking of either just getting rid of the SuspendQueueException, but that would then needlessly fail my queue items for Config Entity A, which I already know are failing, OR I would have a Queue per Config Entity. But then I would need to define a QueueWorker class per Queue, I think? Which could become a problem if I have let’s say 1,000 Config Entities, each needing such an individual QueueWorker class?

How should I address this best? Or how can I have 1 QueueWorker utilise multiple Queues that I know need the same processing logic?

This is my ExampleQueueWorker class:

namespace DrupalexamplePluginQueueWorker;

use DrupalCorePluginContainerFactoryPluginInterface;
use DrupalCoreQueueQueueWorkerBase;
use DrupalCoreQueueSuspendQueueException;

/**
 * Process a queue of items.
 *
 * @QueueWorker(
 *   id = "example_queue",
 *   title = @Translation("Example Queue worker"),
 *   cron = {"time" = 60}
 * )
 */
class ExampleQueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * The maximum amount of times a single queue item is allowed for retries.
   */
  public const MAX_RETRY_THRESHOLD = 5;

  ...

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {

    // $obj can have a parent of Config Entity A, B, C, etc...
    if (!$obj = ExampleRecord::load($data->getId())) {
      $this->logger->error('Invalid item.');
      return;
    }

    try {
      // Process or halt depending on $obj parent settings.
      $this->ExampleService->post($obj, TRUE);
    }
    catch (Exception $e) {
      // Log failure.
      $this->logger->error('ID: %id, Error: %error', (
        '%id' => $obj->id(),
        '%error' => $e->getMessage(),
      ));

      // Get retry count.
      $retry_count = (int) $obj->getRetryCount ?: 0;

      // Increment and save retry count.
      $obj->setRetryCount(++$retry_count)->save();

      if ($retry_count >= self::MAX_RETRY_THRESHOLD) {
        return;
      }

      // Treat a ServiceOutageException as a reason to suspend the queue.
      if ($e instanceof ServiceOutageException) {
        throw new SuspendQueueException($e->getMessage());
      }

      // And any other Exception for default queue error handling.
      throw new Exception($e->getMessage());
    }

  }

}