import – Dealing with data from multiple individual spreadsheets. Should data be merged OR are there better ways to deal with multiple sheets?

You can use the importrange() function to merge data from multiple spreadsheet files into a master spreadsheet. It would look something like this:

=query( 
  { 
    importrange("spreadsheet id 1", "Sheet1!A1:F"); 
    importrange("spreadsheet id 2", "Sheet1!A2:F"); 
    importrange("spreadsheet id 3", "Sheet1!A2:F"); 
    importrange("spreadsheet id 4", "Sheet1!A2:F") 
  }, 
  "where Col1 is not null", 
  1 
)

The results will automatically update every 30 minutes, and usually much more often. They will be view-only.

If the data is stored in tabs in the same spreadsheet file, and the master sheet is in the same spreadsheet file as well, do not use importrange() but an { array expression }.

Questions about Lightning Network: Connectivity, Funding, Dealing w Bad Counterparties

TLDR

Long time buyer, holder, and user of Bitcoin (since 2015). Absolutely zero experience with Lightning Network. I’ve read some entry-level tutorials but still have basic conceptual questions regarding funding, capacity, revocations, etc.

Hypothetical Situation

Let’s say I run a gambling site. All business is conducted in BTC. More and more customers are asking that Lightning Network be made available to facilitate quick and cheap deposit and withdrawal of funds.

Where do I connect for maximum reach?

The tutorials always seem show to show two parties, Bob and Alice. They open a “channel” using a funding transaction. The example then typically adds in a third party (e.g. Festus) and says something along the lines of “and look, Bob can pay Festus through Alice.”

The implication seems to be that the network size could become enormous, to the point where anyone can pay anyone because hey, every Bitcoin user is inevitably connected by only a few degrees of separation on the network.

But this doesn’t really answer the question of to whom I, as a brand new user, should connect? I could connect to you, I guess. But maybe you’re a new user too and have zero other connections. Do I connect to some sort of hub? Guess that would work but doesn’t that make things overly centralized?

As a site owner (see hypothetical above), is it best for me to act as a hub and open a channel with each of my users, which means I’d have thousands of channels open? Or is it better to make a single connection to one really popular, well-connected dude? Seems like the latter, but which dude? How do I find him?

Do I always have to be online looking for cheats?

Ok, so I get that my LN peer can try to cheat me by broadcasting a settlement transaction of a prior balance state that’s more advantageous to him. And I also know that his cheat TX settlement won’t clear for twenty-four hours, giving me time to broadcast a “revocation” TX that settles everything in my favor instead. This is what dissuades my peer from cheating.

But this also implies that my Lightning node needs to be up 24/7, or at least never offline for more than 24 hours and, furthermore, I have to be ever vigilant to make sure no one is cheating, and execute revocations if they are. Are these assumptions correct? Does the Lightning software automate the cheat-detection process for me?

How do I add funds to an existing channel?

It’s still not clear how to add funds to a preexisting channel. I’ve seen some material online indicating that a third party service needs to be paid for this? I can’t imagine that’s correct is it? That doesn’t seem compatible with the whole ethos of LN.

Using my hypothetical example. Let’s say a client opens a channel with me and sends me 1 BTC. He bets on an upcoming UFC fight (Ronda Rousey vs. Oprah Winfrey). A successful bet on Winfrey pays 15x. That means in the unlikely even that he wins, I need to have at least 15 BTC available on that channel to pay him out.

How do I add funds to the channel if he wins? Or does that 15 BTC have to be placed in the channel via the initial funding transaction?

Now, if I’m servicing all users over a single channel, that’s fine. But if each user has his own channel, I’d have to fund each one with an enormous amount of BTC — despite the fact that 99.99% of my users will never even bet on that particular event at all. That would be an inefficient use of funds. I assume there’s a way to add funds to a channel after initial funding, but how?

Wallets

I’m running on Win 2019 Server and need to be able to create channels, send funds, be notified of incoming funds, etc. using an API. Which wallets support this?

With Bitcoin’s first layer, I have the option of either running a full blown node or leveraging a centralized service like Electrum? Does LN have an analogous situation with two different styles of wallet?

dnd 5e – Can I use conjure animal to drop cows on targets, dealing damage?

I’m asking because of the fact that the feys take the shape of the beast, a cow, but, since the feys are spirits would they do any damage if they fell on an enemy?

Can cows that I conjure using conjure animals fall onto targets thereby dealing damage?


Related question: If a creature is dropped on a monster, how much damage does each of them take?

certificate authority – Dealing with an independent security researcher

I recently received several emails from a security researcher, one for each “vulnerability” that he had discovered on my website. These alleged vulnerabilities were respectively: a missing certificate authority, no valid SPF, and click-jacking.

enter image description here

I’m less interested in what he’s hoping to accomplish here as I am in whether these vulnerabilities are legitimate threats to my website.

