How to create descriptor watch-only wallet with bitcoin-cli in Bitcoin Core 0.21?

Using only command line (no GUI), how can I create watch only wallet based on descriptor and get first unused address?

This is the descriptor:

“wpkh((00000000/84h/0h/0h)xpub6DP….xyz/0/*)#checksum”

this is the bitcoin-cli command to list addresses based on this descriptor:

./bitcoin-cli deriveaddresses
“wpkh((00000000/84h/0h/0h)xpub6DP….xyz/0/*)#checksum” “(0,2)”

How to create actuall watch only wallet so that I can get automatically first unused address?

Create an analogue clock interface in Java using JavaFX

The app when works fine, but people are saying that the code is not written with good code style and following OOP principles.

Can I improve on any parts of my code? Especially regarding:

  • Code comments
  • Variable naming
  • Separation of concerns
  • Single responsibility principle
  • etc.
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.util.Duration;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.scene.text.Text;
import javafx.application.Platform;

public class AnalogClockv2 extends Application {
  @Override // Override the start method in the Application class
  public void start(Stage primaryStage) {
    ClockPane clock = new ClockPane(); // Create a clock

    HBox hBox = new HBox(5);
    Button btStop = new Button("Stop");
    Button btStart = new Button("Start");
    hBox.getChildren().addAll(btStop, btStart);
    hBox.setAlignment(Pos.CENTER);

    BorderPane pane = new BorderPane();
    pane.setCenter(clock);
    pane.setBottom(hBox);

    // Create a scene and place it in the stage
    Scene scene = new Scene(pane, 250, 300);
    primaryStage.setTitle("Java Analog Clock Reloaded"); // Set the stage title
    primaryStage.setScene(scene); // Place the scene in the stage
    primaryStage.show(); // Display the stage


    clock.widthProperty().addListener(ov -> {
      clock.setW(pane.getWidth());
    });

    clock.heightProperty().addListener(ov -> {
      clock.setH(pane.getHeight());
    });
  }

  /**
   * The main method is only needed for the IDE with limited
   * JavaFX support. Not needed for running from the command line.
   */
  public static void main(String() args) {
    launch(args);
  }

  class ClockPane extends Pane {
    private int hour;
    private int minute;
    private int second;

    // Clock pane's width and height
    private double w = 250, h = 250;

    private int sleepTime = 50;
    /**
     * Construct a default clock with the current time
     */
    public ClockPane() {
      setCurrentTime();

    }

    /**
     * Construct a clock with specified hour, minute, and second
     */
    public ClockPane(int hour, int minute, int second) {
      this.hour = hour;
      this.minute = minute;
      this.second = second;
      paintClock();
    }

    /**
     * Return hour
     */
    public int getHour() {
      return hour;
    }

    /**
     * Set a new hour
     */
    public void setHour(int hour) {
      this.hour = hour;
      paintClock();
    }

    /**
     * Return minute
     */
    public int getMinute() {
      return minute;
    }

    /**
     * Set a new minute
     */
    public void setMinute(int minute) {
      this.minute = minute;
      paintClock();
    }

    /**
     * Return second
     */
    public int getSecond() {
      return second;
    }

    /**
     * Set a new second
     */
    public void setSecond(int second) {
      this.second = second;
      paintClock();
    }

    /**
     * Return clock pane's width
     */
    public double getW() {
      return w;
    }

    /**
     * Set clock pane's width
     */
    public void setW(double w) {
      this.w = w;
      paintClock();
    }

    /**
     * Return clock pane's height
     */
    public double getH() {
      return h;
    }

    /**
     * Set clock pane's height
     */
    public void setH(double h) {
      this.h = h;
      paintClock();
    }

    /* Set the current time for the clock */
    public void setCurrentTime() {
      // Construct a calendar for the current date and time
      Calendar calendar = new GregorianCalendar();

      // Set current hour, minute and second
      this.hour = calendar.get(Calendar.HOUR_OF_DAY);
      this.minute = calendar.get(Calendar.MINUTE);
      this.second = calendar.get(Calendar.SECOND);

      paintClock(); // Repaint the clock
    }

    /**
     * Paint the clock
     */
    private void paintClock() {
      // Initialize clock parameters
      double clockRadius = Math.min(w, h) * 0.8 * 0.5;
      double centerX = w / 2;
      double centerY = h / 2;

      // Draw circle
      Circle circle = new Circle(centerX, centerY, clockRadius);
      circle.setFill(Color.WHITE);
      circle.setStroke(Color.BLACK);
      Text t1 = new Text(centerX - 5, centerY - clockRadius + 12, "12");
      Text t2 = new Text(centerX - clockRadius + 3, centerY + 5, "9");
      Text t3 = new Text(centerX + clockRadius - 10, centerY + 3, "3");
      Text t4 = new Text(centerX - 3, centerY + clockRadius - 3, "6");

      // Draw second hand
      double sLength = clockRadius * 0.8;
      double secondX = centerX + sLength
              * Math.sin(second * (2 * Math.PI / 60));
      double secondY = centerY - sLength
              * Math.cos(second * (2 * Math.PI / 60));
      Line sLine = new Line(centerX, centerY, secondX, secondY);
      sLine.setStroke(Color.RED);

      // Draw minute hand
      double mLength = clockRadius * 0.65;
      double xMinute = centerX + mLength
              * Math.sin(minute * (2 * Math.PI / 60));
      double minuteY = centerY - mLength
              * Math.cos(minute * (2 * Math.PI / 60));
      Line mLine = new Line(centerX, centerY, xMinute, minuteY);
      mLine.setStroke(Color.BLUE);

      // Draw hour hand
      double hLength = clockRadius * 0.5;
      double hourX = centerX + hLength
              * Math.sin((hour % 12 + minute / 60.0) * (2 * Math.PI / 12));
      double hourY = centerY - hLength
              * Math.cos((hour % 12 + minute / 60.0) * (2 * Math.PI / 12));
      Line hLine = new Line(centerX, centerY, hourX, hourY);
      hLine.setStroke(Color.GREEN);

      getChildren().clear();
      getChildren().addAll(circle, t1, t2, t3, t4, sLine, mLine, hLine);
    }
  }
}

