boot – How do I get a hyper-v Windows VM to run installation and configuration scripts no later than the first time a user logs in?

I want to set up a Windows 10 VM on my workstation from an available VHD from Microsoft.
I’ve got a PSH script that will download the VHD and create the VM in Hyper-V. Check.

Before I use the VM, I want to make sure my favorite development applications are installed and some required network and security configurations and applications are installed. The latter, at least, require certain batch and PowerShell scripts to run.

I can mount the VHD and copy the scripts to the VHD for the VM from PowerShell. Check.

When I launch the VM I can manually run the scripts in the VM and they install and configure things, when run with the right administrative privilege. That’s OK, but not ideal. I want this to be fully automatic, so when I log into the VM for the first time then the applications and configurations are either already in place or launch automagically in the background and everything is soon in place.

Examples of the customizations to the base image:

  • Install the latest Chrome (install without user input)
  • Install a particular VPN we use, which requires a bunch of PowerShell
    configuration changes in administrative mode before the installer
    will work correctly
  • Install WinMerge

I have not worked deeply with automating the configuration of Windows workstations in ages nor with Hyper-V VMs, so I’m not even sure if the approach is to put scripts in a magic startup folder or to set registry keys in the VM or some other VM setup hack that is quite unknown to me.

Any ideas how to pull this off with PowerShell and maybe a little batch?

Run Python Script on WordPress Website

I am trying to run A python Script as mentioned in the following link..

Running a python script within wordpress

But I am still getting the message "permission denied".

How to run a VBA macro from the Task Scheduler in Windows Server 2016?

I have a VBA macro for extracting some data daily. My task is to automate its extraction using Windows’ Task Scheduler.

I tried to create a VBS macro to run it like here:

https://stackoverflow.com/questions/58139154/running-an-excel-macro-from-task-scheduler

It didn’t work.

I created my own C# app to run it and didn’t work.

At this point, I’m stuck because the VBS app and the C# app run the macro properly if I run it manually.

I have tried the following combinations:

  • Run only when the user is logged on. -> Successful.
  • Run whether user is logged or not. -> Failed.
  • Run whether user is logged or not. Plus, Run with the highest privileges. -> Failed.
  • Run whether user is logged or not. Plus, Do not store password … -> Failed.
  • Run whether user is logged or not. Plus, Do not store password … And Run with the highest privileges -> Failed.
  • Run whether user is logged or not. Plus, Run with the highest privileges and Hidden. -> Failed.
  • Run whether user is logged or not. Plus, Do not store password … and Hidden -> Failed.
  • Run whether user is logged or not. Plus, Do not store password …, Run with the highest privileges and Hidden -> Failed.

Also, I tried to schedule the VBA macro too and there was no difference (this was my first attempt).

Any idea what could I be doing wrong? Thanks for your time.

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

java – JDK wont run in terminal and this is preventing me from downloading eclipse

i am able to download the latest JDK from oracle. When i install it, it says successfully installed. However, when i go into my terminal and type java -version this is what i get

Error: dl failure on line 558 Error: failed /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/lib/server/libjvm.dylib, because dlopen(/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/lib/server/libjvm.dylib, 10): no suitable image found. Did find: /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/lib/server/libjvm.dylib: code signature invalid for ‘/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/lib/server/libjvm.dylib’

devin-MacBook-Air:~ devin$

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 on cron 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());
    }

  }

}