Two things make me question that they are: the first is that the website in question consists of a static landing page whose only “dynamic” element is a single mailto link. The second is that the website is hosted on AWS S3, which I would expect to be taking care of at least the Missing Certificate Authority and invalid SPF issues.

Are these legitimate vulnerabilities, and if so, are they a legitimate threat to my basic website?

mage the ascension – Are there any spirits dealing with oaths in world of darkness

It may not have the exact details you want, but there is an option suggested by Vampire: the Masquerade. The level 5 Thaumaturgy ritual Blood Contract has an effect like you describe, and implies that demons can be associated with compliance:

Blood Contract

This ritual creates an unbreakable agreement between
the two parties who sign it. The contract must
be written in the caster’s blood and signed in the blood
of whoever applies their name to the document. This
ritual takes three nights to enact fully, after which both
parties are compelled to fulfill the terms of the contract.

System: This ritual is best handled by the Storyteller,
who may bring those who sign the blood contract
into compliance by whatever means necessary (it is
not unknown for demons to materialize and enforce
adherence to certain blood contracts). (…) (V20 Core Rulebook, page 239)

The details are left undefined, but that the ritual describes demons appearing to enforce contracts sometimes (meaning not all the time) indicates that the magic surrounding the contracts themselves is not necessarily enough to ensure compliance. This in turn suggests that at least some demons have some association with keeping or enforcing contracts, at least in some cases. It’s not much of a stretch to go from a contract to an oath.

This doesn’t answer how a character would go about contacting or getting such a creature to enforce a contract (outside of this particular ritual, which will not be directly available to a mage), but it is at least an option with some representation in the published books.

design patterns – Standard way of dealing with standardization for tabular data in PyTorch

This question is all about structuring the code in an elegant way that allows training from scratch, training using a model already trained and evaluating a model + doing the data normalization accordingly.

It is well known that a model works better if the data is standardized. Here is how I deal with this in the context of regression based on tabular data:

df_train, df_test, df_val = get_data(config)
if config('scaler') is not None:
     scaler = config('scaler') 
else:
    scaler = StandardScaler().fit(df(config('columns')), df(target)) # I only scale some numerical columns
df_train, df_test, df_val = scaler.transform(df_train), scaler.transform(df_test), scaler.transform(df_val)
best_model, test_predictions = train(df_train, df_test, df_val, config)
target_std, target_mean = get_scaler_coeffs(scaler)
test_predictions('y_hat') = test_predictions('y_hat') * target_std + target_mean
store_results(test_predictions, best_model, scaler, config)

In short, I use StandardScaler from sklearn to scale values (target included) and pandas for operating with csv files. After training, I store the best model along with its scaler and its results.

I am trying to write clean, elegant code. However, as you can see, this approach is not elegant at all, but I can’t figure out how I should change the code. What is the “standard” way of dealing with scaling and reverse scaling in pytorch? (preferably for regression purposes).

dnd 5e – What class, race or spell; damage dealing personal “Aura” powers exist in D&D 5e?

Racial Traits

Scourge Aasimar

Radiant Consumption Starting at 3rd level, you can use your action to unleash the divine energy within yourself…… at the end of each of your turns, you and each creature within 10 feet of you take radiant damage equal to half your level (rounded up).

Class Features

Ranger-Hunter Level 11

Whirlwind Attack
You can use your action to make a melee attack against any number of creatures within 5 feet of you, with a separate attack roll for each target.

Druid-Circle of Spores Level 2

Halo of Spores When a creature you can see moves into a space within 10 feet of you or starts its turn there, you can use your reaction to deal 1d4 necrotic damage to that creature unless it succeeds on a Constitution saving throw against your spell save DC.

Symbiotic Entity When you deal your Halo of Spores damage, roll the damage die a second time and add it to the total. Your melee weapon attacks deal an extra 1d6 necrotic damage to any target they hit.
These benefits last for 10 minutes

Warlock Invocation XGtE

Cloak of Flies As a bonus action, you can surround yourself with a
magical aura that looks like buzzing flies. The aura extends 5 feet from you in every direction, but not through total cover. It lasts until you’re incapacitated or you dismiss it as a bonus action. The aura grants you advantage on Charisma (Intimidation) checks but disadvantage on all other Charisma checks. Any other creature that starts its turn in the
aura takes poison damage equal to your Charisma modifier (minimum of 0 damage). Once you use this invocation, you can’t use it again until you finish a short or long rest.

Spells

Spirit Guardians

You call forth spirits to protect you. They flit around you to a distance of 15 feet for the duration…..An affected creature’s speed is halved in the area, and when the creature enters the area for the first time on a turn or starts its turn there, it must make a Wisdom saving throw. On a failed save, the creature takes 3d8 radiant damage (if you are good or neutral) or 3d8 necrotic damage (if you are evil). On a successful save, the creature takes half as much damage.