For more context, the code is used to teach the fundamentals of OOP, how to use Java, and JavaFX in a high school CS course.

Please ask for clarification if there are issues running the code if needed, this is my first time on this site. Thanks!

Basic pseudocode to create a rope physics

I am trying to simulate the physics of a 2D hanging rope, consistent of a series of n-links. It could be a series of four pendulums. I just want some movement of the rope and the ability to contact with the ground. I was inspired by this question and this one.

I would like to programme it from zero in Python or a similar modelling program, but I don’t find simple maths to recreate this effects. Which are the basic equations to escalate a series of n-links to resemble like a rope, please?

Create your own whatsapp app for your privacy for $125

Create your own whatsapp app for your privacy

As of now WhatsApp issues are going on most of the people will reduce use of WhatsApp due privacy issue .

so here we provide your own WhatsApp with following features.

-encrypted

-fully private

-fully safe-more advance

-customizable-you can share upto 1.5gb fileAnd unlimitedYou can also earn money from it

.

VBA – create separate spreadsheets from a filtered table

The task is relatively simple and until now it was always performed by some poor admin soul. There is a large table that needs to be filtered based on a simple criteria and each view has to be saved as a new spreadsheet.

The code is as simple as the task (and as my coding skills) so I would love to get some feedback about any tricks I might have missed to make it more robust or “best practices” advice.

Option Explicit

Sub SplitWorksheet()

    Dim d As Long
    Dim dctList As Object
    Dim varList As Variant
    Dim varName As Variant
    Dim wkb As Workbook
    Dim wks As Worksheet
    Dim rng As Range
    Dim wkbNew As Workbook
    Dim strPath As String

    Application.DisplayAlerts = False
    Application.ScreenUpdating = False
    
    Set wkb = ThisWorkbook
    Set wks = wkb.Sheets("Data")
    Set rng = wks.Range("A1").CurrentRegion
    
    strPath = Application.ThisWorkbook.Path & "Distribution"
        
    Set dctList = CreateObject("Scripting.Dictionary")
    dctList.CompareMode = vbTextCompare

    With wks
    
        varList = .Range(.Cells(6, "H"), .Cells(Rows.Count, "H").End(xlUp)).Value2

        For d = LBound(varList) To UBound(varList)
            dctList.Item(varList(d, 1)) = vbNullString
        Next

        For Each varName In dctList
            .Range("a1").CurrentRegion.AutoFilter Field:=8, Criteria1:="=" & varName, Operator:=xlFilterValues
        
            Set wkbNew = Workbooks.Add
            .Range("A1").CurrentRegion.SpecialCells(xlCellTypeVisible).Copy _
                Destination:=wkbNew.Sheets(1).Range("A1")
            wkbNew.SaveAs strPath & varName & ".xlsx"
            wkbNew.Close
        
        Next
        
        .Range("a1").CurrentRegion.AutoFilter
        
    End With

    Application.DisplayAlerts = True
    Application.ScreenUpdating = True

    MsgBox "All done, individual spreadsheets have been saved", vbOKOnly, "Great success!"
 
