chain reorganization – What is the proper way to handle reorgs when fetching headers

I work on bitcoin-s, and we’ve found a problem where if a node is stopped with it’s chain tip being a one that is later reorged out it will not be able to continue syncing headers.

This happens because we request headers using a get headers message with hashes= <current chain tip> and stopHash=<00000..0000>. Since, our chain tip is reorged out we will receive the first 2000 block headers of the network.

My current solution is to walk back our chain tip, and each iteration check if don’t get the first 2k blocks. However, I recognize this is a poor solution, is there a GetHeadersMessage that I should be using here, or a better alternative?

Thanks

What’s the proper syntax for the Terminal MV command when you want to move a folder’s contents, or is there a better approach?

For testing purposes I have two folders in my User folder: Source and Dest

There’s a file in the Source folder that I want to move to Dest, and delete Source in the process.

mv ~/Source ~/Dest moves the Source folder and its contents into Dest. I don’t want Source to be subfolder in Dest; I want it gone.

mv ~/Source/ ~/Dest yields the same results, which surprised me because I thought adding / to the end of ~/Source/ would cause its contents to move independent of the source folder.

mv ~/Source/* ~/Dest does what I want but I read somewhere that some files (.file ?) wouldn’t be copied.

Plus, I don’t want to change the file timestamps, ownership, attributes and whatever other hidden stuff exists beyond my paygrade.

I’m starting to think I should use a two-line script instead, to ensure that the copy is exact:

ditto ~/source ~/dest
sudo rm -rf ~/source

Am I overlooking anything here? Is the 2-line script the best one?

Proper DDL For Insert Statement In MySQL

I’m trying to insert rows into a MySql table, but I am getting the error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Insert Into 'empSales' ('employeename', 'saleamt', 'saleMonth') VALUES
('James',' at line 8

This is the DDL that I have tried

Create Table empSales
(
    employeename varchar(100)
    ,saleamt decimal(10,2)
    ,saleMonth varchar(100)
)

Insert Into 'empSales' ('employeename', 'saleamt', 'saleMonth') VALUES
('James', '1.00', 'January'),
('Richard', '3.28', 'January',
('Barb', '4.13', 'January'),
('James', '1.00', 'February'),
('Richard', '3.28', 'February'),
('Barb', '4.13', 'February'),
('James', '1.00', 'March'),
('Richard', '3.28', 'March'),
('Barb', '4.13', 'March');

What is the proper way to write this Insert Into statement?

number theory – Correct definition of proper divisor.

Similar question was previously asked on these topic. Also, Wolfram Mathworld has the same definition as the question that the proper divisors of a number are the divisors excluding the number itself.

But this site has excluded $1$, too, from the number of proper divisors. Same here (in the section “Problems Based on Number Theory”). In my maths textbook “Objective Mathematics Vol.1” by R.D. Sharma this illustration is given which is same as these two.

My question is simple: Who is correct?

mg.metric geometry – Does a rank 1 CAT(0) space with a proper cocompact group action contain a zero width axis?

A geodesic in a proper CAT(0) space is said to be rank 1 if it does not bound a flat half-plane and zero-width if it does not bound a flat strip of any width.
Let $X$ be a geodesically complete CAT(0) space which is rank 1, i.e. one that contains a geodesic which does not bound a flat half-plane. Assume it admits a properly discontinuous cocompact action by a group $G$.

Under these conditions we know:

1)$X$ contains a rank 1 geodesic which is an axis of an isometry in $G$ ((Link, Lemma 4.2)
https://arxiv.org/pdf/1706.00402.pdf).

  1. $X$ contains zero-width geodesic ((Ricks, Theorem 2) https://arxiv.org/abs/1410.3921)

My question: Must $X$ necessarily contain a zero width geodesic which is the axis of some isometry in $G$?

json – Proper recursive rendering in React

I’m trying to render a recursive list from a json file. Could you please suggest a proper way to render children (and their children etc.)?
Those elements are stored in entry.children

By now I can just render parent elements like this:

import React, {useState, useEffect} from "react"
import {useSpring, animated, config} from 'react-spring'

function App() {

    const loadedData = require('json!./data.json');
    const (entries, setEntries) = useState(loadedData.projectTreeData.mainProjectTreeInfo.rootProjectchildrenildren)
    const (clicked, setClicked) = useState(-1)
    const (hovered, setHovered) = useState(-1)
    const props = useSpring({fontSize: 42, from: {fontSize: 24}})

    const handleMouseEnter = i => e => {
        setHovered(i)
    }

    function handleMouseLeave(){
        setHovered(-1)
    }

    return (

        <div>
        <br/>         

        {entries.map ((entry, i) => 

            <animated.div 
            style={useSpring({ config: { mass: 0.07 }, fontSize: i == hovered ? 50 : 30 , from: {fontSize: 24}   })}> 

            <a              
            key={i} 
            onMouseEnter={handleMouseEnter(i)}
            onMouseLeave={handleMouseLeave}
            > 

            {entry.name}    </a> <br/> 
            </animated.div>)} 

        </div>
    )
}


export default App

It is clear for me that there has to be a loop, but how to build it properly?
Many thanks!

What is the proper CR for this homebrewed Souls-esque NPC?

Returning for another year of a gothic horror adventure, I wanted to try my hand at creating a truly difficult encounter. Following on past my original npcs I opted to turn a certain Dark Souls boss into a DnD npc. However, my bravado got the better of me. And now I am forced to accept that I may have designed this npc in a way that makes them way too small a challenge for a group of mid-level players. I was aiming for the CR 12-15 range.

What is the proper CR for this creature given their abilities?

Once again, the calculator just doesn’t seem to cut it. There’s a lot of interactions between different abilities and legendary actions. It’s enough to make my head spin and I just can’t wrap my head around it all. But for completeness sake, the calculator says CR 12 based off a CR 10 Defense and CR 13 Offense.


Sister Lorelei

Medium undead, neutral

Armor Class: 17 (natural armor)
Hit Points: 90 (20d8)
Speed: 40 ft.

STR – 11 (+0)
DEX – 19 (+4)
CON – 10 (+0)
INT – 14 (+2)
WIS – 15 (+2)
CHA – 20 (+5)

Saving Throws: Dex +9, Con +5, Cha +10
Skills: History +5, Insight +7, Religion +5, Stealth +9
Damage Resistances
Damage Immunities: Necrotic, Poison; Bludgeoning, Piercing, and Slashing from Nonmagical Attacks
Condition Immunities: Charmed, Exhaustion, Frightened, Paralyzed, Poisoned
Senses: Passive Perception 12
Languages: The languages they knew in life
Challenge: ???

Traits

Magic Resistance. Sister Lorelei has advantage on saving throws against spells and other magical effects.

Nimble Escape. Sister Lorelei can take the Dash, Disengage or Hide action as a bonus action on each of their turns.

Rejuvenation. If Sister Lorelei is destroyed, she gains a new body in 24 hours if their frozen heart is intact, regaining all her hit points and becoming active again. The new body appears within 5 ft. of sister lorelei’s frozen heart.

Spellcasting. Sister Lorelei is a 14th-level spellcaster. Its spellcasting ability is Charisma (spell save DC 18, +10 to hit with spell attacks).
Sister Lorelei has the following sorcerer spells prepared:
Cantrips (at will): chill touch, control flames, frostbite, ray of frost, shape water, true strike
1st level (4 slots): burning hands, detect magic, jump
2nd level (3 slots): mirror image, misty step
3rd level (3 slots): fireball, haste
4th level (3 slots): greater invisibility, wall of fire
5th level (2 slots): cone of cold, enervation
6th level (1 slot): investiture of ice
7th level (1 slot): fire storm

Turn Resistance. Sister Lorelai has advantage on saving throws against any effect that turns undead.

Actions

Multiattack. Sister Lorelei makes two attacks with her spectral sickle and one attack with her reaping scythe.

Reaping Scythe. Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 9 (1d10+4) slashing damage + 7 (2d6) necrotic damage

Spectral Sickle. Melee Weapon Attack: +9 to hit, reach 5 ft., one target. Hit: 6 (1d4+4) piercing damage + 7 (2d6) cold damage.

Legendary Actions

Sister Lorelei can take 3 legendary actions, choosing from the options below. Only one legendary action option can be used at a time and only at the end of another creature’s turn. Sister Lorelei regains spent legendary actions at the start of its turn.

Cantrip Sister Lorelei casts a cantrip.

Move Sister Lorelei moves up to their speed without provoking opportunity attacks

Reaping Scythe Sister Lorelei makes a Reaping Scythe attack.

Spectral Evanescence Sister Lorelei becomes magically invisible for up to 1 minute or until immediately after they make an attack roll.

mvc – Which would be a proper way to design a Python programme for both terminal and GUI?

I have doubts on how to face the design when making a Python programme for both running on the terminal and as a tkinter application.

I’m considering that in the terminal the input would use parameters in the usual syntax (i.e: -o, –option) and in the tkinter GUI all options would be entered through the input, radiobuttons, entries, combos, etc…

There is much literature about how to make a tkinter application using MVC pattern but I have no good clue about how to adapt it to the idea in which also the terminal would be an option.

I’m also concerned about the differences in which the GUI or terminal frontend connects to a daemon and to a regular backend.

I would be grateful just for a good understandable and readable sample code (great if it has comments). Gists and github repositories are welcome, and also blogs or any kind of resource which can be easily read and understood.

Thanks.

Proper Educational Facilitates – General Forex Questions & Help

If you want to become successful in the forex market, you need to be perfect on your strategy and planning. Wrong strategy can put you in danger. To make a profitable strategy, you need to have knowledge about forex market. Education is the main key to success in this platform. If you want to get all kind of education about forex you can openĀ a demo account.

I also opened a demo account in Forex4you when i was starting trading. This demo helps me to understand all the tools and techniques about forex easily and practically. It also helps me to know all the basics of the forex market.