Sword Burst

Casting Time: 1 action
Range: Self (5-foot radius)
Components: V
Duration: Instantaneous
You create a momentary circle of spectral blades that sweep around you. All other creatures within 5 feet of you must each succeed on a Dexterity saving throw or take 1d6 force damage. This spell’s damage increases by 1d6 when you reach 5th level (2d6), 1 1th level (3d6), and 17th level (4d6).

Thunderclap

You create a burst of thunderous sound, which can be heard 100 feet
away. Each creature other than you within 5 feet of you must make a
Constitution saving throw. On a failed save, the creature takes 1d6
thunder damage.

Arms of Hadar

You invoke the power of Hadar, the Dark Hunger. Tendrils of dark
energy erupt from you and batter all creatures within 10 feet of you.
Each creature in that area must make a Strength saving throw. On a
failed save, a target takes 2d6 necrotic damage and can’t take
reactions until its next turn. On a successful save, the creature
takes half damage, but suffers no other effect.

Thunderwave

A wave of thunderous force sweeps out from you. Each creature in a
15-foot cube originating from you must make a Constitution saving
throw. On a failed save, a creature takes 2d8 thunder damage and is
pushed 10 feet away from you. On a successful save, the creature takes
half as much damage and isn’t pushed.

Darkness

Misc.

CULT OF ITRANTH RAXUS THE FLAMED ONE

Radiant Flames (1/Day).

Multihued flame surrounds the cultist for 1 minute, until the cultist is incapacitated or dies, or until the cultist extinguishes the flame {no action required). While inflamed, the cultist has telepathy with a range of 30 feet, and it can teleport as a bonus action up to 30 feet to an unoccupied space it can see. In addition, every creature that starts its turn within 5 feet of the cultist must make a DC 15 Dexterity saving throw, taking 16 (3dl0) radiant damage on a failed save, or half as much damage on a successful one.

dnd 5e – What are the DM’s responsibilities when dealing with a character’s death?

This is about Best Practices, not responsibilities.

You ask about responsibilities and there aren’t any, formally.
Informally, the objective of the DM is to facilitate the play experience for the players. There is a practical need to work with the player, once the session is over and before the next session, to get their next character set up and ready to fit into the game world. I’ve done that literally dozens of times, probably hundreds. I have also been the player in that situation dozens of times.

  • Good DMs have always opened up some time to help me get my new PC
    ready for the next session with the group.

Should they leave? Should they just sit quietly and watch? What can
they do? What should I, as DM, do?

It depends on the player.

What I usually do when it comes up during a session

I usually have the dead character’s player, for the rest of that session, do all of the die rolling and movement for the monsters that the party is fighting. I’ve been doing this since I started DMing in the late 1970’s. Very few players don’t enjoy this. Most of them jump right in – when they do it relieves the DM of a lot of detailed work, and (importantly) keeps the player engaged for the rest of the session. (This was very important for pre teens, I found).

For those rare ones who do not embrace that option, I have generally put them to work in creating their next character. They can stay in the room, or, if they don’t want the distraction of the session going on while they do that, move to another room.

For those who get upset and / or rage quit

Yeah, it happens. Some people get very upset about their character’s death. I don’t see it that much anymore, but I saw it a lot among teenaged players and a very few adults.

For those cases:

  1. Express condolences. (I did this even in old school games. I never
    took joy nor pride in the PC dying – some DMs seemed to …)

  2. Remind them that this is a game.

  3. Ask them to make a new character, and encourage them to start right
    now. Sometimes this does not work, and that leaves …

  4. Ask them to come back later, or for the next session, when they have
    cooled down.

Those are DM best practices that I’ve seen, and implemented, over a lot of D&D years.


The Impromptu Funeral – a group option if your players like this

I was in one very memorable group in a high lethality campaign (AD&D 1e) who would, after a battle where a PC died, put together an impromptu funeral pyre and each player would say something nice about the dead PC before the flames burned out – unless hot pursuit was an issue. In a few cases of the latter, we had memorial services at a local tavern during the session wrap up, or at the beginning of the next session.
I (a player) maintained the “Hall of Heroes” notebook where the char sheets of dead PCs was kept. (about a dozen). That small three ring binder is still in a box in my pile of old D&D stuff in the attic.


Proper Prior Planning

DMG p. 236 offers this:

Multiple characters can be a good idea in a game that features nonstop
peril and a high rate of character death. If your group agrees to the
premise, have each player keep one or two additional characters on
hand, ready to jump in whenever the current character dies. Each time
the main character gains a level, the backup characters do as well

If you all are running a campaign with a high lethality rate, or have embraced that tone of a campaign, then having a back up character already put together(one for each player) is a best practice. You still have the matter of what to do ‘for the rest of the session’ or ‘until I can fit in a Meet the New PC situation’ which takes us back to “run the monsters” as a good way to keep the player engaged until the session ends, or the meet up scene arises.