End Sub

c# – How to create fallout intensity on a generated mesh in Unity?

So I was able to generate a circle mesh in Unity to basically see the other characters when they are inside of it, and hide the characters when they are outside of it, and partially hide and show the character if they are partially in or outside of it. Below is an image of what I was able to generate, but the thing is, the edges are very sharp and I would like to have some Fallout Intensity on the mesh. Just like with Lights in Unity, where they have a fallout intensity at the edge of the lights.

Image of Generated Mesh
enter image description here

As you can see, the edges of the mesh are very sharp and thats not the kind of effect am after, I would like to add some fallout to that, and adjust it.

Here is The Code That Generates The Mesh

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class FieldOfView : MonoBehaviour {

    public float fieldOfView = 360f;
    public int numberEdges = 360;
    public float initalAngle = 0;
    public float visionDistance = 8f;
    public LayerMask layerMask;

    private Mesh mesh;
    private Vector3 origin;

    private void Start()
    {
        mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        origin = Vector3.zero;
    }

    private void LateUpdate()
    {
        GenerateUpdateMesh();
    }

    private void GenerateUpdateMesh()
    {
        float actualAngle = initalAngle;
        float incrementAngle = fieldOfView / numberEdges;

        Vector3() vertices = new Vector3(numberEdges + 1);
        int() triangles = new int(numberEdges * 3);

        vertices(0) = origin;

        int verticeIndex = 1;
        int triangleIndex = 0;

        for (int i = 0; i < numberEdges; i++)
        {
            Vector3 actualVertices;
            RaycastHit2D raycastHit2D = Physics2D.Raycast(origin, GetVectorFromAngle(actualAngle), visionDistance, layerMask);
            if (raycastHit2D.collider == null)
            {
                // No hit
                actualVertices = origin + GetVectorFromAngle(actualAngle) * visionDistance;
            }
            else
            {
                // Hit object
                actualVertices = raycastHit2D.point;
            }

            vertices(verticeIndex) = actualVertices;

            if (i > 0)
            {
                triangles(triangleIndex + 0) = 0;
                triangles(triangleIndex + 1) = verticeIndex - 1;
                triangles(triangleIndex + 2) = verticeIndex;

                triangleIndex += 3;
            }

            verticeIndex++;
            actualAngle -= incrementAngle;
        }

        // We form the last triangle
        triangles(triangleIndex + 0) = 0;
        triangles(triangleIndex + 1) = verticeIndex - 1;
        triangles(triangleIndex + 2) = 1;


        mesh.vertices = vertices;
        mesh.triangles = triangles;
    }

    Vector3 GetVectorFromAngle(float angle)
    {
        float angleRad = angle * (Mathf.PI / 180f);
        return new Vector3(Mathf.Cos(angleRad), Mathf.Sin(angleRad));
    }

    public void SetOrigin(Vector3 newOrigin)
    {
        origin = newOrigin;
    }
}

What do I do here to add some Fallout Intensity? All the help is really appreciated. And Thank you in advance.

magento2 – Magento 2 how to create custom index.php and pass store code programmatically?

I have a multi-vendor e-commerce platform, everytime I create a new store I need to create a folder for the store and include an index.php

for example:

var/www/html/magento/stores/store2/index.php

Inside the index.php I add the store code like this:

$params = $_SERVER;
$params(MagentoStoreModelStoreManager::PARAM_RUN_CODE) = 'store2_code'; //this is the important line
$params(MagentoStoreModelStoreManager::PARAM_RUN_TYPE) = 'store';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
$bootstrap->run($app);

How could I programmatically create an index.php file and add the store code?
Currently I know how to create the store programmatically, but just the index.php is missing.

Thanks!

Want to create site in lower budget? | Proxies-free

If your budget is lower but still want to create new website, we have solution for that. Contact us for a pre-made solution. You buy the theme and I’ll give you a price to integrate your content, links and graphics. I’m trying to keep the cost low so it’s affordable for everyone. Contact on hello@adultdc.com

We are also taking Mainstream projects.