[-] bloopernova@programming.dev 83 points 4 months ago

Can he please be charged with attempted murder for each person who was swatted?

[-] bloopernova@programming.dev 139 points 6 months ago

Evil. If you vote republican you support this evil.

They are evil.

27

My wife and I are both autistic. She has difficulty moderating the volume of her voice, and I'm volume sensitive. So far she's been unable to recognize when I'm having trouble, and I've been unable to stop being so sensitive. :/

I've tried wearing earplugs but I have trouble remembering to keep them in.

Does anyone have any suggestions on how to reduce volume from someone when you're sensitive and they're loud without realizing it?

[-] bloopernova@programming.dev 85 points 7 months ago

Tree. Style. Tabs.

Best damned extension ever. It's amazing to me that all browsers don't have this style of tabs.

10

Utterly wild and hilarious, today is a Moog kind of day.

[-] bloopernova@programming.dev 95 points 8 months ago

Mullvad.

Shit you can pay for the service by anonymously mailing them cash.

[-] bloopernova@programming.dev 90 points 8 months ago

I have nothing but a gut feeling to back this up, but isn't this oh so convenient for russia? Now the very powerful USA Israel lobby will be asking for as much aid as possible.

I wouldn't be surprised if russia was behind this and other escalations.

[-] bloopernova@programming.dev 101 points 9 months ago

That sounds ominous as all fuck.

[-] bloopernova@programming.dev 112 points 9 months ago

Just fabulous soldiers.

[-] bloopernova@programming.dev 104 points 9 months ago

"ill-fated diarrhea plane"

What a beautiful phrase. Shakespearean.

26
submitted 10 months ago* (last edited 10 months ago) by bloopernova@programming.dev to c/programming@programming.dev

This is solved, I was being dumb. Please see second EDIT below

This isn't really language specific, but if it helps I'm using Python. I can get the parameters just fine with the Traitlets module, but I'm still a novice really and figuring out which patterns to use is challenging.

Say you have a bunch of command line parameters. Some are booleans, where their presence means True, absence means False. Other parameters must accept one text string, and others can be used multiple times to build a list of strings.

It feels inefficient/wrong to use a bunch of IF/THEN/ELSE statements to decide what to do with the parameters, and prone to edge case errors. Is there a pattern that would invoke the correct method based on the combination of input parameters?

Examples:

app thing --dry-run --create --name=newname01 --name=newname02 --verbose

app thing --create --name=newname01 --name=newname02 --name=newname03

app job --cancel -i 01 -i 02 -i 03

EDIT: Via the Traitlets module, I get those arguments parsed and accessible as self.argname, so getting them into my app is working great. It's just deciding what to do with them that is confusing me.

Thank you, sorry for my noobness.

EDIT2: I think I understand where I'm going wrong:

I'm creating subcommands based on objects, not actions. i.e. appname thing --action should really be appname action --thing. Once things are divided up into actions, assigning things to those actions will be much, much easier and straightforward.

Sorry for a confusing and fairly pointless post :(

[-] bloopernova@programming.dev 139 points 10 months ago

Then. Just. Fucking. LEAVE!

[-] bloopernova@programming.dev 143 points 10 months ago

Holy shit he actually said "the report will come out next week". Like his healthcare solution. Or his infrastructure plan. It's all coming out next week.

[-] bloopernova@programming.dev 91 points 10 months ago

They'll do something with AI in 3 years or so, if they still exist.

[-] bloopernova@programming.dev 158 points 10 months ago

Guaranteed that people smarter than the reddit staff will exploit their processes or code to cause mayhem and chaos.

100% guaranteed.

18

When I submit a comment, the edit window stays open. I then get prompted to Stay or Leave the comment, even though it's already been submitted. Is there a way to disable that behaviour?

12

I am writing an object-oriented app to help our developers manage some cloud systems. I'd like to make the configuration information available to all the classes, but I'm not sure of a good way to do that. Everything I can think of seems to fall under the category of "global variables" which as far as I know is a Very Bad Thing.

I already have a logging Mixin class that enables logging for every class that inherits it, and I was wondering if that's the right way to approach the configuration data:

class LoggingMixin:
    @classmethod
    @property
    def log(cls):
        return logging.getLogger(cls.__name__)

class TestClassA(LoggingMixin):
    def testmethod1(self):
        self.log.debug("debug message from test class A")

if __name__ == "__main__":
    logging.basicConfig(
        format="{created:<f} {levelname:>5s} {name}.{funcName:>8s} |{message}|",
        level=logging.DEBUG,
        style="{",
    )

    a = TestClassA()
    a.testmethod1()

Outputs (in case you are curious)

1688494741.449282 DEBUG TestClassA.testmethod1 |debug message from test class A|

What's a good way of making data from a class available to all classes/objects? It wouldn't be static, it'd be combined from a JSON file and any command line parameters.

If I copied the example above but changed it to a ConfigMixin, would that work? With the logging example, each class creates its own logger object when it first calls self.log.debug, so that might not work because each object needs to get the same config data.

Is there a pattern or other design that could help? How do you make configuration data available to your whole app? Do you have a config object that can get/set values and saves to disk, etc?

Thank you for reading, my apologies for poorly worded questions.

view more: next ›

bloopernova

joined 1 year ago