Bonus: this approach is also useful if a player gets tired of a PC and wants to retire (or suicide) the PC and bring in a different one. We’ve had five instances of that in my current shared-world campaign that I DM with my brother.

python – Dealing with business logic on DTOs using a DDD

I have a scenario in which an Entity defines an EntityRepresentation that is created from another end. The EntityRepresentation is a value object that implements some logic that should be performed on the other end after its transmission. In the end, the EntityRepresentation and Entity contains the same data but in the first case it is stored as a Python base type (string in my case), in fact the EntityMapper object is used to do the mapping between the two types in order to store the Entity mapped from the EntityRepresentation.

In other words, EntityRepresentation contains the same data as Entity but in a seriazable format that is determined by Entity. Since I’m trying to stick to a DDD I would know if what I’m doing is considered as anti-pattern. I’m a little skeptical about this design because I feel like I can stick with the Entity class only and the representation format could be handled by simply using a method on both ends. The fact is that this representation should not be stored along with the Entity props since it is subject to change in the future.

How correct would be let Entity provide a method to create a serializable representation of itself since my domain imposes a contraint on that?

Here is a sample code:

import json


class Entity:

    def __init__(self, id: str, name: str, type: str):
        self.id = id
        self.name = name
        self.type = type


class EntityRepresentation:

    def __init__(self, data: str = None):
        if data is None:
            d = {
                "id": "ID",
                "name": "NAME",
                "type": "TYPE"
            }
            self.data = json.dumps(d)
        else:
            self.data = data

    def process(self):
        # performs ops on self.data
        return True


class EntityMapper:

    def fromRepr(self, repr: EntityRepresentation) -> Entity:
        return json.loads(repr.data, object_hook=lambda r: Entity(**r))

    def toRepr(self, ent: Entity) -> EntityRepresentation:
        return EntityRepresentation(json.dumps(ent.__dict__))


def main():

    mapper = EntityMapper()

    # the representation is created on the first end
    e_repr = EntityRepresentation()

    # serialization
    e_repr_json = json.dumps(e_repr.data)

    # the json is sent into a wire
    # it is then received and deserialized on the other end
    e_repr_rec: EntityRepresentation = json.loads(
        json.loads(e_repr_json), object_hook=lambda d: EntityRepresentation(json.dumps(d)))

    if e_repr_rec.process():
        print(mapper.fromRepr(e_repr_rec))

    return 0


if __name__ == '__main__':
    main()

problem players – Dealing with a Repeatedly Cheating Friend

I’m the GM of a long-running online campaign. Three years ago, we had a new (and young) player who cheated on dice rolls. I kicked him out.

A while later, he messaged me to apologize for his behavior. A while after that, we played together in another game GM’d by a mutual friend. We had a fun experience, so I invited him back to my game. I’d cheated in games too when I was his age and figured if I could reform, so could he.

He came back and things were really great. He was a very enthusiastic player who loved the game and enriched it in tons of ways. One of these ways was by using his coding knowledge to write custom dice rolling and sheet editor bots. We spent many hours talking outside of the game, chatting over voice calls, watching movies together, etc., and I considered us good friends.

However, I recently discovered he’s rigged the dice bot to cheat on rolls, and has been cheating for almost a year. He also used the sheet editor to spy on the other PCs’ character sheets, and has read portions of the sourcebook I get many of the game’s plots and characters from.

All of these things are huge no-nos in our game. He knows they are. PvP is allowed, so sheets are kept strictly secret between player and GM. I am also completely against all forms of player or GM roll fudging. A major part of our game’s culture is letting the dice fall where they will.

I’ve been mulling over what to do. I’ve arrived at some in-game and metagame penalties that I feel sufficiently make up for his PC’s year of cheated rolls (and less than sufficiently make up for the spied-on sheets.) He can’t cheat on rolls or view other PCs’ sheets any longer. I liked the player a lot, and I genuinely would like to levy the penalties, forgive him, and move on. We live across the country, so the game is the primary venue we socialize through and maintain our friendship.

But I don’t feel like I can ever trust him again. We already went through this song and dance three years ago: he cheated, I kicked him out, gave him a second chance, and he started doing it again anyway. I think his love for the game and desire to stay friends is sincere. But I don’t think he sees anything wrong with his behavior. I think he would have continued cheating forever if he thought he’d get away with it.

The game’s other two players both feel the same way. His relationships with them are in the toilet after they found out he’d been cheating and reading their sheets. They’re willing (and able) to be civil if he stays, but that’s it. The player who used to consider him a friend no longer does so.

Right now I am leaning towards kicking him out. Doing so will nevertheless make me very sad. What do other people think?